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.
| Name | Type | Description |
|---|---|---|
config | Object |
- 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).
This module can be accessed using the MediaPlayer API getProtectionController()
- 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
handleKeySystemFromManifest()
Once all mediaInfo objects have been added to our mediaInfoArray we can select a key system or check if the kid has changed and we need to trigger a new license request
hasLicenseBeenApplied() → {boolean}
Returns whether a license has been applied to a key session since this ProtectionController was created or reset. The state is kept when playback is stopped: if the MediaKeys and the key sessions are kept for the next playback session (keepProtectionMediaKeys), they are reused without a new license exchange. Once set, the state does not change until reset() is called. It is no statement about the usability of specific keys.
- Type:
- boolean
initializeForMedia(mediaInfoopt)
Initialize this protection system for a given media type.
| Name | Type | Attributes | Description |
|---|---|---|---|
mediaInfo | StreamInfo | <optional> | Media information |
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
| Name | Type | Description |
|---|---|---|
element | HTMLMediaElement | the media element to which the protection system should be associated |
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.
| Name | Type | Description |
|---|---|---|
level | string | the robustness level |
setServerCertificate(serverCertificate) → {Promise}
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.
| Name | Type | Description |
|---|---|---|
serverCertificate | ArrayBuffer | a CDM-specific license server certificate |
- ProtectionController#event:ServerCertificateUpdated
- Type:
- Promise
setSessionType(value)
Sets the session type to use when creating key sessions. Either "temporary" or "persistent-license". Default is "temporary".
| Name | Type | Description |
|---|---|---|
value | string | the session type |
stop()
Stop method is called when current playback is stopped/resetted.