Interface: ProtectionModel

ProtectionModel

Defines the public interface for all ProtectionModel implementations.

ProtectionModel implementations provide access to particular versions of the Encrypted Media Extensions (EME) APIs that have been implemented in a user agent. Developers wishing to add support for a new EME version found in a target user-agent should add a new instance of this interface to the

Applications should not need direct access to this object. All interactions with the protection system should be performed with module:ProtectionController

Source:

Members


<readonly> keySystem :MediaPlayer.dependencies.protection.KeySystem

Currently selected key system. Will be null or undefined if no key system has yet been selected

Type:
  • MediaPlayer.dependencies.protection.KeySystem
Source:

Methods


closeKeySession(sessionToken)

Close the given session and release all associated keys. Following this call, the sessionToken becomes invalid. Sends KEY_SESSION_CLOSED with sessionID as data

Parameters:
Name Type Description
sessionToken

the session token

Source:

createKeySession(initData, sessionType)

Creates a new key session using the given initData and type. Sends KEY_SESSION_CREATED event with MediaPlayer.vo.protection.SessionToken as data.

Parameters:
Name Type Description
initData ArrayBuffer

PSSH box for the currently selected key system.

sessionType string

the desired session type. One of "temporary", "persistent-license", "persistent-release-message". CDM implementations are not required to support anything except "temporary"

Source:

getAllInitData()

Returns an array of all initialization data currently used by active sessions.

Source:
Returns:

an array of initialization data buffers

Type
Array.<ArrayBuffer>

loadKeySession(sessionID)

Loads the persisted key session data associated with the given sessionID into a new session. Sends KEY_SESSION_CREATED event with {@MediaPlayer.vo.protection.SessionToken} as data.

Parameters:
Name Type Description
sessionID string

the session ID corresponding to the persisted session data to be loaded

Source:

removeKeySession(sessionToken)

Removes any persisted key session data associated with the given session. Also closes the session. Sends KEY_SESSION_REMOVED and ENAME_KEY_SESSION_CLOSED with sessionID as data

Parameters:
Name Type Description
sessionToken SessionToken

the session token

Source:

requestKeySystemAccess(ksConfigurations)

Determine if the user-agent supports one of the given key systems and content type configurations. Sends ENAME_KEY_SYSTEM_ACCESS_COMPLETE event with a KeySystemAccess object as event data

Parameters:
Name Type Description
ksConfigurations Array.<Object>

array of desired key system configurations in priority order (highest priority first)

Properties
Name Type Description
ks MediaPlayer.dependencies.protection.KeySystem

the key system

configs Array.<MediaPlayer.vo.protection.KeySystemConfiguration>

array of acceptable key system configurations for this key system in priority order (highest priority first)

Source:

selectKeySystem(keySystemAccess)

Selects the key system to use for all future operations on this ProtectionModel. Sends ENAME_KEY_SYSTEM_SELECTED with no data

Parameters:
Name Type Description
keySystemAccess MediaPlayer.vo.protection.KeySystemAccess

the key system access token representing a supported key system

Source:

setMediaElement(mediaElement)

Associate this protection model with a HTMLMediaElement

Parameters:
Name Type Description
mediaElement HTMLMediaElement

the media element to which we should associate this protection model and all current key sessions

Source:

setServerCertificate(serverCertificate)

Sets the certificate to be used by the CDM for encrypting messages

Parameters:
Name Type Description
serverCertificate ArrayBuffer
Source:

updateKeySession(sessionToken, message)

Update the given key session with a key (or any other message intended for the CDM)

Parameters:
Name Type Description
sessionToken MediaPlayer.vo.protection.SessionToken

the session token

message ArrayBuffer

the message that should be delivered to the CDM for this session

Source: