Module: ProtectionController

Provides access to media protection information and functionality. Each ProtectionController manages a single MediaPlayer.models.ProtectionModel which encapsulates a set of protection information (EME APIs, selected key system, key sessions). The APIs of ProtectionController mostly align with the latest EME APIs. Key system selection is mostly automated when combined with app-overrideable functionality provided in ProtectionKeyController.

Source:
To Do:
  • ProtectionController does almost all of its tasks automatically after init() is called. Applications might want more control over this process and want to go through each step manually (key system selection, session creation, session maintenance).

Methods


setMediaElement(element)

Associate this protection system with the given HTMLMediaElement. This causes the system to register for needkey/encrypted events from the given element and provides a destination for setting of MediaKeys

Parameters:
Name Type Description
element HTMLMediaElement

the media element to which the protection system should be associated

Source:

setRobustnessLevel(level)

Sets the robustness level for video and audio capabilities. Optional to remove Chrome warnings. Possible values are SW_SECURE_CRYPTO, SW_SECURE_DECODE, HW_SECURE_CRYPTO, HW_SECURE_CRYPTO, HW_SECURE_DECODE, HW_SECURE_ALL.

Parameters:
Name Type Description
level string

the robustness level

Source:

setServerCertificate(serverCertificate)

Sets a server certificate for use by the CDM when signing key messages intended for a particular license server. This will fire an error event if a key system has not yet been selected.

Parameters:
Name Type Description
serverCertificate ArrayBuffer

a CDM-specific license server certificate

Source:
Fires:
  • ProtectionController#event:ServerCertificateUpdated

setSessionType(value)

Sets the session type to use when creating key sessions. Either "temporary" or "persistent-license". Default is "temporary".

Parameters:
Name Type Description
value string

the session type

Source:

stop()

Stop method is called when current playback is stopped/resetted.

Source: