Skip to content

Commit

Permalink
docs: update config.drm.initDataTransform documentation (#5170)
Browse files Browse the repository at this point in the history
  • Loading branch information
zangue authored and joeyparrish committed Apr 26, 2023
1 parent df40985 commit 64e5373
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 @@ -25,14 +25,14 @@ 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 @@ -613,9 +613,7 @@ shaka.extern.AdvancedDrmConfiguration;
* clearKeys: !Object.<string, string>,
* delayLicenseRequestUntilPlayed: boolean,
* 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 All @@ -639,10 +637,7 @@ shaka.extern.AdvancedDrmConfiguration;
* <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 All @@ -664,6 +659,17 @@ shaka.extern.AdvancedDrmConfiguration;
*/
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 64e5373

Please sign in to comment.