bunny_video_player 0.1.0 copy "bunny_video_player: ^0.1.0" to clipboard
bunny_video_player: ^0.1.0 copied to clipboard

Flutter video player for Bunny.net with signed/tokenized HLS/MP4, PiP, and full control from Dart. Android and iOS.

bunny_video_player #

A Flutter plugin for Bunny Stream playback with native rendering on Android and iOS.

  • Android: Bunny Stream Android player integration
  • iOS: AVPlayer-based native implementation
  • Robust Native -> Dart and Dart -> Native communication
  • PiP, lifecycle handling, playback events, source switching

Features #

  • Native platform view rendering (BunnyVideoView)
  • Controller API (BunnyVideoController)
  • Playback controls: play, pause, seek, speed, volume, looping
  • Picture in Picture (Android/iOS)
  • Signed URL refresh
  • Real-time streams:
    • playback state
    • position
    • buffered position
    • errors
    • PiP mode state
  • Runtime Android control layout tuning from Dart

Requirements #

  • Flutter >=3.22.0
  • Dart >=3.0.0 <4.0.0
  • Android minSdk 26
  • iOS 12.0+

Installation #

Add dependency:

dependencies:
  bunny_video_player: ^0.1.0

Then run:

flutter pub get

Platform Setup #

Android #

PiP support in your app AndroidManifest.xml activity:

<activity
    android:name=".MainActivity"
    android:supportsPictureInPicture="true"
    android:resizeableActivity="true"
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" />

iOS #

For background playback/PiP behavior, enable audio background mode in Info.plist:

<key>UIBackgroundModes</key>
<array>
  <string>audio</string>
</array>

Quick Start #

import 'package:bunny_video_player/bunny_video_player.dart';

final controller = BunnyVideoController(playerId: 0);

await controller.initialize(
  libraryId: '596670',
  videoId: 'your-video-id',
  accessKey: 'your-access-key',
  autoPlay: false,
  looping: false,
  allowBackgroundPlayback: true,
);

Render native view:

BunnyVideoView(
  playerId: 0,
  config: const BunnyPlayerViewConfig(),
)

Controller API #

await controller.play();
await controller.pause();
await controller.seekTo(const Duration(seconds: 10));
await controller.setPlaybackSpeed(1.25);
await controller.setVolume(0.8);
await controller.setLooping(true);
await controller.enterPictureInPicture();
await controller.exitPictureInPicture();
await controller.refreshSignedUrl('https://...');
await controller.dispose();

Switch to another video source on same controller:

await controller.switchSource(
  libraryId: '596670',
  videoId: 'another-video-id',
  accessKey: 'your-access-key',
  keepPlaybackState: true,
);

Event Streams #

controller.playbackStateStream.listen((state) {});
controller.positionStream.listen((position) {});
controller.bufferedStream.listen((buffered) {});
controller.errorStream.listen((message) {});
controller.pipModeStream.listen((isInPip) {});

BunnyPlaybackState values:

  • idle
  • loading
  • ready
  • playing
  • paused
  • buffering
  • completed
  • error

View Configuration #

BunnyPlayerViewConfig supports:

  • useHybridComposition
  • eagerGestureHandling
  • applyWhiteIcons
  • showFullscreenButton
  • showSettingsButton
  • keepScreenOn
  • playerBackgroundColorArgb
  • controlsIconVerticalPaddingDp
  • controlsTextVerticalPaddingDp
  • controlsLeadingSpaceDp
  • progressBarTranslationDp
  • progressBarBottomMarginDp

Example:

const BunnyVideoView(
  config: BunnyPlayerViewConfig(
    applyWhiteIcons: true,
    controlsIconVerticalPaddingDp: 3,
    controlsTextVerticalPaddingDp: 3,
    controlsLeadingSpaceDp: 1,
    progressBarTranslationDp: 8,
    progressBarBottomMarginDp: -3,
  ),
)

Error Notes #

A Bunny API 404 Not Found means the video is not available for the provided:

  • libraryId
  • videoId
  • accessKey

Validate all three before playback.

Publishing #

See PUBLISHING.md for release and pub.dev publish steps.

License #

MIT

1
likes
0
points
251
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter video player for Bunny.net with signed/tokenized HLS/MP4, PiP, and full control from Dart. Android and iOS.

Homepage

Topics

#video #streaming #player #pip #bunny

License

unknown (license)

Dependencies

flutter, meta

More

Packages that depend on bunny_video_player

Packages that implement bunny_video_player