Skip to content

Commit

Permalink
chore: update docs for robustness and mention widevine warning (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Feb 11, 2021
1 parent 4136355 commit 9c4f577
Showing 1 changed file with 41 additions and 13 deletions.
54 changes: 41 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Maintenance Status: Stable
- [Other DRM Systems](#other-drm-systems)
- [Get License By URL](#get-license-by-url)
- [Get License By Function](#get-license-by-function)
- [Get Certificate by function](#get-certificate-by-function)
- [audioContentType/videoContentType](#audiocontenttypevideocontenttype)
- [audioRobustness/videoRobustness](#audiorobustnessvideorobustness)
- [MediaKeySystemConfiguration and supportedConfigurations](#mediakeysystemconfiguration-and-supportedconfigurations)
- [Get License Errors](#get-license-errors)
- [API](#api)
Expand Down Expand Up @@ -254,36 +257,61 @@ For more complex integrations, you may pass a `getLicense` function to fully con
}
```


#### Get Certificate by function
Although the license acquisition is the only required configuration, `getCertificate()` is also supported if your source needs to retrieve a certificate, similar to the [FairPlay](#fairplay) implementation above.

The `audioContentType` and `videoContentType` properties for non-FairPlay sources are used to determine if the system supports that codec and to create an appropriate `keySystemAccess` object. If left out, it is possible that the system will create a `keySystemAccess` object for the given key system, but will not be able to play the source due to the browser's inability to use that codec.
Example:
```js
{
'org.w3.clearkey': {
getCertificate: function(emeOptions, callback) {
// request certificate
// if err, callback(err)
// if success, callback(null, certificate)
},
}
}
```


Below is an example of using one of these DRM systems and custom `getLicense()` and `getCertificate()` functions:
### audioContentType/videoContentType

The `audioContentType` and `videoContentType` properties for non-FairPlay sources are used to determine if the system supports that codec and to create an appropriate `keySystemAccess` object. If left out, it is possible that the system will create a `keySystemAccess` object for the given key system, but will not be able to play the source due to the browser's inability to use that codec.

example:
```js
{
keySystems: {
'org.w3.clearkey': {
audioContentType: 'audio/webm; codecs="vorbis"',
videoContentType: 'video/webm; codecs="vp9"',
getCertificate: function(emeOptions, callback) {
// request certificate
// if err, callback(err)
// if success, callback(null, certificate)
},
getLicense: function(emeOptions, keyMessage, callback) {
// request license
// if err, callback(err)
// if success, callback(null, license)
}
}
}
}
```

### audioRobustness/videoRobustness
> If `audioRobustness`/`videoRobustness` is not passed in for widevine, you will see a warning similar to: `It is recommended that a robustness level be specified. Not specifying the robustness level could result in unexpected behavior`. Possible Options for widevine: `SW_SECURE_CRYPTO`, `SW_SECURE_DECODE`, `HW_SECURE_CRYPTO`, `HW_SECURE_DECODE`, `HW_SECURE_ALL`
The `audioRobustness` and `videoRobustness` properties for non-FairPlay sources are used to determine the robustness level of the DRM you are using.

Example:

```js
{
keySystems: {
'com.widevine.alpha': {
audioRobustness: 'SW_SECURE_CRYPTO',
videoRobustness: 'SW_SECURE_CRYPTO'
}
}
}
```

### MediaKeySystemConfiguration and supportedConfigurations

In addition to `audioContentType` and `videoContentType` posted above, it is possible to directly provide the `supportedConfigurations` array to use for the `requestMediaKeySystemAccess` call. This allows for the entire range of options specified by the [MediaKeySystemConfiguration] object.
In addition to key systems options provided above, it is possible to directly provide the `supportedConfigurations` array to use for the `requestMediaKeySystemAccess` call. This allows for the entire range of options specified by the [MediaKeySystemConfiguration] object.

Note that if `supportedConfigurations` is provided, it will override `audioContentType`, `videoContentType`, `audioRobustness`, `videoRobustness`, and `persistentState`.

Expand Down

0 comments on commit 9c4f577

Please sign in to comment.