diff --git a/externs/shaka/net.js b/externs/shaka/net.js index 44c80a6431..5fe56e7b65 100644 --- a/externs/shaka/net.js +++ b/externs/shaka/net.js @@ -61,6 +61,8 @@ shaka.extern.RetryParameters; * licenseRequestType: ?string, * sessionId: ?string, * drmInfo: ?shaka.extern.DrmInfo, + * initData: ?Uint8Array, + * initDataType: ?string, * streamDataCallback: ?function(BufferSource):!Promise * }} * @@ -94,6 +96,12 @@ shaka.extern.RetryParameters; * @property {?shaka.extern.DrmInfo} drmInfo * If this is a LICENSE request, this field contains the DRM info used to * initialize EME. + * @property {?Uint8Array} initData + * If this is a LICENSE request, this field contains the initData info used + * to initialize EME. + * @property {?string} initDataType + * If this is a LICENSE request, this field contains the initDataType info + * used to initialize EME. * @property {?function(BufferSource):!Promise} streamDataCallback * A callback function to handle the chunked data of the ReadableStream. * @exportDoc diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index 1762f5c5fe..e23aa8f7d3 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -1169,6 +1169,7 @@ shaka.media.DrmEngine = class { const metadata = { initData: null, + initDataType: null, loaded: false, oldExpiration: Infinity, updatePromise: null, @@ -1245,6 +1246,7 @@ shaka.media.DrmEngine = class { const metadata = { initData: initData, + initDataType: initDataType, loaded: false, oldExpiration: Infinity, updatePromise: null, @@ -1386,6 +1388,10 @@ shaka.media.DrmEngine = class { request.licenseRequestType = event.messageType; request.sessionId = session.sessionId; request.drmInfo = this.currentDrmInfo_; + if (metadata) { + request.initData = metadata.initData; + request.initDataType = metadata.initDataType; + } // NOTE: allowCrossSiteCredentials can be set in a request filter. if (shaka.media.DrmEngine.isPlayReadyKeySystem( @@ -2342,6 +2348,7 @@ shaka.media.DrmEngine = class { * @typedef {{ * loaded: boolean, * initData: Uint8Array, + * initDataType: ?string, * oldExpiration: number, * type: string, * updatePromise: shaka.util.PublicPromise @@ -2353,6 +2360,8 @@ shaka.media.DrmEngine = class { * does not mean the session is 'usable'. * @property {Uint8Array} initData * The init data used to create the session. + * @property {?string} initDataType + * The init data type used to create the session. * @property {!MediaKeySession} session * The session object. * @property {number} oldExpiration diff --git a/lib/net/networking_engine.js b/lib/net/networking_engine.js index 04a7ca4265..17bf470acc 100644 --- a/lib/net/networking_engine.js +++ b/lib/net/networking_engine.js @@ -221,6 +221,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget { licenseRequestType: null, sessionId: null, drmInfo: null, + initData: null, + initDataType: null, streamDataCallback: streamDataCallback, }; } diff --git a/test/util/cmcd_manager_unit.js b/test/util/cmcd_manager_unit.js index 5150a36c58..b193fad640 100644 --- a/test/util/cmcd_manager_unit.js +++ b/test/util/cmcd_manager_unit.js @@ -124,6 +124,8 @@ describe('CmcdManager', () => { licenseRequestType: null, sessionId: null, drmInfo: null, + initData: null, + initDataType: null, streamDataCallback: null, };