Skip to content

Commit

Permalink
docs: update config.drm.initDataTransform documentation (shaka-proj…
Browse files Browse the repository at this point in the history
  • Loading branch information
zangue committed Apr 25, 2023
1 parent 577b0e7 commit 19b7f93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/tutorials/fairplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ is used by the browser to generate the license request. If you don't use the
default content ID derivation, you need to specify a custom init data transform:

```js
player.configure('drm.initDataTransform', (initData, initDataType) => {
player.configure('drm.initDataTransform', (initData, initDataType, drmInfo) => {
if (initDataType != 'skd')
return initData;
// 'initData' is a buffer containing an 'skd://' URL as a UTF-8 string.
const skdUri = shaka.util.StringUtils.fromBytesAutoDetect(initData);
const contentId = getMyContentId(skdUri);
const cert = player.drmInfo().serverCertificate;
const cert = drmInfo.serverCertificate;
return shaka.util.FairPlayUtils.initDataTransform(initData, contentId, cert);
});
```
Expand Down
20 changes: 13 additions & 7 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,7 @@ shaka.extern.PersistentSessionMetadata;
* persistentSessionsMetadata:
* !Array.<shaka.extern.PersistentSessionMetadata>,
* advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
* initDataTransform:
* ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
* undefined),
* initDataTransform:(shaka.extern.InitDataTransform|undefined),
* logLicenseExchange: boolean,
* updateExpirationTime: number,
* preferredKeySystems: !Array.<string>,
Expand Down Expand Up @@ -772,10 +770,7 @@ shaka.extern.PersistentSessionMetadata;
* <i>Optional.</i> <br>
* A dictionary which maps key system IDs to advanced DRM configuration for
* those key systems.
* @property
* {((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
* undefined)}
* initDataTransform
* @property {shaka.extern.InitDataTransform|undefined} initDataTransform
* <i>Optional.</i><br>
* If given, this function is called with the init data from the
* manifest/media and should return the (possibly transformed) init data to
Expand Down Expand Up @@ -808,6 +803,17 @@ shaka.extern.PersistentSessionMetadata;
*/
shaka.extern.DrmConfiguration;

/**
* @typedef {function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array}
*
* @description
* A callback function to handle custom content ID signaling for FairPlay
* content.
*
* @exportDoc
*/
shaka.extern.InitDataTransform;


/**
* @typedef {{
Expand Down

0 comments on commit 19b7f93

Please sign in to comment.