rx-player 3.28.0-dev.2022063000 → 3.28.1-dev.2022083000

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.
Files changed (108) hide show
  1. package/.github/workflows/checks.yml +20 -18
  2. package/CHANGELOG.md +14 -2
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/eme/load_session.d.ts +5 -6
  5. package/dist/_esm5.processed/compat/eme/load_session.js +5 -6
  6. package/dist/_esm5.processed/compat/event_listeners.js +5 -0
  7. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +1 -1
  8. package/dist/_esm5.processed/core/api/public_api.js +2 -2
  9. package/dist/_esm5.processed/core/decrypt/create_session.js +33 -4
  10. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +14 -0
  11. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +25 -0
  12. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +1 -1
  13. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
  14. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +110 -38
  15. package/dist/_esm5.processed/core/stream/representation/check_for_discontinuity.js +21 -9
  16. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +21 -29
  17. package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +1 -2
  18. package/dist/_esm5.processed/errors/encrypted_media_error.js +0 -1
  19. package/dist/_esm5.processed/errors/error_codes.d.ts +6 -1
  20. package/dist/_esm5.processed/errors/media_error.d.ts +1 -2
  21. package/dist/_esm5.processed/errors/media_error.js +0 -1
  22. package/dist/_esm5.processed/errors/network_error.d.ts +1 -2
  23. package/dist/_esm5.processed/errors/network_error.js +0 -1
  24. package/dist/_esm5.processed/errors/other_error.d.ts +1 -2
  25. package/dist/_esm5.processed/errors/other_error.js +0 -1
  26. package/dist/_esm5.processed/manifest/manifest.d.ts +1 -1
  27. package/dist/_esm5.processed/manifest/manifest.js +1 -1
  28. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +21 -6
  29. package/dist/_esm5.processed/manifest/representation_index/static.js +26 -8
  30. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +55 -44
  31. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +21 -8
  32. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +25 -10
  33. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +26 -12
  34. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +26 -13
  35. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +23 -7
  36. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +65 -22
  37. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +20 -3
  38. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +57 -7
  39. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.d.ts → utils.d.ts} +3 -6
  40. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.js → utils.js} +4 -8
  41. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +1 -1
  42. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +5 -8
  43. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +21 -8
  44. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +49 -14
  45. package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +16 -0
  46. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +20 -6
  47. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +28 -10
  48. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +4 -4
  49. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -12
  50. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +39 -14
  51. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +1 -1
  52. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +1 -1
  53. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +0 -2
  54. package/dist/_esm5.processed/transports/smooth/segment_loader.js +1 -1
  55. package/dist/_esm5.processed/transports/types.d.ts +1 -1
  56. package/dist/_esm5.processed/utils/deep_merge.d.ts +1 -1
  57. package/dist/_esm5.processed/utils/deep_merge.js +6 -5
  58. package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -3
  59. package/dist/_esm5.processed/utils/task_canceller.js +0 -3
  60. package/dist/mpd-parser.wasm +0 -0
  61. package/dist/rx-player.js +1390 -1059
  62. package/dist/rx-player.min.js +1 -1
  63. package/jest.config.js +5 -0
  64. package/package.json +31 -30
  65. package/sonar-project.properties +1 -1
  66. package/src/compat/eme/load_session.ts +5 -6
  67. package/src/compat/event_listeners.ts +5 -0
  68. package/src/core/api/media_element_track_choice_manager.ts +1 -1
  69. package/src/core/api/public_api.ts +2 -2
  70. package/src/core/decrypt/create_session.ts +28 -2
  71. package/src/core/decrypt/utils/loaded_sessions_store.ts +29 -0
  72. package/src/core/fetchers/segment/segment_fetcher.ts +1 -1
  73. package/src/core/init/content_time_boundaries_observer.ts +116 -42
  74. package/src/core/stream/representation/check_for_discontinuity.ts +28 -10
  75. package/src/core/stream/representation/get_buffer_status.ts +27 -34
  76. package/src/errors/encrypted_media_error.ts +1 -2
  77. package/src/errors/error_codes.ts +2 -2
  78. package/src/errors/media_error.ts +1 -2
  79. package/src/errors/network_error.ts +1 -2
  80. package/src/errors/other_error.ts +1 -2
  81. package/src/manifest/__tests__/adaptation.test.ts +4 -3
  82. package/src/manifest/__tests__/representation.test.ts +4 -3
  83. package/src/manifest/manifest.ts +1 -1
  84. package/src/manifest/representation_index/__tests__/static.test.ts +5 -4
  85. package/src/manifest/representation_index/static.ts +28 -9
  86. package/src/manifest/representation_index/types.ts +62 -46
  87. package/src/parsers/manifest/dash/common/indexes/base.ts +27 -11
  88. package/src/parsers/manifest/dash/common/indexes/list.ts +32 -15
  89. package/src/parsers/manifest/dash/common/indexes/template.ts +73 -27
  90. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +60 -8
  91. package/src/parsers/manifest/dash/common/indexes/{is_period_fulfilled.ts → utils.ts} +4 -13
  92. package/src/parsers/manifest/dash/common/parse_periods.ts +1 -1
  93. package/src/parsers/manifest/local/parse_local_manifest.ts +8 -20
  94. package/src/parsers/manifest/local/representation_index.ts +51 -16
  95. package/src/parsers/manifest/local/types.ts +13 -0
  96. package/src/parsers/manifest/metaplaylist/representation_index.ts +31 -11
  97. package/src/parsers/manifest/smooth/create_parser.ts +4 -4
  98. package/src/parsers/manifest/smooth/representation_index.ts +40 -15
  99. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +4 -3
  100. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +4 -3
  101. package/src/parsers/manifest/utils/get_first_time_from_adaptation.ts +1 -1
  102. package/src/parsers/manifest/utils/get_last_time_from_adaptation.ts +1 -1
  103. package/src/transports/metaplaylist/pipelines.ts +0 -2
  104. package/src/transports/smooth/segment_loader.ts +1 -1
  105. package/src/transports/types.ts +1 -1
  106. package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -0
  107. package/src/utils/deep_merge.ts +7 -4
  108. package/src/utils/task_canceller.ts +0 -3
package/dist/rx-player.js CHANGED
@@ -11,405 +11,6 @@
11
11
  return /******/ (function() { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ 9591:
15
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
16
-
17
- var _typeof = (__webpack_require__(8)["default"]);
18
-
19
- function _regeneratorRuntime() {
20
- "use strict";
21
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
22
-
23
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
24
- return exports;
25
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
26
- var exports = {},
27
- Op = Object.prototype,
28
- hasOwn = Op.hasOwnProperty,
29
- $Symbol = "function" == typeof Symbol ? Symbol : {},
30
- iteratorSymbol = $Symbol.iterator || "@@iterator",
31
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
32
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
33
-
34
- function define(obj, key, value) {
35
- return Object.defineProperty(obj, key, {
36
- value: value,
37
- enumerable: !0,
38
- configurable: !0,
39
- writable: !0
40
- }), obj[key];
41
- }
42
-
43
- try {
44
- define({}, "");
45
- } catch (err) {
46
- define = function define(obj, key, value) {
47
- return obj[key] = value;
48
- };
49
- }
50
-
51
- function wrap(innerFn, outerFn, self, tryLocsList) {
52
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
53
- generator = Object.create(protoGenerator.prototype),
54
- context = new Context(tryLocsList || []);
55
- return generator._invoke = function (innerFn, self, context) {
56
- var state = "suspendedStart";
57
- return function (method, arg) {
58
- if ("executing" === state) throw new Error("Generator is already running");
59
-
60
- if ("completed" === state) {
61
- if ("throw" === method) throw arg;
62
- return doneResult();
63
- }
64
-
65
- for (context.method = method, context.arg = arg;;) {
66
- var delegate = context.delegate;
67
-
68
- if (delegate) {
69
- var delegateResult = maybeInvokeDelegate(delegate, context);
70
-
71
- if (delegateResult) {
72
- if (delegateResult === ContinueSentinel) continue;
73
- return delegateResult;
74
- }
75
- }
76
-
77
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
78
- if ("suspendedStart" === state) throw state = "completed", context.arg;
79
- context.dispatchException(context.arg);
80
- } else "return" === context.method && context.abrupt("return", context.arg);
81
- state = "executing";
82
- var record = tryCatch(innerFn, self, context);
83
-
84
- if ("normal" === record.type) {
85
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
86
- return {
87
- value: record.arg,
88
- done: context.done
89
- };
90
- }
91
-
92
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
93
- }
94
- };
95
- }(innerFn, self, context), generator;
96
- }
97
-
98
- function tryCatch(fn, obj, arg) {
99
- try {
100
- return {
101
- type: "normal",
102
- arg: fn.call(obj, arg)
103
- };
104
- } catch (err) {
105
- return {
106
- type: "throw",
107
- arg: err
108
- };
109
- }
110
- }
111
-
112
- exports.wrap = wrap;
113
- var ContinueSentinel = {};
114
-
115
- function Generator() {}
116
-
117
- function GeneratorFunction() {}
118
-
119
- function GeneratorFunctionPrototype() {}
120
-
121
- var IteratorPrototype = {};
122
- define(IteratorPrototype, iteratorSymbol, function () {
123
- return this;
124
- });
125
- var getProto = Object.getPrototypeOf,
126
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
127
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
128
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
129
-
130
- function defineIteratorMethods(prototype) {
131
- ["next", "throw", "return"].forEach(function (method) {
132
- define(prototype, method, function (arg) {
133
- return this._invoke(method, arg);
134
- });
135
- });
136
- }
137
-
138
- function AsyncIterator(generator, PromiseImpl) {
139
- function invoke(method, arg, resolve, reject) {
140
- var record = tryCatch(generator[method], generator, arg);
141
-
142
- if ("throw" !== record.type) {
143
- var result = record.arg,
144
- value = result.value;
145
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
146
- invoke("next", value, resolve, reject);
147
- }, function (err) {
148
- invoke("throw", err, resolve, reject);
149
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
150
- result.value = unwrapped, resolve(result);
151
- }, function (error) {
152
- return invoke("throw", error, resolve, reject);
153
- });
154
- }
155
-
156
- reject(record.arg);
157
- }
158
-
159
- var previousPromise;
160
-
161
- this._invoke = function (method, arg) {
162
- function callInvokeWithMethodAndArg() {
163
- return new PromiseImpl(function (resolve, reject) {
164
- invoke(method, arg, resolve, reject);
165
- });
166
- }
167
-
168
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
169
- };
170
- }
171
-
172
- function maybeInvokeDelegate(delegate, context) {
173
- var method = delegate.iterator[context.method];
174
-
175
- if (undefined === method) {
176
- if (context.delegate = null, "throw" === context.method) {
177
- if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
178
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
179
- }
180
-
181
- return ContinueSentinel;
182
- }
183
-
184
- var record = tryCatch(method, delegate.iterator, context.arg);
185
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
186
- var info = record.arg;
187
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
188
- }
189
-
190
- function pushTryEntry(locs) {
191
- var entry = {
192
- tryLoc: locs[0]
193
- };
194
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
195
- }
196
-
197
- function resetTryEntry(entry) {
198
- var record = entry.completion || {};
199
- record.type = "normal", delete record.arg, entry.completion = record;
200
- }
201
-
202
- function Context(tryLocsList) {
203
- this.tryEntries = [{
204
- tryLoc: "root"
205
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
206
- }
207
-
208
- function values(iterable) {
209
- if (iterable) {
210
- var iteratorMethod = iterable[iteratorSymbol];
211
- if (iteratorMethod) return iteratorMethod.call(iterable);
212
- if ("function" == typeof iterable.next) return iterable;
213
-
214
- if (!isNaN(iterable.length)) {
215
- var i = -1,
216
- next = function next() {
217
- for (; ++i < iterable.length;) {
218
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
219
- }
220
-
221
- return next.value = undefined, next.done = !0, next;
222
- };
223
-
224
- return next.next = next;
225
- }
226
- }
227
-
228
- return {
229
- next: doneResult
230
- };
231
- }
232
-
233
- function doneResult() {
234
- return {
235
- value: undefined,
236
- done: !0
237
- };
238
- }
239
-
240
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
241
- var ctor = "function" == typeof genFun && genFun.constructor;
242
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
243
- }, exports.mark = function (genFun) {
244
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
245
- }, exports.awrap = function (arg) {
246
- return {
247
- __await: arg
248
- };
249
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
250
- return this;
251
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
252
- void 0 === PromiseImpl && (PromiseImpl = Promise);
253
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
254
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
255
- return result.done ? result.value : iter.next();
256
- });
257
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
258
- return this;
259
- }), define(Gp, "toString", function () {
260
- return "[object Generator]";
261
- }), exports.keys = function (object) {
262
- var keys = [];
263
-
264
- for (var key in object) {
265
- keys.push(key);
266
- }
267
-
268
- return keys.reverse(), function next() {
269
- for (; keys.length;) {
270
- var key = keys.pop();
271
- if (key in object) return next.value = key, next.done = !1, next;
272
- }
273
-
274
- return next.done = !0, next;
275
- };
276
- }, exports.values = values, Context.prototype = {
277
- constructor: Context,
278
- reset: function reset(skipTempReset) {
279
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
280
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
281
- }
282
- },
283
- stop: function stop() {
284
- this.done = !0;
285
- var rootRecord = this.tryEntries[0].completion;
286
- if ("throw" === rootRecord.type) throw rootRecord.arg;
287
- return this.rval;
288
- },
289
- dispatchException: function dispatchException(exception) {
290
- if (this.done) throw exception;
291
- var context = this;
292
-
293
- function handle(loc, caught) {
294
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
295
- }
296
-
297
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
298
- var entry = this.tryEntries[i],
299
- record = entry.completion;
300
- if ("root" === entry.tryLoc) return handle("end");
301
-
302
- if (entry.tryLoc <= this.prev) {
303
- var hasCatch = hasOwn.call(entry, "catchLoc"),
304
- hasFinally = hasOwn.call(entry, "finallyLoc");
305
-
306
- if (hasCatch && hasFinally) {
307
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
308
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
309
- } else if (hasCatch) {
310
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
311
- } else {
312
- if (!hasFinally) throw new Error("try statement without catch or finally");
313
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
314
- }
315
- }
316
- }
317
- },
318
- abrupt: function abrupt(type, arg) {
319
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
320
- var entry = this.tryEntries[i];
321
-
322
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
323
- var finallyEntry = entry;
324
- break;
325
- }
326
- }
327
-
328
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
329
- var record = finallyEntry ? finallyEntry.completion : {};
330
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
331
- },
332
- complete: function complete(record, afterLoc) {
333
- if ("throw" === record.type) throw record.arg;
334
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
335
- },
336
- finish: function finish(finallyLoc) {
337
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
338
- var entry = this.tryEntries[i];
339
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
340
- }
341
- },
342
- "catch": function _catch(tryLoc) {
343
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
344
- var entry = this.tryEntries[i];
345
-
346
- if (entry.tryLoc === tryLoc) {
347
- var record = entry.completion;
348
-
349
- if ("throw" === record.type) {
350
- var thrown = record.arg;
351
- resetTryEntry(entry);
352
- }
353
-
354
- return thrown;
355
- }
356
- }
357
-
358
- throw new Error("illegal catch attempt");
359
- },
360
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
361
- return this.delegate = {
362
- iterator: values(iterable),
363
- resultName: resultName,
364
- nextLoc: nextLoc
365
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
366
- }
367
- }, exports;
368
- }
369
-
370
- module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
371
-
372
- /***/ }),
373
-
374
- /***/ 8:
375
- /***/ (function(module) {
376
-
377
- function _typeof(obj) {
378
- "@babel/helpers - typeof";
379
-
380
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
381
- return typeof obj;
382
- } : function (obj) {
383
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
384
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
385
- }
386
-
387
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
388
-
389
- /***/ }),
390
-
391
- /***/ 7757:
392
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
393
-
394
- // TODO(Babel 8): Remove this file.
395
-
396
- var runtime = __webpack_require__(9591)();
397
- module.exports = runtime;
398
-
399
- // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
400
- try {
401
- regeneratorRuntime = runtime;
402
- } catch (accidentalStrictMode) {
403
- if (typeof globalThis === "object") {
404
- globalThis.regeneratorRuntime = runtime;
405
- } else {
406
- Function("r", "regeneratorRuntime = r")(runtime);
407
- }
408
- }
409
-
410
-
411
- /***/ }),
412
-
413
14
  /***/ 3774:
414
15
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
415
16
 
@@ -659,18 +260,6 @@ var CustomMediaKeySystemAccess = /*#__PURE__*/function () {
659
260
  }();
660
261
 
661
262
 
662
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
663
- var inheritsLoose = __webpack_require__(4578);
664
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Subject.js + 1 modules
665
- var Subject = __webpack_require__(6716);
666
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/merge.js
667
- var merge = __webpack_require__(3071);
668
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js
669
- var takeUntil = __webpack_require__(3505);
670
- // EXTERNAL MODULE: ./src/utils/event_emitter.ts
671
- var event_emitter = __webpack_require__(1959);
672
- // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
673
- var event_listeners = __webpack_require__(1381);
674
263
  ;// CONCATENATED MODULE: ./src/compat/eme/custom_media_keys/ms_media_keys_constructor.ts
675
264
  /**
676
265
  * Copyright 2015 CANAL+ Group
@@ -704,6 +293,18 @@ if (!is_node/* default */.Z) {
704
293
  }
705
294
 
706
295
 
296
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
297
+ var inheritsLoose = __webpack_require__(4578);
298
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Subject.js + 1 modules
299
+ var Subject = __webpack_require__(6716);
300
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/merge.js
301
+ var merge = __webpack_require__(3071);
302
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js
303
+ var takeUntil = __webpack_require__(3505);
304
+ // EXTERNAL MODULE: ./src/utils/event_emitter.ts
305
+ var event_emitter = __webpack_require__(1959);
306
+ // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
307
+ var event_listeners = __webpack_require__(1381);
707
308
  ;// CONCATENATED MODULE: ./src/compat/eme/custom_media_keys/ie11_media_keys.ts
