rx-player 4.3.0-dev.2024112900 → 4.3.0-dev.2025011000
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/CHANGELOG.md +24 -8
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.d.ts +7 -2
- package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.js +0 -1
- package/dist/commonjs/compat/browser_detection.js +1 -1
- package/dist/commonjs/compat/event_listeners.d.ts.map +1 -1
- package/dist/commonjs/compat/event_listeners.js +2 -4
- package/dist/commonjs/compat/has_mse_in_worker.d.ts.map +1 -1
- package/dist/commonjs/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
- package/dist/commonjs/core/cmcd/cmcd_data_builder.js +1 -2
- package/dist/commonjs/core/main/worker/send_message.d.ts.map +1 -1
- package/dist/commonjs/core/main/worker/send_message.js +0 -1
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +4 -8
- package/dist/commonjs/core/stream/period/period_stream.js +1 -3
- package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +1 -2
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/index.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +4 -4
- package/dist/commonjs/main_thread/decrypt/clear_on_stop.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/clear_on_stop.js +60 -14
- package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/content_decryptor.js +21 -9
- package/dist/commonjs/main_thread/decrypt/dispose_decryption_resources.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/dispose_decryption_resources.js +2 -18
- package/dist/commonjs/main_thread/decrypt/find_key_system.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/find_key_system.js +134 -68
- package/dist/commonjs/main_thread/decrypt/get_key_system_configuration.js +2 -2
- package/dist/commonjs/main_thread/decrypt/get_media_keys.js +5 -3
- package/dist/commonjs/main_thread/decrypt/init_media_keys.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/init_media_keys.js +2 -2
- package/dist/{es2017/main_thread/decrypt/utils/media_keys_infos_store.d.ts → commonjs/main_thread/decrypt/utils/media_keys_attacher.d.ts} +31 -9
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_attacher.d.ts.map +1 -0
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_attacher.js +282 -0
- package/dist/commonjs/main_thread/init/utils/rebuffering_controller.js +1 -1
- package/dist/commonjs/main_thread/text_displayer/html/text_track_cues_store.js +1 -1
- package/dist/commonjs/main_thread/tracks_store/track_dispatcher.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/track_dispatcher.js +3 -4
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/tracks_store.js +1 -1
- package/dist/commonjs/manifest/classes/representation.d.ts +15 -1
- package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/representation.js +17 -0
- package/dist/commonjs/manifest/utils.d.ts +15 -0
- package/dist/commonjs/manifest/utils.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +28 -5
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +2 -2
- package/dist/commonjs/playback_observer/media_element_playback_observer.js +1 -1
- package/dist/commonjs/public_types.d.ts +44 -0
- package/dist/commonjs/public_types.d.ts.map +1 -1
- package/dist/commonjs/utils/flat_map.d.ts +2 -2
- package/dist/commonjs/utils/flat_map.js +2 -2
- package/dist/commonjs/utils/url-utils.d.ts.map +1 -1
- package/dist/commonjs/utils/url-utils.js +11 -10
- package/dist/commonjs/utils/xml-parser.d.ts.map +1 -1
- package/dist/commonjs/utils/xml-parser.js +10 -8
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/browser_compatibility_types.d.ts +7 -2
- package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/es2017/compat/browser_compatibility_types.js +0 -1
- package/dist/es2017/compat/browser_detection.js +1 -1
- package/dist/es2017/compat/event_listeners.d.ts.map +1 -1
- package/dist/es2017/compat/event_listeners.js +2 -4
- package/dist/es2017/compat/has_mse_in_worker.d.ts.map +1 -1
- package/dist/es2017/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
- package/dist/es2017/core/cmcd/cmcd_data_builder.js +1 -2
- package/dist/es2017/core/main/worker/send_message.d.ts.map +1 -1
- package/dist/es2017/core/main/worker/send_message.js +0 -1
- package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +4 -6
- package/dist/es2017/core/stream/period/period_stream.js +1 -3
- package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +1 -2
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/index.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +4 -4
- package/dist/es2017/main_thread/decrypt/clear_on_stop.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/clear_on_stop.js +3 -3
- package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/content_decryptor.js +21 -9
- package/dist/es2017/main_thread/decrypt/dispose_decryption_resources.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/dispose_decryption_resources.js +2 -12
- package/dist/es2017/main_thread/decrypt/find_key_system.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/find_key_system.js +102 -56
- package/dist/es2017/main_thread/decrypt/get_key_system_configuration.js +2 -2
- package/dist/es2017/main_thread/decrypt/get_media_keys.js +2 -2
- package/dist/es2017/main_thread/decrypt/init_media_keys.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/init_media_keys.js +2 -2
- package/dist/{commonjs/main_thread/decrypt/utils/media_keys_infos_store.d.ts → es2017/main_thread/decrypt/utils/media_keys_attacher.d.ts} +31 -9
- package/dist/es2017/main_thread/decrypt/utils/media_keys_attacher.d.ts.map +1 -0
- package/dist/es2017/main_thread/decrypt/utils/media_keys_attacher.js +180 -0
- package/dist/es2017/main_thread/init/utils/rebuffering_controller.js +1 -1
- package/dist/es2017/main_thread/text_displayer/html/text_track_cues_store.js +1 -1
- package/dist/es2017/main_thread/tracks_store/track_dispatcher.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/track_dispatcher.js +3 -4
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/tracks_store.js +2 -2
- package/dist/es2017/manifest/classes/representation.d.ts +15 -1
- package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/representation.js +17 -0
- package/dist/es2017/manifest/utils.d.ts +15 -0
- package/dist/es2017/manifest/utils.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +27 -5
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +2 -2
- package/dist/es2017/playback_observer/media_element_playback_observer.js +1 -1
- package/dist/es2017/public_types.d.ts +44 -0
- package/dist/es2017/public_types.d.ts.map +1 -1
- package/dist/es2017/utils/flat_map.d.ts +2 -2
- package/dist/es2017/utils/flat_map.js +2 -2
- package/dist/es2017/utils/url-utils.d.ts.map +1 -1
- package/dist/es2017/utils/url-utils.js +11 -10
- package/dist/es2017/utils/xml-parser.d.ts.map +1 -1
- package/dist/es2017/utils/xml-parser.js +10 -8
- package/dist/rx-player.js +494 -364
- package/dist/rx-player.min.js +18 -18
- package/dist/worker.js +6 -6
- package/package.json +21 -19
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/browser_compatibility_types.ts +22 -4
- package/src/compat/browser_detection.ts +1 -1
- package/src/compat/event_listeners.ts +2 -4
- package/src/compat/has_mse_in_worker.ts +1 -1
- package/src/core/cmcd/cmcd_data_builder.ts +1 -4
- package/src/core/main/worker/send_message.ts +4 -2
- package/src/core/stream/adaptation/adaptation_stream.ts +4 -7
- package/src/core/stream/period/period_stream.ts +3 -3
- package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +1 -2
- package/src/main_thread/api/public_api.ts +4 -4
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +239 -6
- package/src/main_thread/decrypt/__tests__/find_key_system.test.ts +325 -0
- package/src/main_thread/decrypt/clear_on_stop.ts +3 -3
- package/src/main_thread/decrypt/content_decryptor.ts +26 -8
- package/src/main_thread/decrypt/dispose_decryption_resources.ts +2 -13
- package/src/main_thread/decrypt/find_key_system.ts +120 -81
- package/src/main_thread/decrypt/get_key_system_configuration.ts +2 -2
- package/src/main_thread/decrypt/get_media_keys.ts +2 -2
- package/src/main_thread/decrypt/init_media_keys.ts +2 -2
- package/src/main_thread/decrypt/utils/media_keys_attacher.ts +284 -0
- package/src/main_thread/init/utils/rebuffering_controller.ts +1 -1
- package/src/main_thread/text_displayer/html/text_track_cues_store.ts +1 -1
- package/src/main_thread/tracks_store/track_dispatcher.ts +3 -6
- package/src/main_thread/tracks_store/tracks_store.ts +2 -1
- package/src/manifest/classes/representation.ts +18 -1
- package/src/manifest/utils.ts +30 -9
- package/src/parsers/manifest/dash/common/parse_representations.ts +2 -2
- package/src/playback_observer/media_element_playback_observer.ts +1 -1
- package/src/public_types.ts +45 -0
- package/src/utils/__tests__/flat_map.test.ts +7 -20
- package/src/utils/flat_map.ts +2 -2
- package/src/utils/url-utils.ts +11 -10
- package/src/utils/xml-parser.ts +13 -8
- package/vitest.config.mjs +9 -4
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.d.ts +0 -60
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.d.ts.map +0 -1
- package/dist/commonjs/main_thread/decrypt/attach_media_keys.js +0 -124
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.d.ts.map +0 -1
- package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.js +0 -45
- package/dist/es2017/main_thread/decrypt/attach_media_keys.d.ts +0 -60
- package/dist/es2017/main_thread/decrypt/attach_media_keys.d.ts.map +0 -1
- package/dist/es2017/main_thread/decrypt/attach_media_keys.js +0 -73
- package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.d.ts.map +0 -1
- package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.js +0 -43
- package/src/main_thread/decrypt/attach_media_keys.ts +0 -125
- package/src/main_thread/decrypt/utils/media_keys_infos_store.ts +0 -88
|
@@ -112,37 +112,83 @@ var are_codecs_compatible_1 = require("../../utils/are_codecs_compatible");
|
|
|
112
112
|
var array_includes_1 = require("../../utils/array_includes");
|
|
113
113
|
var flat_map_1 = require("../../utils/flat_map");
|
|
114
114
|
var is_null_or_undefined_1 = require("../../utils/is_null_or_undefined");
|
|
115
|
-
var
|
|
115
|
+
var media_keys_attacher_1 = require("./utils/media_keys_attacher");
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
117
|
+
* Takes a `newConfiguration` `MediaKeySystemConfiguration`, that is intended
|
|
118
|
+
* for the creation of a `MediaKeySystemAccess`, and a `prevConfiguration`
|
|
119
|
+
* `MediaKeySystemConfiguration`, that was the one used at creation of the
|
|
120
|
+
* current `MediaKeySystemAccess`.
|
|
121
|
+
*
|
|
122
|
+
* This function will then return `true` if it determined that the new
|
|
123
|
+
* configuration is conceptually compatible with the one used before, and
|
|
124
|
+
* `false` otherwise.
|
|
125
|
+
* @param {Object} newConfiguration - New wanted `MediaKeySystemConfiguration`
|
|
126
|
+
* @param {Object} prevConfiguration - The `MediaKeySystemConfiguration` that is
|
|
127
|
+
* relied on util now.
|
|
128
|
+
* @returns {boolean} - `true` if `newConfiguration` is compatible with
|
|
129
|
+
* `prevConfiguration`.
|
|
122
130
|
*/
|
|
123
|
-
function
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
function isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(newConfiguration, prevConfiguration) {
|
|
132
|
+
var e_1, _a;
|
|
133
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
134
|
+
if (newConfiguration.label !== prevConfiguration.label) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
var prevDistinctiveIdentifier = (_b = prevConfiguration.distinctiveIdentifier) !== null && _b !== void 0 ? _b : "optional";
|
|
138
|
+
var newDistinctiveIdentifier = (_c = newConfiguration.distinctiveIdentifier) !== null && _c !== void 0 ? _c : "optional";
|
|
139
|
+
if (prevDistinctiveIdentifier !== newDistinctiveIdentifier) {
|
|
140
|
+
return false;
|
|
127
141
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
142
|
+
var prevPersistentState = (_d = prevConfiguration.persistentState) !== null && _d !== void 0 ? _d : "optional";
|
|
143
|
+
var newPersistentState = (_e = newConfiguration.persistentState) !== null && _e !== void 0 ? _e : "optional";
|
|
144
|
+
if (prevPersistentState !== newPersistentState) {
|
|
145
|
+
return false;
|
|
131
146
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return
|
|
147
|
+
var prevInitDataTypes = (_f = prevConfiguration.initDataTypes) !== null && _f !== void 0 ? _f : [];
|
|
148
|
+
var newInitDataTypes = (_g = newConfiguration.initDataTypes) !== null && _g !== void 0 ? _g : [];
|
|
149
|
+
if (!isArraySubsetOf(newInitDataTypes, prevInitDataTypes)) {
|
|
150
|
+
return false;
|
|
136
151
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
152
|
+
var prevSessionTypes = (_h = prevConfiguration.sessionTypes) !== null && _h !== void 0 ? _h : [];
|
|
153
|
+
var newSessionTypes = (_j = newConfiguration.sessionTypes) !== null && _j !== void 0 ? _j : [];
|
|
154
|
+
if (!isArraySubsetOf(newSessionTypes, prevSessionTypes)) {
|
|
155
|
+
return false;
|
|
140
156
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
var _loop_1 = function (prop) {
|
|
158
|
+
var newCapabilities = (_k = newConfiguration[prop]) !== null && _k !== void 0 ? _k : [];
|
|
159
|
+
var prevCapabilities = (_l = prevConfiguration[prop]) !== null && _l !== void 0 ? _l : [];
|
|
160
|
+
var wasFound = newCapabilities.every(function (n) {
|
|
161
|
+
var _a, _b, _c, _d, _e, _f;
|
|
162
|
+
for (var i = 0; i < prevCapabilities.length; i++) {
|
|
163
|
+
var prevCap = prevCapabilities[i];
|
|
164
|
+
if (((_a = prevCap.robustness) !== null && _a !== void 0 ? _a : "") === ((_b = n.robustness) !== null && _b !== void 0 ? _b : "") ||
|
|
165
|
+
((_c = prevCap.encryptionScheme) !== null && _c !== void 0 ? _c : null) === ((_d = n.encryptionScheme) !== null && _d !== void 0 ? _d : null) ||
|
|
166
|
+
((_e = prevCap.robustness) !== null && _e !== void 0 ? _e : "") === ((_f = n.robustness) !== null && _f !== void 0 ? _f : "")) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
});
|
|
172
|
+
if (!wasFound) {
|
|
173
|
+
return { value: false };
|
|
174
|
+
}
|
|
145
175
|
};
|
|
176
|
+
try {
|
|
177
|
+
for (var _m = __values(["audioCapabilities", "videoCapabilities"]), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
178
|
+
var prop = _o.value;
|
|
179
|
+
var state_1 = _loop_1(prop);
|
|
180
|
+
if (typeof state_1 === "object")
|
|
181
|
+
return state_1.value;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
185
|
+
finally {
|
|
186
|
+
try {
|
|
187
|
+
if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
|
|
188
|
+
}
|
|
189
|
+
finally { if (e_1) throw e_1.error; }
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
146
192
|
}
|
|
147
193
|
/**
|
|
148
194
|
* Find key system canonical name from key system type.
|
|
@@ -150,7 +196,7 @@ function checkCachedMediaKeySystemAccess(keySystem, askedConfiguration, currentK
|
|
|
150
196
|
* @returns {string|undefined} - Either the canonical name, or undefined.
|
|
151
197
|
*/
|
|
152
198
|
function findKeySystemCanonicalName(ksType) {
|
|
153
|
-
var
|
|
199
|
+
var e_2, _a;
|
|
154
200
|
var EME_KEY_SYSTEMS = config_1.default.getCurrent().EME_KEY_SYSTEMS;
|
|
155
201
|
try {
|
|
156
202
|
for (var _b = __values(Object.keys(EME_KEY_SYSTEMS)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -160,12 +206,12 @@ function findKeySystemCanonicalName(ksType) {
|
|
|
160
206
|
}
|
|
161
207
|
}
|
|
162
208
|
}
|
|
163
|
-
catch (
|
|
209
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
164
210
|
finally {
|
|
165
211
|
try {
|
|
166
212
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
167
213
|
}
|
|
168
|
-
finally { if (
|
|
214
|
+
finally { if (e_2) throw e_2.error; }
|
|
169
215
|
}
|
|
170
216
|
return undefined;
|
|
171
217
|
}
|
|
@@ -178,12 +224,22 @@ function findKeySystemCanonicalName(ksType) {
|
|
|
178
224
|
*/
|
|
179
225
|
function buildKeySystemConfigurations(keySystemTypeInfo) {
|
|
180
226
|
var keyName = keySystemTypeInfo.keyName, keyType = keySystemTypeInfo.keyType, keySystem = keySystemTypeInfo.keySystemOptions;
|
|
181
|
-
var sessionTypes
|
|
227
|
+
var sessionTypes;
|
|
182
228
|
var persistentState = "optional";
|
|
183
229
|
var distinctiveIdentifier = "optional";
|
|
184
|
-
if (
|
|
230
|
+
if (Array.isArray(keySystem.wantedSessionTypes)) {
|
|
231
|
+
sessionTypes = keySystem.wantedSessionTypes;
|
|
232
|
+
if ((0, array_includes_1.default)(keySystem.wantedSessionTypes, "persistent-license") &&
|
|
233
|
+
!(0, is_null_or_undefined_1.default)(keySystem.persistentLicenseConfig)) {
|
|
234
|
+
persistentState = "required";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (!(0, is_null_or_undefined_1.default)(keySystem.persistentLicenseConfig)) {
|
|
185
238
|
persistentState = "required";
|
|
186
|
-
sessionTypes
|
|
239
|
+
sessionTypes = ["persistent-license"];
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
sessionTypes = ["temporary"];
|
|
187
243
|
}
|
|
188
244
|
if (!(0, is_null_or_undefined_1.default)(keySystem.persistentState)) {
|
|
189
245
|
persistentState = keySystem.persistentState;
|
|
@@ -359,14 +415,7 @@ function extractCodecSupportListFromConfiguration(initialConfiguration, mksConfi
|
|
|
359
415
|
*/
|
|
360
416
|
function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal) {
|
|
361
417
|
log_1.default.info("DRM: Searching for compatible MediaKeySystemAccess");
|
|
362
|
-
/**
|
|
363
|
-
* Array of set keySystems for this content.
|
|
364
|
-
* Each item of this array is an object containing the following keys:
|
|
365
|
-
* - keyName {string}: keySystem canonical name (e.g. "widevine")
|
|
366
|
-
* - keyType {string}: keySystem type (e.g. "com.widevine.alpha")
|
|
367
|
-
* - keySystem {Object}: the original keySystem object
|
|
368
|
-
* @type {Array.<Object>}
|
|
369
|
-
*/
|
|
418
|
+
/** Array of set keySystems for this content. */
|
|
370
419
|
var keySystemsType = keySystemsConfigs.reduce(function (arr, keySystemOptions) {
|
|
371
420
|
var EME_KEY_SYSTEMS = config_1.default.getCurrent().EME_KEY_SYSTEMS;
|
|
372
421
|
var managedRDNs = EME_KEY_SYSTEMS[keySystemOptions.type];
|
|
@@ -397,7 +446,7 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
|
|
|
397
446
|
*/
|
|
398
447
|
function recursivelyTestKeySystems(index) {
|
|
399
448
|
return __awaiter(this, void 0, void 0, function () {
|
|
400
|
-
var chosenType,
|
|
449
|
+
var chosenType, keyType, keySystemOptions, keySystemConfigurations, keySystemAccess, currentState, configIdx, keySystemConfiguration, _1;
|
|
401
450
|
return __generator(this, function (_a) {
|
|
402
451
|
switch (_a.label) {
|
|
403
452
|
case 0:
|
|
@@ -411,38 +460,41 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
|
|
|
411
460
|
throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");
|
|
412
461
|
}
|
|
413
462
|
chosenType = keySystemsType[index];
|
|
414
|
-
currentState = media_keys_infos_store_1.default.getState(mediaElement);
|
|
415
|
-
if (currentState !== null) {
|
|
416
|
-
if (eme_1.default.implementation === currentState.emeImplementation.implementation) {
|
|
417
|
-
cachedKeySystemAccess = checkCachedMediaKeySystemAccess(chosenType.keySystemOptions, currentState.askedConfiguration, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
|
|
418
|
-
if (cachedKeySystemAccess !== null) {
|
|
419
|
-
log_1.default.info("DRM: Found cached compatible keySystem");
|
|
420
|
-
return [2 /*return*/, Promise.resolve({
|
|
421
|
-
type: "reuse-media-key-system-access",
|
|
422
|
-
value: {
|
|
423
|
-
mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
|
|
424
|
-
askedConfiguration: cachedKeySystemAccess.askedConfiguration,
|
|
425
|
-
options: cachedKeySystemAccess.keySystemOptions,
|
|
426
|
-
codecSupport: extractCodecSupportListFromConfiguration(cachedKeySystemAccess.askedConfiguration, cachedKeySystemAccess.keySystemAccess.getConfiguration()),
|
|
427
|
-
},
|
|
428
|
-
})];
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
463
|
keyType = chosenType.keyType, keySystemOptions = chosenType.keySystemOptions;
|
|
433
464
|
keySystemConfigurations = buildKeySystemConfigurations(chosenType);
|
|
434
465
|
log_1.default.debug("DRM: Request keysystem access ".concat(keyType, ",") +
|
|
435
466
|
"".concat(index + 1, " of ").concat(keySystemsType.length));
|
|
436
|
-
|
|
437
|
-
_a.label = 1;
|
|
467
|
+
return [4 /*yield*/, media_keys_attacher_1.default.getAttachedMediaKeysState(mediaElement)];
|
|
438
468
|
case 1:
|
|
439
|
-
|
|
440
|
-
|
|
469
|
+
currentState = _a.sent();
|
|
470
|
+
configIdx = 0;
|
|
441
471
|
_a.label = 2;
|
|
442
472
|
case 2:
|
|
443
|
-
|
|
444
|
-
|
|
473
|
+
if (!(configIdx < keySystemConfigurations.length)) return [3 /*break*/, 7];
|
|
474
|
+
keySystemConfiguration = keySystemConfigurations[configIdx];
|
|
475
|
+
// Check if the current `MediaKeySystemAccess` created cannot be reused here
|
|
476
|
+
if (currentState !== null &&
|
|
477
|
+
!(0, should_renew_media_key_system_access_1.default)() &&
|
|
478
|
+
// TODO: Do it with MediaKeySystemAccess.prototype.keySystem instead?
|
|
479
|
+
keyType === currentState.mediaKeySystemAccess.keySystem &&
|
|
480
|
+
eme_1.default.implementation === currentState.emeImplementation.implementation &&
|
|
481
|
+
isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(keySystemConfiguration, currentState.askedConfiguration)) {
|
|
482
|
+
log_1.default.info("DRM: Found cached compatible keySystem");
|
|
483
|
+
return [2 /*return*/, Promise.resolve({
|
|
484
|
+
type: "reuse-media-key-system-access",
|
|
485
|
+
value: {
|
|
486
|
+
mediaKeySystemAccess: currentState.mediaKeySystemAccess,
|
|
487
|
+
askedConfiguration: currentState.askedConfiguration,
|
|
488
|
+
options: keySystemOptions,
|
|
489
|
+
codecSupport: extractCodecSupportListFromConfiguration(currentState.askedConfiguration, currentState.mediaKeySystemAccess.getConfiguration()),
|
|
490
|
+
},
|
|
491
|
+
})];
|
|
492
|
+
}
|
|
493
|
+
_a.label = 3;
|
|
445
494
|
case 3:
|
|
495
|
+
_a.trys.push([3, 5, , 6]);
|
|
496
|
+
return [4 /*yield*/, testKeySystem(keyType, [keySystemConfiguration])];
|
|
497
|
+
case 4:
|
|
446
498
|
keySystemAccess = _a.sent();
|
|
447
499
|
log_1.default.info("DRM: Found compatible keysystem", keyType, index + 1);
|
|
448
500
|
return [2 /*return*/, {
|
|
@@ -454,17 +506,17 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
|
|
|
454
506
|
codecSupport: extractCodecSupportListFromConfiguration(keySystemConfiguration, keySystemAccess.getConfiguration()),
|
|
455
507
|
},
|
|
456
508
|
}];
|
|
457
|
-
case
|
|
509
|
+
case 5:
|
|
458
510
|
_1 = _a.sent();
|
|
459
511
|
log_1.default.debug("DRM: Rejected access to keysystem", keyType, index + 1, configIdx);
|
|
460
512
|
if (cancelSignal.cancellationError !== null) {
|
|
461
513
|
throw cancelSignal.cancellationError;
|
|
462
514
|
}
|
|
463
|
-
return [3 /*break*/,
|
|
464
|
-
case
|
|
515
|
+
return [3 /*break*/, 6];
|
|
516
|
+
case 6:
|
|
465
517
|
configIdx++;
|
|
466
|
-
return [3 /*break*/,
|
|
467
|
-
case
|
|
518
|
+
return [3 /*break*/, 2];
|
|
519
|
+
case 7: return [2 /*return*/, recursivelyTestKeySystems(index + 1)];
|
|
468
520
|
}
|
|
469
521
|
});
|
|
470
522
|
});
|
|
@@ -510,3 +562,17 @@ function testKeySystem(keyType, keySystemConfigurations) {
|
|
|
510
562
|
});
|
|
511
563
|
});
|
|
512
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Returns `true` if `arr1`'s values are entirely contained in `arr2`.
|
|
567
|
+
* @param {string} arr1
|
|
568
|
+
* @param {string} arr2
|
|
569
|
+
* @return {boolean}
|
|
570
|
+
*/
|
|
571
|
+
function isArraySubsetOf(arr1, arr2) {
|
|
572
|
+
for (var i = 0; i < arr1.length; i++) {
|
|
573
|
+
if (!(0, array_includes_1.default)(arr2, arr1[i])) {
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return true;
|
|
578
|
+
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.default = getKeySystemConfiguration;
|
|
19
|
-
var
|
|
19
|
+
var media_keys_attacher_1 = require("./utils/media_keys_attacher");
|
|
20
20
|
/**
|
|
21
21
|
* Returns the name of the current key system used as well as its configuration,
|
|
22
22
|
* as reported by the `MediaKeySystemAccess` itself.
|
|
@@ -24,7 +24,7 @@ var media_keys_infos_store_1 = require("./utils/media_keys_infos_store");
|
|
|
24
24
|
* @returns {Array|null}
|
|
25
25
|
*/
|
|
26
26
|
function getKeySystemConfiguration(mediaElement) {
|
|
27
|
-
var currentState =
|
|
27
|
+
var currentState = media_keys_attacher_1.default.getAwaitedState(mediaElement);
|
|
28
28
|
if (currentState === null) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -58,7 +58,7 @@ var log_1 = require("../../log");
|
|
|
58
58
|
var is_null_or_undefined_1 = require("../../utils/is_null_or_undefined");
|
|
59
59
|
var find_key_system_1 = require("./find_key_system");
|
|
60
60
|
var loaded_sessions_store_1 = require("./utils/loaded_sessions_store");
|
|
61
|
-
var
|
|
61
|
+
var media_keys_attacher_1 = require("./utils/media_keys_attacher");
|
|
62
62
|
var persistent_sessions_store_1 = require("./utils/persistent_sessions_store");
|
|
63
63
|
var server_certificate_store_1 = require("./utils/server_certificate_store");
|
|
64
64
|
/**
|
|
@@ -99,7 +99,9 @@ function getMediaKeysInfos(mediaElement, keySystemsConfigs, cancelSignal) {
|
|
|
99
99
|
throw cancelSignal.cancellationError;
|
|
100
100
|
}
|
|
101
101
|
_a = evt.value, options = _a.options, mediaKeySystemAccess = _a.mediaKeySystemAccess, askedConfiguration = _a.askedConfiguration, codecSupport = _a.codecSupport;
|
|
102
|
-
|
|
102
|
+
return [4 /*yield*/, media_keys_attacher_1.default.getAttachedMediaKeysState(mediaElement)];
|
|
103
|
+
case 2:
|
|
104
|
+
currentState = _b.sent();
|
|
103
105
|
persistentSessionsStore = createPersistentSessionsStorage(options);
|
|
104
106
|
if (evt.value.options.reuseMediaKeys !== false &&
|
|
105
107
|
(0, can_reuse_media_keys_1.default)() &&
|
|
@@ -124,7 +126,7 @@ function getMediaKeysInfos(mediaElement, keySystemsConfigs, cancelSignal) {
|
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
return [4 /*yield*/, createMediaKeys(mediaKeySystemAccess)];
|
|
127
|
-
case
|
|
129
|
+
case 3:
|
|
128
130
|
mediaKeys = _b.sent();
|
|
129
131
|
log_1.default.info("DRM: MediaKeys created with success");
|
|
130
132
|
loadedSessionsStore = new loaded_sessions_store_1.default(mediaKeys);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init_media_keys.d.ts","sourceRoot":"","sources":["../../../../src/main_thread/decrypt/init_media_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"init_media_keys.d.ts","sourceRoot":"","sources":["../../../../src/main_thread/decrypt/init_media_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxD;;;;;;GAMG;AACH,wBAA8B,aAAa,CACzC,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAkB1B"}
|
|
@@ -53,8 +53,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.default = initMediaKeys;
|
|
55
55
|
var log_1 = require("../../log");
|
|
56
|
-
var attach_media_keys_1 = require("./attach_media_keys");
|
|
57
56
|
var get_media_keys_1 = require("./get_media_keys");
|
|
57
|
+
var media_keys_attacher_1 = require("./utils/media_keys_attacher");
|
|
58
58
|
/**
|
|
59
59
|
* Get media keys infos from key system configs then attach media keys to media element.
|
|
60
60
|
* @param {HTMLMediaElement} mediaElement
|
|
@@ -76,7 +76,7 @@ function initMediaKeys(mediaElement, keySystemsConfigs, cancelSignal) {
|
|
|
76
76
|
mediaKeys !== mediaElement.mediaKeys;
|
|
77
77
|
if (!shouldDisableOldMediaKeys) return [3 /*break*/, 3];
|
|
78
78
|
log_1.default.debug("DRM: Disabling old MediaKeys");
|
|
79
|
-
return [4 /*yield*/,
|
|
79
|
+
return [4 /*yield*/, media_keys_attacher_1.default.clearMediaKeys(mediaElement)];
|
|
80
80
|
case 2:
|
|
81
81
|
_a.sent();
|
|
82
82
|
_a.label = 3;
|
|
@@ -42,22 +42,44 @@ export interface IMediaElementMediaKeysInfos {
|
|
|
42
42
|
}
|
|
43
43
|
declare const _default: {
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Attach new MediaKeys infos set on a HMTLMediaElement.
|
|
46
46
|
* @param {HTMLMediaElement} mediaElement
|
|
47
|
-
* @param {Object}
|
|
47
|
+
* @param {Object} mediaKeysInfo
|
|
48
|
+
* @returns {Promise}
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
|
+
attach(mediaElement: IMediaElement, mediaKeysInfo: IMediaElementMediaKeysInfos): Promise<void>;
|
|
50
51
|
/**
|
|
51
|
-
* Get MediaKeys
|
|
52
|
+
* Get MediaKeys information expected to be linked to the given
|
|
53
|
+
* `HTMLMediaElement`.
|
|
54
|
+
*
|
|
55
|
+
* Unlike `getAttachedMediaKeysState`, this method is synchronous and will
|
|
56
|
+
* also return the expected state when `MediaKeys` attachment is still
|
|
57
|
+
* pending and thus when that state is not truly applied (and where it
|
|
58
|
+
* might fail before being applied).
|
|
59
|
+
*
|
|
60
|
+
* As such, only call this method if you want the currently expected state,
|
|
61
|
+
* not the actual one.
|
|
52
62
|
* @param {HTMLMediaElement} mediaElement
|
|
53
|
-
* @returns {
|
|
63
|
+
* @returns {Array}
|
|
54
64
|
*/
|
|
55
|
-
|
|
65
|
+
getAwaitedState(mediaElement: IMediaElement): IMediaElementMediaKeysInfos | null;
|
|
56
66
|
/**
|
|
57
|
-
*
|
|
67
|
+
* Get MediaKeys information set on a HMTLMediaElement.
|
|
68
|
+
*
|
|
69
|
+
* This method is asynchronous because that state may still be in a process
|
|
70
|
+
* of being attached to the `HTMLMediaElement` (and the state we're
|
|
71
|
+
* currently setting may not work out).
|
|
58
72
|
* @param {HTMLMediaElement} mediaElement
|
|
73
|
+
* @returns {Object|null}
|
|
59
74
|
*/
|
|
60
|
-
|
|
75
|
+
getAttachedMediaKeysState(mediaElement: IMediaElement): Promise<IMediaElementMediaKeysInfos | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Remove MediaKeys currently set on a HMTLMediaElement and update state
|
|
78
|
+
* accordingly.
|
|
79
|
+
* @param {HTMLMediaElement} mediaElement
|
|
80
|
+
* @returns {Promise}
|
|
81
|
+
*/
|
|
82
|
+
clearMediaKeys(mediaElement: IMediaElement): Promise<void>;
|
|
61
83
|
};
|
|
62
84
|
export default _default;
|
|
63
|
-
//# sourceMappingURL=
|
|
85
|
+
//# sourceMappingURL=media_keys_attacher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media_keys_attacher.d.ts","sourceRoot":"","sources":["../../../../../src/main_thread/decrypt/utils/media_keys_attacher.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;AAI7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,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;;IA6BC;;;;;OAKG;yBAEa,aAAa,iBACZ,2BAA2B,GACzC,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;;;;;;;;;;OAaG;kCAC2B,aAAa,GAAG,2BAA2B,GAAG,IAAI;IAKhF;;;;;;;;OAQG;4CAEa,aAAa,GAC1B,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAY9C;;;;;OAKG;iCAC0B,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;;AAjF5D,wBAuGE"}
|