rx-player 3.33.4 → 3.33.5-dev.2025040100
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 +29 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.js +1 -1
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +1 -1
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +39 -1
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +5 -1
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -66
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +26 -18
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +4 -0
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +27 -45
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +0 -3
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +0 -3
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +248 -206
- package/dist/rx-player.min.js +1 -1
- package/package.json +3 -3
- package/.vscode/settings.json +0 -9
- package/experimental/features/index.d.ts-E +0 -16
- package/experimental/features/index.js-E +0 -16
- package/experimental/index.d.ts-E +0 -16
- package/experimental/index.js-E +0 -16
- package/experimental/tools/VideoThumbnailLoader/index.d.ts-E +0 -18
- package/experimental/tools/VideoThumbnailLoader/index.js-E +0 -18
- package/experimental/tools/index.d.ts-E +0 -16
- package/experimental/tools/index.js-E +0 -16
- package/features/index.d.ts-E +0 -16
- package/features/index.js-E +0 -16
- package/logger/index.d.ts-E +0 -17
- package/logger/index.js-E +0 -17
- package/minimal/index.d.ts-E +0 -17
- package/minimal/index.js-E +0 -17
- package/tools/TextTrackRenderer.d.ts-E +0 -18
- package/tools/TextTrackRenderer.js-E +0 -18
- package/tools/index.d.ts-E +0 -16
- package/tools/index.js-E +0 -16
- package/tools/string-utils.d.ts-E +0 -18
- package/tools/string-utils.js-E +0 -18
- package/types/index.d.ts-E +0 -16
- package/types/index.js-E +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.33.
|
|
3
|
+
## Current dev build: v3.33.5-dev.2025040100
|
|
4
|
+
|
|
5
|
+
### Bug fixes
|
|
6
|
+
|
|
7
|
+
- DRM: fix typo which prevented `MediaKeys` reusage on some devices including desktop
|
|
8
|
+
browsers [#1679]
|
|
9
|
+
- DRM: Only ask for `"persistent-license"` `MediaKeySession` (and not also for
|
|
10
|
+
`"temporary"` license) when the `keySystems[].persistentLicense` option is set to `true`
|
|
11
|
+
- DRM: Fix reusage of some `keySystems[]` option changing when reusing a
|
|
12
|
+
`MediaKeySystemAccess` with a different `keySystems[]` configuration [#1678]
|
|
13
|
+
- DRM: Fix `KEY_UPDATE_ERROR` which was mistakenly inheriting the code `KEY_LOAD_ERROR`
|
|
14
|
+
[#1682]
|
|
15
|
+
- Fix minor memory leak when switching RepresentationStream through ABR [#1681]
|
|
16
|
+
- fix rare infinite rebuffering issues that may happen when updating tracks in a
|
|
17
|
+
`newAvailablePeriods` event [#1680]
|
|
18
|
+
|
|
19
|
+
### Other improvements
|
|
20
|
+
|
|
21
|
+
- Compat: Limit long "FREEZING" issues on Tizen (samsung) by awaiting for browser action
|
|
22
|
+
before seeking ourselves over a discontinuity [#1673]
|
|
23
|
+
- DRM: Only reuse cached `MediaKeySystemAccess` if none is more wanted for the current
|
|
24
|
+
content [#1674]
|
|
25
|
+
- DRM: Reuse cache even if key system type given in API is not the same
|
|
26
|
+
- DEBUG_ELEMENT: Add buffer size estimate to debug buffer content graph [#1672]
|
|
27
|
+
- DEBUG_ELEMENT: Add `hdr` information to video Representation [#1671]
|
|
28
|
+
- Avoid error log when stopping a stream with a pending `BufferGarbageCollector` buffer
|
|
29
|
+
removal [#1685]
|
|
30
|
+
|
|
31
|
+
## v3.33.4
|
|
4
32
|
|
|
5
33
|
### Bug fixes
|
|
6
34
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.33.
|
|
1
|
+
3.33.5-dev.2025040100
|
|
@@ -126,7 +126,7 @@ var isA1KStb40xx = false;
|
|
|
126
126
|
else if (navigator.userAgent.indexOf("Xbox") !== -1) {
|
|
127
127
|
isXbox = true;
|
|
128
128
|
}
|
|
129
|
-
else if (navigator.userAgent.indexOf("Model/a1-kstb40xx")) {
|
|
129
|
+
else if (navigator.userAgent.indexOf("Model/a1-kstb40xx") !== -1) {
|
|
130
130
|
isA1KStb40xx = true;
|
|
131
131
|
}
|
|
132
132
|
})();
|
|
@@ -136,7 +136,7 @@ function getEmeApiImplementation(preferredApiType) {
|
|
|
136
136
|
initDataTypes: ["cenc"],
|
|
137
137
|
distinctiveIdentifier: "not-allowed",
|
|
138
138
|
persistentState: "required",
|
|
139
|
-
sessionTypes: ["
|
|
139
|
+
sessionTypes: ["persistent-license"],
|
|
140
140
|
};
|
|
141
141
|
if (videoCapabilities !== undefined) {
|
|
142
142
|
keySystemConfigurationResponse.videoCapabilities = videoCapabilities;
|
|
@@ -6,6 +6,7 @@ export default function createSegmentBufferGraph(instance, bufferType, title, pa
|
|
|
6
6
|
var bufferGraphWrapper = createElement("div");
|
|
7
7
|
var bufferTitle = createMetricTitle(title);
|
|
8
8
|
var canvasElt = createGraphCanvas();
|
|
9
|
+
var bufferSizeElt = document.createElement("span");
|
|
9
10
|
var currentRangeRepInfoElt = createElement("div");
|
|
10
11
|
var loadingRangeRepInfoElt = createElement("div");
|
|
11
12
|
var bufferGraph = new SegmentBufferGraph(canvasElt);
|
|
@@ -15,8 +16,11 @@ export default function createSegmentBufferGraph(instance, bufferType, title, pa
|
|
|
15
16
|
});
|
|
16
17
|
bufferGraphWrapper.appendChild(bufferTitle);
|
|
17
18
|
bufferGraphWrapper.appendChild(canvasElt);
|
|
19
|
+
bufferGraphWrapper.appendChild(bufferSizeElt);
|
|
18
20
|
bufferGraphWrapper.appendChild(currentRangeRepInfoElt);
|
|
19
21
|
bufferGraphWrapper.appendChild(loadingRangeRepInfoElt);
|
|
22
|
+
bufferSizeElt.style.marginLeft = "5px";
|
|
23
|
+
bufferSizeElt.style.fontSize = "0.9em";
|
|
20
24
|
bufferGraphWrapper.style.padding = "5px 0px";
|
|
21
25
|
update();
|
|
22
26
|
return bufferGraphWrapper;
|
|
@@ -33,11 +37,42 @@ export default function createSegmentBufferGraph(instance, bufferType, title, pa
|
|
|
33
37
|
var inventory = instance.__priv_getSegmentBufferContent(bufferType);
|
|
34
38
|
if (inventory === null) {
|
|
35
39
|
bufferGraphWrapper.style.display = "none";
|
|
40
|
+
bufferSizeElt.innerHTML = "";
|
|
36
41
|
currentRangeRepInfoElt.innerHTML = "";
|
|
37
42
|
loadingRangeRepInfoElt.innerHTML = "";
|
|
38
43
|
}
|
|
39
44
|
else {
|
|
45
|
+
var sizeEstimate = void 0;
|
|
46
|
+
for (var _i = 0, inventory_1 = inventory; _i < inventory_1.length; _i++) {
|
|
47
|
+
var segment = inventory_1[_i];
|
|
48
|
+
if (segment.chunkSize === undefined) {
|
|
49
|
+
sizeEstimate = undefined;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
else if (sizeEstimate === undefined) {
|
|
53
|
+
sizeEstimate = segment.chunkSize;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
sizeEstimate += segment.chunkSize;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
40
59
|
bufferGraphWrapper.style.display = "block";
|
|
60
|
+
if (sizeEstimate !== undefined) {
|
|
61
|
+
var sizeStr = void 0;
|
|
62
|
+
if (sizeEstimate > 2e6) {
|
|
63
|
+
sizeStr = (sizeEstimate / 1e6).toFixed(2) + "MB";
|
|
64
|
+
}
|
|
65
|
+
else if (sizeEstimate > 2e3) {
|
|
66
|
+
sizeStr = (sizeEstimate / 1e3).toFixed(2) + "kB";
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
sizeStr = sizeEstimate + "B";
|
|
70
|
+
}
|
|
71
|
+
bufferSizeElt.innerHTML = sizeStr;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
bufferSizeElt.innerHTML = "";
|
|
75
|
+
}
|
|
41
76
|
var currentTime = instance.getPosition();
|
|
42
77
|
var width = Math.min(parentElt.clientWidth - 150, 600);
|
|
43
78
|
bufferGraph.update({
|
|
@@ -92,7 +127,7 @@ function constructRepresentationInfo(content) {
|
|
|
92
127
|
var _a;
|
|
93
128
|
var period = content.period;
|
|
94
129
|
var _b = content.adaptation, language = _b.language, isAudioDescription = _b.isAudioDescription, isClosedCaption = _b.isClosedCaption, isTrickModeTrack = _b.isTrickModeTrack, isSignInterpreted = _b.isSignInterpreted, bufferType = _b.type;
|
|
95
|
-
var _c = content.representation, id = _c.id, height = _c.height, width = _c.width, bitrate = _c.bitrate, codec = _c.codec;
|
|
130
|
+
var _c = content.representation, id = _c.id, height = _c.height, width = _c.width, bitrate = _c.bitrate, codec = _c.codec, hdrInfo = _c.hdrInfo;
|
|
96
131
|
var representationInfo = "\"".concat(id, "\" ");
|
|
97
132
|
if (height !== undefined && width !== undefined) {
|
|
98
133
|
representationInfo += "".concat(width, "x").concat(height, " ");
|
|
@@ -106,6 +141,9 @@ function constructRepresentationInfo(content) {
|
|
|
106
141
|
if (language !== undefined) {
|
|
107
142
|
representationInfo += "l:\"".concat(language, "\" ");
|
|
108
143
|
}
|
|
144
|
+
if (bufferType === "video" && hdrInfo !== undefined) {
|
|
145
|
+
representationInfo += "hdr:1 ";
|
|
146
|
+
}
|
|
109
147
|
if (bufferType === "video" && typeof isSignInterpreted === "boolean") {
|
|
110
148
|
representationInfo += "si:".concat(isSignInterpreted ? 1 : 0, " ");
|
|
111
149
|
}
|
|
@@ -88,7 +88,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
88
88
|
// Workaround to support Firefox autoplay on FF 42.
|
|
89
89
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
90
90
|
videoElement.preload = "auto";
|
|
91
|
-
_this.version = /* PLAYER_VERSION */ "3.33.
|
|
91
|
+
_this.version = /* PLAYER_VERSION */ "3.33.5-dev.2025040100";
|
|
92
92
|
_this.log = log;
|
|
93
93
|
_this.state = "STOPPED";
|
|
94
94
|
_this.videoElement = videoElement;
|
|
@@ -2520,5 +2520,5 @@ var Player = /** @class */ (function (_super) {
|
|
|
2520
2520
|
Player._priv_currentlyUsedVideoElements = new WeakSet();
|
|
2521
2521
|
return Player;
|
|
2522
2522
|
}(EventEmitter));
|
|
2523
|
-
Player.version = /* PLAYER_VERSION */ "3.33.
|
|
2523
|
+
Player.version = /* PLAYER_VERSION */ "3.33.5-dev.2025040100";
|
|
2524
2524
|
export default Player;
|
|
@@ -121,12 +121,14 @@ var TrackChoiceManager = /** @class */ (function () {
|
|
|
121
121
|
*/
|
|
122
122
|
TrackChoiceManager.prototype.addPeriod = function (bufferType, period, adaptationRef) {
|
|
123
123
|
var _a;
|
|
124
|
+
var _b;
|
|
125
|
+
log.debug("TCM: Adding Track Reference", bufferType, period.id);
|
|
124
126
|
var periodItem = getPeriodItem(this._periods, period);
|
|
125
127
|
var adaptations = period.getSupportedAdaptations(bufferType);
|
|
126
128
|
if (periodItem !== undefined) {
|
|
127
129
|
if (periodItem[bufferType] !== undefined) {
|
|
128
130
|
log.warn("TrackChoiceManager: ".concat(bufferType, " already added for period"), period.start);
|
|
129
|
-
|
|
131
|
+
(_b = periodItem[bufferType]) === null || _b === void 0 ? void 0 : _b.adaptationRef.finish();
|
|
130
132
|
}
|
|
131
133
|
else {
|
|
132
134
|
periodItem[bufferType] = { adaptations: adaptations, adaptationRef: adaptationRef };
|
|
@@ -143,6 +145,7 @@ var TrackChoiceManager = /** @class */ (function () {
|
|
|
143
145
|
* @param {Period} period - The concerned Period.
|
|
144
146
|
*/
|
|
145
147
|
TrackChoiceManager.prototype.removePeriod = function (bufferType, period) {
|
|
148
|
+
log.debug("TCM: Removing Track Reference", bufferType, period.id);
|
|
146
149
|
var periodIndex = findPeriodIndex(this._periods, period);
|
|
147
150
|
if (periodIndex === undefined) {
|
|
148
151
|
log.warn("TrackChoiceManager: ".concat(bufferType, " not found for period"), period.start);
|
|
@@ -161,6 +164,7 @@ var TrackChoiceManager = /** @class */ (function () {
|
|
|
161
164
|
}
|
|
162
165
|
};
|
|
163
166
|
TrackChoiceManager.prototype.resetPeriods = function () {
|
|
167
|
+
log.debug("TCM: Resetting Period Objects");
|
|
164
168
|
while (this._periods.length() > 0) {
|
|
165
169
|
this._periods.pop();
|
|
166
170
|
}
|
|
@@ -72,40 +72,71 @@ import flatMap from "../../utils/flat_map";
|
|
|
72
72
|
import isNullOrUndefined from "../../utils/is_null_or_undefined";
|
|
73
73
|
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
75
|
+
* Takes a `newConfiguration` `MediaKeySystemConfiguration`, that is intended
|
|
76
|
+
* for the creation of a `MediaKeySystemAccess`, and a `prevConfiguration`
|
|
77
|
+
* `MediaKeySystemConfiguration`, that was the one used at creation of the
|
|
78
|
+
* current `MediaKeySystemAccess`.
|
|
79
|
+
*
|
|
80
|
+
* This function will then return `true` if it determined that the new
|
|
81
|
+
* configuration is conceptually compatible with the one used before, and
|
|
82
|
+
* `false` otherwise.
|
|
83
|
+
* @param {Object} newConfiguration - New wanted `MediaKeySystemConfiguration`
|
|
84
|
+
* @param {Object} prevConfiguration - The `MediaKeySystemConfiguration` that is
|
|
85
|
+
* relied on util now.
|
|
86
|
+
* @returns {boolean} - `true` if `newConfiguration` is compatible with
|
|
87
|
+
* `prevConfiguration`.
|
|
80
88
|
*/
|
|
81
|
-
function
|
|
82
|
-
var
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
89
|
+
function isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(newConfiguration, prevConfiguration) {
|
|
90
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
91
|
+
if (newConfiguration.label !== prevConfiguration.label) {
|
|
92
|
+
return false;
|
|
85
93
|
}
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
var prevDistinctiveIdentifier = (_a = prevConfiguration.distinctiveIdentifier) !== null && _a !== void 0 ? _a : "optional";
|
|
95
|
+
var newDistinctiveIdentifier = (_b = newConfiguration.distinctiveIdentifier) !== null && _b !== void 0 ? _b : "optional";
|
|
96
|
+
if (prevDistinctiveIdentifier !== newDistinctiveIdentifier) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
var prevPersistentState = (_c = prevConfiguration.persistentState) !== null && _c !== void 0 ? _c : "optional";
|
|
100
|
+
var newPersistentState = (_d = newConfiguration.persistentState) !== null && _d !== void 0 ? _d : "optional";
|
|
101
|
+
if (prevPersistentState !== newPersistentState) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
var prevInitDataTypes = (_e = prevConfiguration.initDataTypes) !== null && _e !== void 0 ? _e : [];
|
|
105
|
+
var newInitDataTypes = (_f = newConfiguration.initDataTypes) !== null && _f !== void 0 ? _f : [];
|
|
106
|
+
if (!isArraySubsetOf(newInitDataTypes, prevInitDataTypes)) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
var prevSessionTypes = (_g = prevConfiguration.sessionTypes) !== null && _g !== void 0 ? _g : [];
|
|
110
|
+
var newSessionTypes = (_h = newConfiguration.sessionTypes) !== null && _h !== void 0 ? _h : [];
|
|
111
|
+
if (!isArraySubsetOf(newSessionTypes, prevSessionTypes)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
var _loop_1 = function (prop) {
|
|
115
|
+
var newCapabilities = (_j = newConfiguration[prop]) !== null && _j !== void 0 ? _j : [];
|
|
116
|
+
var prevCapabilities = (_k = prevConfiguration[prop]) !== null && _k !== void 0 ? _k : [];
|
|
117
|
+
var wasFound = newCapabilities.every(function (n) {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f;
|
|
119
|
+
for (var i = 0; i < prevCapabilities.length; i++) {
|
|
120
|
+
var prevCap = prevCapabilities[i];
|
|
121
|
+
if (((_a = prevCap.robustness) !== null && _a !== void 0 ? _a : "") === ((_b = n.robustness) !== null && _b !== void 0 ? _b : "") ||
|
|
122
|
+
((_c = prevCap.encryptionScheme) !== null && _c !== void 0 ? _c : null) === ((_d = n.encryptionScheme) !== null && _d !== void 0 ? _d : null) ||
|
|
123
|
+
((_e = prevCap.robustness) !== null && _e !== void 0 ? _e : "") === ((_f = n.robustness) !== null && _f !== void 0 ? _f : "")) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
97
127
|
return false;
|
|
128
|
+
});
|
|
129
|
+
if (!wasFound) {
|
|
130
|
+
return { value: false };
|
|
98
131
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
askedConfiguration: askedConfiguration,
|
|
106
|
-
};
|
|
132
|
+
};
|
|
133
|
+
for (var _i = 0, _l = ["audioCapabilities", "videoCapabilities"]; _i < _l.length; _i++) {
|
|
134
|
+
var prop = _l[_i];
|
|
135
|
+
var state_1 = _loop_1(prop);
|
|
136
|
+
if (typeof state_1 === "object")
|
|
137
|
+
return state_1.value;
|
|
107
138
|
}
|
|
108
|
-
return
|
|
139
|
+
return true;
|
|
109
140
|
}
|
|
110
141
|
/**
|
|
111
142
|
* Find key system canonical name from key system type.
|
|
@@ -140,7 +171,7 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
|
|
|
140
171
|
var distinctiveIdentifier = "optional";
|
|
141
172
|
if (keySystem.persistentLicense === true) {
|
|
142
173
|
persistentState = "required";
|
|
143
|
-
sessionTypes
|
|
174
|
+
sessionTypes = ["persistent-license"];
|
|
144
175
|
}
|
|
145
176
|
if (keySystem.persistentStateRequired === true) {
|
|
146
177
|
persistentState = "required";
|
|
@@ -246,33 +277,7 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
|
|
|
246
277
|
*/
|
|
247
278
|
export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal) {
|
|
248
279
|
log.info("DRM: Searching for compatible MediaKeySystemAccess");
|
|
249
|
-
|
|
250
|
-
if (currentState !== null) {
|
|
251
|
-
if (eme.implementation === currentState.emeImplementation.implementation) {
|
|
252
|
-
// Fast way to find a compatible keySystem if the currently loaded
|
|
253
|
-
// one as exactly the same compatibility options.
|
|
254
|
-
var cachedKeySystemAccess = checkCachedMediaKeySystemAccess(keySystemsConfigs, currentState.askedConfiguration, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
|
|
255
|
-
if (cachedKeySystemAccess !== null) {
|
|
256
|
-
log.info("DRM: Found cached compatible keySystem");
|
|
257
|
-
return Promise.resolve({
|
|
258
|
-
type: "reuse-media-key-system-access",
|
|
259
|
-
value: {
|
|
260
|
-
mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
|
|
261
|
-
askedConfiguration: cachedKeySystemAccess.askedConfiguration,
|
|
262
|
-
options: cachedKeySystemAccess.keySystemOptions,
|
|
263
|
-
},
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Array of set keySystems for this content.
|
|
270
|
-
* Each item of this array is an object containing the following keys:
|
|
271
|
-
* - keyName {string}: keySystem canonical name (e.g. "widevine")
|
|
272
|
-
* - keyType {string}: keySystem type (e.g. "com.widevine.alpha")
|
|
273
|
-
* - keySystem {Object}: the original keySystem object
|
|
274
|
-
* @type {Array.<Object>}
|
|
275
|
-
*/
|
|
280
|
+
/** Array of set keySystems for this content. */
|
|
276
281
|
var keySystemsType = keySystemsConfigs.reduce(function (arr, keySystemOptions) {
|
|
277
282
|
var EME_KEY_SYSTEMS = config.getCurrent().EME_KEY_SYSTEMS;
|
|
278
283
|
var managedRDNs = EME_KEY_SYSTEMS[keySystemOptions.type];
|
|
@@ -303,9 +308,9 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
303
308
|
*/
|
|
304
309
|
function recursivelyTestKeySystems(index) {
|
|
305
310
|
return __awaiter(this, void 0, void 0, function () {
|
|
306
|
-
var
|
|
307
|
-
return __generator(this, function (
|
|
308
|
-
switch (
|
|
311
|
+
var chosenType, keyName, keyType, keySystemOptions, keySystemConfigurations, keySystemAccess, currentState, configIdx, keySystemConfiguration, _1;
|
|
312
|
+
return __generator(this, function (_a) {
|
|
313
|
+
switch (_a.label) {
|
|
309
314
|
case 0:
|
|
310
315
|
// if we iterated over the whole keySystemsType Array, quit on error
|
|
311
316
|
if (index >= keySystemsType.length) {
|
|
@@ -316,21 +321,40 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
316
321
|
if (eme.requestMediaKeySystemAccess == null) {
|
|
317
322
|
throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");
|
|
318
323
|
}
|
|
319
|
-
|
|
324
|
+
chosenType = keySystemsType[index];
|
|
325
|
+
keyName = chosenType.keyName, keyType = chosenType.keyType, keySystemOptions = chosenType.keySystemOptions;
|
|
320
326
|
keySystemConfigurations = buildKeySystemConfigurations(keyName, keyType, keySystemOptions);
|
|
321
327
|
log.debug("DRM: Request keysystem access ".concat(keyType, ",") +
|
|
322
328
|
"".concat(index + 1, " of ").concat(keySystemsType.length));
|
|
329
|
+
currentState = MediaKeysInfosStore.getState(mediaElement);
|
|
323
330
|
configIdx = 0;
|
|
324
|
-
|
|
331
|
+
_a.label = 1;
|
|
325
332
|
case 1:
|
|
326
333
|
if (!(configIdx < keySystemConfigurations.length)) return [3 /*break*/, 6];
|
|
327
334
|
keySystemConfiguration = keySystemConfigurations[configIdx];
|
|
328
|
-
|
|
335
|
+
// Check if the current `MediaKeySystemAccess` created cannot be reused here
|
|
336
|
+
if (currentState !== null &&
|
|
337
|
+
!shouldRenewMediaKeySystemAccess() &&
|
|
338
|
+
// TODO: Do it with MediaKeySystemAccess.prototype.keySystem instead?
|
|
339
|
+
keyType === currentState.mediaKeySystemAccess.keySystem &&
|
|
340
|
+
eme.implementation === currentState.emeImplementation.implementation &&
|
|
341
|
+
isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(keySystemConfiguration, currentState.askedConfiguration)) {
|
|
342
|
+
log.info("DRM: Found cached compatible keySystem");
|
|
343
|
+
return [2 /*return*/, Promise.resolve({
|
|
344
|
+
type: "reuse-media-key-system-access",
|
|
345
|
+
value: {
|
|
346
|
+
mediaKeySystemAccess: currentState.mediaKeySystemAccess,
|
|
347
|
+
askedConfiguration: currentState.askedConfiguration,
|
|
348
|
+
options: keySystemOptions,
|
|
349
|
+
},
|
|
350
|
+
})];
|
|
351
|
+
}
|
|
352
|
+
_a.label = 2;
|
|
329
353
|
case 2:
|
|
330
|
-
|
|
354
|
+
_a.trys.push([2, 4, , 5]);
|
|
331
355
|
return [4 /*yield*/, testKeySystem(keyType, [keySystemConfiguration])];
|
|
332
356
|
case 3:
|
|
333
|
-
keySystemAccess =
|
|
357
|
+
keySystemAccess = _a.sent();
|
|
334
358
|
log.info("DRM: Found compatible keysystem", keyType, index + 1);
|
|
335
359
|
return [2 /*return*/, {
|
|
336
360
|
type: "create-media-key-system-access",
|
|
@@ -341,7 +365,7 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
341
365
|
},
|
|
342
366
|
}];
|
|
343
367
|
case 4:
|
|
344
|
-
_1 =
|
|
368
|
+
_1 = _a.sent();
|
|
345
369
|
log.debug("DRM: Rejected access to keysystem", keyType, index + 1, configIdx);
|
|
346
370
|
if (cancelSignal.cancellationError !== null) {
|
|
347
371
|
throw cancelSignal.cancellationError;
|
|
@@ -395,3 +419,17 @@ export function testKeySystem(keyType, keySystemConfigurations) {
|
|
|
395
419
|
});
|
|
396
420
|
});
|
|
397
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Returns `true` if `arr1`'s values are entirely contained in `arr2`.
|
|
424
|
+
* @param {string} arr1
|
|
425
|
+
* @param {string} arr2
|
|
426
|
+
* @return {boolean}
|
|
427
|
+
*/
|
|
428
|
+
function isArraySubsetOf(arr1, arr2) {
|
|
429
|
+
for (var i = 0; i < arr1.length; i++) {
|
|
430
|
+
if (!arrayIncludes(arr2, arr1[i])) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
@@ -83,6 +83,7 @@ var onKeyError = events.onKeyError, onKeyMessage = events.onKeyMessage, onKeySta
|
|
|
83
83
|
* @param {Object} cancelSignal
|
|
84
84
|
*/
|
|
85
85
|
export default function SessionEventsListener(session, keySystemOptions, keySystem, callbacks, cancelSignal) {
|
|
86
|
+
var _this = this;
|
|
86
87
|
log.info("DRM: Binding session events", session.sessionId);
|
|
87
88
|
var _a = keySystemOptions.getLicenseConfig, getLicenseConfig = _a === void 0 ? {} : _a;
|
|
88
89
|
/** Allows to manually cancel everything the `SessionEventsListener` is doing. */
|
|
@@ -122,25 +123,32 @@ export default function SessionEventsListener(session, keySystemOptions, keySyst
|
|
|
122
123
|
: "license-request";
|
|
123
124
|
log.info("DRM: Received message event, type ".concat(messageType), session.sessionId);
|
|
124
125
|
var backoffOptions = getLicenseBackoffOptions(getLicenseConfig.retry);
|
|
125
|
-
retryPromiseWithBackoff(function () { return runGetLicense(message, messageType); }, backoffOptions, manualCanceller.signal)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
retryPromiseWithBackoff(function () { return runGetLicense(message, messageType); }, backoffOptions, manualCanceller.signal).then(function (licenseObject) { return __awaiter(_this, void 0, void 0, function () {
|
|
127
|
+
var err_1;
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0:
|
|
131
|
+
if (manualCanceller.isUsed()) {
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
}
|
|
134
|
+
if (!isNullOrUndefined(licenseObject)) return [3 /*break*/, 1];
|
|
135
|
+
log.info("DRM: No license given, skipping session.update");
|
|
136
|
+
return [3 /*break*/, 4];
|
|
137
|
+
case 1:
|
|
138
|
+
_a.trys.push([1, 3, , 4]);
|
|
139
|
+
return [4 /*yield*/, updateSessionWithMessage(session, licenseObject)];
|
|
140
|
+
case 2:
|
|
141
|
+
_a.sent();
|
|
142
|
+
return [3 /*break*/, 4];
|
|
143
|
+
case 3:
|
|
144
|
+
err_1 = _a.sent();
|
|
145
|
+
manualCanceller.cancel();
|
|
146
|
+
callbacks.onError(err_1);
|
|
147
|
+
return [3 /*break*/, 4];
|
|
148
|
+
case 4: return [2 /*return*/];
|
|
140
149
|
}
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
.catch(function (err) {
|
|
150
|
+
});
|
|
151
|
+
}); }, function (err) {
|
|
144
152
|
if (manualCanceller.isUsed()) {
|
|
145
153
|
return;
|
|
146
154
|
}
|
|
@@ -180,7 +180,8 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
180
180
|
}
|
|
181
181
|
ignoredStallTimeStamp = null;
|
|
182
182
|
playbackRateUpdater.startRebuffering();
|
|
183
|
-
if (_this._manifest === null
|
|
183
|
+
if (_this._manifest === null ||
|
|
184
|
+
(isSeekingApproximate && performance.now() - rebuffering.timestamp <= 1000)) {
|
|
184
185
|
_this.trigger("stalled", stalledReason);
|
|
185
186
|
return;
|
|
186
187
|
}
|
|
@@ -212,7 +213,8 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
212
213
|
// implementation that might drop an injected segment, or in
|
|
213
214
|
// case of small discontinuity in the content.
|
|
214
215
|
var nextBufferRangeGap = getNextRangeGap(buffered, freezePosition);
|
|
215
|
-
if (
|
|
216
|
+
if ((!isSeekingApproximate || performance.now() - rebuffering.timestamp > 1000) &&
|
|
217
|
+
_this._speed.getValue() > 0 &&
|
|
216
218
|
nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD) {
|
|
217
219
|
var seekTo = freezePosition + nextBufferRangeGap + EPSILON;
|
|
218
220
|
if (_this._playbackObserver.getCurrentTime() < seekTo) {
|
|
@@ -51,6 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
};
|
|
52
52
|
import log from "../../log";
|
|
53
53
|
import { getInnerAndOuterTimeRanges } from "../../utils/ranges";
|
|
54
|
+
import TaskCanceller from "../../utils/task_canceller";
|
|
54
55
|
/**
|
|
55
56
|
* Perform cleaning of the buffer according to the values set by the user
|
|
56
57
|
* each time `playbackObserver` emits and each times the
|
|
@@ -71,6 +72,9 @@ export default function BufferGarbageCollector(_a, cancellationSignal) {
|
|
|
71
72
|
}, { includeLastObservation: true, clearSignal: cancellationSignal });
|
|
72
73
|
function clean() {
|
|
73
74
|
clearBuffer(segmentBuffer, lastPosition, maxBufferBehind.getValue(), maxBufferAhead.getValue(), cancellationSignal).catch(function (e) {
|
|
75
|
+
if (cancellationSignal.isCancelled() && TaskCanceller.isCancellationError(e)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
74
78
|
var errMsg = e instanceof Error ? e.message : "Unknown error";
|
|
75
79
|
log.error("Could not run BufferGarbageCollector:", errMsg);
|
|
76
80
|
});
|