Class MediaKeySession
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The MediaKeySession interface of the Encrypted Media Extensions API represents a context for message exchange with a content decryption module (CDM).
[Value("MediaKeySession")]
public class MediaKeySession : EventTarget
- Inheritance
-
MediaKeySession
- Inherited Members
Remarks
Constructors
MediaKeySession()
public MediaKeySession()
Properties
Closed
The closed read-only property of the 'MediaKeySession' interface returns a {{jsxref('Promise')}} signaling when a 'MediaKeySession' closes.
This promise can only be fulfilled and is never rejected.
Closing a session means that licenses and keys associated with it are no longer valid for decrypting media data.
[Value("closed")]
public Task<MediaKeySessionClosedReason> Closed { get; }
Property Value
Remarks
Expiration
The expiration read-only property of the 'MediaKeySession' interface returns the time after which the keys in the current session can no longer be used to decrypt media data, or NaN if no such time exists.
[Value("expiration")]
public double Expiration { get; }
Property Value
- double
A number or NaN.
Remarks
This value is determined by the CDM and measured in milliseconds since January 1, 1970, UTC.
This value may change during a session lifetime, such as when an action triggers the start of a window.
KeyStatuses
The keyStatuses read-only property of the 'MediaKeySession' interface returns a reference to a read-only 'MediaKeyStatusMap' of the current session's keys and their statuses.
[Value("keyStatuses")]
public MediaKeyStatusMap KeyStatuses { get; }
Property Value
- MediaKeyStatusMap
A 'MediaKeyStatusMap'.
Remarks
Onkeystatuseschange
[Value("onkeystatuseschange")]
public EventHandlerNonNull Onkeystatuseschange { get; set; }
Property Value
Onmessage
[Value("onmessage")]
public EventHandlerNonNull Onmessage { get; set; }
Property Value
SessionId
The sessionId read-only property of the 'MediaKeySession' interface contains a unique string generated by the content decryption module (CDM) for the current media object and its associated keys or licenses.
[Value("sessionId")]
public string SessionId { get; }
Property Value
- string
A string.
Remarks
Methods
Close()
The close() method of the 'MediaKeySession' interface notifies that the current media session is no longer needed, and that the content decryption module should release any resources associated with this object and close it.
Then, it returns a 'Promise'.
[Value("close")]
public Task<GlobalObject.Undefined> Close()
Returns
- Task<GlobalObject.Undefined>
A 'Promise'.
Remarks
GenerateRequest(string, Union224)
The generateRequest() method of the 'MediaKeySession' interface returns a {{jsxref('Promise')}} after generating a license request based on initialization data.
[Value("generateRequest")]
public Task<GlobalObject.Undefined> GenerateRequest(string initDataType, Union224 initData)
Parameters
Returns
- Task<GlobalObject.Undefined>
A 'Promise'.
Remarks
Load(string)
The load() method of the 'MediaKeySession' interface returns a {{jsxref('Promise')}} that resolves to a boolean value after loading data for a specified session object.
[Value("load")]
public Task<bool> Load(string sessionId)
Parameters
sessionIdstring
Returns
Remarks
Remove()
The remove() method of the 'MediaKeySession' interface returns a {{jsxref('Promise')}} after removing any session data associated with the current object.
[Value("remove")]
public Task<GlobalObject.Undefined> Remove()
Returns
- Task<GlobalObject.Undefined>
A 'Promise' that resolves to GlobalObject.Undefined.
Remarks
Update(Union224)
The update() method of the 'MediaKeySession' interface loads messages and licenses to the CDM, and then returns a {{jsxref('Promise')}}.
[Value("update")]
public Task<GlobalObject.Undefined> Update(Union224 response)
Parameters
responseUnion224
Returns
- Task<GlobalObject.Undefined>
A 'Promise' that resolves to
undefined.