708
309
 
709
310
 
@@ -1813,6 +1414,8 @@ __webpack_require__.d(__webpack_exports__, {
1813
1414
 
1814
1415
  // UNUSED EXPORTS: addEventListener, onTimeUpdate$
1815
1416
 
1417
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js
1418
+ var fromEvent = __webpack_require__(2401);
1816
1419
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js + 1 modules
1817
1420
  var Observable = __webpack_require__(1480);
1818
1421
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/util/noop.js
@@ -1825,8 +1428,6 @@ function never() {
1825
1428
  return NEVER;
1826
1429
  }
1827
1430
  //# sourceMappingURL=never.js.map
1828
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js
1829
- var fromEvent = __webpack_require__(2401);
1830
1431
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/merge.js
1831
1432
  var merge = __webpack_require__(3071);
1832
1433
  // EXTERNAL MODULE: ./src/config.ts + 2 modules
@@ -2007,11 +1608,14 @@ function getPageActivityRef(stopListening) {
2007
1608
  var ref = (0,reference/* default */.ZP)(true);
2008
1609
  stopListening.register(function () {
2009
1610
  clearTimeout(currentTimeout);
1611
+ currentTimeout = undefined;
2010
1612
  ref.finish();
2011
1613
  });
2012
1614
  isDocVisibleRef.onUpdate(function onDocVisibilityChange(isVisible) {
2013
1615
  clearTimeout(currentTimeout); // clear potential previous timeout
2014
1616
 
1617
+ currentTimeout = undefined;
1618
+
2015
1619
  if (!isVisible) {
2016
1620
  var _config$getCurrent = config/* default.getCurrent */.Z.getCurrent(),
2017
1621
  INACTIVITY_DELAY = _config$getCurrent.INACTIVITY_DELAY;
@@ -2117,6 +1721,7 @@ function getVideoVisibilityRef(pipStatus, stopListening) {
2117
1721
  var ref = (0,reference/* default */.ZP)(true);
2118
1722
  stopListening.register(function () {
2119
1723
  clearTimeout(currentTimeout);
1724
+ currentTimeout = undefined;
2120
1725
  ref.finish();
2121
1726
  });
2122
1727
  isDocVisibleRef.onUpdate(checkCurrentVisibility, {
@@ -2129,6 +1734,9 @@ function getVideoVisibilityRef(pipStatus, stopListening) {
2129
1734
  return ref;
2130
1735
 
2131
1736
  function checkCurrentVisibility() {
1737
+ clearTimeout(currentTimeout);
1738
+ currentTimeout = undefined;
1739
+
2132
1740
  if (pipStatus.getValue().isEnabled || isDocVisibleRef.getValue()) {
2133
1741
  ref.setValueIfChanged(true);
2134
1742
  } else {
@@ -3781,18 +3389,18 @@ function deepMerge(target) {
3781
3389
  if (isObject(target) && isObject(source)) {
3782
3390
  for (var key in source) {
3783
3391
  if (isObject(source[key])) {
3784
- if (target[key] === undefined) {
3785
- var _objectAssign;
3392
+ var newTarget = target[key];
3786
3393
 
3787
- (0,object_assign/* default */.Z)(target, (_objectAssign = {}, _objectAssign[key] = {}, _objectAssign));
3394
+ if (newTarget === undefined) {
3395
+ newTarget = {};
3396
+ target[key] = newTarget;
3788
3397
  }
3789
3398
 
3790
- var newTarget = target[key];
3791
3399
  deepMerge(newTarget, source[key]);
3792
3400
  } else {
3793
- var _objectAssign2;
3401
+ var _objectAssign;
3794
3402
 
3795
- (0,object_assign/* default */.Z)(target, (_objectAssign2 = {}, _objectAssign2[key] = source[key], _objectAssign2));
3403
+ (0,object_assign/* default */.Z)(target, (_objectAssign = {}, _objectAssign[key] = source[key], _objectAssign));
3796
3404
  }
3797
3405
  }
3798
3406
  }
@@ -3924,7 +3532,7 @@ function createAudioTracks(audioTracks) {
3924
3532
  language: audioTrack.language,
3925
3533
  id: id,
3926
3534
  normalized: (0,_utils_languages__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(audioTrack.language),
3927
- audioDescription: false,
3535
+ audioDescription: audioTrack.kind === "descriptions",
3928
3536
  representations: []
3929
3537
  };
3930
3538
  newAudioTracks.push({
@@ -4888,8 +4496,10 @@ var asyncToGenerator = __webpack_require__(5861);
4888
4496
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
4889
4497
  var inheritsLoose = __webpack_require__(4578);
4890
4498
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
4891
- var regenerator = __webpack_require__(7757);
4499
+ var regenerator = __webpack_require__(4687);
4892
4500
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
4501
+ // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
4502
+ var event_listeners = __webpack_require__(1381);
4893
4503
  // EXTERNAL MODULE: ./src/log.ts + 1 modules
4894
4504
  var log = __webpack_require__(3887);
4895
4505
  // EXTERNAL MODULE: ./src/parsers/containers/isobmff/take_pssh_out.ts + 1 modules
@@ -5059,8 +4669,6 @@ function getInitData(encryptedEvent) {
5059
4669
  values: values
5060
4670
  };
5061
4671
  }
5062
- // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
5063
- var event_listeners = __webpack_require__(1381);
5064
4672
  // EXTERNAL MODULE: ./src/config.ts + 2 modules
5065
4673
  var config = __webpack_require__(6872);
5066
4674
  // EXTERNAL MODULE: ./src/errors/encrypted_media_error.ts
@@ -5317,7 +4925,7 @@ function createAndTryToRetrievePersistentSession(_x, _x2, _x3, _x4) {
5317
4925
 
5318
4926
  function _createAndTryToRetrievePersistentSession() {
5319
4927
  _createAndTryToRetrievePersistentSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal) {
5320
- var entry, storedEntry, hasLoadedSession, recreatePersistentSession, _recreatePersistentSession;
4928
+ var entry, storedEntry, hasLoadedSession, newEntry, recreatePersistentSession, _recreatePersistentSession;
5321
4929
 
5322
4930
  return regenerator_default().wrap(function _callee2$(_context2) {
5323
4931
  while (1) {
@@ -5345,18 +4953,37 @@ function _createAndTryToRetrievePersistentSession() {
5345
4953
  persistentSessionsStore["delete"](persistentEntry.sessionId);
5346
4954
  }
5347
4955
 
5348
- _context.next = 7;
4956
+ _context.prev = 5;
4957
+ _context.next = 8;
5349
4958
  return loadedSessionsStore.closeSession(entry.mediaKeySession);
5350
4959
 
5351
- case 7:
4960
+ case 8:
4961
+ _context.next = 15;
4962
+ break;
4963
+
4964
+ case 10:
4965
+ _context.prev = 10;
4966
+ _context.t0 = _context["catch"](5);
4967
+
4968
+ if (!(entry.mediaKeySession.sessionId !== "")) {
4969
+ _context.next = 14;
4970
+ break;
4971
+ }
4972
+
4973
+ throw _context.t0;
4974
+
4975
+ case 14:
4976
+ loadedSessionsStore.removeSessionWithoutClosingIt(entry.mediaKeySession);
4977
+
4978
+ case 15:
5352
4979
  if (!(cancelSignal.cancellationError !== null)) {
5353
- _context.next = 9;
4980
+ _context.next = 17;
5354
4981
  break;
5355
4982
  }
5356
4983
 
5357
4984
  throw cancelSignal.cancellationError;
5358
4985
 
5359
- case 9:
4986
+ case 17:
5360
4987
  newEntry = loadedSessionsStore.createSession(initData, "persistent-license");
5361
4988
  return _context.abrupt("return", {
5362
4989
  type: "created-session"
@@ -5365,12 +4992,12 @@ function _createAndTryToRetrievePersistentSession() {
5365
4992
  value: newEntry
5366
4993
  });
5367
4994
 
5368
- case 11:
4995
+ case 19:
5369
4996
  case "end":
5370
4997
  return _context.stop();
5371
4998
  }
5372
4999
  }
5373
- }, _callee);
5000
+ }, _callee, null, [[5, 10]]);
5374
5001
  }));
5375
5002
  return _recreatePersistentSession.apply(this, arguments);
5376
5003
  };
@@ -5412,22 +5039,30 @@ function _createAndTryToRetrievePersistentSession() {
5412
5039
  hasLoadedSession = _context2.sent;
5413
5040
 
5414
5041
  if (hasLoadedSession) {
5415
- _context2.next = 17;
5042
+ _context2.next = 19;
5416
5043
  break;
5417
5044
  }
5418
5045
 
5419
5046
  log/* default.warn */.Z.warn("DRM: No data stored for the loaded session");
5420
- persistentSessionsStore["delete"](storedEntry.sessionId);
5047
+ persistentSessionsStore["delete"](storedEntry.sessionId); // The EME specification is kind of implicit about it but it seems from my
5048
+ // understanding (Paul B.) that a MediaKeySession on wich a `load` attempt
5049
+ // did not succeed due to the loaded session not being found by the
5050
+ // browser/CDM, should neither be used anymore nor closed.
5051
+ // Thus, we're creating another `"persistent-license"` `MediaKeySession`
5052
+ // in that specific case.
5053
+
5054
+ loadedSessionsStore.removeSessionWithoutClosingIt(entry.mediaKeySession);
5055
+ newEntry = loadedSessionsStore.createSession(initData, "persistent-license");
5421
5056
  return _context2.abrupt("return", {
5422
5057
  type: "created-session"
5423
5058
  /* MediaKeySessionLoadingType.Created */
5424
5059
  ,
5425
- value: entry
5060
+ value: newEntry
5426
5061
  });
5427
5062
 
5428
- case 17:
5063
+ case 19:
5429
5064
  if (!(hasLoadedSession && isSessionUsable(entry.mediaKeySession))) {
5430
- _context2.next = 21;
5065
+ _context2.next = 23;
5431
5066
  break;
5432
5067
  }
5433
5068
 
@@ -5440,23 +5075,23 @@ function _createAndTryToRetrievePersistentSession() {
5440
5075
  value: entry
5441
5076
  });
5442
5077
 
5443
- case 21:
5078
+ case 23:
5444
5079
  // Unusable persistent session: recreate a new session from scratch.
5445
5080
  log/* default.warn */.Z.warn("DRM: Previous persistent session not usable anymore.");
5446
5081
  return _context2.abrupt("return", recreatePersistentSession());
5447
5082
 
5448
- case 25:
5449
- _context2.prev = 25;
5083
+ case 27:
5084
+ _context2.prev = 27;
5450
5085
  _context2.t0 = _context2["catch"](9);
5451
5086
  log/* default.warn */.Z.warn("DRM: Unable to load persistent session: " + (_context2.t0 instanceof Error ? _context2.t0.toString() : "Unknown Error"));
5452
5087
  return _context2.abrupt("return", recreatePersistentSession());
5453
5088
 
5454
- case 29:
5089
+ case 31:
5455
5090
  case "end":
5456
5091
  return _context2.stop();
5457
5092
  }
5458
5093
  }
5459
- }, _callee2, null, [[9, 25]]);
5094
+ }, _callee2, null, [[9, 27]]);
5460
5095
  }));
5461
5096
  return _createAndTryToRetrievePersistentSession.apply(this, arguments);
5462
5097
  }
@@ -6214,15 +5849,14 @@ var EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES = 100;
6214
5849
  * Load a persistent session, based on its `sessionId`, on the given
6215
5850
  * MediaKeySession.
6216
5851
  *
6217
- * Returns an Observable which emits:
6218
- * - true if the persistent MediaKeySession was found and loaded
6219
- * - false if no persistent MediaKeySession was found with that `sessionId`.
6220
- * Then completes.
5852
+ * Returns a Promise which resolves with:
5853
+ * - `true` if the persistent MediaKeySession was found and loaded
5854
+ * - `false` if no persistent MediaKeySession was found with that `sessionId`.
6221
5855
  *
6222
- * The Observable throws if anything goes wrong in the process.
5856
+ * The Promise rejects if anything goes wrong in the process.
6223
5857
  * @param {MediaKeySession} session
6224
5858
  * @param {string} sessionId
6225
- * @returns {Observable}
5859
+ * @returns {Promise.<boolean>}
6226
5860
  */
6227
5861
 
6228
5862
  function loadSession(_x, _x2) {
@@ -6452,6 +6086,8 @@ function closeSession(session) {
6452
6086
  return _tryUpdatingSession.apply(this, arguments);
6453
6087
  }
6454
6088
  }
6089
+ // EXTERNAL MODULE: ./src/utils/assert.ts
6090
+ var assert = __webpack_require__(811);
6455
6091
  ;// CONCATENATED MODULE: ./src/core/decrypt/utils/key_id_comparison.ts
6456
6092
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6457
6093
 
@@ -6771,6 +6407,7 @@ function loaded_sessions_store_arrayLikeToArray(arr, len) { if (len == null || l
6771
6407
 
6772
6408
 
6773
6409
 
6410
+
6774
6411
  /**
6775
6412
  * Create and store MediaKeySessions linked to a single MediaKeys
6776
6413
  * instance.
@@ -7259,6 +6896,36 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
7259
6896
 
7260
6897
  return closeAllSessions;
7261
6898
  }()
6899
+ /**
6900
+ * Find the given `MediaKeySession` in the `LoadedSessionsStore` and removes
6901
+ * any reference to it without actually closing it.
6902
+ *
6903
+ * Returns `true` if the given `mediaKeySession` has been found and removed,
6904
+ * `false` otherwise.
6905
+ *
6906
+ * Note that this may create a `MediaKeySession` leakage in the wrong
6907
+ * conditions, cases where this method should be called should be very
6908
+ * carefully evaluated.
6909
+ * @param {MediaKeySession} mediaKeySession
6910
+ * @returns {boolean}
6911
+ */
6912
+ ;
6913
+
6914
+ _proto.removeSessionWithoutClosingIt = function removeSessionWithoutClosingIt(mediaKeySession) {
6915
+ (0,assert/* default */.Z)(mediaKeySession.sessionId === "", "Initialized `MediaKeySession`s should always be properly closed");
6916
+
6917
+ for (var i = this._storage.length - 1; i >= 0; i--) {
6918
+ var stored = this._storage[i];
6919
+
6920
+ if (stored.mediaKeySession === mediaKeySession) {
6921
+ this._storage.splice(i, 1);
6922
+
6923
+ return true;
6924
+ }
6925
+ }
6926
+
6927
+ return false;
6928
+ }
7262
6929
  /**
7263
6930
  * Get the index of a stored MediaKeySession entry based on its
7264
6931
  * `KeySessionRecord`.
@@ -7397,8 +7064,6 @@ function _safelyCloseMediaKeySession() {
7397
7064
  }));
7398
7065
  return _safelyCloseMediaKeySession.apply(this, arguments);
7399
7066
  }
7400
- // EXTERNAL MODULE: ./src/utils/assert.ts
7401
- var assert = __webpack_require__(811);
7402
7067
  // EXTERNAL MODULE: ./src/utils/base64.ts
7403
7068
  var utils_base64 = __webpack_require__(9689);
7404
7069
  // EXTERNAL MODULE: ./src/utils/hash_buffer.ts
@@ -11157,12 +10822,12 @@ var switchMap = __webpack_require__(4978);
11157
10822
  var of = __webpack_require__(2817);
11158
10823
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/merge.js
11159
10824
  var merge = __webpack_require__(3071);
10825
+ // EXTERNAL MODULE: ./src/compat/clear_element_src.ts
10826
+ var clear_element_src = __webpack_require__(5767);
11160
10827
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js + 1 modules
11161
10828
  var Observable = __webpack_require__(1480);
11162
10829
  // EXTERNAL MODULE: ./src/log.ts + 1 modules
11163
10830
  var log = __webpack_require__(3887);
11164
- // EXTERNAL MODULE: ./src/compat/clear_element_src.ts
11165
- var clear_element_src = __webpack_require__(5767);
11166
10831
  ;// CONCATENATED MODULE: ./src/compat/set_element_src.ts
11167
10832
  /**
11168
10833
  * Copyright 2015 CANAL+ Group
@@ -11390,6 +11055,8 @@ var merge = __webpack_require__(3071);
11390
11055
  var map = __webpack_require__(9127);
11391
11056
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js + 1 modules
11392
11057
  var Observable = __webpack_require__(1480);
11058
+ // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
11059
+ var event_listeners = __webpack_require__(1381);
11393
11060
  // EXTERNAL MODULE: ./src/compat/eme/custom_media_keys/index.ts + 7 modules
11394
11061
  var custom_media_keys = __webpack_require__(6139);
11395
11062
  ;// CONCATENATED MODULE: ./src/compat/has_eme_apis.ts
@@ -11418,8 +11085,6 @@ var custom_media_keys = __webpack_require__(6139);
11418
11085
  function hasEMEAPIs() {
11419
11086
  return typeof custom_media_keys/* requestMediaKeySystemAccess */.N === "function";
11420
11087
  }
11421
- // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
11422
- var event_listeners = __webpack_require__(1381);
11423
11088
  // EXTERNAL MODULE: ./src/errors/encrypted_media_error.ts
11424
11089
  var encrypted_media_error = __webpack_require__(5157);
11425
11090
  // EXTERNAL MODULE: ./src/features/index.ts
@@ -15746,7 +15411,6 @@ var EncryptedMediaError = /*#__PURE__*/function (_Error) {
15746
15411
  /**
15747
15412
  * @param {string} code
15748
15413
  * @param {string} reason
15749
- * @Param {Boolean} fatal
15750
15414
  */
15751
15415
  function EncryptedMediaError(code, reason) {
15752
15416
  var _this;
@@ -16023,7 +15687,6 @@ var MediaError = /*#__PURE__*/function (_Error) {
16023
15687
  /**
16024
15688
  * @param {string} code
16025
15689
  * @param {string} reason
16026
- * @param {Boolean} fatal
16027
15690
  */
16028
15691
  function MediaError(code, reason) {
16029
15692
  var _this;
@@ -16092,7 +15755,6 @@ var NetworkError = /*#__PURE__*/function (_Error) {
16092
15755
  /**
16093
15756
  * @param {string} code
16094
15757
  * @param {Error} baseError
16095
- * @param {Boolean} fatal
16096
15758
  */
16097
15759
  function NetworkError(code, baseError) {
16098
15760
  var _this;
@@ -16175,7 +15837,6 @@ var OtherError = /*#__PURE__*/function (_Error) {
16175
15837
  /**
16176
15838
  * @param {string} code
16177
15839
  * @param {string} reason
16178
- * @param {Boolean} fatal
16179
15840
  */
16180
15841
  function OtherError(code, reason) {
16181
15842
  var _this;
@@ -17311,6 +16972,7 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17311
16972
  end: Number.MAX_VALUE,
17312
16973
  duration: Number.MAX_VALUE,
17313
16974
  complete: true,
16975
+ privateInfos: {},
17314
16976
  timescale: 1
17315
16977
  }];
17316
16978
  }
@@ -17320,7 +16982,7 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17320
16982
  */
17321
16983
  ;
17322
16984
 
17323
- _proto.getFirstPosition = function getFirstPosition() {
16985
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
17324
16986
  return;
17325
16987
  }
17326
16988
  /**
@@ -17329,9 +16991,36 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17329
16991
  */
17330
16992
  ;
17331
16993
 
17332
- _proto.getLastPosition = function getLastPosition() {
16994
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
16995
+ return;
16996
+ }
16997
+ /**
16998
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
16999
+ * all segments are available.
17000
+ * @returns {number|null|undefined}
17001
+ */
17002
+ ;
17003
+
17004
+ _proto.getEnd = function getEnd() {
17333
17005
  return;
17334
17006
  }
17007
+ /**
17008
+ * Returns:
17009
+ * - `true` if in the given time interval, at least one new segment is
17010
+ * expected to be available in the future.
17011
+ * - `false` either if all segments in that time interval are already
17012
+ * available for download or if none will ever be available for it.
17013
+ * - `undefined` when it is not possible to tell.
17014
+ *
17015
+ * Always `false` in a `StaticRepresentationIndex` because all segments should
17016
+ * be directly available.
17017
+ * @returns {boolean}
17018
+ */
17019
+ ;
17020
+
17021
+ _proto.awaitSegmentBetween = function awaitSegmentBetween() {
17022
+ return false;
17023
+ }
17335
17024
  /**
17336
17025
  * Returns false as a static file never need to be refreshed.
17337
17026
  * @returns {Boolean}
@@ -17349,14 +17038,6 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17349
17038
  _proto.checkDiscontinuity = function checkDiscontinuity() {
17350
17039
  return null;
17351
17040
  }
17352
- /**
17353
- * @returns {boolean}
17354
- */
17355
- ;
17356
-
17357
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
17358
- return true;
17359
- }
17360
17041
  /**
17361
17042
  * Returns true as a static file should never need lose availability.
17362
17043
  * @returns {Boolean}
@@ -17944,7 +17625,7 @@ var Manifest = /*#__PURE__*/function (_EventEmitter) {
17944
17625
  * and mark them as being impossible to decrypt.
17945
17626
  * Then trigger a "decipherabilityUpdate" event to notify everyone of the
17946
17627
  * changes performed.
17947
- * @param {Object} keyUpdates
17628
+ * @param {Function} isDecipherableCb
17948
17629
  */
17949
17630
  ;
17950
17631
 
@@ -19824,7 +19505,7 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19824
19505
  */
19825
19506
  ;
19826
19507
 
19827
- _proto.getFirstPosition = function getFirstPosition() {
19508
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
19828
19509
  var index = this._index;
19829
19510
 
19830
19511
  if (index.timeline.length === 0) {
@@ -19839,7 +19520,7 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19839
19520
  */
19840
19521
  ;
19841
19522
 
19842
- _proto.getLastPosition = function getLastPosition() {
19523
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
19843
19524
  var _a;
19844
19525
 
19845
19526
  var timeline = this._index.timeline;
@@ -19852,6 +19533,33 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19852
19533
  var lastTime = Math.min((0,_utils_index_helpers__WEBPACK_IMPORTED_MODULE_1__/* .getIndexSegmentEnd */ .jH)(lastTimelineElement, null, this._scaledPeriodEnd), (_a = this._scaledPeriodEnd) !== null && _a !== void 0 ? _a : Infinity);
19853
19534
  return (0,_utils_index_helpers__WEBPACK_IMPORTED_MODULE_1__/* .fromIndexTime */ .zG)(lastTime, this._index);
19854
19535
  }
19536
+ /**
19537
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
19538
+ * all segments are available.
19539
+ * @returns {number|null|undefined}
19540
+ */
19541
+ ;
19542
+
19543
+ _proto.getEnd = function getEnd() {
19544
+ return this.getLastAvailablePosition();
19545
+ }
19546
+ /**
19547
+ * Returns:
19548
+ * - `true` if in the given time interval, at least one new segment is
19549
+ * expected to be available in the future.
19550
+ * - `false` either if all segments in that time interval are already
19551
+ * available for download or if none will ever be available for it.
19552
+ * - `undefined` when it is not possible to tell.
19553
+ *
19554
+ * Always `false` in a `BaseRepresentationIndex` because all segments should
19555
+ * be directly available.
19556
+ * @returns {boolean}
19557
+ */
19558
+ ;
19559
+
19560
+ _proto.awaitSegmentBetween = function awaitSegmentBetween() {
19561
+ return false;
19562
+ }
19855
19563
  /**
19856
19564
  * Segments in a segmentBase scheme should stay available.
19857
19565
  * @returns {Boolean|undefined}
@@ -19870,16 +19578,6 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19870
19578
  _proto.checkDiscontinuity = function checkDiscontinuity() {
19871
19579
  return null;
19872
19580
  }
19873
- /**
19874
- * `BaseRepresentationIndex` should just already all be generated.
19875
- * Return `true` as a default value here.
19876
- * @returns {boolean}
19877
- */
19878
- ;
19879
-
19880
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
19881
- return true;
19882
- }
19883
19581
  /**
19884
19582
  * No segment in a `BaseRepresentationIndex` are known initially.
19885
19583
  * It is only defined generally in an "index segment" that will thus need to
@@ -20275,7 +19973,7 @@ function createDashUrlDetokenizer(time, nb) {
20275
19973
 
20276
19974
  /***/ }),
20277
19975
 
20278
- /***/ 4846:
19976
+ /***/ 4541:
20279
19977
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
20280
19978
 
20281
19979
  "use strict";
@@ -20399,7 +20097,7 @@ function getLastPositionFromAdaptation(adaptation) {
20399
20097
  var min = null;
20400
20098
 
20401
20099
  for (var i = 0; i < representations.length; i++) {
20402
- var lastPosition = representations[i].index.getLastPosition();
20100
+ var lastPosition = representations[i].index.getLastAvailablePosition();
20403
20101
 
20404
20102
  if (lastPosition === undefined) {
20405
20103
  // we cannot tell
@@ -20546,7 +20244,7 @@ function getFirstPositionFromAdaptation(adaptation) {
20546
20244
  var max = null;
20547
20245
 
20548
20246
  for (var i = 0; i < representations.length; i++) {
20549
- var firstPosition = representations[i].index.getFirstPosition();
20247
+ var firstPosition = representations[i].index.getFirstAvailablePosition();
20550
20248
 
20551
20249
  if (firstPosition === undefined) {
20552
20250
  // we cannot tell
@@ -21360,7 +21058,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21360
21058
  }
21361
21059
  /**
21362
21060
  * @param {Number} fromTime
21363
- * @param {Number} duration
21061
+ * @param {Number} dur
21364
21062
  * @returns {Array.<Object>}
21365
21063
  */
21366
21064
  ;
@@ -21428,7 +21126,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21428
21126
  */
21429
21127
  ;
21430
21128
 
21431
- _proto.getFirstPosition = function getFirstPosition() {
21129
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
21432
21130
  return this._periodStart;
21433
21131
  }
21434
21132
  /**
@@ -21437,7 +21135,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21437
21135
  */
21438
21136
  ;
21439
21137
 
21440
- _proto.getLastPosition = function getLastPosition() {
21138
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
21441
21139
  var _a;
21442
21140
 
21443
21141
  var index = this._index;
@@ -21445,10 +21143,36 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21445
21143
  list = index.list;
21446
21144
  return Math.min(list.length * duration / index.timescale + this._periodStart, (_a = this._periodEnd) !== null && _a !== void 0 ? _a : Infinity);
21447
21145
  }
21146
+ /**
21147
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
21148
+ * all segments are available.
21149
+ * @returns {number|null|undefined}
21150
+ */
21151
+ ;
21152
+
21153
+ _proto.getEnd = function getEnd() {
21154
+ return this.getLastAvailablePosition();
21155
+ }
21156
+ /**
21157
+ * Returns:
21158
+ * - `true` if in the given time interval, at least one new segment is
21159
+ * expected to be available in the future.
21160
+ * - `false` either if all segments in that time interval are already
21161
+ * available for download or if none will ever be available for it.
21162
+ * - `undefined` when it is not possible to tell.
21163
+ *
21164
+ * Always `false` in a `ListRepresentationIndex` because all segments should
21165
+ * be directly available.
21166
+ * @returns {boolean}
21167
+ */
21168
+ ;
21169
+
21170
+ _proto.awaitSegmentBetween = function awaitSegmentBetween() {
21171
+ return false;
21172
+ }
21448
21173
  /**
21449
21174
  * Returns true if a Segment returned by this index is still considered
21450
21175
  * available.
21451
- * @param {Object} segment
21452
21176
  * @returns {Boolean}
21453
21177
  */
21454
21178
  ;
@@ -21465,14 +21189,6 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21465
21189
  _proto.checkDiscontinuity = function checkDiscontinuity() {
21466
21190
  return null;
21467
21191
  }
21468
- /**
21469
- * @returns {boolean}
21470
- */
21471
- ;
21472
-
21473
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
21474
- return true;
21475
- }
21476
21192
  /**
21477
21193
  * SegmentList should not be updated.
21478
21194
  * @returns {Boolean}
@@ -21505,11 +21221,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21505
21221
 
21506
21222
  _proto._replace = function _replace(newIndex) {
21507
21223
  this._index = newIndex._index;
21508
- }
21509
- /**
21510
- * @param {Object} newIndex
21511
- */
21512
- ;
21224
+ };
21513
21225
 
21514
21226
  _proto._update = function _update() {
21515
21227
  log/* default.error */.Z.error("List RepresentationIndex: Cannot update a SegmentList");
@@ -21521,6 +21233,8 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21521
21233
 
21522
21234
  // EXTERNAL MODULE: ./src/errors/network_error.ts
21523
21235
  var network_error = __webpack_require__(9362);
21236
+ // EXTERNAL MODULE: ./src/utils/assert.ts
21237
+ var assert = __webpack_require__(811);
21524
21238
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/clear_timeline_from_position.ts
21525
21239
  var clear_timeline_from_position = __webpack_require__(8232);
21526
21240
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/is_segment_still_available.ts
@@ -21529,7 +21243,7 @@ var is_segment_still_available = __webpack_require__(1091);
21529
21243
  var update_segment_timeline = __webpack_require__(5505);
21530
21244
  // EXTERNAL MODULE: ./src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts
21531
21245
  var get_segments_from_timeline = __webpack_require__(6394);
21532
- ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts
21246
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/utils.ts
21533
21247
  /**
21534
21248
  * Copyright 2015 CANAL+ Group
21535
21249
  *
@@ -21550,18 +21264,14 @@ var get_segments_from_timeline = __webpack_require__(6394);
21550
21264
  * In Javascript, numbers are encoded in a way that a floating number may be
21551
21265
  * represented internally with a rounding error.
21552
21266
  *
21553
- * As the period end is the result of a multiplication between a floating or integer
21554
- * number (period end * timescale), this function takes into account the potential
21555
- * rounding error to tell if the period is fulfilled with content.
21267
+ * This function returns a small number allowing to accound for rounding many
21268
+ * rounding errors.
21556
21269
  * @param {number} timescale
21557
- * @param {number} lastSegmentEnd
21558
- * @param {number} periodEnd
21559
21270
  * @returns {boolean}
21560
21271
  */
21561
21272
 
21562
- function isPeriodFulfilled(timescale, lastSegmentEnd, periodEnd) {
21563
- var scaledRoundingError = config/* default.getCurrent */.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
21564
- return lastSegmentEnd + scaledRoundingError >= periodEnd;
21273
+ function getSegmentTimeRoundingError(timescale) {
21274
+ return config/* default.getCurrent */.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
21565
21275
  }
21566
21276
  ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.ts
21567
21277
  /**
@@ -22014,6 +21724,7 @@ function constructTimelineFromPreviousTimeline(newElements, prevTimeline) {
22014
21724
 
22015
21725
 
22016
21726
 
21727
+
22017
21728
  // eslint-disable-next-line max-len
22018
21729
 
22019
21730
 
@@ -22140,7 +21851,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22140
21851
  */
22141
21852
  ;
22142
21853
 
22143
- _proto.getFirstPosition = function getFirstPosition() {
21854
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
22144
21855
  this._refreshTimeline();
22145
21856
 
22146
21857
  if (this._index.timeline === null) {
@@ -22158,7 +21869,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22158
21869
  */
22159
21870
  ;
22160
21871
 
22161
- _proto.getLastPosition = function getLastPosition() {
21872
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
22162
21873
  this._refreshTimeline();
22163
21874
 
22164
21875
  if (this._index.timeline === null) {
@@ -22168,6 +21879,72 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22168
21879
  var lastTime = TimelineRepresentationIndex.getIndexEnd(this._index.timeline, this._scaledPeriodEnd);
22169
21880
  return lastTime === null ? null : (0,index_helpers/* fromIndexTime */.zG)(lastTime, this._index);
22170
21881
  }
21882
+ /**
21883
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
21884
+ * all segments are available.
21885
+ * @returns {number|null|undefined}
21886
+ */
21887
+ ;
21888
+
21889
+ _proto.getEnd = function getEnd() {
21890
+ if (!this._isDynamic || !this._isLastPeriod) {
21891
+ // @see isFinished
21892
+ return this.getLastAvailablePosition();
21893
+ }
21894
+
21895
+ return undefined;
21896
+ }
21897
+ /**
21898
+ * Returns:
21899
+ * - `true` if in the given time interval, at least one new segment is
21900
+ * expected to be available in the future.
21901
+ * - `false` either if all segments in that time interval are already
21902
+ * available for download or if none will ever be available for it.
21903
+ * - `undefined` when it is not possible to tell.
21904
+ * @param {number} start
21905
+ * @param {number} end
21906
+ * @returns {boolean|undefined}
21907
+ */
21908
+ ;
21909
+
21910
+ _proto.awaitSegmentBetween = function awaitSegmentBetween(start, end) {
21911
+ var _a;
21912
+
21913
+ (0,assert/* default */.Z)(start <= end);
21914
+
21915
+ if (!this._isDynamic || !this._isLastPeriod) {
21916
+ return false;
21917
+ }
21918
+
21919
+ this._refreshTimeline();
21920
+
21921
+ if (this._index.timeline === null) {
21922
+ this._index.timeline = this._getTimeline();
21923
+ }
21924
+
21925
+ var _this$_index2 = this._index,
21926
+ timeline = _this$_index2.timeline,
21927
+ timescale = _this$_index2.timescale;
21928
+ var segmentTimeRounding = getSegmentTimeRoundingError(timescale);
21929
+ var scaledEnd = (0,index_helpers/* toIndexTime */.gT)(end, this._index);
21930
+
21931
+ if (timeline.length > 0) {
21932
+ var lastTimelineElement = timeline[timeline.length - 1];
21933
+ var lastSegmentEnd = (0,index_helpers/* getIndexSegmentEnd */.jH)(lastTimelineElement, null, this._scaledPeriodEnd);
21934
+ var roundedEnd = lastSegmentEnd + segmentTimeRounding;
21935
+
21936
+ if (roundedEnd >= Math.min(scaledEnd, (_a = this._scaledPeriodEnd) !== null && _a !== void 0 ? _a : Infinity)) {
21937
+ return false; // already loaded
21938
+ }
21939
+ }
21940
+
21941
+ if (this._scaledPeriodEnd === undefined) {
21942
+ return scaledEnd + segmentTimeRounding > this._scaledPeriodStart ? undefined : false;
21943
+ }
21944
+
21945
+ var scaledStart = (0,index_helpers/* toIndexTime */.gT)(start, this._index);
21946
+ return scaledStart - segmentTimeRounding < this._scaledPeriodEnd && scaledEnd + segmentTimeRounding > this._scaledPeriodStart;
21947
+ }
22171
21948
  /**
22172
21949
  * Returns true if a Segment returned by this index is still considered
22173
21950
  * available.
@@ -22189,10 +21966,10 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22189
21966
  this._index.timeline = this._getTimeline();
22190
21967
  }
22191
21968
 
22192
- var _this$_index2 = this._index,
22193
- timeline = _this$_index2.timeline,
22194
- timescale = _this$_index2.timescale,
22195
- indexTimeOffset = _this$_index2.indexTimeOffset;
21969
+ var _this$_index3 = this._index,
21970
+ timeline = _this$_index3.timeline,
21971
+ timescale = _this$_index3.timescale,
21972
+ indexTimeOffset = _this$_index3.indexTimeOffset;
22196
21973
  return (0,is_segment_still_available/* default */.Z)(segment, timeline, timescale, indexTimeOffset);
22197
21974
  }
22198
21975
  /**
@@ -22233,10 +22010,6 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22233
22010
  }
22234
22011
 
22235
22012
  return error instanceof network_error/* default */.Z && error.isHttpError(404);
22236
- };
22237
-
22238
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
22239
- return true;
22240
22013
  }
22241
22014
  /**
22242
22015
  * Replace this RepresentationIndex with one from a new version of the
@@ -22314,7 +22087,8 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22314
22087
 
22315
22088
  var lastTimelineElement = timeline[timeline.length - 1];
22316
22089
  var lastTime = (0,index_helpers/* getIndexSegmentEnd */.jH)(lastTimelineElement, null, this._scaledPeriodEnd);
22317
- return isPeriodFulfilled(this._index.timescale, lastTime, this._scaledPeriodEnd);
22090
+ var segmentTimeRounding = getSegmentTimeRoundingError(this._index.timescale);
22091
+ return lastTime + segmentTimeRounding >= this._scaledPeriodEnd;
22318
22092
  }
22319
22093
  /**
22320
22094
  * @returns {Boolean}
@@ -22474,6 +22248,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22474
22248
 
22475
22249
 
22476
22250
 
22251
+
22477
22252
  /**
22478
22253
  * IRepresentationIndex implementation for DASH' SegmentTemplate without a
22479
22254
  * SegmentTimeline.
@@ -22531,7 +22306,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22531
22306
  };
22532
22307
  this._isDynamic = isDynamic;
22533
22308
  this._periodStart = periodStart;
22534
- this._scaledPeriodEnd = periodEnd === undefined ? undefined : (periodEnd - periodStart) * timescale;
22309
+ this._scaledRelativePeriodEnd = periodEnd === undefined ? undefined : (periodEnd - periodStart) * timescale;
22535
22310
  this._isEMSGWhitelisted = isEMSGWhitelisted;
22536
22311
  }
22537
22312
  /**
@@ -22559,7 +22334,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22559
22334
  timescale = index.timescale,
22560
22335
  mediaURLs = index.mediaURLs;
22561
22336
  var scaledStart = this._periodStart * timescale;
22562
- var scaledEnd = this._scaledPeriodEnd; // Convert the asked position to the right timescales, and consider them
22337
+ var scaledEnd = this._scaledRelativePeriodEnd; // Convert the asked position to the right timescales, and consider them
22563
22338
  // relatively to the Period's start.
22564
22339
 
22565
22340
  var upFromPeriodStart = fromTime * timescale - scaledStart;
@@ -22622,7 +22397,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22622
22397
  */
22623
22398
  ;
22624
22399
 
22625
- _proto.getFirstPosition = function getFirstPosition() {
22400
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
22626
22401
  var firstSegmentStart = this._getFirstSegmentStart();
22627
22402
 
22628
22403
  if (firstSegmentStart == null) {
@@ -22637,21 +22412,75 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22637
22412
  */
22638
22413
  ;
22639
22414
 
22640
- _proto.getLastPosition = function getLastPosition() {
22415
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
22641
22416
  var _a;
22642
22417
 
22643
22418
  var lastSegmentStart = this._getLastSegmentStart();
22644
22419
 
22645
22420
  if (lastSegmentStart == null) {
22646
- // In that case (null or undefined), getLastPosition should reflect
22421
+ // In that case (null or undefined), getLastAvailablePosition should reflect
22647
22422
  // the result of getLastSegmentStart, as the meaning is the same for
22648
22423
  // the two functions. So, we return the result of the latter.
22649
22424
  return lastSegmentStart;
22650
22425
  }
22651
22426
 
22652
- var lastSegmentEnd = Math.min(lastSegmentStart + this._index.duration, (_a = this._scaledPeriodEnd) !== null && _a !== void 0 ? _a : Infinity);
22427
+ var lastSegmentEnd = Math.min(lastSegmentStart + this._index.duration, (_a = this._scaledRelativePeriodEnd) !== null && _a !== void 0 ? _a : Infinity);
22653
22428
  return lastSegmentEnd / this._index.timescale + this._periodStart;
22654
22429
  }
22430
+ /**
22431
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
22432
+ * all segments are available.
22433
+ * @returns {number|null|undefined}
22434
+ */
22435
+ ;
22436
+
22437
+ _proto.getEnd = function getEnd() {
22438
+ if (!this._isDynamic) {
22439
+ return this.getLastAvailablePosition();
22440
+ }
22441
+
22442
+ if (this._scaledRelativePeriodEnd === undefined) {
22443
+ return undefined;
22444
+ }
22445
+
22446
+ var timescale = this._index.timescale;
22447
+ var absoluteScaledPeriodEnd = this._scaledRelativePeriodEnd + this._periodStart * timescale;
22448
+ return absoluteScaledPeriodEnd / this._index.timescale;
22449
+ }
22450
+ /**
22451
+ * Returns:
22452
+ * - `true` if in the given time interval, at least one new segment is
22453
+ * expected to be available in the future.
22454
+ * - `false` either if all segments in that time interval are already
22455
+ * available for download or if none will ever be available for it.
22456
+ * - `undefined` when it is not possible to tell.
22457
+ *
22458
+ * Always `false` in a `BaseRepresentationIndex` because all segments should
22459
+ * be directly available.
22460
+ * @returns {boolean}
22461
+ */
22462
+ ;
22463
+
22464
+ _proto.awaitSegmentBetween = function awaitSegmentBetween(start, end) {
22465
+ (0,assert/* default */.Z)(start <= end);
22466
+
22467
+ if (!this._isDynamic) {
22468
+ return false;
22469
+ }
22470
+
22471
+ var timescale = this._index.timescale;
22472
+ var segmentTimeRounding = getSegmentTimeRoundingError(timescale);
22473
+ var scaledPeriodStart = this._periodStart * timescale;
22474
+ var scaledRelativeEnd = end * timescale - scaledPeriodStart;
22475
+
22476
+ if (this._scaledRelativePeriodEnd === undefined) {
22477
+ return scaledRelativeEnd + segmentTimeRounding >= 0;
22478
+ }
22479
+
22480
+ var scaledRelativePeriodEnd = this._scaledRelativePeriodEnd;
22481
+ var scaledRelativeStart = start * timescale - scaledPeriodStart;
22482
+ return scaledRelativeStart - segmentTimeRounding < scaledRelativePeriodEnd && scaledRelativeEnd + segmentTimeRounding >= 0;
22483
+ }
22655
22484
  /**
22656
22485
  * Returns true if, based on the arguments, the index should be refreshed.
22657
22486
  * We never have to refresh a SegmentTemplate-based manifest.
@@ -22671,14 +22500,6 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22671
22500
  _proto.checkDiscontinuity = function checkDiscontinuity() {
22672
22501
  return null;
22673
22502
  }
22674
- /**
22675
- * @returns {Boolean}
22676
- */
22677
- ;
22678
-
22679
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
22680
- return true;
22681
- }
22682
22503
  /**
22683
22504
  * Returns `true` if the given segment should still be available as of now
22684
22505
  * (not removed since and still request-able).
@@ -22721,7 +22542,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22721
22542
  return true;
22722
22543
  }
22723
22544
 
22724
- if (this._scaledPeriodEnd === undefined) {
22545
+ if (this._scaledRelativePeriodEnd === undefined) {
22725
22546
  return false;
22726
22547
  }
22727
22548
 
@@ -22736,7 +22557,8 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22736
22557
  }
22737
22558
 
22738
22559
  var lastSegmentEnd = lastSegmentStart + this._index.duration;
22739
- return isPeriodFulfilled(timescale, lastSegmentEnd, this._scaledPeriodEnd);
22560
+ var segmentTimeRounding = getSegmentTimeRoundingError(timescale);
22561
+ return lastSegmentEnd + segmentTimeRounding >= this._scaledRelativePeriodEnd;
22740
22562
  }
22741
22563
  /**
22742
22564
  * @returns {Boolean}
@@ -22756,7 +22578,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22756
22578
  this._aggressiveMode = newIndex._aggressiveMode;
22757
22579
  this._isDynamic = newIndex._isDynamic;
22758
22580
  this._periodStart = newIndex._periodStart;
22759
- this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
22581
+ this._scaledRelativePeriodEnd = newIndex._scaledRelativePeriodEnd;
22760
22582
  this._manifestBoundsCalculator = newIndex._manifestBoundsCalculator;
22761
22583
  }
22762
22584
  /**
@@ -22782,7 +22604,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22782
22604
  } // 1 - check that this index is already available
22783
22605
 
22784
22606
 
22785
- if (this._scaledPeriodEnd === 0 || this._scaledPeriodEnd === undefined) {
22607
+ if (this._scaledRelativePeriodEnd === 0 || this._scaledRelativePeriodEnd === undefined) {
22786
22608
  // /!\ The scaled max position augments continuously and might not
22787
22609
  // reflect exactly the real server-side value. As segments are
22788
22610
  // generated discretely.
@@ -22833,12 +22655,12 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22833
22655
 
22834
22656
  var agressiveModeOffset = this._aggressiveMode ? duration / timescale : 0;
22835
22657
 
22836
- if (this._scaledPeriodEnd != null && this._scaledPeriodEnd < (lastPos + agressiveModeOffset - this._periodStart) * this._index.timescale) {
22837
- if (this._scaledPeriodEnd < duration) {
22658
+ if (this._scaledRelativePeriodEnd != null && this._scaledRelativePeriodEnd < (lastPos + agressiveModeOffset - this._periodStart) * this._index.timescale) {
22659
+ if (this._scaledRelativePeriodEnd < duration) {
22838
22660
  return null;
22839
22661
  }
22840
22662
 
22841
- return (Math.floor(this._scaledPeriodEnd / duration) - 1) * duration;
22663
+ return (Math.floor(this._scaledRelativePeriodEnd / duration) - 1) * duration;
22842
22664
  } // /!\ The scaled last position augments continuously and might not
22843
22665
  // reflect exactly the real server-side value. As segments are
22844
22666
  // generated discretely.
@@ -22855,7 +22677,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22855
22677
  var numberOfSegmentsAvailable = Math.floor((scaledLastPosition + availabilityTimeOffset) / duration);
22856
22678
  return numberOfSegmentsAvailable <= 0 ? null : (numberOfSegmentsAvailable - 1) * duration;
22857
22679
  } else {
22858
- var maximumTime = (_a = this._scaledPeriodEnd) !== null && _a !== void 0 ? _a : 0;
22680
+ var maximumTime = (_a = this._scaledRelativePeriodEnd) !== null && _a !== void 0 ? _a : 0;
22859
22681
  var numberIndexedToZero = Math.ceil(maximumTime / duration) - 1;
22860
22682
  var regularLastSegmentStart = numberIndexedToZero * duration; // In some SegmentTemplate, we could think that there is one more
22861
22683
  // segment that there actually is due to a very little difference between
@@ -24009,7 +23831,7 @@ function getMaximumLastPosition(adaptationsPerType) {
24009
23831
 
24010
23832
  for (var _iterator2 = parse_periods_createForOfIteratorHelperLoose(representations), _step2; !(_step2 = _iterator2()).done;) {
24011
23833
  var representation = _step2.value;
24012
- var position = representation.index.getLastPosition();
23834
+ var position = representation.index.getLastAvailablePosition();
24013
23835
 
24014
23836
  if (position !== null) {
24015
23837
  allIndexAreEmpty = false;
@@ -31995,7 +31817,7 @@ var generate_manifest_loader = __webpack_require__(8791);
31995
31817
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
31996
31818
  var asyncToGenerator = __webpack_require__(5861);
31997
31819
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
31998
- var regenerator = __webpack_require__(7757);
31820
+ var regenerator = __webpack_require__(4687);
31999
31821
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
32000
31822
  // EXTERNAL MODULE: ./src/utils/request/index.ts + 1 modules
32001
31823
  var request = __webpack_require__(4597);
@@ -34536,7 +34358,7 @@ __webpack_require__.d(__webpack_exports__, {
34536
34358
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
34537
34359
  var asyncToGenerator = __webpack_require__(5861);
34538
34360
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
34539
- var regenerator = __webpack_require__(7757);
34361
+ var regenerator = __webpack_require__(4687);
34540
34362
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
34541
34363
  // EXTERNAL MODULE: ./src/features/index.ts
34542
34364
  var features = __webpack_require__(7874);
@@ -34546,416 +34368,10 @@ var log = __webpack_require__(3887);
34546
34368
  var src_manifest = __webpack_require__(1989);
34547
34369
  // EXTERNAL MODULE: ./src/parsers/containers/isobmff/read.ts
34548
34370
  var read = __webpack_require__(6807);
34549
- // EXTERNAL MODULE: ./src/manifest/adaptation.ts + 3 modules
34550
- var adaptation = __webpack_require__(8999);
34551
- // EXTERNAL MODULE: ./src/utils/array_includes.ts
34552
- var array_includes = __webpack_require__(7714);
34553
- // EXTERNAL MODULE: ./src/utils/assert.ts
34554
- var assert = __webpack_require__(811);
34555
- // EXTERNAL MODULE: ./src/utils/byte_parsing.ts
34556
- var byte_parsing = __webpack_require__(6968);
34557
- // EXTERNAL MODULE: ./src/utils/is_non_empty_string.ts
34558
- var is_non_empty_string = __webpack_require__(6923);
34559
- // EXTERNAL MODULE: ./src/utils/object_assign.ts
34560
- var object_assign = __webpack_require__(8026);
34561
- // EXTERNAL MODULE: ./src/utils/resolve_url.ts
34562
- var resolve_url = __webpack_require__(9829);
34563
- // EXTERNAL MODULE: ./src/utils/string_parsing.ts
34564
- var string_parsing = __webpack_require__(3635);
34565
- // EXTERNAL MODULE: ./src/utils/take_first_set.ts
34566
- var take_first_set = __webpack_require__(5278);
34567
- // EXTERNAL MODULE: ./src/parsers/containers/isobmff/constants.ts
34568
- var constants = __webpack_require__(2689);
34569
- ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/create_box.ts
34570
- /**
34571
- * Copyright 2015 CANAL+ Group
34572
- *
34573
- * Licensed under the Apache License, Version 2.0 (the "License");
34574
- * you may not use this file except in compliance with the License.
34575
- * You may obtain a copy of the License at
34576
- *
34577
- * http://www.apache.org/licenses/LICENSE-2.0
34578
- *
34579
- * Unless required by applicable law or agreed to in writing, software
34580
- * distributed under the License is distributed on an "AS IS" BASIS,
34581
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34582
- * See the License for the specific language governing permissions and
34583
- * limitations under the License.
34584
- */
34585
-
34586
-
34587
-
34588
- /**
34589
- * Speed up string to bytes conversion by memorizing the result
34590
- *
34591
- * The keys here are ISOBMFF box names. The values are the corresponding
34592
- * bytes conversion for putting as an ISOBMFF boxes.
34593
- *
34594
- * Used by the boxName method.
34595
- * @type {Object}
34596
- */
34597
-
34598
- var boxNamesMem = {};
34599
- /**
34600
- * Convert the string name of an ISOBMFF box into the corresponding bytes.
34601
- * Has a memorization mechanism to speed-up if you want to translate the
34602
- * same string multiple times.
34603
- * @param {string} str
34604
- * @returns {Uint8Array}
34605
- */
34606
-
34607
- function boxName(str) {
34608
- if (boxNamesMem[str] != null) {
34609
- return boxNamesMem[str];
34610
- }
34611
-
34612
- var nameInBytes = (0,string_parsing/* strToUtf8 */.tG)(str);
34613
- boxNamesMem[str] = nameInBytes;
34614
- return nameInBytes;
34615
- }
34616
- /**
34617
- * Create a new ISOBMFF "box" with the given name.
34618
- * @param {string} name - name of the box you want to create, must always
34619
- * be 4 characters (uuid boxes not supported)
34620
- * @param {Uint8Array} buff - content of the box
34621
- * @returns {Uint8Array} - The entire ISOBMFF box (length+name+content)
34622
- */
34623
-
34624
-
34625
- function createBox(name, buff) {
34626
- var len = buff.length + 8;
34627
- return len <= constants/* MAX_32_BIT_INT */.s ? (0,byte_parsing/* concat */.zo)((0,byte_parsing/* itobe4 */.kh)(len), boxName(name), buff) : (0,byte_parsing/* concat */.zo)((0,byte_parsing/* itobe4 */.kh)(1), boxName(name), (0,byte_parsing/* itobe8 */.el)(len + 8), buff);
34628
- }
34629
- /**
34630
- * @param {string} name
34631
- * @param {Array.<Uint8Array>} children
34632
- * @returns {Uint8Array}
34633
- */
34634
-
34635
-
34636
- function createBoxWithChildren(name, children) {
34637
- return createBox(name, byte_parsing/* concat.apply */.zo.apply(void 0, children));
34638
- }
34639
-
34640
-
34641
- ;// CONCATENATED MODULE: ./src/parsers/manifest/utils/check_manifest_ids.ts
34642
- /**
34643
- * Copyright 2015 CANAL+ Group
34644
- *
34645
- * Licensed under the Apache License, Version 2.0 (the "License");
34646
- * you may not use this file except in compliance with the License.
34647
- * You may obtain a copy of the License at
34648
- *
34649
- * http://www.apache.org/licenses/LICENSE-2.0
34650
- *
34651
- * Unless required by applicable law or agreed to in writing, software
34652
- * distributed under the License is distributed on an "AS IS" BASIS,
34653
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34654
- * See the License for the specific language governing permissions and
34655
- * limitations under the License.
34656
- */
34657
-
34658
-
34659
- /**
34660
- * Ensure that no two periods, adaptations from the same period and
34661
- * representations from the same adaptation, have the same ID.
34662
- *
34663
- * Log and mutate their ID if not until this is verified.
34664
- *
34665
- * @param {Object} manifest
34666
- */
34667
-
34668
- function checkManifestIDs(manifest) {
34669
- var periodIDS = [];
34670
- manifest.periods.forEach(function (period) {
34671
- var periodID = period.id;
34672
-
34673
- if ((0,array_includes/* default */.Z)(periodIDS, periodID)) {
34674
- log/* default.warn */.Z.warn("Two periods with the same ID found. Updating.");
34675
- var newID = periodID + "-dup";
34676
- period.id = newID;
34677
- checkManifestIDs(manifest);
34678
- periodIDS.push(newID);
34679
- } else {
34680
- periodIDS.push(periodID);
34681
- }
34682
-
34683
- var adaptations = period.adaptations;
34684
- var adaptationIDs = [];
34685
- Object.keys(adaptations).forEach(function (type) {
34686
- var adaptationsForType = adaptations[type];
34687
-
34688
- if (adaptationsForType === undefined) {
34689
- return;
34690
- }
34691
-
34692
- adaptationsForType.forEach(function (adaptation) {
34693
- var adaptationID = adaptation.id;
34694
-
34695
- if ((0,array_includes/* default */.Z)(adaptationIDs, adaptationID)) {
34696
- log/* default.warn */.Z.warn("Two adaptations with the same ID found. Updating.", adaptationID);
34697
- var newID = adaptationID + "-dup";
34698
- adaptation.id = newID;
34699
- checkManifestIDs(manifest);
34700
- adaptationIDs.push(newID);
34701
- } else {
34702
- adaptationIDs.push(adaptationID);
34703
- }
34704
-
34705
- var representationIDs = [];
34706
- adaptation.representations.forEach(function (representation) {
34707
- var representationID = representation.id;
34708
-
34709
- if ((0,array_includes/* default */.Z)(representationIDs, representationID)) {
34710
- log/* default.warn */.Z.warn("Two representations with the same ID found. Updating.", representationID);
34711
-
34712
- var _newID = representationID + "-dup";
34713
-
34714
- representation.id = _newID;
34715
- checkManifestIDs(manifest);
34716
- representationIDs.push(_newID);
34717
- } else {
34718
- representationIDs.push(representationID);
34719
- }
34720
- });
34721
- });
34722
- });
34723
- });
34724
- }
34725
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/get_codecs.ts
34726
- /**
34727
- * Copyright 2015 CANAL+ Group
34728
- *
34729
- * Licensed under the Apache License, Version 2.0 (the "License");
34730
- * you may not use this file except in compliance with the License.
34731
- * You may obtain a copy of the License at
34732
- *
34733
- * http://www.apache.org/licenses/LICENSE-2.0
34734
- *
34735
- * Unless required by applicable law or agreed to in writing, software
34736
- * distributed under the License is distributed on an "AS IS" BASIS,
34737
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34738
- * See the License for the specific language governing permissions and
34739
- * limitations under the License.
34740
- */
34741
-
34742
- /**
34743
- * @param {string} codecPrivateData
34744
- * @param {string|undefined} fourCC
34745
- * @returns {string}
34746
- */
34747
-
34748
- function getAudioCodecs(codecPrivateData, fourCC) {
34749
- var mpProfile;
34750
-
34751
- if (fourCC === "AACH") {
34752
- mpProfile = 5; // High Efficiency AAC Profile
34753
- } else {
34754
- mpProfile = (0,is_non_empty_string/* default */.Z)(codecPrivateData) ? (parseInt(codecPrivateData.substring(0, 2), 16) & 0xF8) >> 3 : 2;
34755
- }
34756
-
34757
- if (mpProfile === 0) {
34758
- // Return default audio codec
34759
- return "mp4a.40.2";
34760
- }
34761
-
34762
- return "mp4a.40." + mpProfile;
34763
- }
34764
- /**
34765
- * @param {string} codecPrivateData
34766
- * @returns {string}
34767
- */
34768
-
34769
- function getVideoCodecs(codecPrivateData) {
34770
- // we can extract codes only if fourCC is on of "H264", "X264", "DAVC", "AVC1"
34771
- var arr = /00000001\d7([0-9a-fA-F]{6})/.exec(codecPrivateData);
34772
-
34773
- if (arr === null || !(0,is_non_empty_string/* default */.Z)(arr[1])) {
34774
- // Return default video codec
34775
- return "avc1.4D401E";
34776
- }
34777
-
34778
- return "avc1." + arr[1];
34779
- }
34780
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_C_nodes.ts
34781
- /**
34782
- * Copyright 2015 CANAL+ Group
34783
- *
34784
- * Licensed under the Apache License, Version 2.0 (the "License");
34785
- * you may not use this file except in compliance with the License.
34786
- * You may obtain a copy of the License at
34787
- *
34788
- * http://www.apache.org/licenses/LICENSE-2.0
34789
- *
34790
- * Unless required by applicable law or agreed to in writing, software
34791
- * distributed under the License is distributed on an "AS IS" BASIS,
34792
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34793
- * See the License for the specific language governing permissions and
34794
- * limitations under the License.
34795
- */
34796
-
34797
- /**
34798
- * Parse C nodes to build index timeline.
34799
- * @param {Element} nodes
34800
- */
34801
-
34802
- function parseCNodes(nodes) {
34803
- return nodes.reduce(function (timeline, node, i) {
34804
- var dAttr = node.getAttribute("d");
34805
- var tAttr = node.getAttribute("t");
34806
- var rAttr = node.getAttribute("r");
34807
- var repeatCount = rAttr !== null ? +rAttr - 1 : 0;
34808
- var start = tAttr !== null ? +tAttr : undefined;
34809
- var duration = dAttr !== null ? +dAttr : undefined;
34810
-
34811
- if (i === 0) {
34812
- // first node
34813
- start = start === undefined || isNaN(start) ? 0 : start;
34814
- } else {
34815
- // from second node to the end
34816
- var prev = timeline[i - 1];
34817
-
34818
- if (start == null || isNaN(start)) {
34819
- if (prev.duration == null || isNaN(prev.duration)) {
34820
- throw new Error("Smooth: Invalid CNodes. Missing timestamp.");
34821
- }
34822
-
34823
- start = prev.start + prev.duration * (prev.repeatCount + 1);
34824
- }
34825
- }
34826
-
34827
- if (duration == null || isNaN(duration)) {
34828
- var nextNode = nodes[i + 1];
34829
-
34830
- if (nextNode !== undefined) {
34831
- var nextTAttr = nextNode.getAttribute("t");
34832
- var nextStart = (0,is_non_empty_string/* default */.Z)(nextTAttr) ? +nextTAttr : null;
34833
-
34834
- if (nextStart === null) {
34835
- throw new Error("Can't build index timeline from Smooth Manifest.");
34836
- }
34837
-
34838
- duration = nextStart - start;
34839
- } else {
34840
- return timeline;
34841
- }
34842
- }
34843
-
34844
- timeline.push({
34845
- duration: duration,
34846
- start: start,
34847
- repeatCount: repeatCount
34848
- });
34849
- return timeline;
34850
- }, []);
34851
- }
34852
- // EXTERNAL MODULE: ./src/utils/base64.ts
34853
- var base64 = __webpack_require__(9689);
34854
- ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/drm/playready.ts
34855
- /**
34856
- * Copyright 2015 CANAL+ Group
34857
- *
34858
- * Licensed under the Apache License, Version 2.0 (the "License");
34859
- * you may not use this file except in compliance with the License.
34860
- * You may obtain a copy of the License at
34861
- *
34862
- * http://www.apache.org/licenses/LICENSE-2.0
34863
- *
34864
- * Unless required by applicable law or agreed to in writing, software
34865
- * distributed under the License is distributed on an "AS IS" BASIS,
34866
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34867
- * See the License for the specific language governing permissions and
34868
- * limitations under the License.
34869
- */
34870
-
34871
-
34872
-
34873
- /**
34874
- * Parse PlayReady privateData to get its Hexa-coded KeyID.
34875
- * @param {Uint8Array} privateData
34876
- * @returns {string}
34877
- */
34878
-
34879
- function getPlayReadyKIDFromPrivateData(data) {
34880
- var xmlLength = (0,byte_parsing/* le2toi */.qb)(data, 8);
34881
- var xml = (0,string_parsing/* utf16LEToStr */.wV)(data.subarray(10, xmlLength + 10));
34882
- var doc = new DOMParser().parseFromString(xml, "application/xml");
34883
- var kidElement = doc.querySelector("KID");
34884
-
34885
- if (kidElement === null) {
34886
- throw new Error("Cannot parse PlayReady private data: invalid XML");
34887
- }
34888
-
34889
- var b64guidKid = kidElement.textContent === null ? "" : kidElement.textContent;
34890
- var uuidKid = (0,string_parsing/* guidToUuid */.wO)((0,base64/* base64ToBytes */.K)(b64guidKid));
34891
- return (0,string_parsing/* bytesToHex */.ci)(uuidKid).toLowerCase();
34892
- }
34893
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_protection_node.ts
34894
- /**
34895
- * Copyright 2015 CANAL+ Group
34896
- *
34897
- * Licensed under the Apache License, Version 2.0 (the "License");
34898
- * you may not use this file except in compliance with the License.
34899
- * You may obtain a copy of the License at
34900
- *
34901
- * http://www.apache.org/licenses/LICENSE-2.0
34902
- *
34903
- * Unless required by applicable law or agreed to in writing, software
34904
- * distributed under the License is distributed on an "AS IS" BASIS,
34905
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34906
- * See the License for the specific language governing permissions and
34907
- * limitations under the License.
34908
- */
34909
-
34910
-
34911
-
34912
-
34913
- /**
34914
- * @param {Uint8Array} keyIdBytes
34915
- * @returns {Array.<Object>}
34916
- */
34917
-
34918
- function createWidevineKeySystem(keyIdBytes) {
34919
- return [{
34920
- systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
34921
- privateData: (0,byte_parsing/* concat */.zo)([0x08, 0x01, 0x12, 0x10], keyIdBytes)
34922
- }];
34923
- }
34924
- /**
34925
- * Parse "Protection" Node, which contains DRM information
34926
- * @param {Element} protectionNode
34927
- * @returns {Object}
34928
- */
34929
-
34930
-
34931
- function parseProtectionNode(protectionNode, keySystemCreator) {
34932
- if (keySystemCreator === void 0) {
34933
- keySystemCreator = createWidevineKeySystem;
34934
- }
34935
-
34936
- if (protectionNode.firstElementChild === null || protectionNode.firstElementChild.nodeName !== "ProtectionHeader") {
34937
- throw new Error("Protection should have ProtectionHeader child");
34938
- }
34939
-
34940
- var header = protectionNode.firstElementChild;
34941
- var privateData = (0,base64/* base64ToBytes */.K)(header.textContent === null ? "" : header.textContent);
34942
- var keyIdHex = getPlayReadyKIDFromPrivateData(privateData);
34943
- var keyIdBytes = (0,string_parsing/* hexToBytes */.nr)(keyIdHex); // remove possible braces
34944
-
34945
- var systemIdAttr = header.getAttribute("SystemID");
34946
- var systemId = (systemIdAttr !== null ? systemIdAttr : "").toLowerCase().replace(/\{|\}/g, "");
34947
- return {
34948
- keyId: keyIdBytes,
34949
- keySystems: [{
34950
- systemId: systemId,
34951
- privateData: privateData
34952
- /* keyIds: [keyIdBytes], */
34953
-
34954
- }].concat(keySystemCreator(keyIdBytes))
34955
- };
34956
- }
34957
34371
  // EXTERNAL MODULE: ./src/errors/network_error.ts
34958
34372
  var network_error = __webpack_require__(9362);
34373
+ // EXTERNAL MODULE: ./src/utils/assert.ts
34374
+ var assert = __webpack_require__(811);
34959
34375
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/clear_timeline_from_position.ts
34960
34376
  var clear_timeline_from_position = __webpack_require__(8232);
34961
34377
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/index_helpers.ts
@@ -35093,6 +34509,7 @@ function replaceSegmentSmoothTokens(url, time) {
35093
34509
 
35094
34510
 
35095
34511
 
34512
+
35096
34513
  /**
35097
34514
  * @param {Number} start
35098
34515
  * @param {Number} up
@@ -35219,7 +34636,7 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35219
34636
  * Generate a list of Segments for a particular period of time.
35220
34637
  *
35221
34638
  * @param {Number} from
35222
- * @param {Number} duration
34639
+ * @param {Number} dur
35223
34640
  * @returns {Array.<Object>}
35224
34641
  */
35225
34642
  ;
@@ -35330,13 +34747,11 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35330
34747
  }
35331
34748
  /**
35332
34749
  * Returns first position available in the index.
35333
- *
35334
- * @param {Object} index
35335
34750
  * @returns {Number|null}
35336
34751
  */
35337
34752
  ;
35338
34753
 
35339
- _proto.getFirstPosition = function getFirstPosition() {
34754
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
35340
34755
  this._refreshTimeline();
35341
34756
 
35342
34757
  var index = this._index;
@@ -35349,12 +34764,11 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35349
34764
  }
35350
34765
  /**
35351
34766
  * Returns last position available in the index.
35352
- * @param {Object} index
35353
34767
  * @returns {Number}
35354
34768
  */
35355
34769
  ;
35356
34770
 
35357
- _proto.getLastPosition = function getLastPosition() {
34771
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
35358
34772
  this._refreshTimeline();
35359
34773
 
35360
34774
  var index = this._index;
@@ -35383,6 +34797,50 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35383
34797
 
35384
34798
  return undefined;
35385
34799
  }
34800
+ /**
34801
+ * Returns the absolute end in seconds this RepresentationIndex can reach once
34802
+ * all segments are available.
34803
+ * @returns {number|null|undefined}
34804
+ */
34805
+ ;
34806
+
34807
+ _proto.getEnd = function getEnd() {
34808
+ if (!this._isLive) {
34809
+ return this.getLastAvailablePosition();
34810
+ }
34811
+
34812
+ return undefined;
34813
+ }
34814
+ /**
34815
+ * Returns:
34816
+ * - `true` if in the given time interval, at least one new segment is
34817
+ * expected to be available in the future.
34818
+ * - `false` either if all segments in that time interval are already
34819
+ * available for download or if none will ever be available for it.
34820
+ * - `undefined` when it is not possible to tell.
34821
+ * @param {number} start
34822
+ * @param {number} end
34823
+ * @returns {boolean|undefined}
34824
+ */
34825
+ ;
34826
+
34827
+ _proto.awaitSegmentBetween = function awaitSegmentBetween(start, end) {
34828
+ var _a;
34829
+
34830
+ (0,assert/* default */.Z)(start <= end);
34831
+
34832
+ if (this.isFinished()) {
34833
+ return false;
34834
+ }
34835
+
34836
+ var lastAvailablePosition = this.getLastAvailablePosition();
34837
+
34838
+ if (lastAvailablePosition !== undefined && end < lastAvailablePosition) {
34839
+ return false;
34840
+ }
34841
+
34842
+ return end > ((_a = this.getFirstAvailablePosition()) !== null && _a !== void 0 ? _a : 0) ? undefined : false;
34843
+ }
35386
34844
  /**
35387
34845
  * Checks if `timeSec` is in a discontinuity.
35388
34846
  * That is, if there's no segment available for the `timeSec` position.
@@ -35399,16 +34857,6 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35399
34857
 
35400
34858
  return (0,index_helpers/* checkDiscontinuity */._j)(this._index, timeSec, undefined);
35401
34859
  }
35402
- /**
35403
- * Returns `true` as Smooth segments should always be generated in
35404
- * chronological order.
35405
- * @returns {boolean}
35406
- */
35407
- ;
35408
-
35409
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
35410
- return true;
35411
- }
35412
34860
  /**
35413
34861
  * Returns `true` if a Segment returned by this index is still considered
35414
34862
  * available.
@@ -35595,6 +35043,412 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35595
35043
  }();
35596
35044
 
35597
35045
 
35046
+ // EXTERNAL MODULE: ./src/manifest/adaptation.ts + 3 modules
35047
+ var adaptation = __webpack_require__(8999);
35048
+ // EXTERNAL MODULE: ./src/utils/array_includes.ts
35049
+ var array_includes = __webpack_require__(7714);
35050
+ // EXTERNAL MODULE: ./src/utils/byte_parsing.ts
35051
+ var byte_parsing = __webpack_require__(6968);
35052
+ // EXTERNAL MODULE: ./src/utils/is_non_empty_string.ts
35053
+ var is_non_empty_string = __webpack_require__(6923);
35054
+ // EXTERNAL MODULE: ./src/utils/object_assign.ts
35055
+ var object_assign = __webpack_require__(8026);
35056
+ // EXTERNAL MODULE: ./src/utils/resolve_url.ts
35057
+ var resolve_url = __webpack_require__(9829);
35058
+ // EXTERNAL MODULE: ./src/utils/string_parsing.ts
35059
+ var string_parsing = __webpack_require__(3635);
35060
+ // EXTERNAL MODULE: ./src/utils/take_first_set.ts
35061
+ var take_first_set = __webpack_require__(5278);
35062
+ // EXTERNAL MODULE: ./src/parsers/containers/isobmff/constants.ts
35063
+ var constants = __webpack_require__(2689);
35064
+ ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/create_box.ts
35065
+ /**
35066
+ * Copyright 2015 CANAL+ Group
35067
+ *
35068
+ * Licensed under the Apache License, Version 2.0 (the "License");
35069
+ * you may not use this file except in compliance with the License.
35070
+ * You may obtain a copy of the License at
35071
+ *
35072
+ * http://www.apache.org/licenses/LICENSE-2.0
35073
+ *
35074
+ * Unless required by applicable law or agreed to in writing, software
35075
+ * distributed under the License is distributed on an "AS IS" BASIS,
35076
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35077
+ * See the License for the specific language governing permissions and
35078
+ * limitations under the License.
35079
+ */
35080
+
35081
+
35082
+
35083
+ /**
35084
+ * Speed up string to bytes conversion by memorizing the result
35085
+ *
35086
+ * The keys here are ISOBMFF box names. The values are the corresponding
35087
+ * bytes conversion for putting as an ISOBMFF boxes.
35088
+ *
35089
+ * Used by the boxName method.
35090
+ * @type {Object}
35091
+ */
35092
+
35093
+ var boxNamesMem = {};
35094
+ /**
35095
+ * Convert the string name of an ISOBMFF box into the corresponding bytes.
35096
+ * Has a memorization mechanism to speed-up if you want to translate the
35097
+ * same string multiple times.
35098
+ * @param {string} str
35099
+ * @returns {Uint8Array}
35100
+ */
35101
+
35102
+ function boxName(str) {
35103
+ if (boxNamesMem[str] != null) {
35104
+ return boxNamesMem[str];
35105
+ }
35106
+
35107
+ var nameInBytes = (0,string_parsing/* strToUtf8 */.tG)(str);
35108
+ boxNamesMem[str] = nameInBytes;
35109
+ return nameInBytes;
35110
+ }
35111
+ /**
35112
+ * Create a new ISOBMFF "box" with the given name.
35113
+ * @param {string} name - name of the box you want to create, must always
35114
+ * be 4 characters (uuid boxes not supported)
35115
+ * @param {Uint8Array} buff - content of the box
35116
+ * @returns {Uint8Array} - The entire ISOBMFF box (length+name+content)
35117
+ */
35118
+
35119
+
35120
+ function createBox(name, buff) {
35121
+ var len = buff.length + 8;
35122
+ return len <= constants/* MAX_32_BIT_INT */.s ? (0,byte_parsing/* concat */.zo)((0,byte_parsing/* itobe4 */.kh)(len), boxName(name), buff) : (0,byte_parsing/* concat */.zo)((0,byte_parsing/* itobe4 */.kh)(1), boxName(name), (0,byte_parsing/* itobe8 */.el)(len + 8), buff);
35123
+ }
35124
+ /**
35125
+ * @param {string} name
35126
+ * @param {Array.<Uint8Array>} children
35127
+ * @returns {Uint8Array}
35128
+ */
35129
+
35130
+
35131
+ function createBoxWithChildren(name, children) {
35132
+ return createBox(name, byte_parsing/* concat.apply */.zo.apply(void 0, children));
35133
+ }
35134
+
35135
+
35136
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/utils/check_manifest_ids.ts
35137
+ /**
35138
+ * Copyright 2015 CANAL+ Group
35139
+ *
35140
+ * Licensed under the Apache License, Version 2.0 (the "License");
35141
+ * you may not use this file except in compliance with the License.
35142
+ * You may obtain a copy of the License at
35143
+ *
35144
+ * http://www.apache.org/licenses/LICENSE-2.0
35145
+ *
35146
+ * Unless required by applicable law or agreed to in writing, software
35147
+ * distributed under the License is distributed on an "AS IS" BASIS,
35148
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35149
+ * See the License for the specific language governing permissions and
35150
+ * limitations under the License.
35151
+ */
35152
+
35153
+
35154
+ /**
35155
+ * Ensure that no two periods, adaptations from the same period and
35156
+ * representations from the same adaptation, have the same ID.
35157
+ *
35158
+ * Log and mutate their ID if not until this is verified.
35159
+ *
35160
+ * @param {Object} manifest
35161
+ */
35162
+
35163
+ function checkManifestIDs(manifest) {
35164
+ var periodIDS = [];
35165
+ manifest.periods.forEach(function (period) {
35166
+ var periodID = period.id;
35167
+
35168
+ if ((0,array_includes/* default */.Z)(periodIDS, periodID)) {
35169
+ log/* default.warn */.Z.warn("Two periods with the same ID found. Updating.");
35170
+ var newID = periodID + "-dup";
35171
+ period.id = newID;
35172
+ checkManifestIDs(manifest);
35173
+ periodIDS.push(newID);
35174
+ } else {
35175
+ periodIDS.push(periodID);
35176
+ }
35177
+
35178
+ var adaptations = period.adaptations;
35179
+ var adaptationIDs = [];
35180
+ Object.keys(adaptations).forEach(function (type) {
35181
+ var adaptationsForType = adaptations[type];
35182
+
35183
+ if (adaptationsForType === undefined) {
35184
+ return;
35185
+ }
35186
+
35187
+ adaptationsForType.forEach(function (adaptation) {
35188
+ var adaptationID = adaptation.id;
35189
+
35190
+ if ((0,array_includes/* default */.Z)(adaptationIDs, adaptationID)) {
35191
+ log/* default.warn */.Z.warn("Two adaptations with the same ID found. Updating.", adaptationID);
35192
+ var newID = adaptationID + "-dup";
35193
+ adaptation.id = newID;
35194
+ checkManifestIDs(manifest);
35195
+ adaptationIDs.push(newID);
35196
+ } else {
35197
+ adaptationIDs.push(adaptationID);
35198
+ }
35199
+
35200
+ var representationIDs = [];
35201
+ adaptation.representations.forEach(function (representation) {
35202
+ var representationID = representation.id;
35203
+
35204
+ if ((0,array_includes/* default */.Z)(representationIDs, representationID)) {
35205
+ log/* default.warn */.Z.warn("Two representations with the same ID found. Updating.", representationID);
35206
+
35207
+ var _newID = representationID + "-dup";
35208
+
35209
+ representation.id = _newID;
35210
+ checkManifestIDs(manifest);
35211
+ representationIDs.push(_newID);
35212
+ } else {
35213
+ representationIDs.push(representationID);
35214
+ }
35215
+ });
35216
+ });
35217
+ });
35218
+ });
35219
+ }
35220
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/get_codecs.ts
35221
+ /**
35222
+ * Copyright 2015 CANAL+ Group
35223
+ *
35224
+ * Licensed under the Apache License, Version 2.0 (the "License");
35225
+ * you may not use this file except in compliance with the License.
35226
+ * You may obtain a copy of the License at
35227
+ *
35228
+ * http://www.apache.org/licenses/LICENSE-2.0
35229
+ *
35230
+ * Unless required by applicable law or agreed to in writing, software
35231
+ * distributed under the License is distributed on an "AS IS" BASIS,
35232
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35233
+ * See the License for the specific language governing permissions and
35234
+ * limitations under the License.
35235
+ */
35236
+
35237
+ /**
35238
+ * @param {string} codecPrivateData
35239
+ * @param {string|undefined} fourCC
35240
+ * @returns {string}
35241
+ */
35242
+
35243
+ function getAudioCodecs(codecPrivateData, fourCC) {
35244
+ var mpProfile;
35245
+
35246
+ if (fourCC === "AACH") {
35247
+ mpProfile = 5; // High Efficiency AAC Profile
35248
+ } else {
35249
+ mpProfile = (0,is_non_empty_string/* default */.Z)(codecPrivateData) ? (parseInt(codecPrivateData.substring(0, 2), 16) & 0xF8) >> 3 : 2;
35250
+ }
35251
+
35252
+ if (mpProfile === 0) {
35253
+ // Return default audio codec
35254
+ return "mp4a.40.2";
35255
+ }
35256
+
35257
+ return "mp4a.40." + mpProfile;
35258
+ }
35259
+ /**
35260
+ * @param {string} codecPrivateData
35261
+ * @returns {string}
35262
+ */
35263
+
35264
+ function getVideoCodecs(codecPrivateData) {
35265
+ // we can extract codes only if fourCC is on of "H264", "X264", "DAVC", "AVC1"
35266
+ var arr = /00000001\d7([0-9a-fA-F]{6})/.exec(codecPrivateData);
35267
+
35268
+ if (arr === null || !(0,is_non_empty_string/* default */.Z)(arr[1])) {
35269
+ // Return default video codec
35270
+ return "avc1.4D401E";
35271
+ }
35272
+
35273
+ return "avc1." + arr[1];
35274
+ }
35275
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_C_nodes.ts
35276
+ /**
35277
+ * Copyright 2015 CANAL+ Group
35278
+ *
35279
+ * Licensed under the Apache License, Version 2.0 (the "License");
35280
+ * you may not use this file except in compliance with the License.
35281
+ * You may obtain a copy of the License at
35282
+ *
35283
+ * http://www.apache.org/licenses/LICENSE-2.0
35284
+ *
35285
+ * Unless required by applicable law or agreed to in writing, software
35286
+ * distributed under the License is distributed on an "AS IS" BASIS,
35287
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35288
+ * See the License for the specific language governing permissions and
35289
+ * limitations under the License.
35290
+ */
35291
+
35292
+ /**
35293
+ * Parse C nodes to build index timeline.
35294
+ * @param {Element} nodes
35295
+ */
35296
+
35297
+ function parseCNodes(nodes) {
35298
+ return nodes.reduce(function (timeline, node, i) {
35299
+ var dAttr = node.getAttribute("d");
35300
+ var tAttr = node.getAttribute("t");
35301
+ var rAttr = node.getAttribute("r");
35302
+ var repeatCount = rAttr !== null ? +rAttr - 1 : 0;
35303
+ var start = tAttr !== null ? +tAttr : undefined;
35304
+ var duration = dAttr !== null ? +dAttr : undefined;
35305
+
35306
+ if (i === 0) {
35307
+ // first node
35308
+ start = start === undefined || isNaN(start) ? 0 : start;
35309
+ } else {
35310
+ // from second node to the end
35311
+ var prev = timeline[i - 1];
35312
+
35313
+ if (start == null || isNaN(start)) {
35314
+ if (prev.duration == null || isNaN(prev.duration)) {
35315
+ throw new Error("Smooth: Invalid CNodes. Missing timestamp.");
35316
+ }
35317
+
35318
+ start = prev.start + prev.duration * (prev.repeatCount + 1);
35319
+ }
35320
+ }
35321
+
35322
+ if (duration == null || isNaN(duration)) {
35323
+ var nextNode = nodes[i + 1];
35324
+
35325
+ if (nextNode !== undefined) {
35326
+ var nextTAttr = nextNode.getAttribute("t");
35327
+ var nextStart = (0,is_non_empty_string/* default */.Z)(nextTAttr) ? +nextTAttr : null;
35328
+
35329
+ if (nextStart === null) {
35330
+ throw new Error("Can't build index timeline from Smooth Manifest.");
35331
+ }
35332
+
35333
+ duration = nextStart - start;
35334
+ } else {
35335
+ return timeline;
35336
+ }
35337
+ }
35338
+
35339
+ timeline.push({
35340
+ duration: duration,
35341
+ start: start,
35342
+ repeatCount: repeatCount
35343
+ });
35344
+ return timeline;
35345
+ }, []);
35346
+ }
35347
+ // EXTERNAL MODULE: ./src/utils/base64.ts
35348
+ var base64 = __webpack_require__(9689);
35349
+ ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/drm/playready.ts
35350
+ /**
35351
+ * Copyright 2015 CANAL+ Group
35352
+ *
35353
+ * Licensed under the Apache License, Version 2.0 (the "License");
35354
+ * you may not use this file except in compliance with the License.
35355
+ * You may obtain a copy of the License at
35356
+ *
35357
+ * http://www.apache.org/licenses/LICENSE-2.0
35358
+ *
35359
+ * Unless required by applicable law or agreed to in writing, software
35360
+ * distributed under the License is distributed on an "AS IS" BASIS,
35361
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35362
+ * See the License for the specific language governing permissions and
35363
+ * limitations under the License.
35364
+ */
35365
+
35366
+
35367
+
35368
+ /**
35369
+ * Parse PlayReady privateData to get its Hexa-coded KeyID.
35370
+ * @param {Uint8Array} privateData
35371
+ * @returns {string}
35372
+ */
35373
+
35374
+ function getPlayReadyKIDFromPrivateData(data) {
35375
+ var xmlLength = (0,byte_parsing/* le2toi */.qb)(data, 8);
35376
+ var xml = (0,string_parsing/* utf16LEToStr */.wV)(data.subarray(10, xmlLength + 10));
35377
+ var doc = new DOMParser().parseFromString(xml, "application/xml");
35378
+ var kidElement = doc.querySelector("KID");
35379
+
35380
+ if (kidElement === null) {
35381
+ throw new Error("Cannot parse PlayReady private data: invalid XML");
35382
+ }
35383
+
35384
+ var b64guidKid = kidElement.textContent === null ? "" : kidElement.textContent;
35385
+ var uuidKid = (0,string_parsing/* guidToUuid */.wO)((0,base64/* base64ToBytes */.K)(b64guidKid));
35386
+ return (0,string_parsing/* bytesToHex */.ci)(uuidKid).toLowerCase();
35387
+ }
35388
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_protection_node.ts
35389
+ /**
35390
+ * Copyright 2015 CANAL+ Group
35391
+ *
35392
+ * Licensed under the Apache License, Version 2.0 (the "License");
35393
+ * you may not use this file except in compliance with the License.
35394
+ * You may obtain a copy of the License at
35395
+ *
35396
+ * http://www.apache.org/licenses/LICENSE-2.0
35397
+ *
35398
+ * Unless required by applicable law or agreed to in writing, software
35399
+ * distributed under the License is distributed on an "AS IS" BASIS,
35400
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35401
+ * See the License for the specific language governing permissions and
35402
+ * limitations under the License.
35403
+ */
35404
+
35405
+
35406
+
35407
+
35408
+ /**
35409
+ * @param {Uint8Array} keyIdBytes
35410
+ * @returns {Array.<Object>}
35411
+ */
35412
+
35413
+ function createWidevineKeySystem(keyIdBytes) {
35414
+ return [{
35415
+ systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
35416
+ privateData: (0,byte_parsing/* concat */.zo)([0x08, 0x01, 0x12, 0x10], keyIdBytes)
35417
+ }];
35418
+ }
35419
+ /**
35420
+ * Parse "Protection" Node, which contains DRM information
35421
+ * @param {Element} protectionNode
35422
+ * @returns {Object}
35423
+ */
35424
+
35425
+
35426
+ function parseProtectionNode(protectionNode, keySystemCreator) {
35427
+ if (keySystemCreator === void 0) {
35428
+ keySystemCreator = createWidevineKeySystem;
35429
+ }
35430
+
35431
+ if (protectionNode.firstElementChild === null || protectionNode.firstElementChild.nodeName !== "ProtectionHeader") {
35432
+ throw new Error("Protection should have ProtectionHeader child");
35433
+ }
35434
+
35435
+ var header = protectionNode.firstElementChild;
35436
+ var privateData = (0,base64/* base64ToBytes */.K)(header.textContent === null ? "" : header.textContent);
35437
+ var keyIdHex = getPlayReadyKIDFromPrivateData(privateData);
35438
+ var keyIdBytes = (0,string_parsing/* hexToBytes */.nr)(keyIdHex); // remove possible braces
35439
+
35440
+ var systemIdAttr = header.getAttribute("SystemID");
35441
+ var systemId = (systemIdAttr !== null ? systemIdAttr : "").toLowerCase().replace(/\{|\}/g, "");
35442
+ return {
35443
+ keyId: keyIdBytes,
35444
+ keySystems: [{
35445
+ systemId: systemId,
35446
+ privateData: privateData
35447
+ /* keyIds: [keyIdBytes], */
35448
+
35449
+ }].concat(keySystemCreator(keyIdBytes))
35450
+ };
35451
+ }
35598
35452
  ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/utils/parseBoolean.ts
35599
35453
  /**
35600
35454
  * Copyright 2015 CANAL+ Group
@@ -36133,8 +35987,8 @@ function createSmoothStreamingParser(parserOptions) {
36133
35987
  var firstVideoRepresentation = firstVideoAdaptation.representations[0];
36134
35988
 
36135
35989
  if (firstVideoRepresentation !== undefined) {
36136
- var firstVideoTimeReference = firstVideoRepresentation.index.getFirstPosition();
36137
- var lastVideoTimeReference = firstVideoRepresentation.index.getLastPosition();
35990
+ var firstVideoTimeReference = firstVideoRepresentation.index.getFirstAvailablePosition();
35991
+ var lastVideoTimeReference = firstVideoRepresentation.index.getLastAvailablePosition();
36138
35992
 
36139
35993
  if (firstVideoTimeReference != null) {
36140
35994
  firstTimeReferences.push(firstVideoTimeReference);
@@ -36150,8 +36004,8 @@ function createSmoothStreamingParser(parserOptions) {
36150
36004
  var firstAudioRepresentation = firstAudioAdaptation.representations[0];
36151
36005
 
36152
36006
  if (firstAudioRepresentation !== undefined) {
36153
- var firstAudioTimeReference = firstAudioRepresentation.index.getFirstPosition();
36154
- var lastAudioTimeReference = firstAudioRepresentation.index.getLastPosition();
36007
+ var firstAudioTimeReference = firstAudioRepresentation.index.getFirstAvailablePosition();
36008
+ var lastAudioTimeReference = firstAudioRepresentation.index.getLastAvailablePosition();
36155
36009
 
36156
36010
  if (firstAudioTimeReference != null) {
36157
36011
  firstTimeReferences.push(firstAudioTimeReference);
@@ -37431,7 +37285,7 @@ function isMP4EmbeddedTrack(representation) {
37431
37285
 
37432
37286
  /**
37433
37287
  * Segment loader triggered if there was no custom-defined one in the API.
37434
- * @param {string} uri
37288
+ * @param {string} url
37435
37289
  * @param {Object} content
37436
37290
  * @param {Object} callbacks
37437
37291
  * @param {Object} cancelSignal
@@ -39545,6 +39399,8 @@ __webpack_require__.d(__webpack_exports__, {
39545
39399
  "Z": function() { return /* binding */ deferSubscriptions; }
39546
39400
  });
39547
39401
 
39402
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
39403
+ var subscribeOn = __webpack_require__(8720);
39548
39404
  // EXTERNAL MODULE: ./node_modules/rxjs/node_modules/tslib/tslib.es6.js
39549
39405
  var tslib_es6 = __webpack_require__(5987);
39550
39406
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js + 2 modules
@@ -39676,8 +39532,6 @@ var AsapScheduler = (function (_super) {
39676
39532
  var asapScheduler = new AsapScheduler(AsapAction);
39677
39533
  var asap = (/* unused pure expression or super */ null && (asapScheduler));
39678
39534
  //# sourceMappingURL=asap.js.map
39679
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
39680
- var subscribeOn = __webpack_require__(8720);
39681
39535
  ;// CONCATENATED MODULE: ./src/utils/defer_subscriptions.ts
39682
39536
  /**
39683
39537
  * Copyright 2015 CANAL+ Group
@@ -42835,9 +42689,6 @@ var CancellationSignal = /*#__PURE__*/function () {
42835
42689
  var CancellationError = /*#__PURE__*/function (_Error) {
42836
42690
  (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(CancellationError, _Error);
42837
42691
 
42838
- /**
42839
- * @param {string} message
42840
- */
42841
42692
  function CancellationError() {
42842
42693
  var _this4;
42843
42694
 
@@ -46225,6 +46076,405 @@ function __classPrivateFieldSet(receiver, privateMap, value) {
46225
46076
  }
46226
46077
 
46227
46078
 
46079
+ /***/ }),
46080
+
46081
+ /***/ 7061:
46082
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
46083
+
46084
+ var _typeof = (__webpack_require__(8698)["default"]);
46085
+
46086
+ function _regeneratorRuntime() {
46087
+ "use strict";
46088
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
46089
+
46090
+ module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
46091
+ return exports;
46092
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports;
46093
+ var exports = {},
46094
+ Op = Object.prototype,
46095
+ hasOwn = Op.hasOwnProperty,
46096
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
46097
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
46098
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
46099
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
46100
+
46101
+ function define(obj, key, value) {
46102
+ return Object.defineProperty(obj, key, {
46103
+ value: value,
46104
+ enumerable: !0,
46105
+ configurable: !0,
46106
+ writable: !0
46107
+ }), obj[key];
46108
+ }
46109
+
46110
+ try {
46111
+ define({}, "");
46112
+ } catch (err) {
46113
+ define = function define(obj, key, value) {
46114
+ return obj[key] = value;
46115
+ };
46116
+ }
46117
+
46118
+ function wrap(innerFn, outerFn, self, tryLocsList) {
46119
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
46120
+ generator = Object.create(protoGenerator.prototype),
46121
+ context = new Context(tryLocsList || []);
46122
+ return generator._invoke = function (innerFn, self, context) {
46123
+ var state = "suspendedStart";
46124
+ return function (method, arg) {
46125
+ if ("executing" === state) throw new Error("Generator is already running");
46126
+
46127
+ if ("completed" === state) {
46128
+ if ("throw" === method) throw arg;
46129
+ return doneResult();
46130
+ }
46131
+
46132
+ for (context.method = method, context.arg = arg;;) {
46133
+ var delegate = context.delegate;
46134
+
46135
+ if (delegate) {
46136
+ var delegateResult = maybeInvokeDelegate(delegate, context);
46137
+
46138
+ if (delegateResult) {
46139
+ if (delegateResult === ContinueSentinel) continue;
46140
+ return delegateResult;
46141
+ }
46142
+ }
46143
+
46144
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
46145
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
46146
+ context.dispatchException(context.arg);
46147
+ } else "return" === context.method && context.abrupt("return", context.arg);
46148
+ state = "executing";
46149
+ var record = tryCatch(innerFn, self, context);
46150
+
46151
+ if ("normal" === record.type) {
46152
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
46153
+ return {
46154
+ value: record.arg,
46155
+ done: context.done
46156
+ };
46157
+ }
46158
+
46159
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
46160
+ }
46161
+ };
46162
+ }(innerFn, self, context), generator;
46163
+ }
46164
+
46165
+ function tryCatch(fn, obj, arg) {
46166
+ try {
46167
+ return {
46168
+ type: "normal",
46169
+ arg: fn.call(obj, arg)
46170
+ };
46171
+ } catch (err) {
46172
+ return {
46173
+ type: "throw",
46174
+ arg: err
46175
+ };
46176
+ }
46177
+ }
46178
+
46179
+ exports.wrap = wrap;
46180
+ var ContinueSentinel = {};
46181
+
46182
+ function Generator() {}
46183
+
46184
+ function GeneratorFunction() {}
46185
+
46186
+ function GeneratorFunctionPrototype() {}
46187
+
46188
+ var IteratorPrototype = {};
46189
+ define(IteratorPrototype, iteratorSymbol, function () {
46190
+ return this;
46191
+ });
46192
+ var getProto = Object.getPrototypeOf,
46193
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
46194
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
46195
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
46196
+
46197
+ function defineIteratorMethods(prototype) {
46198
+ ["next", "throw", "return"].forEach(function (method) {
46199
+ define(prototype, method, function (arg) {
46200
+ return this._invoke(method, arg);
46201
+ });
46202
+ });
46203
+ }
46204
+
46205
+ function AsyncIterator(generator, PromiseImpl) {
46206
+ function invoke(method, arg, resolve, reject) {
46207
+ var record = tryCatch(generator[method], generator, arg);
46208
+
46209
+ if ("throw" !== record.type) {
46210
+ var result = record.arg,
46211
+ value = result.value;
46212
+ return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
46213
+ invoke("next", value, resolve, reject);
46214
+ }, function (err) {
46215
+ invoke("throw", err, resolve, reject);
46216
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
46217
+ result.value = unwrapped, resolve(result);
46218
+ }, function (error) {
46219
+ return invoke("throw", error, resolve, reject);
46220
+ });
46221
+ }
46222
+
46223
+ reject(record.arg);
46224
+ }
46225
+
46226
+ var previousPromise;
46227
+
46228
+ this._invoke = function (method, arg) {
46229
+ function callInvokeWithMethodAndArg() {
46230
+ return new PromiseImpl(function (resolve, reject) {
46231
+ invoke(method, arg, resolve, reject);
46232
+ });
46233
+ }
46234
+
46235
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
46236
+ };
46237
+ }
46238
+
46239
+ function maybeInvokeDelegate(delegate, context) {
46240
+ var method = delegate.iterator[context.method];
46241
+
46242
+ if (undefined === method) {
46243
+ if (context.delegate = null, "throw" === context.method) {
46244
+ if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
46245
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
46246
+ }
46247
+
46248
+ return ContinueSentinel;
46249
+ }
46250
+
46251
+ var record = tryCatch(method, delegate.iterator, context.arg);
46252
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
46253
+ var info = record.arg;
46254
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
46255
+ }
46256
+
46257
+ function pushTryEntry(locs) {
46258
+ var entry = {
46259
+ tryLoc: locs[0]
46260
+ };
46261
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
46262
+ }
46263
+
46264
+ function resetTryEntry(entry) {
46265
+ var record = entry.completion || {};
46266
+ record.type = "normal", delete record.arg, entry.completion = record;
46267
+ }
46268
+
46269
+ function Context(tryLocsList) {
46270
+ this.tryEntries = [{
46271
+ tryLoc: "root"
46272
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
46273
+ }
46274
+
46275
+ function values(iterable) {
46276
+ if (iterable) {
46277
+ var iteratorMethod = iterable[iteratorSymbol];
46278
+ if (iteratorMethod) return iteratorMethod.call(iterable);
46279
+ if ("function" == typeof iterable.next) return iterable;
46280
+
46281
+ if (!isNaN(iterable.length)) {
46282
+ var i = -1,
46283
+ next = function next() {
46284
+ for (; ++i < iterable.length;) {
46285
+ if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
46286
+ }
46287
+
46288
+ return next.value = undefined, next.done = !0, next;
46289
+ };
46290
+
46291
+ return next.next = next;
46292
+ }
46293
+ }
46294
+
46295
+ return {
46296
+ next: doneResult
46297
+ };
46298
+ }
46299
+
46300
+ function doneResult() {
46301
+ return {
46302
+ value: undefined,
46303
+ done: !0
46304
+ };
46305
+ }
46306
+
46307
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
46308
+ var ctor = "function" == typeof genFun && genFun.constructor;
46309
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
46310
+ }, exports.mark = function (genFun) {
46311
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
46312
+ }, exports.awrap = function (arg) {
46313
+ return {
46314
+ __await: arg
46315
+ };
46316
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
46317
+ return this;
46318
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
46319
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
46320
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
46321
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
46322
+ return result.done ? result.value : iter.next();
46323
+ });
46324
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
46325
+ return this;
46326
+ }), define(Gp, "toString", function () {
46327
+ return "[object Generator]";
46328
+ }), exports.keys = function (object) {
46329
+ var keys = [];
46330
+
46331
+ for (var key in object) {
46332
+ keys.push(key);
46333
+ }
46334
+
46335
+ return keys.reverse(), function next() {
46336
+ for (; keys.length;) {
46337
+ var key = keys.pop();
46338
+ if (key in object) return next.value = key, next.done = !1, next;
46339
+ }
46340
+
46341
+ return next.done = !0, next;
46342
+ };
46343
+ }, exports.values = values, Context.prototype = {
46344
+ constructor: Context,
46345
+ reset: function reset(skipTempReset) {
46346
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
46347
+ "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
46348
+ }
46349
+ },
46350
+ stop: function stop() {
46351
+ this.done = !0;
46352
+ var rootRecord = this.tryEntries[0].completion;
46353
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
46354
+ return this.rval;
46355
+ },
46356
+ dispatchException: function dispatchException(exception) {
46357
+ if (this.done) throw exception;
46358
+ var context = this;
46359
+
46360
+ function handle(loc, caught) {
46361
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
46362
+ }
46363
+
46364
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
46365
+ var entry = this.tryEntries[i],
46366
+ record = entry.completion;
46367
+ if ("root" === entry.tryLoc) return handle("end");
46368
+
46369
+ if (entry.tryLoc <= this.prev) {
46370
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
46371
+ hasFinally = hasOwn.call(entry, "finallyLoc");
46372
+
46373
+ if (hasCatch && hasFinally) {
46374
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
46375
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
46376
+ } else if (hasCatch) {
46377
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
46378
+ } else {
46379
+ if (!hasFinally) throw new Error("try statement without catch or finally");
46380
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
46381
+ }
46382
+ }
46383
+ }
46384
+ },
46385
+ abrupt: function abrupt(type, arg) {
46386
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
46387
+ var entry = this.tryEntries[i];
46388
+
46389
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
46390
+ var finallyEntry = entry;
46391
+ break;
46392
+ }
46393
+ }
46394
+
46395
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
46396
+ var record = finallyEntry ? finallyEntry.completion : {};
46397
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
46398
+ },
46399
+ complete: function complete(record, afterLoc) {
46400
+ if ("throw" === record.type) throw record.arg;
46401
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
46402
+ },
46403
+ finish: function finish(finallyLoc) {
46404
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
46405
+ var entry = this.tryEntries[i];
46406
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
46407
+ }
46408
+ },
46409
+ "catch": function _catch(tryLoc) {
46410
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
46411
+ var entry = this.tryEntries[i];
46412
+
46413
+ if (entry.tryLoc === tryLoc) {
46414
+ var record = entry.completion;
46415
+
46416
+ if ("throw" === record.type) {
46417
+ var thrown = record.arg;
46418
+ resetTryEntry(entry);
46419
+ }
46420
+
46421
+ return thrown;
46422
+ }
46423
+ }
46424
+
46425
+ throw new Error("illegal catch attempt");
46426
+ },
46427
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
46428
+ return this.delegate = {
46429
+ iterator: values(iterable),
46430
+ resultName: resultName,
46431
+ nextLoc: nextLoc
46432
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
46433
+ }
46434
+ }, exports;
46435
+ }
46436
+
46437
+ module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
46438
+
46439
+ /***/ }),
46440
+
46441
+ /***/ 8698:
46442
+ /***/ (function(module) {
46443
+
46444
+ function _typeof(obj) {
46445
+ "@babel/helpers - typeof";
46446
+
46447
+ return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
46448
+ return typeof obj;
46449
+ } : function (obj) {
46450
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46451
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
46452
+ }
46453
+
46454
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
46455
+
46456
+ /***/ }),
46457
+
46458
+ /***/ 4687:
46459
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
46460
+
46461
+ // TODO(Babel 8): Remove this file.
46462
+
46463
+ var runtime = __webpack_require__(7061)();
46464
+ module.exports = runtime;
46465
+
46466
+ // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
46467
+ try {
46468
+ regeneratorRuntime = runtime;
46469
+ } catch (accidentalStrictMode) {
46470
+ if (typeof globalThis === "object") {
46471
+ globalThis.regeneratorRuntime = runtime;
46472
+ } else {
46473
+ Function("r", "regeneratorRuntime = r")(runtime);
46474
+ }
46475
+ }
46476
+
46477
+
46228
46478
  /***/ }),
