better_player 1.5.1 copy "better_player: ^1.5.1" to clipboard
better_player: ^1.5.1 copied to clipboard

Advanced video player. It solves many typical use cases and it's easy to run.

Better Player #

The most advanced and feature-rich video player for Flutter. #

pub package pub package pub package

Better Player is a powerful video player for Flutter, originally based on the official video_player plugin but now fully independent. It solves common playback issues, provides extensive configuration options, and handles complex media use cases out of the box.

[IMPORTANT] Migrating to 1.x.x? We've introduced a cleaner federated architecture, direct native bridges (JNI/FFI) in v1.2.0, and unified model names (e.g. BetterPlayerConfiguration is now PlayerConfiguration). See the Migration Guide to 1.x.x to learn how to upgrade your project.


📱 Visual Showcase #

Default Controls Settings Menu Audio Tracks Event Listener

🚀 Key Features #

🎬 Advanced Playback #

  • Adaptive Streaming: Full support for HLS (Android & iOS), DASH (Android), and Smooth Streaming (Android) with track selection.
  • Resolution Control: Easy switching between alternative video resolutions.
  • Smart Caching: Seamlessly cache videos for high-performance offline playback.
  • Customizable UI: Refactored controls that are highly customizable via configuration.

🛡️ Content Protection & Security #

  • DRM Support: Industry-standard protection with Widevine, FairPlay, and ClearKey.
  • Secured Requests: Full support for custom HTTP Headers for authenticated streams.

📱 User Experience #

  • Picture in Picture (PiP): Native PiP support for multitasking on Android and iOS.
  • Background Notifications: Rich media notifications for background control.
  • Subtitle Engine: Advanced support for SRT and WebVTT with HTML tags.
  • Playlist Support: Built-in support for multiple videos and continuous playback.
  • Playback Speed: Native support for changing playback speed.

🛠️ Developer Friendly #

  • ListView Integration: Optimized for smooth playback within scrolling lists.
  • Lifecycle Aware: Automatically handles player disposal and lifecycle changes.
  • Event System: Comprehensive event listener for tracking every player state.

📦 Quick Start #

1. Add dependency #

Add Better Player to your pubspec.yaml:

dependencies:
  better_player: ^1.4.0

2. Basic Usage #

The simplest way to play a video is using the network factory:

import 'package:better_player/better_player.dart';

// Inside your build method
AspectRatio(
  aspectRatio: 16 / 9,
  child: BetterPlayer.network(
    "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
    betterPlayerConfiguration: PlayerConfiguration(
      aspectRatio: 16 / 9,
      looping: true,
      autoPlay: true,
    ),
  ),
)

3. Advanced Controller Usage #

For full control, use the BetterPlayerController:

BetterPlayerController _controller = BetterPlayerController(
    const PlayerConfiguration(),
    betterPlayerDataSource: PlayerDataSource(
        DataSourceType.network,
        "https://example.com/video.mp4",
    ),
);

BetterPlayer(controller: _controller)

🔄 Migration Guides #

Switching from another package? Check out our step-by-step migration guides:


📖 Resources #


🤝 Contributing #

Valuable contributions are welcome! Better Player is a community-driven project. If you encounter bugs or have feature requests, please open an issue. If you want to contribute code, feel free to submit a Pull Request.

📄 License #

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.