bunny-stream-android

More: Author   ReportBugs   
Tags:

BunnyNet

What is Bunny Stream?

Bunny Stream is the Android SDK for Bunny's video platform. It covers the whole content flow: manage the videos and live streams in your library, upload from the device, play videos, play live streams, and broadcast live from the camera.

Key features

  • Video playback: a ready player with controls, captions, chapters, seek previews, Chromecast, Picture-in-Picture and resume positions
  • Live streaming: a live player that handles countdowns, pre-stream trailers, DVR and the switch to the recording by itself, plus camera broadcasting with automatic reconnect and primary/backup failover
  • Uploads: chunked TUS uploads with mid-upload pause and resume
  • Full REST API access: videos, collections and live streams of your library

Documentation

Requirements

  • Android 8.0 (API level 26) or newer on the device
  • compileSdk 36 or higher, JDK 17
  • Kotlin 2.1 or newer
  • Core library desugaring enabled, if you use net.bunny:player - see Getting started
  • A Bunny Stream video library

Installation

The SDK ships on Maven Central as four artifacts. Use what you need:

dependencies {
    implementation("net.bunny:api:latest.release")        // management + uploads
    implementation("net.bunny:player:latest.release")     // playback (pulls in :api)
    implementation("net.bunny:recording:latest.release")  // camera + go-live (pulls in :api)
    implementation("net.bunny:tv:latest.release")         // Android TV player activity (pulls in :api)
}

Replace latest.release with a concrete version for reproducible builds. Maven Central is configured by default in Android projects; no extra repository setup is needed.

Module Artifact What it does
bunny-stream-api net.bunny:api REST API access (videos, collections, live streams), uploads, playback settings
bunny-stream-player net.bunny:player Video player and live stream player
bunny-stream-camera-upload net.bunny:recording Camera recording to the library and live broadcasting
bunny-stream-tv net.bunny:tv Android TV player activity with D-pad and remote-control handling

Quickstart

Declare the INTERNET permission (the api and player artifacts do not declare it; the recording artifact does):

<uses-permission android:name="android.permission.INTERNET" />

Initialize once, in Application.onCreate:

BunnyStreamApi.initialize(context, accessKey = "your-api-key", libraryId = 12345L)

That registers a default instance the whole SDK reaches through getInstance(). If your app talks to several libraries, create an instance per library instead and hand it to the views:

val marketing = BunnyStreamApi.create(context, BunnyStreamConfig(marketingKey, 12345L))
playerView.bunny = marketing

Play a video:

// XML: add net.bunny.bunnystreamplayer.ui.BunnyStreamPlayer to a layout, then
binding.videoPlayer.playVideo(videoId = "your-video-guid")

Play a live stream (Compose):

BunnyLiveStreamPlayer(libraryId = 12345L, streamId = "stream-guid")

Broadcast from the camera to a live stream:

// XML: add net.bunny.bunnystreamcameraupload.BunnyStreamCameraUpload to a layout, then
binding.cameraUpload.liveStreamId = "stream-guid"
binding.cameraUpload.startPreview()   // CAMERA + RECORD_AUDIO must be granted

Each of these has a guide with the full flow, prerequisites and gotchas: Getting started, Play a video, Play a live stream, Go live from the camera, Upload videos, Manage live streams.

Chromecast

The player casts to the Bunny Stream receiver application - the same receiver the web player uses - which plays every Bunny asset, including fMP4 HLS and Widevine-protected videos, and mirrors the player appearance configured in the Bunny dashboard on the TV. The cast button appears automatically when the library's player controls include chromecast and a cast device is available; the video title and thumbnail show on the TV, and audio track, caption and playback speed selections apply to the cast session.

No setup is needed. To point the SDK at a different receiver application (for example a staging one), override it in your app's manifest:

<meta-data
    android:name="net.bunny.cast.RECEIVER_APPLICATION_ID"
    android:value="YOUR_APP_ID" />

Player appearance

Colors, visible controls, captions styling and the player language are configured per library in the Bunny dashboard (Stream > your library > Player). Both players apply those settings automatically; the video player also accepts custom control icons in code (Play a video).

Security notes

For token-protected libraries pass token/expires to the players and sign tokens on your server, not in the app. When loading Bunny-hosted images with your own image loader under hotlink protection, send the Referer header. Details: Secure playback.

License

Bunny Stream Android is licensed under the MIT License.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools
AI Daily Digest