MediaReplay

interface MediaReplay : Replay

Media replay stream control interface.

Provides control over some remote media stream, allowing to control playback.

Every client that requests a reference on a media replay stream is given its own dedicated instance of that stream. Multiple, independent stream may thus be open from the same media.

This stream does not support suspension. When it gets interrupted because another stream starts, or because streaming gets disabled globally, then it will move to the STOPPEDstate and will remain in that state even once the interrupting stream stops, or streaming gets enabled. Also, this implies that this stream cannot be started while streaming is globally disabled.

The stream is stopped and released as soon as the reference that provides it is closed. All open sinks are closed as a consequence.

Types

Source
Link copied to clipboard
interface Source : Parcelable
Identifies a source for media replay.

Functions

duration
Link copied to clipboard
@IntRange(from = 0)
abstract fun duration(): Long
Informs about total playback duration.
openSink
Link copied to clipboard
abstract fun openSink(@NonNull config: Stream.Sink.Config): Stream.Sink
Opens a sink from this stream.
pause
Link copied to clipboard
abstract fun pause(): Boolean
Requests playback to pause.
play
Link copied to clipboard
abstract fun play(): Boolean
Requests playback to start.
playState
Link copied to clipboard
abstract fun playState(): Replay.PlayState
Informs about current playback state.
position
Link copied to clipboard
@IntRange(from = 0)
abstract fun position(): Long
Informs about current playback position.
seekTo
Link copied to clipboard
abstract fun seekTo(@IntRange(from = 0position: Long): Boolean
Requests playback position change.
source
Link copied to clipboard
abstract fun source(): MediaReplay.Source
Informs about the configured source for this media replay stream.
state
Link copied to clipboard
abstract fun state(): Stream.State
Informs about current stream state.
stop
Link copied to clipboard
abstract fun stop()
Stops the stream.
videoTrackOf
Link copied to clipboard
open fun videoTrackOf(@NonNull resource: MediaItem.Resource, @NonNull track: MediaItem.Track): MediaReplay.Source
Creates a source for streaming a media resource.