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