Multi-DRM Cross-platform Client Integration Guide


Cross-platform framework is an app development method that can support various client environments such as web, Android, and iOS with a single development language and framework.

The final result of a cross-platform app is converted into native code for each environment, so it has a performance advantage over a hybrid app that is based on a webview control. Among the various cross-platform frameworks, Flutter developed by Google and React Native from Facebook are the most popular as of now.

This document guides how to support DRM content playback easily and quickly when you develop a client app using Flutter or React Native.

Cross-platform Integration Samples

For easy and fast PallyCon multi-DRM integration for Flutter and React Native environment, we provide the integration samples as below.

The cross-platform integration samples linked below only support streaming playback of DRM content. If you need download/offline support, you need to implement the function yourself or use our Cross-Platform Client SDK product which is under development. Alternatively, you can also use cross-platform SDKs from commercial player solutions that support download functionality.

Flutter Sample

PallyCon Multi-DRM Flutter Integration Sample is based on Better Player open-source project. Please refer to the source and guide from the below link for more details.

PallyCon Multi-DRM Flutter Sample

React Native Sample

PallyCon Multi-DRM React Native Integration Sample is based on react-native-video open-source project. Please refer to the source and guide from the below link for more details.

PallyCon Multi-DRM React Native Sample

Cross-platform Client SDK

If you need support for downloading and offline playback of DRM content in a client app developed with a cross-platform framework, you can use the PallyCon Multi-DRM Flutter SDK or PallyCon Multi-DRM React Native SDK depending on the framework you use.

PallyCon Multi-DRM Flutter SDK

PallyCon Multi-DRM Flutter SDK (Flutter SDK for short) is a product that makes it easy to apply Widevine and FairPlay DRM when developing media service apps in a Flutter-based cross-platform application development environment. It supports streaming and downloading scenarios of content encrypted with Widevine and FairPlay DRM on Android and iOS apps developed with Flutter.

Flutter SDK products can be downloaded from PallyCon Github Repository and Flutter Pub Package Manager. In the trial account, you can freely test SDK products within the limit on the trial licenses. But in order to apply SDK to commercial services, you must subscribe to a plan that includes the SDK usage right. (e.g. Standard Plus plan)

SDK structure

The Flutter SDK registered in the Github repository consists of the following.

  • pallycon-drm-sdk:
    • pallycon_drm_sdk: A plugin package that supports DRM content playback in Flutter-based Android/iOS apps
    • pallycon_drm_sdk_android: Android version implementation of pallycon_drm_sdk plug-in
    • pallycon_drm_sdk_ios: iOS version implementation of pallycon_drm_sdk plugin
    • pallycon_drm_sdk_interface: common platform interface for pallycon_drm_sdk plugin
  • player-samples: Flutter sample app that supports DRM content playback
    • basic: a basic sample that only supports streaming scenario
    • advanced: an advanced sample that supports streaming and download/offline playback

Support environment

  • Android 5.0 Lollipop (target SDK 31) or higher
  • iOS 11.2 or higher
  • Android ExoPlayer 2.18.1 or higher

SDK configuration

Refer to the Installation Guide and add PallyConDrmSdk to the Flutter app project. After that, set the following properties for each Android and iOS project.

Android version

Set the compileSdkVersion value in the android/app/build.gradle file as follows:

android {
  compileSdkVersion 31

To use the Flutter SDK, the following permissions must be added to the target application.

<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" />
iOS version

Add PallyConFPSSDK to your project using cocoapods.

SDK initialization

Initialize the Flutter SDK by adding the code below to the app initialization step.

PallyConDrmSdk.initialize(siteId); // siteId: 4 alphanumeric characters generated when signing up for PallyCon service

Event settings

Set events related to the Flutter SDK as follows:

PallyConDrmSdk.onPallyConEvent.listen((event) {
    var downloadState = DownloadStatus.pending;
    switch (event.eventType) {
        case PallyConEventType.prepare:
        case PallyConEventType.complete:
          // Called when download is complete
        case PallyConEventType.pause:
          // Called when downloading is stopped during download
          // Called when download starts
        case PallyConEventType.contentDataError:
          // Called when an error occurs in the parameters passed to the sdk
        case PallyConEventType.drmError:
          // Called when a license error occurs
        case PallyConEventType.licenseServerError:
          // Called when an error comes down from the license server
        case PallyConEventType.downloadError:
          // Called when an error occurs during download
        case PallyConEventType.networkConnectedError:
          // Called in case of network error
        case PallyConEventType.detectedDeviceTimeModifiedError:
          // Called when device time is forcibly manipulated
        case PallyConEventType.migrationError:
          // Called when sdk migration fails
        case PallyConEventType.unknown:
          // Internally called when an unknown error occurs
    // content state
  }).onError((error) {

Content download for offline playback is implemented using the following APIs.

// start download

// cancel downloads

// pause downloads

// resume downloads

To display the progress of content download on the UI, register an event listener as shown below.

PallyConDrmSdk.onDownloadProgress.listen((event) {
    // event.url is url
    // event.percent is downloaded percent

You can check the download completion status with the following code.

PallyConDownloadState downloadState =
        await PallyConDrmSdk.getDownloadState(PallyConContentConfiguration);
    switch (downloadState) {
      case PallyConDownloadState.DOWNLOADING:
      case PallyConDownloadState.PAUSED:
      case PallyConDownloadState.COMPLETED:

Downloaded content and DRM licenses can be deleted with the following API.

// remove downloaded content

// remove license for content

Releasing the SDK

At the time of application termination, the SDK is released with the following code.


PallyCon Multi-DRM React Native SDK

The React Native SDK product is under development. Information on the SDK will be added after product release.

3rd Party Commercial Player SDK

Commercial player solutions such as Bitmovin and THEOplayer have also recently released SDKs for React Native, providing cross-platform support. Customers who want to develop React Native apps using one of those solutions, please refer to the link below.