Installation and Configuration
Follow these steps to integrate Better Player into your Flutter application.
1. Add Dependency
Add better_player to your pubspec.yaml file:
dependencies:
better_player: ^1.39.0
2. Install Package
Run the following command in your terminal to fetch the package:
flutter pub get
3. Import Package
Import the library into your Dart code:
import 'package:better_player/better_player.dart';
4. Platform-Specific Configuration
iOS Configuration (Required)
To ensure Better Player functions correctly on iOS, apply the following settings:
- Deployment Target: Set the minimum iOS deployment version to 13.0.
- Swift Version: Ensure your project is configured to use Swift 5.
Android Configuration (Required)
Apply the following settings for Android support:
- SDK Version: Set
compileSdkVersionto 36. - Flutter Version: Use Flutter 3.47.0 or higher (required for latest architectural improvements).
- MultiDex: Ensure MultiDex is enabled in your project.
macOS Configuration (Required)
Apply the following settings for macOS support:
- Deployment Target: Set the minimum macOS deployment version to 10.15 (Catalina) or higher.
- Network Client Entitlement: Flutter macOS apps run inside an App Sandbox by default. To stream network videos, add the incoming/outgoing client network entitlement to both
macos/Runner/DebugProfile.entitlementsandmacos/Runner/Release.entitlements:
<key>com.apple.security.network.client</key>
<true/>
Windows Configuration (Required)
Apply the following settings for Windows support:
- Target OS: Windows 10 version 1809 (Build 17763) or higher.
- Graphics: DirectX 11 capable graphics adapter (D3D11 shared texture rendering).
- libmpv Runtime: The Windows plugin dynamically loads
mpv-2.dll. Ensurempv-2.dllis located next to your built application executable (Runner.exe) or in your systemPATH.
Linux Configuration (Required)
Apply the following settings for Linux support:
- Target OS: Any standard Linux distribution with GTK 3.0+ and
glibc2.31+. - libmpv Runtime: The Linux plugin dynamically loads
libmpv.so.2(orlibmpv.so.1/libmpv.so). Installlibmpvvia your system package manager:- Ubuntu/Debian:
sudo apt install libmpv-dev libmpv2 - Fedora/RHEL:
sudo dnf install mpv-libs-devel - Arch Linux:
sudo pacman -S mpv
- Ubuntu/Debian:
Web Configuration (Required)
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>
Alternatively, you can download the script and host it locally.
Tizen Configuration (Experimental)
To target Samsung Smart TVs or Tizen devices, add better_player_tizen to your pubspec.yaml:
dependencies:
better_player: ^1.39.0
better_player_tizen: ^1.0.0
Warning:
better_player_tizenis EXPERIMENTAL and provides basic playback via the native Tizen Multimedia<player.h>API.
Add network and storage privileges to your tizen/tizen-manifest.xml:
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
<privilege>http://tizen.org/privilege/mediastorage</privilege>
<privilege>http://tizen.org/privilege/externalstorage</privilege>
</privileges>
5. Additional Configurations (Optional)
iOS Fullscreen Rotation
To support automatic screen rotation when entering fullscreen mode, add the following key to your Info.plist file:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
AI Agent Skills
Better Player bundles Dart package skills with setup rules, 1.x API patterns, and examples for DRM, subtitles, caching, and playlists. Install the skill into your workspace .agents/skills/ directory:
dart run skills@ get -p better_player