Media3 NAGRA PRM Extension: Playing NAGRA Connect DRM protected content from device local storage with the Connect MediaDrm plugin
To test this feature and view the example code, please see the Media3 NAGRA PRM Extension Example Code Quick Start.
Local DataSource Playback (this differs from offline playback) enables users to play an Nagra PRM-protected HLS stream stored in the device’s local storage, and fetch the license online when required.
The feature has the following characteristics:
The stream data stores on device storage, e.g., application asset folder or stream URI scheme is
file.The application fetches license online when required.
Prerequisites
Your application should already be able to playback encrypted content.
You should have an encrypted HLS stream stored on the device for testing purposes.
Procedure
The full procedure comprises the following steps:
Initiate the
NagraConnectManagerand set the stream token as described in the Media3 NAGRA PRM Extension: Playing NAGRA PRM protected content with the Connect MediaDrm plugin.Prepare the
NagraDefaultMediaSourceFactorywith theNagraLocalDataSource.Factoryand initiate the player with this factory.
The stream URI for application/src/main/assets is "/android_asset/path/to/stream.m3u8". For stream URI with file scheme, the path should be the absolute path of the file in device storage. For example, "file:///storage/emulated/0/Download/stream.m3u8".