Using the OTVCustomerSSMCallback implementation
The CustomerSSMCallback
(implementation of OTVCustomerSSMCallback
) must be created using the URIs of both the license server and SSM server, and it is then passed to an OTVVideoView
instance. It is only necessary to do this once unless your implementation creates a new callback every time the content is changed.
OTVVideoView videoView = new OTVVideoView(this);
CustomerSSMCallback drmCallback = new CustomerSSMCallback(DRM_URI, SSM_URI);
videoView.setMediaDrmCallback(drmCallback);
Before playback, the content token must be passed to the callback. When the SDK attempts playback, the callback's executeKeyRequest()
method will be called, which in turn calls the getLicense()
implementation, setting up the session and acquiring the initial content license. Periodically (based on the heartbeat defined by the SSM server), executeKeyRequest()
(and getLicense()
) will be called to renew the content license for as long as required.
drmCallback.setContentToken(contentToken);
videoView.setVideoPath(streamUri);
videoView.start();
Switching content
Stopping the current session is again straightforward, simply requiring tearDown()
to be called to end the session and reset the state of the callback. A new content token can then be provided (as above), and when playback is again attempted, a new session will be created, with a new content license retrieved.
drmCallback.tearDown();
videoView.stopPlayback();
drmCallback.setContentToken(newContentToken);
videoView.setVideoPath(newStreamUri);
videoView.start();