dr_multi_drm_sdk 1.2.0
dr_multi_drm_sdk: ^1.2.0 copied to clipboard
Multi-DRM Flutter SDK. This plugin provides a cross-platform (iOS, Android) API for Multi-DRM used functions.
DoveRunner MULTI DRM SDK for Flutter Development Guide #
A Flutter dr_multi_drm_sdk plugin which provides easy to apply Multi-DRM(Android: Widevine, iOS: FairPlay) when developing media service apps for Android and iOS. Please refer to the links below for detailed information.
support environment #
- Android 5.0 (Lolipop) & Android targetSdkVersion 34 or higher
- iOS 12.5 higher
- This SDK supports media3 version 1.5.1 on Android.
Important #
- To develop using the SDK, you must first sign up for the DoveRunner Admin Site and obtain a Site ID.
SDK usage #
To add DrMultiDrmSdk to your Flutter app, read the Installation instructions. Below are the Android and iOS properties required for DrMultiDrmSdk to work properly.
Android
compileSdkVersion
Make sure you set compileSdkVersion in "android/app/build.gradle".
android {
compileSdkVersion 34
...
}
Permissions
Inside the SDK, the following 4 items are used in relation to user permission.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
You can add the Maven repository configuration to the repositories block in your android/build.gradle file as follows:
allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/doverunner/widevine-android-sdk")
credentials {
username = ""
password = ""
}
}
}
}
In the gradle.properties file in the android directory of your project, add the GitHub user (e-mail) and the generated GitHub access token as shown below.
gpr.user = GITHUB_USER
gpr.token = GITHUB_ACCESS_TOKEN
iOS
DoveRunner DRM SDK Flutter uses DoveRunnerFairPlay. DoveRunnerFairPlay is supposed to be downloaded as cocoapods.
SDK requirements #
- Minimum supported version: 14.0
Initialize #
DrMultiDrmSdk.initialize(siteId);
Set Event #
Register events that occur inside the SDK.
DrMultiDrmSdk.onDrEvent.listen((event) {
var downloadState = DownloadStatus.pending;
switch (event.eventType) {
case DrEventType.prepare:
//
break;
case DrEventType.complete:
// Called when download is complete
break;
case DrEventType.pause:
// Called when downloading is stopped during download
break;
case DrEventType.download:
// Called when download starts
break;
case DrEventType.contentDataError:
// Called when an error occurs in the parameters passed to the sdk
break;
case DrEventType.drmError:
// Called when a license error occurs
break;
case DrEventType.licenseServerError:
// Called when an error comes down from the license server
break;
case DrEventType.downloadError:
// Called when an error occurs during download
break;
case DrEventType.networkConnectedError:
// Called in case of network error
break;
case DrEventType.detectedDeviceTimeModifiedError:
// Called when device time is forcibly manipulated
break;
case DrEventType.migrationError:
// Called when sdk migration fails
break;
case DrEventType.unknown:
// Internally called when an unknown error occurs
break;
}
// content state
}).onError((error) {
//
});
When downloading, register a listener to know the size of the currently downloaded data.
DrMultiDrmSdk.onDownloadProgress.listen((event) {
// event.url is url
// event.percent is downloaded percent
});
Get content download status #
Get the current download status of the content.
DrDownloadState downloadState =
await DrMultiDrmSdk.getDownloadState(DrContentConfiguration);
switch (downloadState) {
case DrDownloadState.DOWNLOADING:
break;
case DrDownloadState.PAUSED:
break;
case DrDownloadState.COMPLETED:
break;
default:
break;
}
Download #
Describes the API required for the content download process.
// start download
DrMultiDrmSdk.addStartDownload(DrContentConfiguration);
// stop download
DrMultiDrmSdk.stopDownload(DrContentConfiguration);
// cancel downloads
DrMultiDrmSdk.cancelDownloads();
// pause downloads
DrMultiDrmSdk.pauseDownloads();
// resume downloads
DrMultiDrmSdk.resumeDownloads();
Remove License or Contents #
Remove the downloaded license and content.
// remove downloaded content
DrMultiDrmSdk.removeDownload(DrContentConfiguration);
// remove license for content
DrMultiDrmSdk.removeLicense(DrContentConfiguration);
Release #
Called when you end using the SDK.
DrMultiDrmSdk.release();