A wrapper for Bunny.net mobile SDK for Android & iOS

This plugin currently provides:

  • Bunny Stream data/API calls via BunnyStreamFlutter
  • Native built-in Bunny player widget via BunnyBuiltInPlayerView

Available features

API features

  • Initialize Bunny credentials and defaults via initialize
  • Fetch paginated videos via listVideos
  • Fetch single video metadata via getVideo
  • Generate playback links (HLS + fallback + renditions) via getVideoPlayData
  • Optional tokenized playback URL generation (token, expires)
  • Typed models: BunnyVideo, BunnyCollection, BunnyVideoPlayData
  • Unified platform error mapping through BunnyStreamException

Player features

  • Native built-in Bunny player widget: BunnyBuiltInPlayerView
  • Android and iOS platform view integration
  • Secure playback inputs supported in widget API (token, expires)

Current native method support status

  • Implemented natively on Android and iOS: initialize, listVideos, getVideo, getVideoPlayData
  • Not yet implemented natively: listCollections, getCollection

Requirements

  • Flutter >=3.38.4
  • Dart ^3.10.3
  • Android minSdk 26
  • iOS 15.0+

Quick start (API)

import 'package:bunny_stream_flutter/bunny_stream_flutter.dart';

final bunny = BunnyStreamFlutter();

await bunny.initialize(
  accessKey: 'YOUR_STREAM_ACCESS_KEY',
  libraryId: 12345,
  cdnHostname: 'vz-12345.b-cdn.net',
);

final playData = await bunny.getVideoPlayData(
  libraryId: 12345,
  videoId: 'VIDEO_GUID',
  token: 'OPTIONAL_SECURE_TOKEN',
  expires: 1735689600,
);

print(playData.playlistUrl);

Quick start (built-in player)

import 'package:bunny_stream_flutter/bunny_stream_flutter.dart';

SizedBox(
  height: 260,
  child: BunnyBuiltInPlayerView(
    accessKey: 'YOUR_STREAM_ACCESS_KEY',
    videoId: 'VIDEO_GUID',
    libraryId: 12345,
    token: 'OPTIONAL_SECURE_TOKEN',
    expires: 1735689600,
    isPortrait: false,
    isScreenShotProtectEnable: false,
  ),
)

User-side setup required

Android

Apply the following in your app project (the app that consumes this plugin):

  1. Add JitPack repository in your top-level android/build.gradle or android/build.gradle.kts:
allprojects {
  repositories {
    google()
    mavenCentral()
    maven("https://jitpack.io")
  }
}
  1. Ensure minSdk is at least 26 in your app module.

  2. Use an AppCompat-based app/activity theme (required by Bunny native UI):

<application
    ...
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
  1. Ensure your Flutter activity themes are AppCompat too (LaunchTheme/NormalTheme in styles.xml):
<style name="LaunchTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />
<style name="NormalTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />
  1. Add ProGuard/R8 rule in android/app/proguard-rules.pro:
-keep class net.bunny.bunnystreamplayer.** { *; }
  1. Keep internet permission enabled in manifest:
<uses-permission android:name="android.permission.INTERNET" />

iOS

Apply the following in your iOS app project:

  1. Ensure iOS deployment target is 15.0 or higher (Podfile + Xcode target).

  2. Enable Swift Package Manager support in Flutter toolchain:

flutter config --enable-swift-package-manager
  1. Add Bunny iOS SDK package in Xcode (required):
  • Open ios/Runner.xcworkspace in Xcode
  • Go to RunnerPackage Dependencies+
  • Search for bunny-stream-ios in the package manager
  • Select bunny-stream-ios from results
  • Click Add to Project and choose Runner
  • Select the branch/version you want
  • Click Add Package
  • Ensure product BunnyStreamPlayer and BunnyStreamApi is linked to Runner target
  1. Refresh iOS dependencies:
flutter clean
flutter pub get
cd ios && pod install
  1. Verify package linkage:
  • flutter config --list should include enable-swift-package-manager: true
  • In Xcode, Runner should show bunny-stream-ios under Package Dependencies
  • Ensure no iOS build errors for missing BunnyStreamPlayer

Troubleshooting iOS

Check this: https://github.com/BunnyWay/bunny-stream-ios?tab=readme-ov-file#troubleshooting

FlutterGeneratedPluginSwiftPackage resets to iOS 13.0 after pod install

ios/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/Package.swift is generated by Flutter tooling. If you run only pod install, it may still show:

platforms: [
  .iOS("13.0")
]

Run Flutter iOS config generation so Flutter updates the generated package platform from your project deployment target:

flutter clean
flutter pub get
flutter build ios --config-only --simulator
cd ios && pod install --repo-update

Also ensure all iOS deployment targets in your app project are 15.0+ (Podfile + Xcode target/build settings).

Required Bunny values

  • libraryId
  • accessKey
  • videoId
  • Optional cdnHostname
  • Optional token and expires (recommended from backend for secured playback)

Security notes

  • Do not hardcode production access keys in client apps.
  • Generate token/expires server-side for protected playback.
  • Keep secrets on backend whenever possible.

API reference

Public entrypoint: BunnyStreamFlutter

initialize

Future<void> initialize({
  required String accessKey,
  required int libraryId,
  String? cdnHostname,
  String? token,
  int? expires,
})

listVideos

Future<List<BunnyVideo>> listVideos({
  required int libraryId,
  int page = 1,
  int itemsPerPage = 100,
  String? search,
  String? collectionId,
})

getVideo

Future<BunnyVideo> getVideo({
  required int libraryId,
  required String videoId,
})

listCollections

Future<List<BunnyCollection>> listCollections({
  required int libraryId,
  int page = 1,
  int itemsPerPage = 100,
  String? search,
})

getCollection

Future<BunnyCollection> getCollection({
  required int libraryId,
  required String collectionId,
})

getVideoPlayData

Future<BunnyVideoPlayData> getVideoPlayData({
  required int libraryId,
  required String videoId,
  String? token,
  int? expires,
})

SDK references