HLS stream playback with NAGRA CONNECT
To test this feature and view the example code, please see the PRM Example Code Quick Start guide.
The client code for HLS playback uses the OTVConnectManager
provided by the CONNECT Player SDK, which in turn handles access to the MediaDRM plug-in. The OTVConnectManager
also handles device provisioning, which enables the device to use NAGRA CONNECT.
Enabling the HLS playback of encrypted streams comprises the following steps:
- CONNECT preparation - An
OTVConnectManager
is created and configured with the appropriate OpVault and anOTVMediaDrmCallback
that interacts with the provisioning and licence servers. - Device provisioning status - The
OTVConnectManager
determines if the device is provisioned for this operator. If it is not, provisioning must be performed. - Device provisioning (if not provisioned) - The
OTVConnectManager
sets up a provisioning request. Its data is sent to the provisioning server, located at the URL specified in the request. The response is then processed and stored by the MediaDRM plug-in. - Setting the stream token - Specific for each stream, providing the token for requesting a licence.
Provisioning is 'per device, per operator', and must be done once for each application (containing your OpVault) installed on that device.
OTVConnectManager
The OTVConnectManager
handles device provisioning and licence requests. It obtains provisioning and key requests, provides request data to the appropriate server (via the OTVMediaDrmCallback
) and then uses the response, with the help of the MediaDRM plug-in, to handle licences and decrypt the content. It is implemented as a singleton and so cannot be instantiated directly; its lifecycle is controlled through the createInstance()
, getInstance()
and releaseInstance()
methods.
OTVConnectMediaDrmCallback
The SDK provides OTVConnectMediaDrmCallback
as the default implementation of the OTVMediaDrmCallback
interface, which handles communication with the provisioning and licence servers and is used in the example code.
Rather than directly implementing the OTVMediaDrmCallback
interface, OTVConnectMediaDrmCallback
implements the abstract OTVCommonMediaDrmCallback
class, which has a single constructor with the parameter defaultLicenseUrl
.
Some licence servers expect extra information from the application. This information is a blob of data in a specific data field within the key request challenge data from the MediaDRM plug-in sent to the licence server. The MediaDRM plug-in library can be configured to add that extra data by setting an option in the OTVConnectMediaDrmCallback
class instance. For example, configuring the clientData
and/or protectedClientData
fields with application data will add this data to key requests' challenge data as third-party applicationClearData
and applicationProtectedData
data fields respectively.
For more information, please refer to your licence server documentation.
OTVConnectProvisionListener
The OTVConnectProvisionListener
interface must be implemented in the client code to handle the result of each provisioning attempt via the onProvisionCompleted()
and onProvisionFailure()
methods. The example code provides a basic implementation that displays the provisioning result via a toast message and starts playback if provisioning is successful.