46229
46479
 
46230
46480
  /***/ 7326:
@@ -46972,7 +47222,7 @@ var warn_once = __webpack_require__(8806);
46972
47222
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
46973
47223
  var asyncToGenerator = __webpack_require__(5861);
46974
47224
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
46975
- var regenerator = __webpack_require__(7757);
47225
+ var regenerator = __webpack_require__(4687);
46976
47226
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
46977
47227
  // EXTERNAL MODULE: ./src/compat/eme/custom_media_keys/index.ts + 7 modules
46978
47228
  var custom_media_keys = __webpack_require__(6139);
@@ -48677,7 +48927,7 @@ var generateRequestID = (0,id_generator/* default */.Z)();
48677
48927
  * `options` argument, which may retry a segment request when it fails.
48678
48928
  *
48679
48929
  * @param {string} bufferType
48680
- * @param {Object} transport
48930
+ * @param {Object} pipeline
48681
48931
  * @param {Object} callbacks
48682
48932
  * @param {Object} options
48683
48933
  * @returns {Function}
@@ -53399,10 +53649,16 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53399
53649
  if ( // Next buffered segment starts after the start of the current range
53400
53650
  nextBufferedSegment.bufferedStart !== undefined && nextBufferedSegment.bufferedStart > checkedRange.start && ( // and no segment will fill in that hole
53401
53651
  nextSegmentStart === null || nextBufferedSegment.infos.segment.end <= nextSegmentStart)) {
53652
+ var _discontinuityEnd = nextBufferedSegment.bufferedStart;
53653
+
53654
+ if (!hasFinishedLoading && representation.index.awaitSegmentBetween(checkedRange.start, _discontinuityEnd) !== false) {
53655
+ return null;
53656
+ }
53657
+
53402
53658
  log/* default.debug */.Z.debug("RS: current discontinuity encountered", adaptation.type, nextBufferedSegment.bufferedStart);
53403
53659
  return {
53404
53660
  start: undefined,
53405
- end: nextBufferedSegment.bufferedStart
53661
+ end: _discontinuityEnd
53406
53662
  };
53407
53663
  } // Check if there's a discontinuity BETWEEN segments of the current range
