BunnyPlayer
The playback engine behind net.bunny.bunnystreamplayer.ui.BunnyStreamPlayer. One engine instance is shared by every player view in the process; the views are meant to be used one at a time.
Most apps never touch this interface directly: the net.bunny.bunnystreamplayer.ui.BunnyStreamPlayer view drives it and re-exposes the pieces an app usually needs (play, progress, resume positions). Reach for the engine when you build your own player chrome and need direct control over tracks, quality, volume or speed.
Call engine methods from the main thread.
Inheritors
Properties
True while playback is paused by the SDK itself (for example when the host activity went to the background) rather than by the user. Such playback resumes automatically.
The underlying media3 Player - the local ExoPlayer or, while casting, the cast player.
Player settings of the current video, fetched from the Bunny API when playback starts.
Receives playback state callbacks. See PlayerStateListener.
Storage for resume positions. Set automatically when resume positions are enabled.
Seek-bar preview thumbnails of the current video, when the video has them.
Functions
Returns true while captions are turned on.
Removes saved positions older than the retention configured in ResumeConfig.
Deletes every saved position.
Deletes the saved position of one video.
Turns resume positions off. Already saved positions are kept.
Turns on local resume positions: playback positions are saved on the device automatically. Saving alone does not seek - to resume, set a ResumePositionListener (or pass the resume callback to the player view's enableResumePosition) and confirm the jump from there. See ResumeConfig for thresholds and retention.
Serializes all saved positions to JSON, for backup or transfer between devices.
Returns every saved position. The callback runs on the main thread.
Returns the selectable audio tracks of the current video, or null before playback starts.
Returns the current playback position in milliseconds.
Classifies the device this code is running on. See DeviceType.
Returns the duration of the current video in milliseconds.
Returns the speeds offered in the settings menu.
Returns the caption tracks of the current video and which one is showing.
Returns the selectable renditions of the current video, or null before playback starts.
Returns the player volume, from 0 (silent) to 1 (full volume).
Restores positions exported with exportPositions. The callback reports success.
Returns true on Android TV devices.
Returns true when the device requires a touch screen.
Reapplies the speed remembered from the previous playback, when that option is enabled.
Pauses playback. autoPaused is used by the SDK's own lifecycle handling; leave it false when pausing on behalf of the user.
Starts playback of video inside playerView. Used internally by the net.bunny.bunnystreamplayer.ui.BunnyStreamPlayer view, which fetches the video and its playerSettings first; prefer that view's playVideo(videoId) unless you are building a fully custom player.
Seeks to positionMs, in milliseconds from the start of the video.
Switches to the given audio track. Pick one from getAudioTrackOptions.
Locks playback to the given rendition. Pick one from getVideoQualityOptions.
Shows the given caption track. Pick one from getSubtitles.
Applies a PlaybackSpeedConfig. See that class for the available options.
Seeks to a resume position. Used by the SDK after the resume prompt.
The resume mechanism: notified when a saved position exists for the starting video. The listener decides whether to seek (ask the user, then call seekTo); without a listener playback starts from the beginning.
Turns captions on or off without changing the selected track.
Sets the player volume, from 0 (silent) to 1 (full volume).
Skips 10 seconds forward.