PlayerRepository

interface PlayerRepository

Functions

addMediaItem
Link copied to clipboard
abstract fun addMediaItem(mediaItem: MediaItem)
Adds a media item to the end of the playlist.
abstract fun addMediaItem(index: Int, mediaItem: MediaItem)
Adds a media item at the given index of the playlist.
clearMediaItems
Link copied to clipboard
abstract fun clearMediaItems()
Clears the playlist.
getCurrentMediaItemIndex
Link copied to clipboard
abstract fun getCurrentMediaItemIndex(): Int
Returns the index of the current media item.
getMediaItemAt
Link copied to clipboard
abstract fun getMediaItemAt(index: Int): MediaItem?
Returns the media item at the given index.
getMediaItemCount
Link copied to clipboard
abstract fun getMediaItemCount(): Int
Returns the number of media items in the playlist.
getSeekBackIncrement
Link copied to clipboard
abstract fun getSeekBackIncrement(): Duration
Returns the seekBack increment.
getSeekForwardIncrement
Link copied to clipboard
abstract fun getSeekForwardIncrement(): Duration
Returns the seekForward increment.
hasNextMediaItem
Link copied to clipboard
abstract fun hasNextMediaItem(): Boolean
Returns whether a next media item exists.
hasPreviousMediaItem
Link copied to clipboard
abstract fun hasPreviousMediaItem(): Boolean
Returns whether a previous media item exists.
pause
Link copied to clipboard
abstract fun pause()
Pauses playback.
play
Link copied to clipboard
abstract fun play()
Resumes playback as soon as player is ready.
abstract fun play(mediaItemIndex: Int)
Play media item at given index as soon as player is ready.
prepare
Link copied to clipboard
abstract fun prepare()
Prepares the player.
release
Link copied to clipboard
abstract fun release()
Releases the player.
removeMediaItem
Link copied to clipboard
abstract fun removeMediaItem(index: Int)
Removes the media item at the given index of the playlist.
seekBack
Link copied to clipboard
abstract fun seekBack()
seekForward
Link copied to clipboard
abstract fun seekForward()
setMediaItem
Link copied to clipboard
abstract fun setMediaItem(mediaItem: MediaItem)
Clears the playlist, adds the specified media item and resets the position to the default position.
setMediaItems
Link copied to clipboard
abstract fun setMediaItems(mediaItems: List<MediaItem>)
Clears the playlist, adds the specified media items and resets the position to the default position.
setShuffleModeEnabled
Link copied to clipboard
abstract fun setShuffleModeEnabled(shuffleModeEnabled: Boolean)
Sets whether shuffling of media items is enabled.
skipToNextMediaItem
Link copied to clipboard
abstract fun skipToNextMediaItem()
Skips to the default position of next media item.
skipToPreviousMediaItem
Link copied to clipboard
abstract fun skipToPreviousMediaItem()
Skips to the default position of previous media item.

Properties

availableCommands
Link copied to clipboard
abstract val availableCommands: StateFlow<Set<Command>>
Returns the player's currently available commands.
connected
Link copied to clipboard
abstract val connected: StateFlow<Boolean>
Returns whether the repository is currently connected to a working Player.
currentMediaItem
Link copied to clipboard
abstract val currentMediaItem: StateFlow<MediaItem?>
Returns the current media item playing, or that would play when player starts playing.
currentState
Link copied to clipboard
abstract val currentState: StateFlow<PlayerState>
Returns the player's current state.
mediaItemPosition
Link copied to clipboard
abstract val mediaItemPosition: StateFlow<MediaItemPosition?>
Returns the current media item position of the player.
shuffleModeEnabled
Link copied to clipboard
abstract val shuffleModeEnabled: StateFlow<Boolean>
Returns the current value for shuffling of media items mode.