PlayerStateListener

Callbacks for playback state changes. Assign an implementation to net.bunny.bunnystreamplayer.common.BunnyPlayer.playerStateListener to drive custom UI (play/pause buttons, loading spinners, chapter lists) from the engine's state.

All callbacks are invoked on the main thread.

Functions

Link copied to clipboard
abstract fun onChaptersUpdated(chapters: List<Chapter>)

Chapter markers for the current video were loaded. Chapters are defined per video in the Bunny dashboard; the list is empty when the video has none.

Link copied to clipboard
abstract fun onLoadingChanged(isLoading: Boolean)

The player started (isLoading = true) or stopped (isLoading = false) loading media data over the network. This is not a rebuffering signal: it also fires routinely during smooth playback, so do not drive a buffering spinner from it.

Link copied to clipboard
abstract fun onMomentsUpdated(moments: List<Moment>)

Moment markers for the current video were loaded. Moments are labelled timestamps defined per video in the Bunny dashboard; the list is empty when the video has none.

Link copied to clipboard
abstract fun onMutedChanged(isMuted: Boolean)

The player was muted or unmuted.

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

Playback speed changed, for example after the user picked a speed in the settings menu.

Link copied to clipboard
abstract fun onPlayerError(message: String)

Playback failed. message is a human-readable description suitable for logging.

Link copied to clipboard
abstract fun onPlayerTypeChanged(player: Player, playerType: PlayerType)

Playback moved between the local player and a connected Chromecast device. player is the media3 player instance now in charge; playerType tells you which one it is.

Link copied to clipboard
abstract fun onPlayingChanged(isPlaying: Boolean)

Playback started (isPlaying = true) or paused/stopped (isPlaying = false).

Link copied to clipboard

Audience retention data for the current video was loaded. The player uses it to draw the watch-time heatmap above the seek bar when the library has that feature enabled.

Link copied to clipboard
open fun onVideoSizeChanged(width: Int, height: Int)

The current video's pixel dimensions, reported when the first frame is decoded and whenever they change (e.g. a quality switch or a different stream). Lets hosts size their container to the real aspect ratio so both 16:9 and 9:16 (vertical) content display without distortion. Default no-op so existing implementations keep compiling.