rx-player 4.2.0-dev.2024080600 → 4.2.0-dev.2024080900
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.d.ts +6 -1
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.js +2 -1
- package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/content_decryptor.js +2 -1
- package/dist/commonjs/main_thread/decrypt/find_key_system.d.ts +17 -5
- package/dist/commonjs/main_thread/decrypt/find_key_system.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/find_key_system.js +35 -26
- package/dist/commonjs/main_thread/decrypt/get_media_keys.d.ts +5 -0
- package/dist/commonjs/main_thread/decrypt/get_media_keys.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/get_media_keys.js +4 -2
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.d.ts +5 -0
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/decrypt/attach_media_keys.d.ts +6 -1
- package/dist/es2017/main_thread/decrypt/attach_media_keys.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/attach_media_keys.js +2 -1
- package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/content_decryptor.js +2 -1
- package/dist/es2017/main_thread/decrypt/find_key_system.d.ts +17 -5
- package/dist/es2017/main_thread/decrypt/find_key_system.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/find_key_system.js +40 -35
- package/dist/es2017/main_thread/decrypt/get_media_keys.d.ts +5 -0
- package/dist/es2017/main_thread/decrypt/get_media_keys.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/get_media_keys.js +3 -1
- package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.d.ts +5 -0
- package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.d.ts.map +1 -1
- package/dist/rx-player.js +15 -15
- package/package.json +1 -1
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +376 -102
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +4 -23
- package/src/main_thread/decrypt/attach_media_keys.ts +7 -0
- package/src/main_thread/decrypt/content_decryptor.ts +3 -1
- package/src/main_thread/decrypt/find_key_system.ts +53 -43
- package/src/main_thread/decrypt/get_media_keys.ts +8 -1
- package/src/main_thread/decrypt/utils/media_keys_infos_store.ts +6 -0
|
@@ -31,7 +31,7 @@ import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
|
31
31
|
* @param {Object} currentKeySystemOptions
|
|
32
32
|
* @returns {null|Object}
|
|
33
33
|
*/
|
|
34
|
-
function checkCachedMediaKeySystemAccess(keySystems, currentKeySystemAccess, currentKeySystemOptions) {
|
|
34
|
+
function checkCachedMediaKeySystemAccess(keySystems, askedConfiguration, currentKeySystemAccess, currentKeySystemOptions) {
|
|
35
35
|
const mksConfiguration = currentKeySystemAccess.getConfiguration();
|
|
36
36
|
if (shouldRenewMediaKeySystemAccess() || isNullOrUndefined(mksConfiguration)) {
|
|
37
37
|
return null;
|
|
@@ -56,6 +56,7 @@ function checkCachedMediaKeySystemAccess(keySystems, currentKeySystemAccess, cur
|
|
|
56
56
|
return {
|
|
57
57
|
keySystemOptions: firstCompatibleOption,
|
|
58
58
|
keySystemAccess: currentKeySystemAccess,
|
|
59
|
+
askedConfiguration,
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
return null;
|
|
@@ -183,23 +184,21 @@ function buildKeySystemConfigurations(keySystemTypeInfo) {
|
|
|
183
184
|
}
|
|
184
185
|
/**
|
|
185
186
|
* Extract from the current mediaKeys the supported Codecs.
|
|
186
|
-
* @param {Object
|
|
187
|
-
*
|
|
188
|
-
* @param {Object | undefined} mksConfiguration - The result of
|
|
187
|
+
* @param {Object} initialConfiguration - The MediaKeySystemConfiguration given
|
|
188
|
+
* to the `navigator.requestMediaKeySystemAccess` API.
|
|
189
|
+
* @param {Object | undefined} mksConfiguration - The result of
|
|
190
|
+
* getConfiguration() of the media keys.
|
|
189
191
|
* @return {Array} The list of supported codec by the CDM.
|
|
190
192
|
*/
|
|
191
|
-
export function extractCodecSupportListFromConfiguration(
|
|
192
|
-
var _a, _b;
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const testedCodecs = testedAudioCodecs.concat(testedVideoCodecs);
|
|
201
|
-
const supportedVideoCodecs = (_a = mksConfiguration.videoCapabilities) === null || _a === void 0 ? void 0 : _a.map((entry) => entry.contentType);
|
|
202
|
-
const supportedAudioCodecs = (_b = mksConfiguration.audioCapabilities) === null || _b === void 0 ? void 0 : _b.map((entry) => entry.contentType);
|
|
193
|
+
export function extractCodecSupportListFromConfiguration(initialConfiguration, mksConfiguration) {
|
|
194
|
+
var _a, _b, _c, _d, _e, _f;
|
|
195
|
+
const testedAudioCodecs = (_b = (_a = initialConfiguration.audioCapabilities) === null || _a === void 0 ? void 0 : _a.map((v) => v.contentType)) !== null && _b !== void 0 ? _b : [];
|
|
196
|
+
const testedVideoCodecs = (_d = (_c = initialConfiguration.videoCapabilities) === null || _c === void 0 ? void 0 : _c.map((v) => v.contentType)) !== null && _d !== void 0 ? _d : [];
|
|
197
|
+
const testedCodecs = testedAudioCodecs
|
|
198
|
+
.concat(testedVideoCodecs)
|
|
199
|
+
.filter((c) => c !== undefined);
|
|
200
|
+
const supportedVideoCodecs = (_e = mksConfiguration.videoCapabilities) === null || _e === void 0 ? void 0 : _e.map((entry) => entry.contentType);
|
|
201
|
+
const supportedAudioCodecs = (_f = mksConfiguration.audioCapabilities) === null || _f === void 0 ? void 0 : _f.map((entry) => entry.contentType);
|
|
203
202
|
const supportedCodecs = [
|
|
204
203
|
...(supportedVideoCodecs !== null && supportedVideoCodecs !== void 0 ? supportedVideoCodecs : []),
|
|
205
204
|
...(supportedAudioCodecs !== null && supportedAudioCodecs !== void 0 ? supportedAudioCodecs : []),
|
|
@@ -249,15 +248,16 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
249
248
|
if (eme.implementation === currentState.emeImplementation.implementation) {
|
|
250
249
|
// Fast way to find a compatible keySystem if the currently loaded
|
|
251
250
|
// one as exactly the same compatibility options.
|
|
252
|
-
const cachedKeySystemAccess = checkCachedMediaKeySystemAccess(keySystemsConfigs, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
|
|
251
|
+
const cachedKeySystemAccess = checkCachedMediaKeySystemAccess(keySystemsConfigs, currentState.askedConfiguration, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
|
|
253
252
|
if (cachedKeySystemAccess !== null) {
|
|
254
253
|
log.info("DRM: Found cached compatible keySystem");
|
|
255
254
|
return Promise.resolve({
|
|
256
255
|
type: "reuse-media-key-system-access",
|
|
257
256
|
value: {
|
|
258
257
|
mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
|
|
258
|
+
askedConfiguration: cachedKeySystemAccess.askedConfiguration,
|
|
259
259
|
options: cachedKeySystemAccess.keySystemOptions,
|
|
260
|
-
codecSupport: extractCodecSupportListFromConfiguration(cachedKeySystemAccess.
|
|
260
|
+
codecSupport: extractCodecSupportListFromConfiguration(cachedKeySystemAccess.askedConfiguration, cachedKeySystemAccess.keySystemAccess.getConfiguration()),
|
|
261
261
|
},
|
|
262
262
|
});
|
|
263
263
|
}
|
|
@@ -314,25 +314,30 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
314
314
|
const keySystemConfigurations = buildKeySystemConfigurations(chosenType);
|
|
315
315
|
log.debug(`DRM: Request keysystem access ${keyType},` +
|
|
316
316
|
`${index + 1} of ${keySystemsType.length}`);
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
317
|
+
let keySystemAccess;
|
|
318
|
+
for (let configIdx = 0; configIdx < keySystemConfigurations.length; configIdx++) {
|
|
319
|
+
const keySystemConfiguration = keySystemConfigurations[configIdx];
|
|
320
|
+
try {
|
|
321
|
+
keySystemAccess = await testKeySystem(keyType, [keySystemConfiguration]);
|
|
322
|
+
log.info("DRM: Found compatible keysystem", keyType, index + 1);
|
|
323
|
+
return {
|
|
324
|
+
type: "create-media-key-system-access",
|
|
325
|
+
value: {
|
|
326
|
+
options: keySystemOptions,
|
|
327
|
+
mediaKeySystemAccess: keySystemAccess,
|
|
328
|
+
askedConfiguration: keySystemConfiguration,
|
|
329
|
+
codecSupport: extractCodecSupportListFromConfiguration(keySystemConfiguration, keySystemAccess.getConfiguration()),
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
catch (_) {
|
|
334
|
+
log.debug("DRM: Rejected access to keysystem", keyType, index + 1, configIdx);
|
|
335
|
+
if (cancelSignal.cancellationError !== null) {
|
|
336
|
+
throw cancelSignal.cancellationError;
|
|
337
|
+
}
|
|
333
338
|
}
|
|
334
|
-
return recursivelyTestKeySystems(index + 1);
|
|
335
339
|
}
|
|
340
|
+
return recursivelyTestKeySystems(index + 1);
|
|
336
341
|
}
|
|
337
342
|
}
|
|
338
343
|
/**
|
|
@@ -23,6 +23,11 @@ import type { IMediaKeySessionStores } from "./types";
|
|
|
23
23
|
export interface IMediaKeysInfos {
|
|
24
24
|
/** The MediaKeySystemAccess which allowed to create the MediaKeys instance. */
|
|
25
25
|
mediaKeySystemAccess: MediaKeySystemAccess | ICustomMediaKeySystemAccess;
|
|
26
|
+
/**
|
|
27
|
+
* The MediaKeySystemConfiguration that has been provided to the
|
|
28
|
+
* `requestMediaKeySystemAccess` API.
|
|
29
|
+
*/
|
|
30
|
+
askedConfiguration: MediaKeySystemConfiguration;
|
|
26
31
|
/** The MediaKeys instance. */
|
|
27
32
|
mediaKeys: MediaKeys | ICustomMediaKeys;
|
|
28
33
|
/** Stores allowing to create and retrieve MediaKeySessions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_media_keys.d.ts","sourceRoot":"","sources":["../../../../src/main_thread/decrypt/get_media_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAuBtD,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,oBAAoB,EAAE,oBAAoB,GAAG,2BAA2B,CAAC;IACzE,8BAA8B;IAC9B,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IACxC,+DAA+D;IAC/D,MAAM,EAAE,sBAAsB,CAAC;IAC/B,qEAAqE;IACrE,OAAO,EAAE,gBAAgB,CAAC;IAC1B,yBAAyB;IACzB,YAAY,EAAE,iBAAiB,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAA8B,iBAAiB,CAC7C,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"get_media_keys.d.ts","sourceRoot":"","sources":["../../../../src/main_thread/decrypt/get_media_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAuBtD,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,oBAAoB,EAAE,oBAAoB,GAAG,2BAA2B,CAAC;IACzE;;;OAGG;IACH,kBAAkB,EAAE,2BAA2B,CAAC;IAChD,8BAA8B;IAC9B,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IACxC,+DAA+D;IAC/D,MAAM,EAAE,sBAAsB,CAAC;IAC/B,qEAAqE;IACrE,OAAO,EAAE,gBAAgB,CAAC;IAC1B,yBAAyB;IACzB,YAAY,EAAE,iBAAiB,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAA8B,iBAAiB,CAC7C,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAmD1B"}
|
|
@@ -53,7 +53,7 @@ export default async function getMediaKeysInfos(mediaElement, keySystemsConfigs,
|
|
|
53
53
|
if (cancelSignal.cancellationError !== null) {
|
|
54
54
|
throw cancelSignal.cancellationError;
|
|
55
55
|
}
|
|
56
|
-
const { options, mediaKeySystemAccess, codecSupport } = evt.value;
|
|
56
|
+
const { options, mediaKeySystemAccess, askedConfiguration, codecSupport } = evt.value;
|
|
57
57
|
const currentState = MediaKeysInfosStore.getState(mediaElement);
|
|
58
58
|
const persistentSessionsStore = createPersistentSessionsStorage(options);
|
|
59
59
|
if (canReuseMediaKeys() &&
|
|
@@ -69,6 +69,7 @@ export default async function getMediaKeysInfos(mediaElement, keySystemsConfigs,
|
|
|
69
69
|
return {
|
|
70
70
|
mediaKeys,
|
|
71
71
|
mediaKeySystemAccess,
|
|
72
|
+
askedConfiguration,
|
|
72
73
|
stores: { loadedSessionsStore, persistentSessionsStore },
|
|
73
74
|
options,
|
|
74
75
|
codecSupport,
|
|
@@ -81,6 +82,7 @@ export default async function getMediaKeysInfos(mediaElement, keySystemsConfigs,
|
|
|
81
82
|
return {
|
|
82
83
|
mediaKeys,
|
|
83
84
|
mediaKeySystemAccess,
|
|
85
|
+
askedConfiguration,
|
|
84
86
|
stores: { loadedSessionsStore, persistentSessionsStore },
|
|
85
87
|
options,
|
|
86
88
|
codecSupport,
|
|
@@ -22,6 +22,11 @@ export interface IMediaElementMediaKeysInfos {
|
|
|
22
22
|
emeImplementation: IEmeApiImplementation;
|
|
23
23
|
/** Last keySystemOptions used with that HTMLMediaElement. */
|
|
24
24
|
keySystemOptions: IKeySystemOption;
|
|
25
|
+
/**
|
|
26
|
+
* The actual MediaKeySystemConfiguration asked to the
|
|
27
|
+
* `requestMediaKeySystemAccess` API.
|
|
28
|
+
*/
|
|
29
|
+
askedConfiguration: MediaKeySystemConfiguration;
|
|
25
30
|
/**
|
|
26
31
|
* Last MediaKeySystemAccess used to create a MediaKeys bound to that
|
|
27
32
|
* HTMLMediaElement.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media_keys_infos_store.d.ts","sourceRoot":"","sources":["../../../../../src/main_thread/decrypt/utils/media_keys_infos_store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,yBAAyB,CAAC;AAE/D,6EAA6E;AAC7E,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,qBAAqB,CAAC;IAEzC,6DAA6D;IAC7D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC;;;OAGG;IACH,oBAAoB,EAAE,2BAA2B,GAAG,oBAAoB,CAAC;IAEzE,8DAA8D;IAC9D,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAExC;;;OAGG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;;IASC;;;;OAIG;2BACoB,aAAa,SAAS,2BAA2B,GAAG,IAAI,GAAG,IAAI;IAItF;;;;OAIG;2BACoB,aAAa,GAAG,2BAA2B,GAAG,IAAI;IAKzE;;;OAGG;6BACsB,aAAa,GAAG,IAAI;;AAxB/C,wBA2BE"}
|
|
1
|
+
{"version":3,"file":"media_keys_infos_store.d.ts","sourceRoot":"","sources":["../../../../../src/main_thread/decrypt/utils/media_keys_infos_store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,yBAAyB,CAAC;AAE/D,6EAA6E;AAC7E,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,qBAAqB,CAAC;IAEzC,6DAA6D;IAC7D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC;;;OAGG;IACH,kBAAkB,EAAE,2BAA2B,CAAC;IAEhD;;;OAGG;IACH,oBAAoB,EAAE,2BAA2B,GAAG,oBAAoB,CAAC;IAEzE,8DAA8D;IAC9D,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAExC;;;OAGG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;;IASC;;;;OAIG;2BACoB,aAAa,SAAS,2BAA2B,GAAG,IAAI,GAAG,IAAI;IAItF;;;;OAIG;2BACoB,aAAa,GAAG,2BAA2B,GAAG,IAAI;IAKzE;;;OAGG;6BACsB,aAAa,GAAG,IAAI;;AAxB/C,wBA2BE"}
|