Configure offline DRM (Android)

Allow users to download and view DRM content without connection to the Internet.


By requiring authorization from a key manager, DRM protects content from unauthorized consumption. However, there are situations when your viewers are offline and cannot immediately request this authorization. This article explains how to set up offline DRM playback in your Android app.



Requirements



Implementation

  1. Update the AndroidManifest.xml file.
  2. Make a GET https://cdn.jwplayer.com/v2/media/{media_id}/drm/{policy_id} call to download the offline DRM content. Be sure to replace the {media_id} and {policy_id} placeholders.
  3. Use the following recipe in the Activity to set up the player with the offline DRM content.



Update the AndroidManifest.xml

  1. Add the following permissions:
    • android.permission.FOREGROUND_SERVICE
    • android.permission.RECEIVE_BOOT_COMPLETED
  2. Register the download service (com.longtailvideo.jwplayer.drm.download.DrmDownloadService).

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
	  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    <application>
    ...
        <service
            android:name="com.longtailvideo.jwplayer.drm.download.DrmDownloadService"
            android:exported="false">
            <intent-filter>
                <action android:name="androidx.media3.exoplayer.offline.DownloadService.ACTION_ADD_DOWNLOAD" />
            </intent-filter>
        </service>
    </application>

</manifest>


© 2007-2024 Longtail Ad Solutions, Inc.