Skip to main content

Better Player

Better Player is an advanced and feature-rich video player for Flutter. Built on top of the official video_player plugin and inspired by Chewie, it is designed to solve common playback issues, provide extensive configuration options, and handle complex media use cases out of the box.

Installation

Add this to your pubspec.yaml file:

dependencies:
better_player: ^latest_version

Key Features

  • Advanced Playback: Full support for HLS, DASH, and Smooth Streaming (adaptive streaming), resolution switching, and smart video caching.
  • Content Protection: Industry-standard DRM support (Widevine, FairPlay, ClearKey) and support for custom HTTP headers.
  • User Experience: Native Picture-in-Picture (PiP) on Android/iOS, background media notifications, advanced subtitle support (SRT/WebVTT), playlist support, and playback speed control.
  • Developer Friendly: Optimized for ListView integration, automatic lifecycle management, and a comprehensive event system for tracking player states.
  • Customization: Highly customizable UI controls via configuration.

Usage Example

Basic Usage (Network Video)

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: BetterPlayerConfiguration(
aspectRatio: 16 / 9,
looping: true,
autoPlay: true,
),
),
)

Advanced Controller Usage

BetterPlayerController _controller = BetterPlayerController(
const BetterPlayerConfiguration(),
betterPlayerDataSource: BetterPlayerDataSource(
BetterPlayerDataSourceType.network,
"https://example.com/video.mp4",
),
);

BetterPlayer(controller: _controller)

Resources