# Installation
ByteArk Player SDK for Flutter is published on pub.dev (opens new window). You can add it as a dependency in your Flutter project.
# Requirements
| Item | Version |
|---|---|
| Flutter | 3.22.0 or higher |
| Dart SDK | 3.5.0 or higher |
| iOS Deployment Target | iOS 14.0 or higher |
| iOS Build Tools | Xcode 17 or higher (Swift 6.3) |
| Android Min SDK | API 21 (Android 5.0) or higher |
| Android compileSdk | 35 |
| Android Gradle Plugin (AGP) | 8.6 or higher |
| Gradle | 8.14 or higher |
| Kotlin | 1.9 or higher |
| JDK | 17 |
# Add the dependency
Edit your project's pubspec.yaml:
dependencies:
byteark_player_flutter: ^2.0.0
2
Then run:
flutter pub get
Or use flutter pub add:
flutter pub add byteark_player_flutter
# iOS setup
Open ios/Podfile, set the platform, and add the ByteArk source repositories:
platform :ios, '14.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/byteark/byteark-player-sdk-ios-specs.git'
source 'https://github.com/byteark/lighthouse-sdk-native-ios-specs.git'
2
3
4
5
Then run:
cd ios && pod install --repo-update
For Picture-in-Picture or Background Audio, open your Xcode project's Capabilities and enable Background Mode "Audio, AirPlay, and Picture in Picture".
# Android setup
In android/app/build.gradle, ensure minSdk is at least 21 and compileSdk is 35:
android {
compileSdk 35
defaultConfig {
minSdk 21
}
}
2
3
4
5
6
7
The SDK requires Android Gradle Plugin 8.6+, Gradle 8.14+, Kotlin 1.9+, and JDK 17. Make sure your project's toolchain meets these versions.
In your app's AndroidManifest.xml, add the required permissions:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
2
3
4
Inside the <application> tag, set the AppCompat theme and declare the player service:
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/Theme.AppCompat"/>
<service
android:name="com.byteark.bytearkplayercore.handler.exoplayer.service.ByteArkPlayerService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="androidx.media3.session.MediaLibraryService"/>
<action android:name="android.media.browse.MediaBrowserService"/>
</intent-filter>
</service>
2
3
4
5
6
7
8
9
10
11
12
13
Make your MainActivity extend FlutterFragmentActivity (in android/app/src/main/.../MainActivity.kt):
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity()
2
3
The SDK is distributed through ByteArk's private package registry. Add the access tokens (provided by ByteArk) to android/local.properties:
gitLabByteArkPlayerPrivateToken=[YOUR_PRIVATE_TOKEN]
gitLabByteArkLighthousePrivateToken=[YOUR_PRIVATE_TOKEN]
2
# Web setup
Add the ByteArk Player Web script and a sizing override to web/index.html:
<head>
<!-- ... your existing tags ... -->
<script defer src="https://byteark-sdk.cdn.byteark.com/player/v2/byteark-player.min.js"></script>
<style>
.video-js { width: 100% !important; height: 100% !important; }
</style>
</head>
<body>
<script src="flutter_bootstrap.js" async></script>
</body>
2
3
4
5
6
7
8
9
10
# License key
ByteArk Player SDK requires separate license keys for iOS and Android, along with the private registry tokens above. Contact sales@byteark.com to request your license keys and access tokens.
The license keys are used when creating ByteArkPlayerConfig via ByteArkPlayerLicenseKey:
final config = ByteArkPlayerConfig(
licenseKey: ByteArkPlayerLicenseKey(
android: "<ANDROID_LICENSE_KEY>",
iOS: "<IOS_LICENSE_KEY>",
),
playerItem: playerItem,
);
2
3
4
5
6
7