BunnyStreamPlayer
The video player view of the Bunny Stream SDK. Add it to a layout (or wrap it in AndroidView from Compose) and call playVideo with a video id from your library:
player.playVideo(videoId = "your-video-guid")The view needs an SDK instance: either net.bunny.api.BunnyStreamApi.initialize has been called, or bunny is set to an instance from BunnyStreamApi.create. With neither, playVideo logs an error and shows nothing. Appearance (accent color, visible controls, captions styling) comes from the library's player settings in the Bunny dashboard. Icons can be replaced through iconSet.
What the view handles on its own:
playback controls, seek-bar preview thumbnails, chapters, moments and captions
fullscreen (opens a dedicated fullscreen screen) and Picture-in-Picture (the host activity must declare
android:supportsPictureInPicture="true")Chromecast, when Google Play services are available
pausing when the host goes to the background and resuming on return
resume positions, once enabled with enableResumePosition
The view attaches to its host lifecycle automatically. Playback stops when the view is detached from the window. One playback engine is shared per process; use one player view at a time and detach it before starting playback in another.
Properties
When true, the player periodically samples the video frame behind the position/duration readout and flips the text between black and white based on luminance, so the readout stays legible regardless of scene brightness. Defaults to false to preserve existing behavior; opt in from your app.
The SDK instance this view plays from. Leave it null to use the one net.bunny.api.BunnyStreamApi.initialize registered.
Condensed control bar (hides secondary controls like settings/captions/duration). Driven for live playback by the dashboard's enableCompactControls from the live /play customization. Forwards to BunnyPlayerView.compactControls.
Whether the built-in player chrome is used. Set it to false before starting playback to get a bare video surface and drive playback from your own UI (play(), pause(), seekTo() and the rest of this class stay available). Taps on the player then do nothing and no control is ever shown. Defaults to true.
Apply custom icons to video player interface
Invoked with the video's chapters once they are known (empty when it has none).
Invoked while the player buffers, so a custom UI can show its own spinner.
Invoked with the video's moments once they are known (empty when it has none).
Invoked when the audio is muted or unmuted, from any source. See isMuted.
Invoked when the engine reports a playback error. The live player uses it to re-poll the stream and rebuild playback from the live edge. Forwards to BunnyPlayerView.onPlaybackError.
Invoked whenever the playback rate changes - both when something selects a speed and when the engine restores the remembered one on the next video (PlaybackSpeedConfig.rememberLastSpeed, on by default).
Invoked when playback moves between this device and a connected Chromecast, so a custom UI can stop presenting itself as the thing playing the video.
Invoked when playback starts or stops, whatever the cause - a control, your own code, the end of the video, or a handover to Chromecast. Drive a custom play/pause button from this rather than from your own taps.
Invoked with the retention graph once it is known, for a custom seek bar.
Invoked with the current video's pixel dimensions (first frame and on change) so the host can size its container to the real aspect ratio — supporting both 16:9 and 9:16 (vertical) content.
The playback rate. Setting it takes effect immediately and, with PlaybackSpeedConfig.rememberLastSpeed on, is remembered for the next video.
Manual override for the position/duration text color. Has no lasting effect while autoProgressTextColor is enabled — the sampler overrides it on each tick.
Functions
Clear all saved positions
Clear saved position for specific video
Disable resume position functionality
Enable resume position functionality with auto-save
Get all saved positions for debugging/management
Get current position of video in milliseconds
Get current position as formatted time string (e.g., "1:23" or "1:23:45")
Get the device type (TV, Mobile, or Unknown)
Get total duration of video in milliseconds
Get duration as formatted time string
The speeds offered for this video, from the library's player settings.
Get playback progress as a value between 0.0 and 1.0
Whether the audio is muted. Changes are reported through onMutedChanged.
Check if the app is running on Android TV
Play a pre-resolved HLS URL through the standard Bunny player UI (custom controller, progress text auto-contrast, fullscreen, etc.). Used by the live-stream Compose surface in net.bunny.bunnystreamplayer.livestream so live playback looks visually identical to VOD — same controls, same chrome.
Play video with automatic TV/Mobile detection
Set a listener to receive progress updates