DRM preferences and security levels
The devices on which the player runs may support DRM key systems at different security levels. Four increasing security levels are defined:
OTVDRMSL_UNKNOWN
OTVDRMSL_SW
OTVDRMSL_HW_CRYPT
OTVDRMSL_HW_DECODE
The SDK provides mechanisms by which the application can specify its preferred DRM key system. An API is provided to find the security level of supported key systems on the device to aid the selection of the preferred key system.
A DRM Key System is identified by a String
. The String values are defined by EME, for example “com.widevine.alpha”
Setting the preferred DRM key system
The decision on which DRM system to use on any given stream is left for the application by providing the correct OTVMediaDrmCallback
-derived callback class. The application queries the device to find which DRM systems it supports and then decides which protected streams can be played on that device and the DRM protection to use.
Querying security level capabilities
Querying security level capabilities on the device
To query security level capabilities use the getOTVDrmInfo()
API call which returns an array of the DRM capabilities.
Querying security level capabilities for a given stream
Typically, the application obtains the information regarding the DRM protection systems it uses from the stream metadata. If this information is not available, for DASH streams only, the SDK provides an MpdParser
utility class that can extract the DRM support from the stream’s manifest Media Presentation Description (MPD) file.
If the application has the
.mpd
file, the information can be extracted either by the DRM system’s UUID or its key-system name. The application provides the file text and its URL asString
s toMpdParser
static methods:JAVAList<String> uuidList = MpdParser.getDrmUUIDsFromMpd(streamUrl, mpdText); List<String> supportedDrmTypes = MpdParser.getSupportedDrmTypesFromMpd(streamUrl, mpdText);
If the application only has the stream manifest’s URL,
MpdParser
can download the file and then parse it. The download is done asynchronously, and the application needs to provide a listener inMpdParser
constructor:JAVAList<String> uuidList; List<String> supportedDrmTypes; MpdParser.MpdDownloadListener onMpdDownloadedListener = new MpdParser.MpdDownloadListener() { @Override public void onSuccess(@NonNull MpdParser mpdParser) { uuidList = mpdParser.getDrmUUIDs(); supportedDrmTypes = mpdParser.getSupportedDrmTypes(); } @Override public void onFail(@NonNull MpdParser mpdParser, @Nullable Throwable e) { // Error downloading the file... } }; new MpdParser(streamUrl, onMpdDownloadedListener);
The list of UUIDs will include all DRM systems advertised by the manifest, whereas the list of supported DRM types will only include those systems supported by the SDK.