SSM V2
The SDK provides an implementation of OTVMediaDrmCallback
dedicated to handling licence key requests with a licence server supporting SSM v2 – OTVSspHttpMediaDrmCallbackV2
.
Example code
To implement Widevine with SSM, include the following methods to fetch the relevant data for the stream, licence server, and SSM server. Ensure you have or implement methods to fetch the data relevant to the stream you want to play, the licence server you work with, and the SSM server.
Instantiate OTVSspHttpMediaDrmCallbackV2
with the Licence Server URI. The License Server must be the v2 SSP API.
OTVSspHttpMediaDrmCallbackV2 drmCallback = new OTVSspHttpMediaDrmCallbackV2(DRM_URI, SSM_URI);
Configure the DRM handler using the setKeyRequestProperty()
method. The values below are for illustration purposes only as they are specific to the type of licence server, the account and the content. The nv-authorizations
key-value pair is mandatory for working with SSM.
drmCallback.setKeyRequestProperty("nv-tenant-id", TENANT_ID_STR);
drmCallback.setKeyRequestProperty("nv-authorizations", STREAM_TOKEN);
Assign the OTVHttpMediaDrmCallback
instance to your OTVVideoView
.
otvVideoView.setMediaDrmCallback(drmCallback);
Playback is started by assigning the path to the OTVVideoView
instance.
otvVideoView.setVideoPath(STREAM_URI);
Stopping playback (stopPlayback()
in OTVVideoView
) will NOT tear down the SSM session for this content.
Application can call tearDown()
on drmCallback
to tear down the session
Error reporting for SSM
The setOnErrorListener()
method in OTVVideoView
enables you to register for errors in general and SSM errors in particular. The application has to instantiate a class that implements the OnErrorListener
interface. This interface requires the implementation of one error callback:
boolean onError(MediaPlayer mp, int what, int extra)
The first parameter passed to the callback is the object referencing the OTVMediaPlayer
from which the error is reported. The two other parameters contain information about the nature of the error. For example, the main application can register an onError()
callback.
...
mOTVVideoView.setOnErrorListener((mp, what, extra) -> {
OTVLog.i(TAG, "onError - Enter - what: " + what + ", extra: " + extra);
return true;
});
...
In the context of SSM errors, it will return the license request error, similar to Widevine licence server error codes
Operators can kill an existing session, for example, if the QuickMark tool detects a re-streaming breach. In this case, the player will get a Widevine license renewal failure. The error reported by the license server will be 3002 (Unknown session); see Secure Session Manager (SSM).
{ "code" : 404, jso
"errorCode": 3002,
"message": "Not Found"
}
Playback will stop, and the player will report what 1353 (renewal failure) or 1354 (teardown failure) and extra 3002 (Unknow session, as reported by server) errors.