Skip to main content
Version: 20 Mar 2024

DRM

MediaDRM to obtain the content keys for decrypting protected media streams.

Public Fields

TrackType

Type of track this DRM is used for.


public Track.Type TrackType { get; set; }

TypeDescription
Track.TypeMedia player track types.

Public Methods

Session CreateSession

Creates a new session for the DRM with the provided track information.

public Session CreateSession(
Info trackInfo
)

Parameters

TypeNameDescription
InfotrackInfoThe provided track information to create the new session with.

DRM

Provides initilization of the DRM class with the two given parameters.

public DRM(
MLMedia.Player mlPlayer,
Info trackDRMInfo
)

Parameters

TypeNameDescription
MLMedia.PlayermlPlayerThe media player this DRM is associated with.
InfotrackInfoThe info from the media player track that this DRM is associated with.

MLResult GetPropertyByteArray

CURRENTLY UNTESTED ON CAPI Read a DRM engine plugin byte array property value, given the property name.

public MLResult GetPropertyByteArray(
Property property,
out byte [] propertyValue
)

Parameters

TypeNameDescription
Propertyproperty
out byte []propertyValue

MLResult GetPropertyString

CURRENTLY UNTESTED ON CAPI Read a DRM engine plugin String property value, given the property name.

public MLResult GetPropertyString(
Property property,
out string propertyValue
)

Parameters

TypeNameDescription
Propertyproperty
out stringpropertyValue

MLResult GetSecureStop

CURRENTLY UNTESTED ON CAPI Access secure stop by secure stop ID.

public MLResult GetSecureStop(
byte [] secureStopId,
out byte [] secureStop
)

Parameters

TypeNameDescription
byte []secureStopId
out byte []secureStop

See: MLMediaDRMGetSecureStops()


MLResult GetSecureStops

CURRENTLY UNTESTED ON CAPI 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 GetSecureStops(
out byte secureStops[][]
)

Parameters

TypeNameDescription
out bytesecureStops[][]

MLResult IsCryptoSchemeSupported

CURRENTLY UNTESTED ON CAPI 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 IsCryptoSchemeSupported(
MagicLeapNativeBindings.MLUUID uuid,
string mime,
out bool isSupported
)

Parameters

TypeNameDescription
MagicLeapNativeBindings.MLUUIDuuid
stringmime
out boolisSupported

delegate void OnEventDelegate

Delegate for the any OnEvent event.

public delegate void OnEventDelegate(
DRM drm,
Event eventInfo
)

Parameters

TypeNameDescription
DRMdrmMediaDRM to obtain the content keys for decrypting protected media streams.
EventeventInfoMediaDRM event info associated with a session.

delegate void OnExpirationUpdateDelegate

Delegate for the any OnExpirationUpdate event.

public delegate void OnExpirationUpdateDelegate(
DRM drm,
Expiration expirationInfo
)

Parameters

TypeNameDescription
DRMdrmMediaDRM to obtain the content keys for decrypting protected media streams.
ExpirationexpirationInfoMediaDRM expiration update info associated with a session.

delegate void OnKeyStatusChangeDelegate

Delegate for the any OnKeyStatusChange event.

public delegate void OnKeyStatusChangeDelegate(
DRM drm,
KeyStatuses KeyStatuses
)

Parameters

TypeNameDescription
DRMdrmMediaDRM to obtain the content keys for decrypting protected media streams.
KeyStatusesKeyStatusesMediaDRM session keys status change info.

MLResult ProvisionRequest

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 ProvisionRequest(
out byte [] requestData,
out string defaultURL
)

Parameters

TypeNameDescription
out byte []requestData
out stringdefaultURL

MLResult ProvisionResponse

After a provision response is received by the app, it is provided to the DRM engine plugin using this method.

public MLResult ProvisionResponse(
byte [] responseData
)

Parameters

TypeNameDescription
byte []responseData

MLResult ReleaseAllSecureStops

CURRENTLY UNTESTED ON CAPI Remove all the SecureStops.

public MLResult ReleaseAllSecureStops()

MLResult ReleaseSecureStops

CURRENTLY UNTESTED ON CAPI Process the SecureStop server response message. After authenticating the message, remove the SecureStops identified in the response.

public MLResult ReleaseSecureStops(
byte [] secureStops
)

Parameters

TypeNameDescription
byte []secureStops

MLResult SetPropertyByteArray

CURRENTLY UNTESTED ON CAPI Set a DRM engine plugin byte array property value.

public MLResult SetPropertyByteArray(
Property property,
byte [] propertyValue
)

Parameters

TypeNameDescription
Propertyproperty
byte []propertyValue

MLResult SetPropertyString

CURRENTLY UNTESTED ON CAPI Set a DRM engine plugin String property value.

public MLResult SetPropertyString(
Property property,
string propertyValue
)

Parameters

TypeNameDescription
Propertyproperty
stringpropertyValue

Public Events

OnEvent

Event used to listen for different drm events.

public OnEventDelegate OnEvent()

OnExpirationUpdate

Event used to listen for when there is an update in expiration.

public OnExpirationUpdateDelegate OnExpirationUpdate()

OnKeyStatusChange

Event used to listen for when a key's status has changed.

public OnKeyStatusChangeDelegate OnKeyStatusChange()

Public Enums

EventType

The type of DRM event.

EnumeratorValueDescription
ProvisionRequired1This event type indicates that the app needs to request a certificate from the provisioning server. The request message data is obtained using MLMediaDRMGetProvisionRequest().
KeyRequiredThis event type indicates that the app needs to request keys from a license server. The request message data is obtained using MLMediaDRMGetKeyRequest().
KeyExpiredThis event type indicates that the licensed usage duration for keys in a session has expired. The keys are no longer valid.
VendorDefinedThis event may indicate some specific vendor-defined condition, see your DRM provider documentation for details.
SessionReclaimedThis event indicates that a session opened by the app has been reclaimed by the resource manager.
ExpirationUpdateThis event is issued when a session expiration update occurs, to inform the app about the change in expiration time.
KeysChangeThis event is issued when the keys in a session change status, such as when the license is renewed or expires.

KeyStatus

EnumeratorValueDescription
Usable0
Expired
OutputNotAllowed
Pending
InternalError

KeyType

Type of DRM key.

EnumeratorValueDescription
Streaming1This key request type specifies that the keys will be for online use, they will. not be saved to the device for subsequent use when the device is not connected to a network.
OfflineThis key request type specifies that the keys will be for offline use, they will be saved to the device for use when the device is not connected to a network.
ReleaseThis key request type specifies that previously saved offline keys should be released.

Property

EnumeratorValueDescription
Vendor
Version
Description
Algorithms
DeviceUniqueId