Skip to content

Commit ef9fa23

Browse files
authored
feat: add support for setting persistentState in supportedConfigurations (#102)
1 parent 3085f3f commit ef9fa23

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Below is an example of using one of these DRM systems and custom `getLicense()`
284284

285285
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.
286286

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

289289
Example:
290290

src/eme.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const getSupportedConfigurations = (keySystemOptions) => {
2525
const audioRobustness = keySystemOptions.audioRobustness;
2626
const videoContentType = keySystemOptions.videoContentType;
2727
const videoRobustness = keySystemOptions.videoRobustness;
28+
const persistentState = keySystemOptions.persistentState;
2829

2930
if (audioContentType || audioRobustness) {
3031
supportedConfiguration.audioCapabilities = [
@@ -44,6 +45,10 @@ export const getSupportedConfigurations = (keySystemOptions) => {
4445
];
4546
}
4647

48+
if (persistentState) {
49+
supportedConfiguration.persistentState = persistentState;
50+
}
51+
4752
return [supportedConfiguration];
4853
};
4954

test/eme.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,14 @@ QUnit.test('includes audio and video content types and robustness', function(ass
11051105
);
11061106
});
11071107

1108+
QUnit.test('includes persistentState', function(assert) {
1109+
assert.deepEqual(
1110+
getSupportedConfigurations({ persistentState: 'optional' }),
1111+
[{ persistentState: 'optional' }],
1112+
'included persistentState'
1113+
);
1114+
});
1115+
11081116
QUnit.test('uses supportedConfigurations directly if provided', function(assert) {
11091117
assert.deepEqual(
11101118
getSupportedConfigurations({

0 commit comments

Comments
 (0)