PlayerRepository

Properties

Link copied to clipboard
abstract val availableCommands: StateFlow<Set<Command>>

Returns the player's currently available commands.

Link copied to clipboard
abstract val connected: StateFlow<Boolean>

Returns whether the repository is currently connected to a working Player.

Link copied to clipboard
abstract val currentMedia: StateFlow<Media?>

Returns the current Media playing, or that would play when player starts playing.

Link copied to clipboard
abstract val latestPlaybackState: StateFlow<PlaybackStateEvent>

Emits events when PlaybackState of the player changes.

Link copied to clipboard
abstract val seekBackIncrement: StateFlow<Duration?>

Returns the seekBack increment.

Link copied to clipboard
abstract val seekForwardIncrement: StateFlow<Duration?>

Returns the seekForward increment.

Link copied to clipboard
abstract val shuffleModeEnabled: StateFlow<Boolean>

Returns the current value for shuffling of Media mode.

Functions

Link copied to clipboard
abstract fun addMedia(media: Media)

Adds a Media to the end of the playlist.

abstract fun addMedia(index: Int, media: Media)

Adds a Media at the given index of the playlist.

Link copied to clipboard
abstract fun clearMediaList()

Clears the playlist.

Link copied to clipboard
abstract fun getCurrentMediaIndex(): Int

Returns the index of the current Media.

Link copied to clipboard
abstract fun getMediaAt(index: Int): Media?

Returns the Media at the given index.

Link copied to clipboard
abstract fun getMediaCount(): Int

Returns the number of Media in the playlist.

Link copied to clipboard
abstract fun hasNextMedia(): Boolean

Returns whether a next Media exists.

Link copied to clipboard
abstract fun hasPreviousMedia(): Boolean

Returns whether a previous Media exists.

Link copied to clipboard
abstract fun pause()

Pauses playback.

Link copied to clipboard
abstract fun play()

Resumes playback as soon as player is ready.

Link copied to clipboard
abstract fun removeMedia(index: Int)

Removes the Media at the given index of the playlist.

Link copied to clipboard
abstract fun seekBack()

Seeks back in the current media by seek back increment.

Link copied to clipboard
abstract fun seekForward()

Seek forward in the current media by seek forward increment.

Link copied to clipboard
abstract fun seekToDefaultPosition(mediaIndex: Int)

Seeks to the default position associated with the specified Media.

Link copied to clipboard
abstract fun setMedia(media: Media)

Clears the playlist, adds the specified Media and resets the position to the default position.

Link copied to clipboard
abstract fun setMediaList(mediaList: List<Media>)

Clears the playlist, adds the specified Media list and resets the position to the default position.

abstract fun setMediaList(mediaList: List<Media>, index: Int, position: Duration? = null)

Clears the playlist, adds the specified Media list and resets the position to the provided position.

Link copied to clipboard
abstract fun setPlaybackSpeed(speed: Float)

Set the playback speed.

Link copied to clipboard
abstract fun setShuffleModeEnabled(shuffleModeEnabled: Boolean)

Sets whether shuffling of Media is enabled.

Link copied to clipboard
abstract fun skipToNextMedia()

Skips to the default position of next Media.

Link copied to clipboard
abstract fun skipToPreviousMedia()

Skips to the default position of previous Media.