Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
valotvince committed Nov 14, 2022
1 parent 463914d commit 8ee4eba
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions docs/tutorials/drm-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,62 @@ you should provide an empty string as robustness

Values for other key systems are not known to us at this time.

#### Re-use persistent license DRM for online playback

If your DRM provider configuration allows you to deliver persistent license,
you could re-use the created MediaKeys session for the next online playback.

Configure Shaka to start DRM sessions with the `persistent-license` type
instead of the `temporary` one:

```js
player.configure({
drm: {
advanced: {
'com.widevine.alpha': {
'sessionType': 'persistent-license'
}
}
}
});
```

**Using `persistent-license` might now work on every devices, use this feature
carefully.**

When the playback starts, you can retrieve the sessions metadata:

```js
const activeDrmSessions = this.player.getActiveSessionsMetadata();
const persistentDrmSessions = activeDrmSessions.filter(
({ sessionType }) => sessionType === 'persistent-license');

// Add your own storage mechanism here, give it an unique known identifier for
// the playing video
```

When starting the same video again, retrieve the metadata from the storage, and
set it back to Shaka's configuration.

Shaka will load the given DRM persistent sessions and will only request a
license if some keys are missing for the content.

```js
player.configure({
drm: {
persistentSessionOnlinePlayback: true,
persistentSessionsMetadata: [{
sessionId: 'deadbeefdeadbeefdeadbeefdeadbeef',
initData: new InitData(0),
initDataType: 'cenc'
}]
}
});
```

NB: Shaka doesn't provide a out-of-the-box storage mechanism for the sessions
metadata.

#### Continue the Tutorials

Next, check out {@tutorial license-server-auth}.
Expand Down

0 comments on commit 8ee4eba

Please sign in to comment.