rx-player 4.3.0-dev.2024112900 → 4.3.0-dev.2025012900
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 +30 -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/main/worker/worker_main.js +1 -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.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/rebuffering_controller.js +20 -9
- 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/main/worker/worker_main.js +1 -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.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/rebuffering_controller.js +20 -9
- 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 +505 -372
- 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/main/worker/worker_main.ts +1 -1
- 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 +20 -10
- 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 -23
- 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
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2015 CANAL+ Group
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.disableMediaKeys = disableMediaKeys;
|
|
55
|
-
exports.default = attachMediaKeys;
|
|
56
|
-
var eme_1 = require("../../compat/eme");
|
|
57
|
-
var set_media_keys_1 = require("../../compat/eme/set_media_keys");
|
|
58
|
-
var errors_1 = require("../../errors");
|
|
59
|
-
var log_1 = require("../../log");
|
|
60
|
-
var media_keys_infos_store_1 = require("./utils/media_keys_infos_store");
|
|
61
|
-
/**
|
|
62
|
-
* Dispose of the MediaKeys instance attached to the given media element, if
|
|
63
|
-
* one.
|
|
64
|
-
* @param {Object} mediaElement
|
|
65
|
-
* @returns {Promise}
|
|
66
|
-
*/
|
|
67
|
-
function disableMediaKeys(mediaElement) {
|
|
68
|
-
var _a;
|
|
69
|
-
var previousState = media_keys_infos_store_1.default.getState(mediaElement);
|
|
70
|
-
media_keys_infos_store_1.default.setState(mediaElement, null);
|
|
71
|
-
return (0, set_media_keys_1.setMediaKeys)((_a = previousState === null || previousState === void 0 ? void 0 : previousState.emeImplementation) !== null && _a !== void 0 ? _a : eme_1.default, mediaElement, null);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Attach MediaKeys and its associated state to an HTMLMediaElement.
|
|
75
|
-
*
|
|
76
|
-
* /!\ Mutates heavily MediaKeysInfosStore
|
|
77
|
-
* @param {HTMLMediaElement} mediaElement
|
|
78
|
-
* @param {Object} mediaKeysInfos
|
|
79
|
-
* @param {Object} cancelSignal
|
|
80
|
-
* @returns {Promise}
|
|
81
|
-
*/
|
|
82
|
-
function attachMediaKeys(mediaElement_1, _a, cancelSignal_1) {
|
|
83
|
-
return __awaiter(this, arguments, void 0, function (mediaElement, _b, cancelSignal) {
|
|
84
|
-
var previousState, closeAllSessions;
|
|
85
|
-
var emeImplementation = _b.emeImplementation, keySystemOptions = _b.keySystemOptions, askedConfiguration = _b.askedConfiguration, loadedSessionsStore = _b.loadedSessionsStore, mediaKeySystemAccess = _b.mediaKeySystemAccess, mediaKeys = _b.mediaKeys;
|
|
86
|
-
return __generator(this, function (_c) {
|
|
87
|
-
switch (_c.label) {
|
|
88
|
-
case 0:
|
|
89
|
-
previousState = media_keys_infos_store_1.default.getState(mediaElement);
|
|
90
|
-
closeAllSessions = previousState !== null && previousState.loadedSessionsStore !== loadedSessionsStore
|
|
91
|
-
? previousState.loadedSessionsStore.closeAllSessions()
|
|
92
|
-
: Promise.resolve();
|
|
93
|
-
return [4 /*yield*/, closeAllSessions];
|
|
94
|
-
case 1:
|
|
95
|
-
_c.sent();
|
|
96
|
-
// If this task has been cancelled while we were closing previous sessions,
|
|
97
|
-
// stop now (and thus avoid setting the new media keys);
|
|
98
|
-
if (cancelSignal.isCancelled()) {
|
|
99
|
-
throw cancelSignal.cancellationError;
|
|
100
|
-
}
|
|
101
|
-
media_keys_infos_store_1.default.setState(mediaElement, {
|
|
102
|
-
emeImplementation: emeImplementation,
|
|
103
|
-
keySystemOptions: keySystemOptions,
|
|
104
|
-
mediaKeySystemAccess: mediaKeySystemAccess,
|
|
105
|
-
mediaKeys: mediaKeys,
|
|
106
|
-
loadedSessionsStore: loadedSessionsStore,
|
|
107
|
-
askedConfiguration: askedConfiguration,
|
|
108
|
-
});
|
|
109
|
-
if (mediaElement.mediaKeys === mediaKeys) {
|
|
110
|
-
return [2 /*return*/];
|
|
111
|
-
}
|
|
112
|
-
log_1.default.info("DRM: Attaching MediaKeys to the media element");
|
|
113
|
-
return [2 /*return*/, (0, set_media_keys_1.setMediaKeys)(emeImplementation, mediaElement, mediaKeys)
|
|
114
|
-
.then(function () {
|
|
115
|
-
log_1.default.info("DRM: MediaKeys attached with success");
|
|
116
|
-
})
|
|
117
|
-
.catch(function (err) {
|
|
118
|
-
var errMessage = err instanceof Error ? err.toString() : "Unknown Error";
|
|
119
|
-
throw new errors_1.EncryptedMediaError("MEDIA_KEYS_ATTACHMENT_ERROR", "Could not attach the MediaKeys to the media element: " + errMessage);
|
|
120
|
-
})];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2015 CANAL+ Group
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
// Store the MediaKeys infos attached to a media element.
|
|
19
|
-
var currentMediaState = new WeakMap();
|
|
20
|
-
exports.default = {
|
|
21
|
-
/**
|
|
22
|
-
* Update MediaKeys infos set on a HMTLMediaElement
|
|
23
|
-
* @param {HTMLMediaElement} mediaElement
|
|
24
|
-
* @param {Object} state
|
|
25
|
-
*/
|
|
26
|
-
setState: function (mediaElement, state) {
|
|
27
|
-
currentMediaState.set(mediaElement, state);
|
|
28
|
-
},
|
|
29
|
-
/**
|
|
30
|
-
* Get MediaKeys infos currently set on a HMTLMediaElement
|
|
31
|
-
* @param {HTMLMediaElement} mediaElement
|
|
32
|
-
* @returns {Object}
|
|
33
|
-
*/
|
|
34
|
-
getState: function (mediaElement) {
|
|
35
|
-
var currentState = currentMediaState.get(mediaElement);
|
|
36
|
-
return currentState === undefined ? null : currentState;
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Remove MediaKeys infos currently set on a HMTLMediaElement
|
|
40
|
-
* @param {HTMLMediaElement} mediaElement
|
|
41
|
-
*/
|
|
42
|
-
clearState: function (mediaElement) {
|
|
43
|
-
currentMediaState.set(mediaElement, null);
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IMediaElement } from "../../compat/browser_compatibility_types";
|
|
17
|
-
import type { ICustomMediaKeys, ICustomMediaKeySystemAccess, IEmeApiImplementation } from "../../compat/eme";
|
|
18
|
-
import type { IKeySystemOption } from "../../public_types";
|
|
19
|
-
import type { CancellationSignal } from "../../utils/task_canceller";
|
|
20
|
-
import type LoadedSessionsStore from "./utils/loaded_sessions_store";
|
|
21
|
-
/**
|
|
22
|
-
* Dispose of the MediaKeys instance attached to the given media element, if
|
|
23
|
-
* one.
|
|
24
|
-
* @param {Object} mediaElement
|
|
25
|
-
* @returns {Promise}
|
|
26
|
-
*/
|
|
27
|
-
export declare function disableMediaKeys(mediaElement: IMediaElement): Promise<unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* Attach MediaKeys and its associated state to an HTMLMediaElement.
|
|
30
|
-
*
|
|
31
|
-
* /!\ Mutates heavily MediaKeysInfosStore
|
|
32
|
-
* @param {HTMLMediaElement} mediaElement
|
|
33
|
-
* @param {Object} mediaKeysInfos
|
|
34
|
-
* @param {Object} cancelSignal
|
|
35
|
-
* @returns {Promise}
|
|
36
|
-
*/
|
|
37
|
-
export default function attachMediaKeys(mediaElement: IMediaElement, { emeImplementation, keySystemOptions, askedConfiguration, loadedSessionsStore, mediaKeySystemAccess, mediaKeys, }: IMediaKeysState, cancelSignal: CancellationSignal): Promise<void>;
|
|
38
|
-
/** MediaKeys and associated state attached to a media element. */
|
|
39
|
-
export interface IMediaKeysState {
|
|
40
|
-
/** Options set when the MediaKeys has been attached. */
|
|
41
|
-
keySystemOptions: IKeySystemOption;
|
|
42
|
-
/** LoadedSessionsStore associated to the MediaKeys instance. */
|
|
43
|
-
loadedSessionsStore: LoadedSessionsStore;
|
|
44
|
-
/** The MediaKeySystemAccess allowing to create MediaKeys instances. */
|
|
45
|
-
mediaKeySystemAccess: MediaKeySystemAccess | ICustomMediaKeySystemAccess;
|
|
46
|
-
/** The MediaKeys instance to attach to the media element. */
|
|
47
|
-
mediaKeys: MediaKeys | ICustomMediaKeys;
|
|
48
|
-
/**
|
|
49
|
-
* The MediaKeySystemConfiguration that has been provided to the
|
|
50
|
-
* `requestMediaKeySystemAccess` API.
|
|
51
|
-
*/
|
|
52
|
-
askedConfiguration: MediaKeySystemConfiguration;
|
|
53
|
-
/**
|
|
54
|
-
* The chosen EME implementation abstraction linked to `mediaKeys`.
|
|
55
|
-
* Different EME implementation might for example be used while debugging or
|
|
56
|
-
* work-arounding EME-linked device issues.
|
|
57
|
-
*/
|
|
58
|
-
emeImplementation: IEmeApiImplementation;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=attach_media_keys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attach_media_keys.d.ts","sourceRoot":"","sources":["../../../../src/main_thread/decrypt/attach_media_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,mBAAmB,MAAM,+BAA+B,CAAC;AAGrE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAI9E;AAED;;;;;;;;GAQG;AACH,wBAA8B,eAAe,CAC3C,YAAY,EAAE,aAAa,EAC3B,EACE,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,GACV,EAAE,eAAe,EAClB,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAsCf;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,gEAAgE;IAChE,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,uEAAuE;IACvE,oBAAoB,EAAE,oBAAoB,GAAG,2BAA2B,CAAC;IACzE,6DAA6D;IAC7D,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IACxC;;;OAGG;IACH,kBAAkB,EAAE,2BAA2B,CAAC;IAChD;;;;OAIG;IACH,iBAAiB,EAAE,qBAAqB,CAAC;CAC1C"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import eme from "../../compat/eme";
|
|
17
|
-
import { setMediaKeys } from "../../compat/eme/set_media_keys";
|
|
18
|
-
import { EncryptedMediaError } from "../../errors";
|
|
19
|
-
import log from "../../log";
|
|
20
|
-
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
21
|
-
/**
|
|
22
|
-
* Dispose of the MediaKeys instance attached to the given media element, if
|
|
23
|
-
* one.
|
|
24
|
-
* @param {Object} mediaElement
|
|
25
|
-
* @returns {Promise}
|
|
26
|
-
*/
|
|
27
|
-
export function disableMediaKeys(mediaElement) {
|
|
28
|
-
var _a;
|
|
29
|
-
const previousState = MediaKeysInfosStore.getState(mediaElement);
|
|
30
|
-
MediaKeysInfosStore.setState(mediaElement, null);
|
|
31
|
-
return setMediaKeys((_a = previousState === null || previousState === void 0 ? void 0 : previousState.emeImplementation) !== null && _a !== void 0 ? _a : eme, mediaElement, null);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Attach MediaKeys and its associated state to an HTMLMediaElement.
|
|
35
|
-
*
|
|
36
|
-
* /!\ Mutates heavily MediaKeysInfosStore
|
|
37
|
-
* @param {HTMLMediaElement} mediaElement
|
|
38
|
-
* @param {Object} mediaKeysInfos
|
|
39
|
-
* @param {Object} cancelSignal
|
|
40
|
-
* @returns {Promise}
|
|
41
|
-
*/
|
|
42
|
-
export default async function attachMediaKeys(mediaElement, { emeImplementation, keySystemOptions, askedConfiguration, loadedSessionsStore, mediaKeySystemAccess, mediaKeys, }, cancelSignal) {
|
|
43
|
-
const previousState = MediaKeysInfosStore.getState(mediaElement);
|
|
44
|
-
const closeAllSessions = previousState !== null && previousState.loadedSessionsStore !== loadedSessionsStore
|
|
45
|
-
? previousState.loadedSessionsStore.closeAllSessions()
|
|
46
|
-
: Promise.resolve();
|
|
47
|
-
await closeAllSessions;
|
|
48
|
-
// If this task has been cancelled while we were closing previous sessions,
|
|
49
|
-
// stop now (and thus avoid setting the new media keys);
|
|
50
|
-
if (cancelSignal.isCancelled()) {
|
|
51
|
-
throw cancelSignal.cancellationError;
|
|
52
|
-
}
|
|
53
|
-
MediaKeysInfosStore.setState(mediaElement, {
|
|
54
|
-
emeImplementation,
|
|
55
|
-
keySystemOptions,
|
|
56
|
-
mediaKeySystemAccess,
|
|
57
|
-
mediaKeys,
|
|
58
|
-
loadedSessionsStore,
|
|
59
|
-
askedConfiguration,
|
|
60
|
-
});
|
|
61
|
-
if (mediaElement.mediaKeys === mediaKeys) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
log.info("DRM: Attaching MediaKeys to the media element");
|
|
65
|
-
return setMediaKeys(emeImplementation, mediaElement, mediaKeys)
|
|
66
|
-
.then(() => {
|
|
67
|
-
log.info("DRM: MediaKeys attached with success");
|
|
68
|
-
})
|
|
69
|
-
.catch((err) => {
|
|
70
|
-
const errMessage = err instanceof Error ? err.toString() : "Unknown Error";
|
|
71
|
-
throw new EncryptedMediaError("MEDIA_KEYS_ATTACHMENT_ERROR", "Could not attach the MediaKeys to the media element: " + errMessage);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
// Store the MediaKeys infos attached to a media element.
|
|
17
|
-
const currentMediaState = new WeakMap();
|
|
18
|
-
export default {
|
|
19
|
-
/**
|
|
20
|
-
* Update MediaKeys infos set on a HMTLMediaElement
|
|
21
|
-
* @param {HTMLMediaElement} mediaElement
|
|
22
|
-
* @param {Object} state
|
|
23
|
-
*/
|
|
24
|
-
setState(mediaElement, state) {
|
|
25
|
-
currentMediaState.set(mediaElement, state);
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* Get MediaKeys infos currently set on a HMTLMediaElement
|
|
29
|
-
* @param {HTMLMediaElement} mediaElement
|
|
30
|
-
* @returns {Object}
|
|
31
|
-
*/
|
|
32
|
-
getState(mediaElement) {
|
|
33
|
-
const currentState = currentMediaState.get(mediaElement);
|
|
34
|
-
return currentState === undefined ? null : currentState;
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* Remove MediaKeys infos currently set on a HMTLMediaElement
|
|
38
|
-
* @param {HTMLMediaElement} mediaElement
|
|
39
|
-
*/
|
|
40
|
-
clearState(mediaElement) {
|
|
41
|
-
currentMediaState.set(mediaElement, null);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type { IMediaElement } from "../../compat/browser_compatibility_types";
|
|
18
|
-
import type {
|
|
19
|
-
ICustomMediaKeys,
|
|
20
|
-
ICustomMediaKeySystemAccess,
|
|
21
|
-
IEmeApiImplementation,
|
|
22
|
-
} from "../../compat/eme";
|
|
23
|
-
import eme from "../../compat/eme";
|
|
24
|
-
import { setMediaKeys } from "../../compat/eme/set_media_keys";
|
|
25
|
-
import { EncryptedMediaError } from "../../errors";
|
|
26
|
-
import log from "../../log";
|
|
27
|
-
import type { IKeySystemOption } from "../../public_types";
|
|
28
|
-
import type { CancellationSignal } from "../../utils/task_canceller";
|
|
29
|
-
import type LoadedSessionsStore from "./utils/loaded_sessions_store";
|
|
30
|
-
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Dispose of the MediaKeys instance attached to the given media element, if
|
|
34
|
-
* one.
|
|
35
|
-
* @param {Object} mediaElement
|
|
36
|
-
* @returns {Promise}
|
|
37
|
-
*/
|
|
38
|
-
export function disableMediaKeys(mediaElement: IMediaElement): Promise<unknown> {
|
|
39
|
-
const previousState = MediaKeysInfosStore.getState(mediaElement);
|
|
40
|
-
MediaKeysInfosStore.setState(mediaElement, null);
|
|
41
|
-
return setMediaKeys(previousState?.emeImplementation ?? eme, mediaElement, null);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Attach MediaKeys and its associated state to an HTMLMediaElement.
|
|
46
|
-
*
|
|
47
|
-
* /!\ Mutates heavily MediaKeysInfosStore
|
|
48
|
-
* @param {HTMLMediaElement} mediaElement
|
|
49
|
-
* @param {Object} mediaKeysInfos
|
|
50
|
-
* @param {Object} cancelSignal
|
|
51
|
-
* @returns {Promise}
|
|
52
|
-
*/
|
|
53
|
-
export default async function attachMediaKeys(
|
|
54
|
-
mediaElement: IMediaElement,
|
|
55
|
-
{
|
|
56
|
-
emeImplementation,
|
|
57
|
-
keySystemOptions,
|
|
58
|
-
askedConfiguration,
|
|
59
|
-
loadedSessionsStore,
|
|
60
|
-
mediaKeySystemAccess,
|
|
61
|
-
mediaKeys,
|
|
62
|
-
}: IMediaKeysState,
|
|
63
|
-
cancelSignal: CancellationSignal,
|
|
64
|
-
): Promise<void> {
|
|
65
|
-
const previousState = MediaKeysInfosStore.getState(mediaElement);
|
|
66
|
-
const closeAllSessions =
|
|
67
|
-
previousState !== null && previousState.loadedSessionsStore !== loadedSessionsStore
|
|
68
|
-
? previousState.loadedSessionsStore.closeAllSessions()
|
|
69
|
-
: Promise.resolve();
|
|
70
|
-
|
|
71
|
-
await closeAllSessions;
|
|
72
|
-
|
|
73
|
-
// If this task has been cancelled while we were closing previous sessions,
|
|
74
|
-
// stop now (and thus avoid setting the new media keys);
|
|
75
|
-
if (cancelSignal.isCancelled()) {
|
|
76
|
-
throw cancelSignal.cancellationError;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
MediaKeysInfosStore.setState(mediaElement, {
|
|
80
|
-
emeImplementation,
|
|
81
|
-
keySystemOptions,
|
|
82
|
-
mediaKeySystemAccess,
|
|
83
|
-
mediaKeys,
|
|
84
|
-
loadedSessionsStore,
|
|
85
|
-
askedConfiguration,
|
|
86
|
-
});
|
|
87
|
-
if (mediaElement.mediaKeys === mediaKeys) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
log.info("DRM: Attaching MediaKeys to the media element");
|
|
91
|
-
return setMediaKeys(emeImplementation, mediaElement, mediaKeys)
|
|
92
|
-
.then(() => {
|
|
93
|
-
log.info("DRM: MediaKeys attached with success");
|
|
94
|
-
})
|
|
95
|
-
.catch((err) => {
|
|
96
|
-
const errMessage = err instanceof Error ? err.toString() : "Unknown Error";
|
|
97
|
-
throw new EncryptedMediaError(
|
|
98
|
-
"MEDIA_KEYS_ATTACHMENT_ERROR",
|
|
99
|
-
"Could not attach the MediaKeys to the media element: " + errMessage,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** MediaKeys and associated state attached to a media element. */
|
|
105
|
-
export interface IMediaKeysState {
|
|
106
|
-
/** Options set when the MediaKeys has been attached. */
|
|
107
|
-
keySystemOptions: IKeySystemOption;
|
|
108
|
-
/** LoadedSessionsStore associated to the MediaKeys instance. */
|
|
109
|
-
loadedSessionsStore: LoadedSessionsStore;
|
|
110
|
-
/** The MediaKeySystemAccess allowing to create MediaKeys instances. */
|
|
111
|
-
mediaKeySystemAccess: MediaKeySystemAccess | ICustomMediaKeySystemAccess;
|
|
112
|
-
/** The MediaKeys instance to attach to the media element. */
|
|
113
|
-
mediaKeys: MediaKeys | ICustomMediaKeys;
|
|
114
|
-
/**
|
|
115
|
-
* The MediaKeySystemConfiguration that has been provided to the
|
|
116
|
-
* `requestMediaKeySystemAccess` API.
|
|
117
|
-
*/
|
|
118
|
-
askedConfiguration: MediaKeySystemConfiguration;
|
|
119
|
-
/**
|
|
120
|
-
* The chosen EME implementation abstraction linked to `mediaKeys`.
|
|
121
|
-
* Different EME implementation might for example be used while debugging or
|
|
122
|
-
* work-arounding EME-linked device issues.
|
|
123
|
-
*/
|
|
124
|
-
emeImplementation: IEmeApiImplementation;
|
|
125
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type { IMediaElement } from "../../../compat/browser_compatibility_types";
|
|
18
|
-
import type {
|
|
19
|
-
ICustomMediaKeys,
|
|
20
|
-
ICustomMediaKeySystemAccess,
|
|
21
|
-
IEmeApiImplementation,
|
|
22
|
-
} from "../../../compat/eme";
|
|
23
|
-
import type { IKeySystemOption } from "../../../public_types";
|
|
24
|
-
import type LoadedSessionsStore from "./loaded_sessions_store";
|
|
25
|
-
|
|
26
|
-
/** DRM-related state that can be associated to a single HTMLMediaElement. */
|
|
27
|
-
export interface IMediaElementMediaKeysInfos {
|
|
28
|
-
emeImplementation: IEmeApiImplementation;
|
|
29
|
-
|
|
30
|
-
/** Last keySystemOptions used with that HTMLMediaElement. */
|
|
31
|
-
keySystemOptions: IKeySystemOption;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The actual MediaKeySystemConfiguration asked to the
|
|
35
|
-
* `requestMediaKeySystemAccess` API.
|
|
36
|
-
*/
|
|
37
|
-
askedConfiguration: MediaKeySystemConfiguration;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Last MediaKeySystemAccess used to create a MediaKeys bound to that
|
|
41
|
-
* HTMLMediaElement.
|
|
42
|
-
*/
|
|
43
|
-
mediaKeySystemAccess: ICustomMediaKeySystemAccess | MediaKeySystemAccess;
|
|
44
|
-
|
|
45
|
-
/** Last MediaKeys instance bound to that HTMLMediaElement. */
|
|
46
|
-
mediaKeys: MediaKeys | ICustomMediaKeys;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Store containing information about every MediaKeySession active on the
|
|
50
|
-
* MediaKeys instance bound to that HTMLMediaElement.
|
|
51
|
-
*/
|
|
52
|
-
loadedSessionsStore: LoadedSessionsStore;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Store the MediaKeys infos attached to a media element.
|
|
56
|
-
const currentMediaState = new WeakMap<
|
|
57
|
-
IMediaElement,
|
|
58
|
-
IMediaElementMediaKeysInfos | null
|
|
59
|
-
>();
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
/**
|
|
63
|
-
* Update MediaKeys infos set on a HMTLMediaElement
|
|
64
|
-
* @param {HTMLMediaElement} mediaElement
|
|
65
|
-
* @param {Object} state
|
|
66
|
-
*/
|
|
67
|
-
setState(mediaElement: IMediaElement, state: IMediaElementMediaKeysInfos | null): void {
|
|
68
|
-
currentMediaState.set(mediaElement, state);
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get MediaKeys infos currently set on a HMTLMediaElement
|
|
73
|
-
* @param {HTMLMediaElement} mediaElement
|
|
74
|
-
* @returns {Object}
|
|
75
|
-
*/
|
|
76
|
-
getState(mediaElement: IMediaElement): IMediaElementMediaKeysInfos | null {
|
|
77
|
-
const currentState = currentMediaState.get(mediaElement);
|
|
78
|
-
return currentState === undefined ? null : currentState;
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Remove MediaKeys infos currently set on a HMTLMediaElement
|
|
83
|
-
* @param {HTMLMediaElement} mediaElement
|
|
84
|
-
*/
|
|
85
|
-
clearState(mediaElement: IMediaElement): void {
|
|
86
|
-
currentMediaState.set(mediaElement, null);
|
|
87
|
-
},
|
|
88
|
-
};
|