Interface AudioPlaybackController
-
- All Implemented Interfaces:
public interface AudioPlaybackController
Controller given when entering audio playback mode.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
AudioPlaybackController.AudioPlaybackListener
Listener for audio playback events.
-
Method Summary
Modifier and Type Method Description abstract void
addAudioPlaybackListener(@NonNull() AudioPlaybackController.AudioPlaybackListener listener)
Registers a AudioPlaybackListener to get notified when audio playback state changes. abstract void
removeAudioPlaybackListener(@NonNull() AudioPlaybackController.AudioPlaybackListener listener)
Removes a previously registered AudioPlaybackListener. abstract AudioModeManager
getAudioModeManager()
Returns the audio mode manager from this controller. abstract void
resume()
Resumes playback of the media. abstract void
pause()
Pauses playback of the media. void
toggle()
Toggles audio playback state. abstract void
seekTo(@IntRange(from = 0) int offsetMillis)
Seeks to a specified offset in the media. abstract boolean
isReady()
Checks whether the media is ready to be played. abstract boolean
isResumed()
Checks whether the media playback is currently resumed. abstract int
getCurrentPosition()
Returns current playback position in milliseconds. abstract int
getDuration()
Returns total playback duration in milliseconds. abstract void
exitAudioPlaybackMode()
Leaves playback mode. -
-
Method Detail
-
addAudioPlaybackListener
abstract void addAudioPlaybackListener(@NonNull() AudioPlaybackController.AudioPlaybackListener listener)
Registers a AudioPlaybackListener to get notified when audio playback state changes. If the provider has been registered previously, this method will be a no-op.
- Parameters:
listener
- Listener to register.
-
removeAudioPlaybackListener
abstract void removeAudioPlaybackListener(@NonNull() AudioPlaybackController.AudioPlaybackListener listener)
Removes a previously registered AudioPlaybackListener. If the provider hasn't been registered previously, this method will be a no-op.
- Parameters:
listener
- Listener to unregister.
-
getAudioModeManager
@NonNull() abstract AudioModeManager getAudioModeManager()
Returns the audio mode manager from this controller.
- Returns:
Audio mode manager.
-
resume
abstract void resume()
Resumes playback of the media.
-
pause
abstract void pause()
Pauses playback of the media.
-
toggle
void toggle()
Toggles audio playback state.
-
seekTo
abstract void seekTo(@IntRange(from = 0) int offsetMillis)
Seeks to a specified offset in the media.
- Parameters:
offsetMillis
- Offset to seek to in milliseconds.
-
isReady
abstract boolean isReady()
Checks whether the media is ready to be played.
-
isResumed
abstract boolean isResumed()
Checks whether the media playback is currently resumed.
-
getCurrentPosition
@IntRange(from = 0) abstract int getCurrentPosition()
Returns current playback position in milliseconds.
-
getDuration
@IntRange(from = 0) abstract int getDuration()
Returns total playback duration in milliseconds.
-
exitAudioPlaybackMode
abstract void exitAudioPlaybackMode()
Leaves playback mode.
-
-
-
-