Android OpenTV Player SDK
5.27.2.1680254288
|
A convenience base class implementation of OTVMediaDrmCallback.
This abstract class can be used as the base class in most bespoke implementations of OTVMediaDrmCallback for streaming Widevine- or PlayReady- encrypted streams while fetching the keys from a licence server.
For most licence servers, such as Nagra's Secure Service Platform (SSP) there is already an implementation provided with this SDK - see OTVHttpMediaDrmCallback.
An object of a class implementing OTVMediaDrmCallback) must be assigned to the player for playback of encrypted content.
The configuration of the object is done in the following stages:
The Properties key-value pairs define parameters that are passed to the licence server in the HTTP header. For example:
callback.setKeyRequestProperty("Content-Type", "application/octet-stream");
The Options key-value pairs define parameters that configure the DRM session, specific to the license server. These optional fields affect the construction of the key request challenge data in the OTVMediaDrmCallback#executeKeyRequest method. For example:
callback.setKeyRequestOption("protectedClientData", "someData");
The object should be configured prior to start of playback or setting the stream path, and then assigned to the OTVVideoView instance:
videoView.setMediaDrmCallback(callback);
Configuration may also be changed during playback.
Public Member Functions | |
String | getDrmType () |
Returns the DRM type the callback instance is configured for. More... | |
boolean | isMultiSession () |
byte[] | executeProvisionRequest (UUID uuid, ProvisionRequest request) throws MediaDrmCallbackException |
Executes a provisioning request. More... | |
void | setKeyRequestProperty (String name, String value) |
Sets a header for key requests made by the callback. More... | |
void | clearKeyRequestProperty (String name) |
Clears a specified header for key requests made by the callback. More... | |
void | clearAllKeyRequestProperties () |
Clears all headers for key requests made by the callback. More... | |
void | setDrmType (String xDrmType) |
Set which DRM system to be used to play the stream. More... | |
void | setMultiSession (boolean xIsMultiSession) |
Set if the DRM system supports multiple sessions. More... | |
void | setKeyRequestOption (String name, String value) |
Sets an optional parameter for key requests. More... | |
void | clearKeyRequestOption (String name) |
Clears an option for key requests. More... | |
void | clearAllKeyRequestOptions () |
Clears all options for key requests. More... | |
HashMap< String, String > | getKeyRequestOptions () |
Gets options for key requests. More... | |
void | setDrmPropertyString (String name, String value) |
Sets a drm property. More... | |
void | clearAllDrmPropertyStrings () |
Clears all properties for media drm. More... | |
HashMap< String, String > | getDrmPropertyStrings () |
Gets properties for media drm. More... | |
void | setDrmPropertyByteArray (String name, byte[] value) |
Sets a drm byte array property. More... | |
void | clearAllDrmPropertyByteArray () |
Clears all byte array properties for media drm. More... | |
HashMap< String, byte[]> | getDrmPropertyByteArray () |
Gets byte array properties for media drm. More... | |
void | setMutualAuthentication (SSLSocketFactory xSslSocketFactory) |
Sets SSLSocketFactory for Mutual Authentication. More... | |
byte[] | executeProvisionRequest (UUID uuid, ExoMediaDrm.ProvisionRequest request) throws MediaDrmCallbackException |
Executes a provisioning request. More... | |
byte[] | executeKeyRequest (UUID uuid, ExoMediaDrm.KeyRequest request) throws MediaDrmCallbackException |
Executes a key request. More... | |
Public Attributes | |
String | OTV_DRMTYPE_WIDEVINE = "Widevine" |
Defined DRM type for Widevine. More... | |
String | OTV_DRMTYPE_PLAYREADY = "PlayReady" |
Define DRM type for PlayReady. More... | |
String | OTV_DRMTYPE_CONNECT = "Connect" |
Define DRM type for Connect. More... | |
String | OTV_DRMTYPE_WISEPLAY = "Wiseplay" |
Define DRM type for Connect. More... | |
Protected Member Functions | |
OTVCommonMediaDrmCallback (String defaultLicenseUrl) | |
byte[] | executePost (String url, byte[] data, Map< String, String > requestProperties) throws IOException |
A utility for synchronously sending a POST HTTP message. More... | |
MediaDrmCallbackException | generateDrmCBException (@NonNull IOException exception) |
Helper method to generate MediaDrmCallbackException with IOException. More... | |
|
protected |
defaultLicenseUrl | The default license URL. Used for key requests that do not specify their own license URL. |
void clearAllDrmPropertyByteArray | ( | ) |
Clears all byte array properties for media drm.
void clearAllDrmPropertyStrings | ( | ) |
Clears all properties for media drm.
void clearAllKeyRequestOptions | ( | ) |
Clears all options for key requests.
void clearAllKeyRequestProperties | ( | ) |
Clears all headers for key requests made by the callback.
void clearKeyRequestOption | ( | String | name | ) |
Clears an option for key requests.
name | The name of the option. |
void clearKeyRequestProperty | ( | String | name | ) |
Clears a specified header for key requests made by the callback.
name | The name of the specified header field. |
|
inherited |
Executes a key request.
uuid | The UUID of the content protection scheme.12 |
request | The request. |
MediaDrmCallbackException | If an error occurred executing the request. |
Implemented in OTVConnectMediaDrmCallback.
|
protected |
A utility for synchronously sending a POST
HTTP message.
Used for requesting the licence via HTTP/HTTPS. Can be overridden if special operations are required.
url | The URL address to post to. |
data | Optional additional data to send with the POST message. |
requestProperties | A map of key-value HTTP header entries to use in the message |
IOException | If an error occurred executing the request. |
|
inherited |
Executes a provisioning request.
uuid | The UUID of the content protection scheme. |
request | The request. |
MediaDrmCallbackException | If an error occurred executing the request. |
Implemented in OTVConnectMediaDrmCallback.
byte [] executeProvisionRequest | ( | UUID | uuid, |
ProvisionRequest | request | ||
) | throws MediaDrmCallbackException |
Executes a provisioning request.
uuid | The UUID of the content protection scheme. |
request | The request. |
MediaDrmCallbackException | If an error occurred executing the request. |
|
protected |
Helper method to generate MediaDrmCallbackException with IOException.
exception | the IOException |
HashMap<String, byte[]> getDrmPropertyByteArray | ( | ) |
Gets byte array properties for media drm.
The default value is null.
Implements OTVMediaDrmCallback.
HashMap<String, String> getDrmPropertyStrings | ( | ) |
Gets properties for media drm.
The default value is null.
Implements OTVMediaDrmCallback.
String getDrmType | ( | ) |
Returns the DRM type the callback instance is configured for.
Implements OTVMediaDrmCallback.
HashMap<String, String> getKeyRequestOptions | ( | ) |
boolean isMultiSession | ( | ) |
Implements OTVMediaDrmCallback.
void setDrmPropertyByteArray | ( | String | name, |
byte[] | value | ||
) |
Sets a drm byte array property.
name | The name of the property. |
value | The value of the byte array property. |
void setDrmPropertyString | ( | String | name, |
String | value | ||
) |
Sets a drm property.
name | The name of the property. |
value | The value of the property. |
void setDrmType | ( | String | xDrmType | ) |
Set which DRM system to be used to play the stream.
If not explicitly set, the default is OTV_DRMTYPE_WIDEVINE.
xDrmType | "Widevine" , "PlayReady" , "Connect" or "Wiseplay" |
void setKeyRequestOption | ( | String | name, |
String | value | ||
) |
Sets an optional parameter for key requests.
name | The name of the option. |
value | The value of the option. |
void setKeyRequestProperty | ( | String | name, |
String | value | ||
) |
Sets a header for key requests made by the callback.
name | The name of the header field. |
value | The value of the field. |
void setMultiSession | ( | boolean | xIsMultiSession | ) |
Set if the DRM system supports multiple sessions.
If not explicitly set, the default is false.
xIsMultiSession | true if the DRM system should support multiple sessions. |
void setMutualAuthentication | ( | SSLSocketFactory | xSslSocketFactory | ) |
Sets SSLSocketFactory for Mutual Authentication.
xSslSocketFactory | SSLSocketFactory instance |
|
inherited |
Define DRM type for Connect.
|
inherited |
Define DRM type for PlayReady.
|
inherited |
Defined DRM type for Widevine.
|
inherited |
Define DRM type for Connect.