Key Features
- Complete API Integration: Full support for the Bunny REST Stream API
- Efficient Video Upload: TUS protocol implementation for reliable, resumable uploads
- Advanced Video Player: Custom-built player with full Bunny CDN integration
- Camera Upload Support: Built-in capabilities for recording and uploading videos directly from the device camera
- Type-Safe API: Fully typed Kotlin API for compile-time safety
- Background Processing: Support for background uploads and downloads
- Comprehensive Error Handling: Detailed error information and recovery options
What is the Bunny Stream Android SDK?
Bunny Stream is an Android library designed to seamlessly integrate Bunny’s powerful video streaming capabilities into your Android applications. The library provides a robust set of tools for video management, playback, uploading, and camera-based video uploads, all through an intuitive Kotlin API.Token authentication
When using the Android SDK, two authentication layers exist:- Embed View Token Authentication — controls access to the video.
- CDN Token Authentication — protects delivery from Bunny CDN and is handled automatically by the SDK.
Embed View Token Authentication
Embed View Token Authentication:- Authorizes a viewer to play a specific video
- Is enforced at the Stream API level
- Is required for private or restricted videos
- The customer backend generates the token.
- The app requests the token and passes it to the
PlayVideocall. - The SDK uses the token for playback; CDN token signing happens automatically.
Supported authentication methods
Backend requirements
Your backend (or Edge Script) must:- Securely store the Video Library API Key, as it serves as a secret that must not be stored in the mobile app.
- Authenticate the app user with your custom business logic.
- Generate the embed view token by following the token authentication signing procedure (the token security key is your Video Library API Key).
- Return
tokenandexpiresvalues in the response:
Tokens should be short-lived (1–5 minutes recommended), unless you have a specific use case that requires a longer expiration.
Edge Script example
Below is an example Edge Script that generates embed view tokens. StoreVIDEO_LIBRARY_API_KEY as an Edge Script Secret.
Android SDK usage
ThePlayVideo call supports token parameters:
1
Request the embed token
Call your backend or Edge Script from the app to request a token for the target
videoId.2
Receive the token
Your backend returns
{ token, expires }.3
Play the video
Pass the
token and expires values to the PlayVideo call.Important notes
- The Video Library API Key must never be included in mobile apps.
- Embed View Token Authentication is required if you don’t want to publicly expose your videos.
- CDN Token Authentication is applied to CDN URLs automatically if it is turned on in the video library.