Skip to content

Commit

Permalink
docs: Add Widevine Service Certificate tutorial (shaka-project#5018)
Browse files Browse the repository at this point in the history
Also fixes a related typo in the FairPlay tutorial and adds a missing
entry to the tutorial index.
  • Loading branch information
joeyparrish committed Feb 23, 2023
1 parent fbce38a commit 472bcbb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/tutorials/fairplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ you.
const req = await fetch('https://example.com/cert.der');
const cert = await req.arrayBuffer();

player.configure('drm.advanced.com\\.apple\\.fps\\.serverCertificate',
player.configure('drm.advanced.com\\.apple\\.fps.serverCertificate',
new Uint8Array(cert));
```

```js
player.configure('drm.advanced.com\\.apple\\.fps\\.serverCertificateUri',
player.configure('drm.advanced.com\\.apple\\.fps.serverCertificateUri',
'https://example.com/cert.der');
```

Expand Down
2 changes: 2 additions & 0 deletions docs/tutorials/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
{ "license-wrapping": { "title": "License Wrapping" } },
{ "ui": { "title": "UI Library" } },
{ "ui-customization": { "title": "Configuring the UI" } },
{ "errors": { "title": "Error Handling" } },
{ "a11y": { "title": "Creating accessible buttons" } },
{ "ad_monetization": { "title": "Serving ads with our IMA SDK integration" } },
{ "plugins": { "title": "Plugins and Customizing the Build" } },
{ "manifest-parser": { "title": "Manifest Parser Plugins" } },
{ "architecture": { "title": "Architecture Diagrams" } },
{ "service-worker": { "title": "Service Worker Caching" } },
{ "offline": { "title": "Offline Storage and Playback" } },
{ "widevine-service-certs": { "title": "Widevine Service Certificates" } },
{ "fairplay": { "title": "FairPlay support" } },
{ "application-level-redirects": { "title": "Application-Level Redirects" } },
{ "blob-url": { "title": "Blob URL" } },
Expand Down
45 changes: 45 additions & 0 deletions docs/tutorials/widevine-service-certs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Widevine Service Certificates

With Widevine, you can eliminate one round-trip to your license server or proxy
per session by preloading a Widevine service certificate. You can either provide
it directly or set a URI and let Shaka fetch it for you. Do this before calling
`player.load()`. The values will persist across multiple calls to `load()` on
the same `shaka.Player` instance.

```js
// This is an example of loading the certificate from your site at runtime.
// You could also choose to bundle it into your JavaScript as a Uint8Array.
const req = await fetch('https://example.com/service.cert');
const cert = new Uint8Array(await req.arrayBuffer());

// This is the short form for configuration of a certificate:
player.configure('drm.advanced.com\\.widevine\\.alpha.serverCertificate',
cert);

// This is the long form:
player.configure({
drm: {
advanced: {
'com.widevine.alpha': {
'serverCertificate': cert,
},
},
},
});


// This is the short form for configuration of a certificate URI:
player.configure('drm.advanced.com\\.widevine\\.alpha.serverCertificateUri',
'https://example.com/service.cert');

// This is the long form:
player.configure({
drm: {
advanced: {
'com.widevine.alpha': {
'serverCertificateUri': 'https://example.com/service.cert',
},
},
},
});
```

0 comments on commit 472bcbb

Please sign in to comment.