Content Decryption Module

These functions allow access to the content decryption module of the system.

  • MediaKeySystemAccess: grants access to a specific key system like clearkey, playready or widevine.

  • MediaKeys: grants access to a specific media content for playback from a Cdm point of view. It is linked to the media element (AudioPlayer, VideoPlayer or StreamView) using the setMediaKeys method.

  • MediaKeySession: grants access to a Cdm session. A Cdm session is used to handle communications with license aquisition server.

API Design

The fbx.cdm API is inspired by the W3C EME API : “https://www.w3.org/TR/2017/REC-encrypted-media-20170918/”.

Some feature are not available in QML like the Promise object. Each time a Promise object is returned by the EME API a Deferred.Deferred() is returned by the fbx.cdm module. On resolve, the object is returned in the .then() callback argument. On error the .fail() callback is called.

Not all EME specification is implemented in fbx.cdm. Only the strict necessary feature for VoD playback are currently available.

Cdm.requestMediaKeySystemAccess(keySystem, supportedConfiguration)
Arguments
  • keySystem (string()) – The key system for which access is requested.

  • supportedConfiguration (object()) – A sequence of MediaKeySystemConfiguration. Currently ignored.

Returns

A Deferred.Deferred()

Creates a MediaKeySystemAccess object, granting access to the key system. Current value supported for keySystem is “com.microsoft.playready”.

MediaKeySystemAccess.createMediaKeys()
Returns

A Deferred.Deferred()

Creates a MediaKeys object which can be linked to the media object using media.setMediaKeys() method. The setMediaKeys method is described in the AudioPlayer.

MediaKeys.createSession()
Returns

A MediaKeySession object.

Creates a MediaKeySession object, that can be used to generate request. A new MediaKeySession should be created each time new initData is fired by the encrypted signal of the media element.

MediaKeySession.onmessage

A function callback called by the Cdm when a message should be sent to the license aquisition server. The event object contains 2 important attributes : target (the MediaKeySession) and message (the opaque data to be sent to server).

MediaKeySession.generateRequest(initDataType, initData)
Arguments
  • initDataType (string()) – The type of initData.

  • initData (object()) – An opaque buffer given by media encrypted event.

Returns

A Deferred.Deferred()

Used to generates a license request based on the initData. The initData is given by the media encrypted event. The MediaKeySession.onmessage callback will be called right after the generate request.

MediaKeySession.keystatuses

An object mapping keyId to MediaKeyStatus enum. The keyId are base64 encoded. MediaKeyStatus strings are { ‘usable’, ‘expired’, ‘released’, ‘output-restricted’, ‘output-downscaled’, ‘status-pending’, ‘internal-error’ }.

MediaKeySession.onkeystatuseschange

A function callback called by the Cdm when keystatuses attribute is updated.

MediaKeySession.update(response)
Arguments
  • response (object()) – The server response to be processed by the MediaKeySession.

Returns

A Deferred.Deferred()

Used to process the server response.