DRM preferences and security levels
The CONNECT Player SDK for Browsers and Connected TV supports different DRM key systems depending on the browser/device, and the content protocol:
Widevine
Playready
FairPlay
TVKey
The key systems may have different security levels, depending on the device's capabilities and browser on which they are used.
Four increasing security levels are defined:
OTVDRMSL_UNKNOWN
OTVDRMSL_SW
OTVDRMSL_HW_CRYPT
OTVDRMSL_HW_DECODE
Where a browser supports multiple DRM key systems, the SDK provides mechanisms by which the application can specify its preferred key system. The SDK provides an API to find the security level of the key system on the browser to aid the selection of the preferred key system.
Querying security level capabilities
To query security level capabilities, use the getDrmInfo()
API call which returns a Promise that resolves to provide an array of the DRM capabilities.
playerInstance
.otvtoolkit()
.drmSecurityLevel.getDrmInfo(keySystem, mediaType, contentType);
When details of a specific DRM key system and optionally a specific media and content type combination are required, this can be requested in the arguments to getDrmInfo()
. For example, querying for Widevine encrypted video at a specific codec, if the mediaType
and contentType
parameter combination is omitted, then defaults will be used depending on the keySystem
:
playerInstance
.otvtoolkit()
.drmSecurityLevel.getDrmInfo(
"com.widevine.alpha",
"video",
'video/mp4;codecs="avc1.640015"'
);
keySystem | mediaType | contentType |
---|---|---|
com.microsoft.playready | video | video/mp4;codecs=“avc1” |
com.widevine.alpha | video | video/mp4;codecs=“avc1.640015” |
com.apple.fairplay | none | none |
When details of a specific DRM key system and optionally a specific media and content type combination, this can be requested in the arguments to getDrmInfo()
. For example, querying for Widevine encrypted video generically:
playerInstance
.otvtoolkit()
.drmSecurityLevel.getDrmInfo("com.widevine.alpha");
When no arguments are supplied, all DRM systems are queried, and the results will contain their capabilities (only supported key systems are included in the results). Querying all supported keySystems:
playerInstance.otvtoolkit().drmSecurityLevel.getDrmInfo();
Setting the preferred DRM key system
If no preferred DRM key system is specified, the supported key system with the highest security level will be preferred.
Setting the preferred key system on player initialisation
otvplayer(
"videoPlayer",
// options
{
......
plugins: {
otvtoolkit: {
drm: {
......
config: {
preferredDRM: "com.widevine.alpha"
}
}
}
}
}
);
In HbbTV mode, assuming the preferred player is not overridden (i.e. default player is native, not ShakaPlayer), the CONNECT Player will automatically pick TVKey DRM system ("com.tvkey.drm"
) as the default and only DRM system available; this cannot be overridden.
Setting the preferred key system on source selection
player.src({
src: stream.url,
token: stream.Token,
preferredDRM: "com.widevine.alpha"
});
Setting the preferred key system using the drmSecurityLevel API
playerInstance
.otvtoolkit()
.drmSecurityLevel.setPreferredDrm("com.widevine.alpha");
Finding the actual key system used for playback
The application may select a preferred key system that is not supported by the browser or not supported for a piece of content. In this case, the SDK will use a different key system. To find the actual key system in use during playback:
let ks = playerInstance.otvtoolkit().drmSecurityLevel.getCurrentSelectedDrm();
getCurrentSelectedDrm()
is only valid during playback. Until playback starts, it will return the preferred DRM key system.