Skip to content

Commit

Permalink
feat(FairPlay): Add support for Mux (#8201)
Browse files Browse the repository at this point in the history
This adds support for FairPlay DRM license requests for Mux.io

Close #8202
  • Loading branch information
joshbuddy authored Mar 4, 2025
1 parent 61d44c9 commit 31b32d3
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Jean-alexandre Iragne <[email protected]>
Jesper Haug Karsrud <[email protected]>
Johan Sundström <[email protected]>
Jonas Birmé <[email protected]>
Josh Hull <[email protected]>
Jozef Chúťka <[email protected]>
Juliane Holzt <[email protected]>
Jun Hong Chong <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Johan Sundström <[email protected]>
John Bowers <[email protected]>
Jonas Birmé <[email protected]>
Jono Ward <[email protected]>
Josh Hull <[email protected]>
Jozef Chúťka <[email protected]>
Juan Manuel Tomás <[email protected]>
Julian Domingo <[email protected]>
Expand Down
16 changes: 16 additions & 0 deletions docs/tutorials/fairplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,19 @@ For integration with Nagra the following can be used:
```js
shaka.polyfill.PatchedMediaKeysApple.install();
```

#### Mux (legacy Apple Media Keys)

For integration with Mux the following can be used:

```js
shaka.polyfill.PatchedMediaKeysApple.install();
const FairPlayUtils = shaka.util.FairPlayUtils;
player.getNetworkingEngine()
.registerRequestFilter(FairPlayUtils.muxFairPlayRequest);
player.getNetworkingEngine()
.registerResponseFilter(FairPlayUtils.commonFairPlayResponse);
player.configure('drm.initDataTransform',
FairPlayUtils.muxInitDataTransform);
```

26 changes: 26 additions & 0 deletions lib/util/fairplay_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ shaka.util.FairPlayUtils = class {
initData, initDataType, drmInfo);
}

/**
* Mux initDataTransform configuration.
*
* @param {!Uint8Array} initData
* @param {string} initDataType
* @param {?shaka.extern.DrmInfo} drmInfo
* @return {!Uint8Array}
* @export
*/
static muxInitDataTransform(initData, initDataType, drmInfo) {
return shaka.util.FairPlayUtils.basicInitDataTransform_(
initData, initDataType, drmInfo);
}

/**
* Verimatrix FairPlay request.
*
Expand Down Expand Up @@ -328,6 +342,18 @@ shaka.util.FairPlayUtils = class {
shaka.util.FairPlayUtils.octetStreamFairPlayRequest_(type, request);
}

/**
* Mux FairPlay request.
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.extern.RequestContext=} context
* @export
*/
static muxFairPlayRequest(type, request, context) {
shaka.util.FairPlayUtils.octetStreamFairPlayRequest_(type, request);
}

/**
* Common FairPlay response transform for some DRMs providers.
*
Expand Down

0 comments on commit 31b32d3

Please sign in to comment.