better_player 1.10.0 copy "better_player: ^1.10.0" to clipboard
better_player: ^1.10.0 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 from 0.0.84 to 1.x.x? See the Migration Guide 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,
    ),
  ),
)

4. Web Setup #

To use Better Player on the web, you must include the Shaka Player library in your web/index.html file before the closing </body> tag:

<script src="https://cdn.jsdelivr.net/npm/shaka-player@4/dist/shaka-player.compiled.js"></script>

5. 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.