MediaKeys Class
A CDM instance and the keys of its sessions (https://w3c.github.io/encrypted-media/#mediakeys-interface): the media elements whose HtmlMediaElement.MediaKeys is the object decrypt their media data with the usable keys of its sessions. Clear Key allows a MediaKeys object to be used by several media elements.
public sealed class MediaKeysMethods
| Name | Description |
|---|---|
| CreateSession(MediaKeySessionType) | Creates a key session (https://w3c.github.io/encrypted-media/#dom-mediakeys-createsession). It throws a NotSupportedError when the configuration does not support the session type (a persistent-license session needs a configuration whose persistentState is required). |
| GetStatusForPolicy(MediaKeysPolicy?) | Returns the status of the keys for a policy (https://w3c.github.io/encrypted-media/#dom-mediakeys-getstatusforpolicy): Clear Key resolves with usable. The task fails with a TypeErrorException when the policy has no member. |
| SetServerCertificate(ReadOnlySpan<byte>) | Provides the server certificate of the license server (https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate): Clear Key does not use server certificates, so the task completes with false. It fails with a TypeErrorException when the certificate is empty. |
CreateSession(MediaKeySessionType)
MediaKeys.csCreates a key session (https://w3c.github.io/encrypted-media/#dom-mediakeys-createsession). It throws a NotSupportedError when the configuration does not support the session type (a persistent-license session needs a configuration whose persistentState is required).
public MediaKeySession CreateSession(MediaKeySessionType sessionType = MediaKeySessionType.Temporary)GetStatusForPolicy(MediaKeysPolicy?)
MediaKeys.csReturns the status of the keys for a policy (https://w3c.github.io/encrypted-media/#dom-mediakeys-getstatusforpolicy): Clear Key resolves with usable. The task fails with a TypeErrorException when the policy has no member.
public Task<MediaKeyStatus> GetStatusForPolicy(MediaKeysPolicy? policy = null)SetServerCertificate(ReadOnlySpan<byte>)
MediaKeys.csProvides the server certificate of the license server (https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate): Clear Key does not use server certificates, so the task completes with false. It fails with a TypeErrorException when the certificate is empty.
public Task<bool> SetServerCertificate(ReadOnlySpan<byte> serverCertificate)