Skip to content

Commit

Permalink
feat(DRM): add drmInfo to license requests (#4030)
Browse files Browse the repository at this point in the history
Adds drmInfo field to all LICENSE-type requests.

Based on comments here: #4001 (comment)
  • Loading branch information
Álvaro Velad Galván committed Mar 16, 2022
1 parent f1eeac1 commit abe846e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions externs/shaka/net.js
Expand Up @@ -60,6 +60,7 @@ shaka.extern.RetryParameters;
* retryParameters: !shaka.extern.RetryParameters,
* licenseRequestType: ?string,
* sessionId: ?string,
* drmInfo: ?shaka.extern.DrmInfo,
* streamDataCallback: ?function(BufferSource):!Promise
* }}
*
Expand Down Expand Up @@ -90,6 +91,9 @@ shaka.extern.RetryParameters;
* @property {?string} sessionId
* If this is a LICENSE request, this field contains the session ID of the
* EME session that made the request.
* @property {?shaka.extern.DrmInfo} drmInfo
* If this is a LICENSE request, this field contains the DRM info used to
* initialize EME.
* @property {?function(BufferSource):!Promise} streamDataCallback
* A callback function to handle the chunked data of the ReadableStream.
* @exportDoc
Expand Down
1 change: 1 addition & 0 deletions lib/media/drm_engine.js
Expand Up @@ -1385,6 +1385,7 @@ shaka.media.DrmEngine = class {
request.method = 'POST';
request.licenseRequestType = event.messageType;
request.sessionId = session.sessionId;
request.drmInfo = this.currentDrmInfo_;
// NOTE: allowCrossSiteCredentials can be set in a request filter.

if (shaka.media.DrmEngine.isPlayReadyKeySystem(
Expand Down
1 change: 1 addition & 0 deletions lib/net/networking_engine.js
Expand Up @@ -220,6 +220,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
retryParameters: retryParams,
licenseRequestType: null,
sessionId: null,
drmInfo: null,
streamDataCallback: streamDataCallback,
};
}
Expand Down
1 change: 1 addition & 0 deletions test/util/cmcd_manager_unit.js
Expand Up @@ -123,6 +123,7 @@ describe('CmcdManager', () => {
retryParameters: /** @type {shaka.extern.RetryParameters} */({}),
licenseRequestType: null,
sessionId: null,
drmInfo: null,
streamDataCallback: null,
};

Expand Down

0 comments on commit abe846e

Please sign in to comment.