better_player 1.13.0
better_player: ^1.13.0 copied to clipboard
Advanced video player for Flutter with HLS, DASH, DRM, subtitles, caching, PiP, playlists, and custom controls.
Better Player #
Better Player handles the complex video playback edge cases so you don't have to. Originally based on video_player, it's now fully independent. It tackles HLS, DRM, and caching out of the box.
[IMPORTANT] Migrating from 0.0.84 to 1.x.x? See the Migration Guides section below.
π± Visual Showcase #
![]() |
![]() |
![]() |
![]() |
| Default Controls | Settings Menu | Audio Tracks | Event Listener |
π vs Competitors #
Why choose Better Player? Here is how it stacks up against the alternatives.
| Feature | Better Player | video_player | chewie | media_kit |
|---|---|---|---|---|
| Engine | ExoPlayer/AVPlayer/Shaka | ExoPlayer/AVPlayer | video_player | libmpv |
| UI Controls | β Built-in & Customizable | β None | β Built-in | β Built-in |
| HLS / DASH | β Native | β οΈ Basic | β οΈ Basic | β Native |
| DRM Support | β Widevine/FairPlay/ClearKey | β None | β None | β None |
| Subtitles | β Advanced (WebVTT, HTML, SRT) | β οΈ Basic (SRT only) | β οΈ Basic | β Advanced |
| Caching | β Built-in | β None | β None | β None |
| Playlists | β Built-in | β None | β None | β Built-in |
π Key Features #
- Adaptive Streaming: Play HLS, DASH, and Smooth Streaming with automatic track selection.
- DRM Support: Protect your content with Widevine, FairPlay, and ClearKey.
- Smart Caching: Cache videos for seamless offline playback.
- Picture in Picture (PiP): Keep videos playing while users multitask.
- Advanced Subtitles: Parse SRT and WebVTT, including HTML tags.
π¦ Quick Start #
1. Add dependency #
Add Better Player to your pubspec.yaml:
dependencies:
better_player: ^1.10.0
2. Basic Usage #
Use the network factory to get a player up and running fast.
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 #
Need full control? Initialize a BetterPlayerController manually.
BetterPlayerController _controller = BetterPlayerController(
const PlayerConfiguration(),
betterPlayerDataSource: PlayerDataSource(
DataSourceType.network,
"https://example.com/video.mp4",
),
);
BetterPlayer(controller: _controller)
π€ AI Agent Quick Reference #
Writing a script or prompt? Feed this to your AI to get the right code on the first try.
- Initialization: Always initialize
BetterPlayerControllerininitState()with aPlayerConfigurationandPlayerDataSource. - Core Classes:
BetterPlayerController: Manages state and configuration.PlayerDataSource: Wraps video URL, DRM config, subtitles, headers.PlayerConfiguration: UI, looping, autoPlay, aspect ratio.PlayerControlsConfiguration: Colors, icons, padding for the control bar.
- Subtitles: Pass
PlayerSubtitlesSourcedirectly intoPlayerDataSource. - Disposal: Default is
autoDispose: true. Avoid manualcontroller.dispose()unless you opt out.
π Migration Guides #
Moving from another package? Follow these guides:
π Resources #
π€ Contributing #
Bugs? Feature requests? Open an issue. Better yet, submit a PR.
πΌ Enterprise Support #
Need a custom video source adapter, bespoke DRM implementation, or tailored UI controls? I'm available for consulting.



