-
- All Implemented Interfaces:
-
kotlinx.coroutines.CoroutineScope,org.readium.r2.navigator.MediaNavigator,org.readium.r2.navigator.Navigator
@Deprecated(message = Use the new AudioNavigator from the readium-navigator-media-audio module. This class will be removed in a future 3.x release.) public final class MediaSessionNavigator implements MediaNavigator, CoroutineScope
An implementation of MediaNavigator using an Android's MediaSession compatible media player.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMediaSessionNavigator.Listener
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<Locator>currentLocatorprivate final Flow<MediaPlayback>playbackprivate final BooleanisPlayingprivate final Publicationpublicationprivate final <ERROR CLASS>publicationIdprivate final MediaControllerCompatcontrollerprivate MediaSessionNavigator.Listenerlistenerprivate final LocatorcurrentLocationprivate final CoroutineContextcoroutineContext
-
Constructor Summary
Constructors Constructor Description MediaSessionNavigator(Publication publication, <ERROR CLASS> publicationId, MediaControllerCompat controller, MediaSessionNavigator.Listener listener)
-
Method Summary
Modifier and Type Method Description StateFlow<Locator>getCurrentLocator()Flow<MediaPlayback>getPlayback()Current playback information. BooleangetIsPlaying()final PublicationgetPublication()final <ERROR CLASS>getPublicationId()final MediaControllerCompatgetController()final MediaSessionNavigator.ListenergetListener()final UnitsetListener(MediaSessionNavigator.Listener listener)LocatorgetCurrentLocation()CoroutineContextgetCoroutineContext()Booleango(Locator locator, Boolean animated)Moves to the position in the publication corresponding to the given Locator. Booleango(Link link, Boolean animated)Moves to the position in the publication targeted by the given link. final BooleangoForward(Boolean animated)final BooleangoBackward(Boolean animated)UnitsetPlaybackRate(Double rate)Sets the speed of the media playback. Unitplay()Resumes or start the playback at the current location. Unitpause()Pauses the playback. UnitplayPause()Toggles the playback. Unitstop()Stops the playback. UnitseekTo(Duration position)Seeks to the given time in the current resource. UnitseekRelative(Duration offset)Seeks relatively from the current position in the current resource. -
-
Constructor Detail
-
MediaSessionNavigator
MediaSessionNavigator(Publication publication, <ERROR CLASS> publicationId, MediaControllerCompat controller, MediaSessionNavigator.Listener listener)
-
-
Method Detail
-
getCurrentLocator
StateFlow<Locator> getCurrentLocator()
-
getPlayback
Flow<MediaPlayback> getPlayback()
Current playback information.
-
getIsPlaying
Boolean getIsPlaying()
-
getPublication
final Publication getPublication()
-
getPublicationId
final <ERROR CLASS> getPublicationId()
-
getController
final MediaControllerCompat getController()
-
getListener
final MediaSessionNavigator.Listener getListener()
-
setListener
final Unit setListener(MediaSessionNavigator.Listener listener)
-
getCurrentLocation
Locator getCurrentLocation()
-
getCoroutineContext
CoroutineContext getCoroutineContext()
-
go
Boolean go(Locator locator, Boolean animated)
Moves to the position in the publication corresponding to the given Locator.
-
go
Boolean go(Link link, Boolean animated)
Moves to the position in the publication targeted by the given link.
-
goBackward
final Boolean goBackward(Boolean animated)
-
setPlaybackRate
Unit setPlaybackRate(Double rate)
Sets the speed of the media playback.
Normal speed is 1.0 and 0.0 is incorrect.
-
stop
Unit stop()
Stops the playback.
Compared to pause, the navigator may clear its state in whatever way is appropriate. For example, recovering a player's resources.
-
seekRelative
Unit seekRelative(Duration offset)
Seeks relatively from the current position in the current resource.
-
-
-
-