NativeBindings
See ml_media_drm.h for additional comments.
Inherits from:
MagicLeapNativeBindings
Public Methods
MLResult.Code MLMediaDRMByteArrayAllocAndCopy
Allocate and Copy to byte array buffer.
public MLResult.Code MLMediaDRMByteArrayAllocAndCopy(
IntPtr CopyFrom,
uint Size,
out MLMediaDRMByteArray OutArray
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | CopyFrom | |
uint | Size | |
out MLMediaDRMByteArray | OutArray | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMByteArrayAllocate
String property name: identifies the maker of the DRM engine plugin.
public MLResult.Code MLMediaDRMByteArrayAllocate(
uint Size,
out MLMediaDRMByteArray OutArray
)
Parameters
Type | Name | Description |
---|---|---|
uint | Size | |
out MLMediaDRMByteArray | OutArray | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMByteArrayListRelease
Release list of byte array buffer.
public MLResult.Code MLMediaDRMByteArrayListRelease(
ref MLMediaDRMByteArrayList Array
)
Parameters
Type | Name | Description |
---|---|---|
ref MLMediaDRMByteArrayList | Array | Data type containing list of byte array buffers and the size. |
MLResult.Code MLMediaDRMByteArrayRelease
Release byte array buffer.
public MLResult.Code MLMediaDRMByteArrayRelease(
ref MLMediaDRMByteArray array
)
Parameters
Type | Name | Description |
---|---|---|
ref MLMediaDRMByteArray | array | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMCloseSession
Closes a session that was previously opened.
public MLResult.Code MLMediaDRMCloseSession(
ulong drmHandle,
ref MLMediaDRMByteArray sessionId
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle | |
ref MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMCreate
Create a
public MLResult.Code MLMediaDRMCreate(
Native.MagicLeapNativeBindings.MLUUID uuid,
out ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
Native.MagicLeapNativeBindings.MLUUID | uuid | Universally unique identifier |
out ulong | handle |
MLResult.Code MLMediaDRMDecrypt
Decrypt the data referenced by input using algorithm if specified, and write the encrypted result into output. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMDecrypt(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMCryptoInputParam CryptoKeyParam,
ref MLMediaDRMByteArray Input,
out MLMediaDRMByteArray Output
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMCryptoInputParam | CryptoKeyParam | Data type that encapsulates algorithm, key_set_id and IV for Encryption/Decryption. |
ref MLMediaDRMByteArray | Input | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | Output | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMEncrypt
Encrypt the data referenced by input using algorithm if specified, and write the encrypted result into output. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMEncrypt(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMCryptoInputParam CryptoKeyParam,
ref MLMediaDRMByteArray Input,
out MLMediaDRMByteArray Output
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMCryptoInputParam | CryptoKeyParam | Data type that encapsulates algorithm, key_set_id and IV for Encryption/Decryption. |
ref MLMediaDRMByteArray | Input | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | Output | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMGetKeyRequest
A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content. MLMediaDRMGetKeyRequest() is used to obtain an opaque key request byte array that is delivered to the license server. The opaque key request byte array is returned in out_key_request. request The recommended URL to deliver the key request to is returned in out_key_request. default_URL. After the app has received the key request response from the server, it should deliver to the response to the DRM engine plugin using the method MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMGetKeyRequest(
ulong drmHandle,
ref MLMediaDRMByteArray sessionId,
ref MLMediaDRMKeyRequestInputParam keyRequestParam,
out MLMediaDRMRequestMessage keyRequest
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle | |
ref MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMKeyRequestInputParam | keyRequestParam | Data type that encapsulates Key Request input arguments. |
out MLMediaDRMRequestMessage | keyRequest | Data type that encapsulates either of the following along with an URL: For Key Request Message: an opaque key request byte array that should be delivered to the license server. For Provision Request Message: an opaque provision request byte array that should be delivered to the provisioning server. |
MLResult.Code MLMediaDRMGetPropertyByteArray
Read a DRM engine plugin byte array property value, given the property name.
public MLResult.Code MLMediaDRMGetPropertyByteArray(
ulong MediaDrm,
string PropertyName,
out MLMediaDRMByteArray OutPropertyValue
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
string | PropertyName | |
out MLMediaDRMByteArray | OutPropertyValue | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMGetPropertyString
Read a DRM engine plugin String property value, given the property name.
public MLResult.Code MLMediaDRMGetPropertyString(
ulong MediaDrm,
string PropertyName,
out string OutPropertyValue
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
string | PropertyName | |
out string | OutPropertyValue |
MLResult.Code MLMediaDRMGetProvisionRequest
A provision request/response exchange occurs between the app and a provisioning server to retrieve a device certificate. If provisioning is required, the #EVENT_PROVISION_REQUIRED event will be sent to the event handler. MLMediaDRMGetProvisionRequest() is used to obtain the opaque provision request byte array that should be delivered to the provisioning server.
public MLResult.Code MLMediaDRMGetProvisionRequest(
ulong drmHandle,
string certType,
out MLMediaDRMRequestMessage provisionRequest
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle | |
string | certType | |
out MLMediaDRMRequestMessage | provisionRequest | Data type that encapsulates either of the following along with an URL: For Key Request Message: an opaque key request byte array that should be delivered to the license server. For Provision Request Message: an opaque provision request byte array that should be delivered to the provisioning server. |
MLResult.Code MLMediaDRMGetSecureStop
Access secure stop by secure stop ID.
public MLResult.Code MLMediaDRMGetSecureStop(
ulong MediaDrm,
ref MLMediaDRMByteArray SecureStopId,
out MLMediaDRMByteArray SecureStop
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SecureStopId | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | SecureStop | Data type containing byte array buffer and the size. |
See: MLMediaDRMGetSecureStops()
MLResult.Code MLMediaDRMGetSecureStops
Access all secure stops. Secure Stop: A means of enforcing limits on the number of concurrent streams per subscriber across devices is provided via #SecureStop. This is achieved by securely monitoring the lifetime of sessions. Information from the server related to the current playback session is written to persistent storage on the device when each #MediaCrypto object is created. In the normal case, playback will be completed, the session destroyed and the Secure Stops will be queried. The app queries secure stops and forwards the secure stop message to the server which verifies the signature and notifies the server side database that the session destruction has been confirmed. The persisted record on the client is only removed after positive confirmation that the server received the message using releaseSecureStops().
public MLResult.Code MLMediaDRMGetSecureStops(
ulong MediaDrm,
out MLMediaDRMByteArrayList SecureStops
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
out MLMediaDRMByteArrayList | SecureStops | Data type containing list of byte array buffers and the size. |
MLResult.Code MLMediaDRMIsCryptoSchemeSupported
Query if the given scheme identified by its UUID is supported on this device. And whether the drm plugin is able to handle the media container format.
public MLResult.Code MLMediaDRMIsCryptoSchemeSupported(
Native.MagicLeapNativeBindings.MLUUID Uuid,
IntPtr MimeType,
out bool supported
)
Parameters
Type | Name | Description |
---|---|---|
Native.MagicLeapNativeBindings.MLUUID | Uuid | Universally unique identifier |
IntPtr | MimeType | |
out bool | supported |
MLResult.Code MLMediaDRMKeyValueArrayAdd
Add a {key, value} pair to the array of {key, value} pairs.
public MLResult.Code MLMediaDRMKeyValueArrayAdd(
ref MLMediaDRMKeyValue Pair,
out MLMediaDRMKeyValueArray OutArray
)
Parameters
Type | Name | Description |
---|---|---|
ref MLMediaDRMKeyValue | Pair | Data type containing {key, value} pair. |
out MLMediaDRMKeyValueArray | OutArray | Data type containing array of {key, value} pair. |
MLResult.Code MLMediaDRMKeyValueArrayAllocate
Allocate array of {key, value} pairs.
public MLResult.Code MLMediaDRMKeyValueArrayAllocate(
uint Size,
out MLMediaDRMKeyValueArray OutArray
)
Parameters
Type | Name | Description |
---|---|---|
uint | Size | |
out MLMediaDRMKeyValueArray | OutArray | Data type containing array of {key, value} pair. |
MLResult.Code MLMediaDRMKeyValueArrayRelease
Release {key, value} pair array.
public MLResult.Code MLMediaDRMKeyValueArrayRelease(
ref MLMediaDRMKeyValueArray Array
)
Parameters
Type | Name | Description |
---|---|---|
ref MLMediaDRMKeyValueArray | Array | Data type containing array of {key, value} pair. |
MLResult.Code MLMediaDRMOpenSession
Opens a new session. A session ID is returned.
public MLResult.Code MLMediaDRMOpenSession(
ulong MediaDrm,
out MLMediaDRMByteArray sessionId
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
out MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMProvideKeyResponse
A key response is received from the license server by the app, then it is provided to the DRM engine plugin using MLMediaDRMProvideKeyResponse(). When the response is for an offline key request, a key_set_id is returned that can be used to later restore the keys to a new session with restoreKeys(). When the response is for a streaming or release request, a null key_set_id is returned.
public MLResult.Code MLMediaDRMProvideKeyResponse(
ulong drmHandle,
ref MLMediaDRMByteArray sessionId,
ref MLMediaDRMByteArray response,
out MLMediaDRMByteArray keySetId
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle | |
ref MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMByteArray | response | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | keySetId | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMProvideProvisionResponse
After a provision response is received by the app, it is provided to the DRM engine plugin using this method.
public MLResult.Code MLMediaDRMProvideProvisionResponse(
ulong drmHandle,
ref MLMediaDRMByteArray response,
out MLMediaDRMByteArray certificate,
out MLMediaDRMByteArray wrappedKey
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle | |
ref MLMediaDRMByteArray | response | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | certificate | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | wrappedKey | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMQueryKeyStatus
Request an informative description of the key status for the session. The status is in the form of {key, value} pairs. Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. Refer to your DRM provider documentation for definitions of the field names for a particular DRM engine plugin.
public MLResult.Code MLMediaDRMQueryKeyStatus(
ulong MediaDrm,
ref MLMediaDRMByteArray sessionId,
out MLMediaDRMKeyValueArray OutInfoMap
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
out MLMediaDRMKeyValueArray | OutInfoMap | Data type containing array of {key, value} pair. |
MLResult.Code MLMediaDRMRelease
Release the
public MLResult.Code MLMediaDRMRelease(
ulong drmHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | drmHandle |
MLResult.Code MLMediaDRMReleaseAllSecureStops
Remove all the SecureStops.
public MLResult.Code MLMediaDRMReleaseAllSecureStops(
ulong MediaDrm
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm |
MLResult.Code MLMediaDRMReleaseSecureStops
Process the SecureStop server response message. After authenticating the message, remove the SecureStops identified in the response.
public MLResult.Code MLMediaDRMReleaseSecureStops(
ulong MediaDrm,
ref MLMediaDRMByteArray SecureStop
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SecureStop | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMRemoveKeys
Remove the current keys from a session.
public MLResult.Code MLMediaDRMRemoveKeys(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMByteArray KeySetId
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMByteArray | KeySetId | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMRequestMessageRelease
Release Request Message.
public MLResult.Code MLMediaDRMRequestMessageRelease(
ref MLMediaDRMRequestMessage Request
)
Parameters
Type | Name | Description |
---|---|---|
ref MLMediaDRMRequestMessage | Request | Data type that encapsulates either of the following along with an URL: For Key Request Message: an opaque key request byte array that should be delivered to the license server. For Provision Request Message: an opaque provision request byte array that should be delivered to the provisioning server. |
MLResult.Code MLMediaDRMRestoreKeys
Restore persisted offline keys into a new session. key_set_id identifies the keys to load, obtained from a prior call to MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMRestoreKeys(
ulong MediaDrm,
ref MLMediaDRMByteArray sessionId,
ref MLMediaDRMByteArray KeySetId
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | sessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMByteArray | KeySetId | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMSetOnEventListenerEx
Register a callback to be invoked when an event occurs.
public MLResult.Code MLMediaDRMSetOnEventListenerEx(
ulong MediaDrm,
ref MLMediaDRMEventCallbacks Listener,
IntPtr data
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMEventCallbacks | Listener | Data type containing array of {key, value} pair. |
IntPtr | data |
MLResult.Code MLMediaDRMSetPropertyByteArray
Set a DRM engine plugin byte array property value.
public MLResult.Code MLMediaDRMSetPropertyByteArray(
ulong MediaDrm,
string PropertyName,
ref MLMediaDRMByteArray PropertyValue
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
string | PropertyName | |
ref MLMediaDRMByteArray | PropertyValue | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMSetPropertyString
Set a DRM engine plugin String property value.
public MLResult.Code MLMediaDRMSetPropertyString(
ulong MediaDrm,
string PropertyName,
string PropertyValue
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
string | PropertyName | |
string | PropertyValue |
MLResult.Code MLMediaDRMSign
Generate a signature using the specified algorithm (if provided) over the message data and store the signature. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMSign(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMHMACInputParam HMACParam,
ref MLMediaDRMByteArray Message,
out MLMediaDRMByteArray Signature
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMHMACInputParam | HMACParam | Data type that encapsulates algorithm, key_set_id for HMAC based Sign/Verify. |
ref MLMediaDRMByteArray | Message | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | Signature | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMSignRSA
Generate a signature using the specified RSA Key and algorithm.
public MLResult.Code MLMediaDRMSignRSA(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMRSAInputParam HMACParam,
ref MLMediaDRMByteArray Message,
out MLMediaDRMByteArray Signature
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMRSAInputParam | HMACParam | Data type that encapsulates algorithm, wrapped_key for RSA operation. |
ref MLMediaDRMByteArray | Message | Data type containing byte array buffer and the size. |
out MLMediaDRMByteArray | Signature | Data type containing byte array buffer and the size. |
MLResult.Code MLMediaDRMVerify
Perform a signature verification using the specified algorithm (if specified) over the message data referenced by the message parameter. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult.Code MLMediaDRMVerify(
ulong MediaDrm,
ref MLMediaDRMByteArray SessionId,
ref MLMediaDRMHMACInputParam HMACParam,
ref MLMediaDRMByteArray Message,
ref MLMediaDRMByteArray Signature,
out bool IsMatch
)
Parameters
Type | Name | Description |
---|---|---|
ulong | MediaDrm | |
ref MLMediaDRMByteArray | SessionId | Data type containing byte array buffer and the size. |
ref MLMediaDRMHMACInputParam | HMACParam | Data type that encapsulates algorithm, key_set_id for HMAC based Sign/Verify. |
ref MLMediaDRMByteArray | Message | Data type containing byte array buffer and the size. |
ref MLMediaDRMByteArray | Signature | Data type containing byte array buffer and the size. |
out bool | IsMatch |
delegate void OnEventDelegate
public delegate void OnEventDelegate(
ulong handle,
ref MLMediaDRMEventInfo info
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaDRMEventInfo | info | MediaDRM event info associated with a session. |
delegate void OnExpirationUpdateDelegate
public delegate void OnExpirationUpdateDelegate(
ulong handle,
ref MLMediaDRMExpirationUpdateInfo info
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaDRMExpirationUpdateInfo | info | MediaDRM expiration update info associated with a session. |
delegate void OnKeyStatusChangeDelegate
public delegate void OnKeyStatusChangeDelegate(
ulong handle,
ref MLMediaDRMKeyStatusInfo info
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaDRMKeyStatusInfo | info | MediaDRM session keys status change info. |