Interface IMediaKeySession
interface IMediaKeySession
Extends com.amazon.apmf.IStandard
Representation of MediaKeySession interface struct defined by EME spec.
Apps should use this interface to generate license request and obtain
decrypt key id, and close/remove session.
For more details see
https://www.w3.org/TR/encrypted-media/#mediakeysession-interface
Methods
addExpirationChangedListener()
Add a callback to be notified when the expiration time of MediaKeySession changes.com.amazon.apmf.ISubscription*addExpirationChangedListener(IMediaKeySessionExpirationListener*sessionExpirationChangedListener)
Parameters
sessionExpirationChangedListener
IMediaKeySessionExpirationListener* — Required
IMediaKeySessionExpirationListener instance for callback when the
expiration time of the MediaKeySession changes.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
addKeySessionRemovedListener()
Add a callback to be notified when MediaKeySession is removedcom.amazon.apmf.ISubscription*addKeySessionRemovedListener(IMediaKeySessionRemoveStatusListener*sessionRemovedListener)
Parameters
sessionRemovedListener
IMediaKeySessionRemoveStatusListener* — Required
IMediaKeySessionRemoveStatusListener instance for callback to be notified when
MediaKeySession is removed.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
addKeyStatusChangeListener()
Add a callback to be notified when key status has changedcom.amazon.apmf.ISubscription*addKeyStatusChangeListener(IMediaKeyStatusChangeListener*keyStatusChangeListener)
Parameters
keyStatusChangeListener
IMediaKeyStatusChangeListener* — Required
IMediaKeyStatusChangeListener instance for callback to receive changes to key status.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
addMediaKeyMessageEventListener()
Add a callback to be notified when there is key messagecom.amazon.apmf.ISubscription*addMediaKeyMessageEventListener(IMediaKeyMessageEventListener*keyMessageEventListener)
Parameters
keyMessageEventListener
IMediaKeyMessageEventListener* — Required
IMediaKeyMessageEventListener instance for callback to receive Media Key Message Events.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
generateLicenseRequest()
Generates a License request based on the parameters passed and the session type used while creating thiscom.amazon.apmf.ISubscription*generateLicenseRequest(IContentProtectionInitData*contentProtectionInitData,ILicenseRequestListener*licenseRequestListener)
MediaKeySession
object. Upon a successful call, the actual License challenge/request will be
served through OnMediaKeyMessageEventClosure
For further details see
https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-generaterequest
Parameters
contentProtectionInitData
IContentProtectionInitData* — Required
CDM specific init data (a.k.a PSSH)
licenseRequestListener
ILicenseRequestListener* — Required
ILicenseRequestListener instance for callback when the licenseRequest is
generated.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
load()
Loads a previous persistent session with all its keys. For further details see https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-loadcom.amazon.apmf.ISubscription*load(stringsessionId,IMediaKeySessionLoadStatusListener*keySessionLoadStatusListener)
Parameters
sessionId
string — Required
string. ID of previous, NOT REMOVED PERSISTENT Session.
keySessionLoadStatusListener
IMediaKeySessionLoadStatusListener* — Required
IMediaKeySessionLoadStatusListener instance for callback when MediaKeySession is loaded.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
update()
Once the client receives a valid license response from a license server, this function is used to pass the response for processing to the platform CDM implementation. Upon success, the client will be called back with onKeyStatusChanged() to nofity that a new license is valid for use in decrypt or make aware of its current status. For further details see https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-updatecom.amazon.apmf.ISubscription*update(u8[]licenseResponse,IMediaKeySessionUpdateStatusListener*keySessionUpdateStatusListener)
Parameters
licenseResponse
u8[] — Required
The license response from the license server
keySessionUpdateStatusListener
IMediaKeySessionUpdateStatusListener* — Required
IMediaKeySessionUpdateStatusListener instance for callback when MediaKeySession is updated.
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
close()
Closes a session. NOTE that the session is not removed. It only chaged to be closed if it is PERSISTENT. All the session’s keys are moved to RELEASED and are no longer usable for decryption but are still “known”. For further details see https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-closecom.amazon.apmf.ISubscription*close(IMediaKeySessionCloseStatusListener*keySessionCloseStatusListener)
Parameters
keySessionCloseStatusListener
IMediaKeySessionCloseStatusListener* — Required
IMediaKeySessionCloseStatusListener instance for callback when the MediaKeySession is closed
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
remove()
Removes a session. All the session’s keys and other data are removed from memory. Same effect as close if session type is TEMPORARY. For further details see https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-removecom.amazon.apmf.ISubscription*remove(IMediaKeySessionRemoveStatusListener*keySessionRemoveStatusListener)
Parameters
keySessionRemoveStatusListener
IMediaKeySessionRemoveStatusListener* — Required
IMediaKeySessionRemoveStatusListener instance for callback when MediaKeySession is removed
Returns
com.amazon.apmf.ISubscription*
ISubscription object instance
getSessionId()
string getSessionId()
Session Id getter.
A Session ID is a unique string identifier generated by the CDM that can be
used by the application to identify MediaKeySession objects.
A new Session ID is generated each time the user agent and
CDM successfully create a new session.
For more detail see
https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-sessionid
Returns
string
null terminated id string
isVideoSecure()
bool isVideoSecure()
Checks whether the video is configured use for secure codec.
Returns
bool
true if codec was requested to be secure for the
given media type, otherwise false.
isAudioSecure()
bool isAudioSecure()
Checks whether the audio is configured use for secure codec.
Returns
bool
true if codec was requested to be secure for the
given media type, otherwise false.
getMediaKeyStatusMap()
Getter for drm session’s MediaKeyStatusMap object. For further details see https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-keystatusesIMediaKeyStatusMap*getMediaKeyStatusMap()
Returns
IMediaKeyStatusMap*
MediaKeyStatus map for this drm session.
getExpirationTimeOutSecs()
double getExpirationTimeOutSecs()
Getter for drm session’s expiration.
Returns
double
The expiration in seconds for the keys in this
session