53408
53664
 
@@ -53410,15 +53666,26 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53410
53666
  var nextHoleIdx = getIndexOfFirstDiscontinuityBetweenChunks(bufferedSegments, checkedRange, nextBufferedInRangeIdx + 1); // If there was a hole between two consecutives segments, and if this hole
53411
53667
  // comes before the next segment to load, there is a discontinuity (that hole!)
53412
53668
 
53413
- if (nextHoleIdx !== null && (nextSegmentStart === null || bufferedSegments[nextHoleIdx].infos.segment.end <= nextSegmentStart)) {
53414
- var start = bufferedSegments[nextHoleIdx - 1].bufferedEnd;
53415
- var end = bufferedSegments[nextHoleIdx].bufferedStart;
53416
- log/* default.debug */.Z.debug("RS: future discontinuity encountered", adaptation.type, start, end);
53417
- return {
53418
- start: start,
53419
- end: end
53420
- };
53421
- } else if (nextSegmentStart === null) {
53669
+ if (nextHoleIdx !== null) {
53670
+ var segmentInfoBeforeHole = bufferedSegments[nextHoleIdx - 1];
53671
+ var segmentInfoAfterHole = bufferedSegments[nextHoleIdx];
53672
+
53673
+ if (nextSegmentStart === null || segmentInfoAfterHole.infos.segment.end <= nextSegmentStart) {
53674
+ if (!hasFinishedLoading && representation.index.awaitSegmentBetween(segmentInfoBeforeHole.infos.segment.end, segmentInfoAfterHole.infos.segment.time) !== false) {
53675
+ return null;
53676
+ }
53677
+
53678
+ var start = segmentInfoBeforeHole.bufferedEnd;
53679
+ var end = segmentInfoAfterHole.bufferedStart;
53680
+ log/* default.debug */.Z.debug("RS: future discontinuity encountered", adaptation.type, start, end);
53681
+ return {
53682
+ start: start,
53683
+ end: end
53684
+ };
53685
+ }
53686
+ }
53687
+
53688
+ if (nextSegmentStart === null) {
53422
53689
  // If no hole between segments and no segment to load, check for a
53423
53690
  // discontinuity at the end of the Period
53424
53691
  if (hasFinishedLoading && period.end !== undefined) {
@@ -53461,12 +53728,12 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53461
53728
 
53462
53729
  if (bufSeg.bufferedStart < checkedRange.end) {
53463
53730
  if (bufSeg.bufferedEnd !== undefined && bufSeg.bufferedEnd < checkedRange.end) {
53464
- var _discontinuityEnd = representation.index.checkDiscontinuity(checkedRange.end);
53731
+ var _discontinuityEnd2 = representation.index.checkDiscontinuity(checkedRange.end);
53465
53732
 
53466
- if (_discontinuityEnd !== null) {
53733
+ if (_discontinuityEnd2 !== null) {
53467
53734
  return {
53468
53735
  start: bufSeg.bufferedEnd,
53469
- end: _discontinuityEnd
53736
+ end: _discontinuityEnd2
53470
53737
  };
53471
53738
  }
53472
53739
  }
@@ -54212,37 +54479,29 @@ function getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitc
54212
54479
  * needed segments for this Representation until the end of the Period.
54213
54480
  */
54214
54481
 
54215
- var hasFinishedLoading = neededRange.hasReachedPeriodEnd && prioritizedNeededSegments.length === 0 && segmentsOnHold.length === 0;
54216
- var imminentDiscontinuity;
54217
-
54218
- if (!representation.index.isInitialized() || // TODO better handle contents not chronologically generated
54219
- !representation.index.areSegmentsChronologicallyGenerated() && !hasFinishedLoading) {
54220
- // We might be missing information about future segments
54221
- imminentDiscontinuity = null;
54222
- } else {
54223
- /**
54224
- * Start time in seconds of the next available not-yet pushed segment.
54225
- * `null` if no segment is wanted for the current wanted range.
54226
- */
54227
- var nextSegmentStart = null;
54482
+ var hasFinishedLoading = representation.index.isInitialized() && representation.index.isFinished() && neededRange.hasReachedPeriodEnd && prioritizedNeededSegments.length === 0 && segmentsOnHold.length === 0;
54483
+ /**
54484
+ * Start time in seconds of the next available not-yet pushed segment.
54485
+ * `null` if no segment is wanted for the current wanted range.
54486
+ */
54228
54487
 
54229
- if (segmentsBeingPushed.length > 0) {
54230
- nextSegmentStart = Math.min.apply(Math, segmentsBeingPushed.map(function (info) {
54231
- return info.segment.time;
54232
- }));
54233
- }
54488
+ var nextSegmentStart = null;
54234
54489
 
54235
- if (segmentsOnHold.length > 0) {
54236
- nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, segmentsOnHold[0].time) : segmentsOnHold[0].time;
54237
- }
54490
+ if (segmentsBeingPushed.length > 0) {
54491
+ nextSegmentStart = Math.min.apply(Math, segmentsBeingPushed.map(function (info) {
54492
+ return info.segment.time;
54493
+ }));
54494
+ }
54238
54495
 
54239
- if (prioritizedNeededSegments.length > 0) {
54240
- nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, prioritizedNeededSegments[0].segment.time) : prioritizedNeededSegments[0].segment.time;
54241
- }
54496
+ if (segmentsOnHold.length > 0) {
54497
+ nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, segmentsOnHold[0].time) : segmentsOnHold[0].time;
54498
+ }
54242
54499
 
54243
- imminentDiscontinuity = checkForDiscontinuity(content, neededRange, nextSegmentStart, hasFinishedLoading, bufferedSegments);
54500
+ if (prioritizedNeededSegments.length > 0) {
54501
+ nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, prioritizedNeededSegments[0].segment.time) : prioritizedNeededSegments[0].segment.time;
54244
54502
  }
54245
54503
 
54504
+ var imminentDiscontinuity = checkForDiscontinuity(content, neededRange, nextSegmentStart, hasFinishedLoading, bufferedSegments);
54246
54505
  return {
54247
54506
  imminentDiscontinuity: imminentDiscontinuity,
54248
54507
  hasFinishedLoading: hasFinishedLoading,
@@ -54268,7 +54527,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
54268
54527
  var manifest = content.manifest,
54269
54528
  period = content.period,
54270
54529
  representation = content.representation;
54271
- var lastIndexPosition = representation.index.getLastPosition();
54530
+ var lastIndexPosition = representation.index.getLastAvailablePosition();
54272
54531
  var representationIndex = representation.index; // There is an exception for when the current initially wanted time is already
54273
54532
  // after the last position with segments AND when we're playing the absolute
54274
54533
  // last Period in the Manifest.
@@ -56803,6 +57062,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
56803
57062
 
56804
57063
 
56805
57064
 
57065
+
56806
57066
  // NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
56807
57067
  // first type parameter as `any` instead of the perfectly fine `unknown`,
56808
57068
  // leading to linter issues, as it forbids the usage of `any`.
@@ -56842,7 +57102,7 @@ function ContentTimeBoundariesObserver(manifest, streams, playbackObserver) {
56842
57102
  if (wantedPosition < manifest.getMinimumSafePosition()) {
56843
57103
  var warning = new media_error/* default */.Z("MEDIA_TIME_BEFORE_MANIFEST", "The current position is behind the " + "earliest time announced in the Manifest.");
56844
57104
  return events_generators/* default.warning */.Z.warning(warning);
56845
- } else if (wantedPosition > maximumPositionCalculator.getCurrentMaximumPosition()) {
57105
+ } else if (wantedPosition > maximumPositionCalculator.getMaximumAvailablePosition()) {
56846
57106
  var _warning = new media_error/* default */.Z("MEDIA_TIME_AFTER_MANIFEST", "The current position is after the latest " + "time announced in the Manifest.");
56847
57107
 
56848
57108
  return events_generators/* default.warning */.Z.warning(_warning);
@@ -56858,31 +57118,27 @@ function ContentTimeBoundariesObserver(manifest, streams, playbackObserver) {
56858
57118
 
56859
57119
  var contentDuration = (0,reference/* default */.ZP)(undefined);
56860
57120
  var updateDurationOnManifestUpdate$ = (0,event_emitter/* fromEvent */.R)(manifest, "manifestUpdate").pipe((0,startWith/* startWith */.O)(null), (0,tap/* tap */.b)(function () {
56861
- if (!manifest.isDynamic) {
56862
- var maxPos = maximumPositionCalculator.getCurrentMaximumPosition();
56863
- contentDuration.setValue(maxPos);
56864
- } else {
56865
- // TODO handle finished dynamic contents?
56866
- contentDuration.setValue(undefined);
56867
- }
57121
+ var duration = manifest.isDynamic ? maximumPositionCalculator.getEndingPosition() : maximumPositionCalculator.getMaximumAvailablePosition();
57122
+ contentDuration.setValue(duration);
56868
57123
  }), (0,ignoreElements/* ignoreElements */.l)());
56869
57124
  var updateDurationAndTimeBoundsOnTrackChange$ = streams.pipe((0,tap/* tap */.b)(function (message) {
56870
57125
  if (message.type === "adaptationChange") {
57126
+ if (!manifest.isLastPeriodKnown) {
57127
+ return;
57128
+ }
57129
+
56871
57130
  var lastPeriod = manifest.periods[manifest.periods.length - 1];
56872
57131
 
56873
57132
  if (message.value.period.id === (lastPeriod === null || lastPeriod === void 0 ? void 0 : lastPeriod.id)) {
56874
- if (message.value.type === "audio") {
56875
- maximumPositionCalculator.updateLastAudioAdaptation(message.value.adaptation);
56876
-
56877
- if (!manifest.isDynamic) {
56878
- contentDuration.setValue(maximumPositionCalculator.getCurrentMaximumPosition());
57133
+ if (message.value.type === "audio" || message.value.type === "video") {
57134
+ if (message.value.type === "audio") {
57135
+ maximumPositionCalculator.updateLastAudioAdaptation(message.value.adaptation);
57136
+ } else {
57137
+ maximumPositionCalculator.updateLastVideoAdaptation(message.value.adaptation);
56879
57138
  }
56880
- } else if (message.value.type === "video") {
56881
- maximumPositionCalculator.updateLastVideoAdaptation(message.value.adaptation);
56882
57139
 
56883
- if (!manifest.isDynamic) {
56884
- contentDuration.setValue(maximumPositionCalculator.getCurrentMaximumPosition());
56885
- }
57140
+ var newDuration = manifest.isDynamic ? maximumPositionCalculator.getMaximumAvailablePosition() : maximumPositionCalculator.getEndingPosition();
57141
+ contentDuration.setValue(newDuration);
56886
57142
  }
56887
57143
  }
56888
57144
  }
@@ -56916,7 +57172,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56916
57172
  * If no Adaptation has been set, it should be set to `null`.
56917
57173
  *
56918
57174
  * Allows to calculate the maximum position more precizely in
56919
- * `getCurrentMaximumPosition`.
57175
+ * `getMaximumAvailablePosition` and `getEndingPosition`.
56920
57176
  * @param {Object|null} adaptation
56921
57177
  */
56922
57178
 
@@ -56931,7 +57187,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56931
57187
  * If no Adaptation has been set, it should be set to `null`.
56932
57188
  *
56933
57189
  * Allows to calculate the maximum position more precizely in
56934
- * `getCurrentMaximumPosition`.
57190
+ * `getMaximumAvailablePosition` and `getEndingPosition`.
56935
57191
  * @param {Object|null} adaptation
56936
57192
  */
56937
57193
  ;
@@ -56940,13 +57196,13 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56940
57196
  this._lastVideoAdaptation = adaptation;
56941
57197
  }
56942
57198
  /**
56943
- * Returns an estimate of the maximum position reachable under the current
56944
- * circumstances.
57199
+ * Returns an estimate of the maximum position currently reachable (i.e.
57200
+ * segments are available) under the current circumstances.
56945
57201
  * @returns {number}
56946
57202
  */
56947
57203
  ;
56948
57204
 
56949
- _proto.getCurrentMaximumPosition = function getCurrentMaximumPosition() {
57205
+ _proto.getMaximumAvailablePosition = function getMaximumAvailablePosition() {
56950
57206
  var _a;
56951
57207
 
56952
57208
  if (this._manifest.isDynamic) {
@@ -56959,7 +57215,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56959
57215
  if (this._lastVideoAdaptation === null) {
56960
57216
  return this._manifest.getMaximumSafePosition();
56961
57217
  } else {
56962
- var lastVideoPosition = getLastPositionFromAdaptation(this._lastVideoAdaptation);
57218
+ var lastVideoPosition = getLastAvailablePositionFromAdaptation(this._lastVideoAdaptation);
56963
57219
 
56964
57220
  if (typeof lastVideoPosition !== "number") {
56965
57221
  return this._manifest.getMaximumSafePosition();
@@ -56968,7 +57224,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56968
57224
  return lastVideoPosition;
56969
57225
  }
56970
57226
  } else if (this._lastVideoAdaptation === null) {
56971
- var lastAudioPosition = getLastPositionFromAdaptation(this._lastAudioAdaptation);
57227
+ var lastAudioPosition = getLastAvailablePositionFromAdaptation(this._lastAudioAdaptation);
56972
57228
 
56973
57229
  if (typeof lastAudioPosition !== "number") {
56974
57230
  return this._manifest.getMaximumSafePosition();
@@ -56976,9 +57232,9 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56976
57232
 
56977
57233
  return lastAudioPosition;
56978
57234
  } else {
56979
- var _lastAudioPosition = getLastPositionFromAdaptation(this._lastAudioAdaptation);
57235
+ var _lastAudioPosition = getLastAvailablePositionFromAdaptation(this._lastAudioAdaptation);
56980
57236
 
56981
- var _lastVideoPosition = getLastPositionFromAdaptation(this._lastVideoAdaptation);
57237
+ var _lastVideoPosition = getLastAvailablePositionFromAdaptation(this._lastVideoAdaptation);
56982
57238
 
56983
57239
  if (typeof _lastAudioPosition !== "number" || typeof _lastVideoPosition !== "number") {
56984
57240
  return this._manifest.getMaximumSafePosition();
@@ -56986,24 +57242,60 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56986
57242
  return Math.min(_lastAudioPosition, _lastVideoPosition);
56987
57243
  }
56988
57244
  }
57245
+ }
57246
+ /**
57247
+ * Returns an estimate of the actual ending position once
57248
+ * the full content is available.
57249
+ * Returns `undefined` if that could not be determined, for various reasons.
57250
+ * @returns {number|undefined}
57251
+ */
57252
+ ;
57253
+
57254
+ _proto.getEndingPosition = function getEndingPosition() {
57255
+ var _a, _b;
57256
+
57257
+ if (!this._manifest.isDynamic) {
57258
+ return this.getMaximumAvailablePosition();
57259
+ }
57260
+
57261
+ if (this._lastVideoAdaptation === undefined || this._lastAudioAdaptation === undefined) {
57262
+ return undefined;
57263
+ } else if (this._lastAudioAdaptation === null) {
57264
+ if (this._lastVideoAdaptation === null) {
57265
+ return undefined;
57266
+ } else {
57267
+ return (_a = getEndingPositionFromAdaptation(this._lastVideoAdaptation)) !== null && _a !== void 0 ? _a : undefined;
57268
+ }
57269
+ } else if (this._lastVideoAdaptation === null) {
57270
+ return (_b = getEndingPositionFromAdaptation(this._lastAudioAdaptation)) !== null && _b !== void 0 ? _b : undefined;
57271
+ } else {
57272
+ var lastAudioPosition = getEndingPositionFromAdaptation(this._lastAudioAdaptation);
57273
+ var lastVideoPosition = getEndingPositionFromAdaptation(this._lastVideoAdaptation);
57274
+
57275
+ if (typeof lastAudioPosition !== "number" || typeof lastVideoPosition !== "number") {
57276
+ return undefined;
57277
+ } else {
57278
+ return Math.min(lastAudioPosition, lastVideoPosition);
57279
+ }
57280
+ }
56989
57281
  };
56990
57282
 
56991
57283
  return MaximumPositionCalculator;
56992
57284
  }();
56993
57285
  /**
56994
- * Returns "last time of reference" from the adaptation given.
57286
+ * Returns last currently available position from the Adaptation given.
56995
57287
  * `undefined` if a time could not be found.
56996
- * Null if the Adaptation has no segments (it could be that it didn't started or
57288
+ * `null` if the Adaptation has no segments (it could be that it didn't started or
56997
57289
  * that it already finished for example).
56998
57290
  *
56999
- * We consider the earliest last time from every representations in the given
57000
- * adaptation.
57291
+ * We consider the earliest last available position from every Representation
57292
+ * in the given Adaptation.
57001
57293
  * @param {Object} adaptation
57002
57294
  * @returns {Number|undefined|null}
57003
57295
  */
57004
57296
 
57005
57297
 
57006
- function getLastPositionFromAdaptation(adaptation) {
57298
+ function getLastAvailablePositionFromAdaptation(adaptation) {
57007
57299
  var representations = adaptation.representations;
57008
57300
  var min = null;
57009
57301
  /**
@@ -57018,7 +57310,7 @@ function getLastPositionFromAdaptation(adaptation) {
57018
57310
  for (var i = 0; i < representations.length; i++) {
57019
57311
  if (representations[i].index !== lastIndex) {
57020
57312
  lastIndex = representations[i].index;
57021
- var lastPosition = representations[i].index.getLastPosition();
57313
+ var lastPosition = representations[i].index.getLastAvailablePosition();
57022
57314
 
57023
57315
  if (lastPosition === undefined) {
57024
57316
  // we cannot tell
@@ -57026,14 +57318,53 @@ function getLastPositionFromAdaptation(adaptation) {
57026
57318
  }
57027
57319
 
57028
57320
  if (lastPosition !== null) {
57029
- min = min == null ? lastPosition : Math.min(min, lastPosition);
57321
+ min = (0,is_null_or_undefined/* default */.Z)(min) ? lastPosition : Math.min(min, lastPosition);
57030
57322
  }
57031
57323
  }
57032
57324
  }
57033
57325
 
57034
- if (min === null) {
57035
- // It means that all positions were null === no segments (yet?)
57036
- return null;
57326
+ return min;
57327
+ }
57328
+ /**
57329
+ * Returns ending time from the Adaptation given, once all its segments are
57330
+ * available.
57331
+ * `undefined` if a time could not be found.
57332
+ * `null` if the Adaptation has no segments (it could be that it already
57333
+ * finished for example).
57334
+ *
57335
+ * We consider the earliest ending time from every Representation in the given
57336
+ * Adaptation.
57337
+ * @param {Object} adaptation
57338
+ * @returns {Number|undefined|null}
57339
+ */
57340
+
57341
+
57342
+ function getEndingPositionFromAdaptation(adaptation) {
57343
+ var representations = adaptation.representations;
57344
+ var min = null;
57345
+ /**
57346
+ * Some Manifest parsers use the exact same `IRepresentationIndex` reference
57347
+ * for each Representation of a given Adaptation, because in the actual source
57348
+ * Manifest file, indexing data is often defined at Adaptation-level.
57349
+ * This variable allows to optimize the logic here when this is the case.
57350
+ */
57351
+
57352
+ var lastIndex;
57353
+
57354
+ for (var i = 0; i < representations.length; i++) {
57355
+ if (representations[i].index !== lastIndex) {
57356
+ lastIndex = representations[i].index;
57357
+ var lastPosition = representations[i].index.getEnd();
57358
+
57359
+ if (lastPosition === undefined) {
57360
+ // we cannot tell
57361
+ return undefined;
57362
+ }
57363
+
57364
+ if (lastPosition !== null) {
57365
+ min = (0,is_null_or_undefined/* default */.Z)(min) ? lastPosition : Math.min(min, lastPosition);
57366
+ }
57367
+ }
57037
57368
  }
57038
57369
 
57039
57370
  return min;
@@ -61296,7 +61627,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
61296
61627
  videoElement.preload = "auto";
61297
61628
  _this.version =
61298
61629
  /* PLAYER_VERSION */
61299
- "3.28.0-dev.2022063000";
61630
+ "3.28.1-dev.2022083000";
61300
61631
  _this.log = log/* default */.Z;
61301
61632
  _this.state = "STOPPED";
61302
61633
  _this.videoElement = videoElement;
@@ -64117,7 +64448,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
64117
64448
 
64118
64449
  Player.version =
64119
64450
  /* PLAYER_VERSION */
64120
- "3.28.0-dev.2022063000";
64451
+ "3.28.1-dev.2022083000";
64121
64452
  /* harmony default export */ var public_api = (Player);
64122
64453
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
64123
64454
  /**
@@ -64189,7 +64520,7 @@ function initializeFeaturesObject() {
64189
64520
 
64190
64521
  if (true) {
64191
64522
  features_object/* default.transports.dash */.Z.transports.dash = (__webpack_require__(5877)/* ["default"] */ .Z);
64192
- features_object/* default.dashParsers.js */.Z.dashParsers.js = (__webpack_require__(4846)/* ["default"] */ .Z);
64523
+ features_object/* default.dashParsers.js */.Z.dashParsers.js = (__webpack_require__(4541)/* ["default"] */ .Z);
64193
64524
  }
64194
64525
 
64195
64526
  if (false) {}