rx-player 3.28.0 → 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 (104) hide show
  1. package/.github/workflows/checks.yml +20 -18
  2. package/CHANGELOG.md +11 -0
  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/core/api/public_api.js +2 -2
  7. package/dist/_esm5.processed/core/decrypt/create_session.js +33 -4
  8. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +14 -0
  9. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +25 -0
  10. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +1 -1
  11. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
  12. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +110 -38
  13. package/dist/_esm5.processed/core/stream/representation/check_for_discontinuity.js +21 -9
  14. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +21 -29
  15. package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +1 -2
  16. package/dist/_esm5.processed/errors/encrypted_media_error.js +0 -1
  17. package/dist/_esm5.processed/errors/error_codes.d.ts +6 -1
  18. package/dist/_esm5.processed/errors/media_error.d.ts +1 -2
  19. package/dist/_esm5.processed/errors/media_error.js +0 -1
  20. package/dist/_esm5.processed/errors/network_error.d.ts +1 -2
  21. package/dist/_esm5.processed/errors/network_error.js +0 -1
  22. package/dist/_esm5.processed/errors/other_error.d.ts +1 -2
  23. package/dist/_esm5.processed/errors/other_error.js +0 -1
  24. package/dist/_esm5.processed/manifest/manifest.d.ts +1 -1
  25. package/dist/_esm5.processed/manifest/manifest.js +1 -1
  26. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +21 -6
  27. package/dist/_esm5.processed/manifest/representation_index/static.js +26 -8
  28. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +55 -44
  29. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +21 -8
  30. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +25 -10
  31. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +26 -12
  32. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +26 -13
  33. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +23 -7
  34. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +65 -22
  35. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +20 -3
  36. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +57 -7
  37. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.d.ts → utils.d.ts} +3 -6
  38. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.js → utils.js} +4 -8
  39. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +1 -1
  40. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +5 -8
  41. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +21 -8
  42. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +49 -14
  43. package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +16 -0
  44. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +20 -6
  45. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +28 -10
  46. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +4 -4
  47. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -12
  48. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +39 -14
  49. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +1 -1
  50. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +1 -1
  51. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +0 -2
  52. package/dist/_esm5.processed/transports/smooth/segment_loader.js +1 -1
  53. package/dist/_esm5.processed/transports/types.d.ts +1 -1
  54. package/dist/_esm5.processed/utils/deep_merge.d.ts +1 -1
  55. package/dist/_esm5.processed/utils/deep_merge.js +6 -5
  56. package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -3
  57. package/dist/_esm5.processed/utils/task_canceller.js +0 -3
  58. package/dist/mpd-parser.wasm +0 -0
  59. package/dist/rx-player.js +1382 -1058
  60. package/dist/rx-player.min.js +1 -1
  61. package/jest.config.js +5 -0
  62. package/package.json +31 -30
  63. package/sonar-project.properties +1 -1
  64. package/src/compat/eme/load_session.ts +5 -6
  65. package/src/core/api/public_api.ts +2 -2
  66. package/src/core/decrypt/create_session.ts +28 -2
  67. package/src/core/decrypt/utils/loaded_sessions_store.ts +29 -0
  68. package/src/core/fetchers/segment/segment_fetcher.ts +1 -1
  69. package/src/core/init/content_time_boundaries_observer.ts +116 -42
  70. package/src/core/stream/representation/check_for_discontinuity.ts +28 -10
  71. package/src/core/stream/representation/get_buffer_status.ts +27 -34
  72. package/src/errors/encrypted_media_error.ts +1 -2
  73. package/src/errors/error_codes.ts +2 -2
  74. package/src/errors/media_error.ts +1 -2
  75. package/src/errors/network_error.ts +1 -2
  76. package/src/errors/other_error.ts +1 -2
  77. package/src/manifest/__tests__/adaptation.test.ts +4 -3
  78. package/src/manifest/__tests__/representation.test.ts +4 -3
  79. package/src/manifest/manifest.ts +1 -1
  80. package/src/manifest/representation_index/__tests__/static.test.ts +5 -4
  81. package/src/manifest/representation_index/static.ts +28 -9
  82. package/src/manifest/representation_index/types.ts +62 -46
  83. package/src/parsers/manifest/dash/common/indexes/base.ts +27 -11
  84. package/src/parsers/manifest/dash/common/indexes/list.ts +32 -15
  85. package/src/parsers/manifest/dash/common/indexes/template.ts +73 -27
  86. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +60 -8
  87. package/src/parsers/manifest/dash/common/indexes/{is_period_fulfilled.ts → utils.ts} +4 -13
  88. package/src/parsers/manifest/dash/common/parse_periods.ts +1 -1
  89. package/src/parsers/manifest/local/parse_local_manifest.ts +8 -20
  90. package/src/parsers/manifest/local/representation_index.ts +51 -16
  91. package/src/parsers/manifest/local/types.ts +13 -0
  92. package/src/parsers/manifest/metaplaylist/representation_index.ts +31 -11
  93. package/src/parsers/manifest/smooth/create_parser.ts +4 -4
  94. package/src/parsers/manifest/smooth/representation_index.ts +40 -15
  95. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +4 -3
  96. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +4 -3
  97. package/src/parsers/manifest/utils/get_first_time_from_adaptation.ts +1 -1
  98. package/src/parsers/manifest/utils/get_last_time_from_adaptation.ts +1 -1
  99. package/src/transports/metaplaylist/pipelines.ts +0 -2
  100. package/src/transports/smooth/segment_loader.ts +1 -1
  101. package/src/transports/types.ts +1 -1
  102. package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -0
  103. package/src/utils/deep_merge.ts +7 -4
  104. 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
@@ -3788,18 +3389,18 @@ function deepMerge(target) {
3788
3389
  if (isObject(target) && isObject(source)) {
3789
3390
  for (var key in source) {
3790
3391
  if (isObject(source[key])) {
3791
- if (target[key] === undefined) {
3792
- var _objectAssign;
3392
+ var newTarget = target[key];
3793
3393
 
3794
- (0,object_assign/* default */.Z)(target, (_objectAssign = {}, _objectAssign[key] = {}, _objectAssign));
3394
+ if (newTarget === undefined) {
3395
+ newTarget = {};
3396
+ target[key] = newTarget;
3795
3397
  }
3796
3398
 
3797
- var newTarget = target[key];
3798
3399
  deepMerge(newTarget, source[key]);
3799
3400
  } else {
3800
- var _objectAssign2;
3401
+ var _objectAssign;
3801
3402
 
3802
- (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));
3803
3404
  }
3804
3405
  }
3805
3406
  }
@@ -4895,8 +4496,10 @@ var asyncToGenerator = __webpack_require__(5861);
4895
4496
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
4896
4497
  var inheritsLoose = __webpack_require__(4578);
4897
4498
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
4898
- var regenerator = __webpack_require__(7757);
4499
+ var regenerator = __webpack_require__(4687);
4899
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);
4900
4503
  // EXTERNAL MODULE: ./src/log.ts + 1 modules
4901
4504
  var log = __webpack_require__(3887);
4902
4505
  // EXTERNAL MODULE: ./src/parsers/containers/isobmff/take_pssh_out.ts + 1 modules
@@ -5066,8 +4669,6 @@ function getInitData(encryptedEvent) {
5066
4669
  values: values
5067
4670
  };
5068
4671
  }
5069
- // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
5070
- var event_listeners = __webpack_require__(1381);
5071
4672
  // EXTERNAL MODULE: ./src/config.ts + 2 modules
5072
4673
  var config = __webpack_require__(6872);
5073
4674
  // EXTERNAL MODULE: ./src/errors/encrypted_media_error.ts
@@ -5324,7 +4925,7 @@ function createAndTryToRetrievePersistentSession(_x, _x2, _x3, _x4) {
5324
4925
 
5325
4926
  function _createAndTryToRetrievePersistentSession() {
5326
4927
  _createAndTryToRetrievePersistentSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal) {
5327
- var entry, storedEntry, hasLoadedSession, recreatePersistentSession, _recreatePersistentSession;
4928
+ var entry, storedEntry, hasLoadedSession, newEntry, recreatePersistentSession, _recreatePersistentSession;
5328
4929
 
5329
4930
  return regenerator_default().wrap(function _callee2$(_context2) {
5330
4931
  while (1) {
@@ -5352,18 +4953,37 @@ function _createAndTryToRetrievePersistentSession() {
5352
4953
  persistentSessionsStore["delete"](persistentEntry.sessionId);
5353
4954
  }
5354
4955
 
5355
- _context.next = 7;
4956
+ _context.prev = 5;
4957
+ _context.next = 8;
5356
4958
  return loadedSessionsStore.closeSession(entry.mediaKeySession);
5357
4959
 
5358
- 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:
5359
4979
  if (!(cancelSignal.cancellationError !== null)) {
5360
- _context.next = 9;
4980
+ _context.next = 17;
5361
4981
  break;
5362
4982
  }
5363
4983
 
5364
4984
  throw cancelSignal.cancellationError;
5365
4985
 
5366
- case 9:
4986
+ case 17:
5367
4987
  newEntry = loadedSessionsStore.createSession(initData, "persistent-license");
5368
4988
  return _context.abrupt("return", {
5369
4989
  type: "created-session"
@@ -5372,12 +4992,12 @@ function _createAndTryToRetrievePersistentSession() {
5372
4992
  value: newEntry
5373
4993
  });
5374
4994
 
5375
- case 11:
4995
+ case 19:
5376
4996
  case "end":
5377
4997
  return _context.stop();
5378
4998
  }
5379
4999
  }
5380
- }, _callee);
5000
+ }, _callee, null, [[5, 10]]);
5381
5001
  }));
5382
5002
  return _recreatePersistentSession.apply(this, arguments);
5383
5003
  };
@@ -5419,22 +5039,30 @@ function _createAndTryToRetrievePersistentSession() {
5419
5039
  hasLoadedSession = _context2.sent;
5420
5040
 
5421
5041
  if (hasLoadedSession) {
5422
- _context2.next = 17;
5042
+ _context2.next = 19;
5423
5043
  break;
5424
5044
  }
5425
5045
 
5426
5046
  log/* default.warn */.Z.warn("DRM: No data stored for the loaded session");
5427
- 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");
5428
5056
  return _context2.abrupt("return", {
5429
5057
  type: "created-session"
5430
5058
  /* MediaKeySessionLoadingType.Created */
5431
5059
  ,
5432
- value: entry
5060
+ value: newEntry
5433
5061
  });
5434
5062
 
5435
- case 17:
5063
+ case 19:
5436
5064
  if (!(hasLoadedSession && isSessionUsable(entry.mediaKeySession))) {
5437
- _context2.next = 21;
5065
+ _context2.next = 23;
5438
5066
  break;
5439
5067
  }
5440
5068
 
@@ -5447,23 +5075,23 @@ function _createAndTryToRetrievePersistentSession() {
5447
5075
  value: entry
5448
5076
  });
5449
5077
 
5450
- case 21:
5078
+ case 23:
5451
5079
  // Unusable persistent session: recreate a new session from scratch.
5452
5080
  log/* default.warn */.Z.warn("DRM: Previous persistent session not usable anymore.");
5453
5081
  return _context2.abrupt("return", recreatePersistentSession());
5454
5082
 
5455
- case 25:
5456
- _context2.prev = 25;
5083
+ case 27:
5084
+ _context2.prev = 27;
5457
5085
  _context2.t0 = _context2["catch"](9);
5458
5086
  log/* default.warn */.Z.warn("DRM: Unable to load persistent session: " + (_context2.t0 instanceof Error ? _context2.t0.toString() : "Unknown Error"));
5459
5087
  return _context2.abrupt("return", recreatePersistentSession());
5460
5088
 
5461
- case 29:
5089
+ case 31:
5462
5090
  case "end":
5463
5091
  return _context2.stop();
5464
5092
  }
5465
5093
  }
5466
- }, _callee2, null, [[9, 25]]);
5094
+ }, _callee2, null, [[9, 27]]);
5467
5095
  }));
5468
5096
  return _createAndTryToRetrievePersistentSession.apply(this, arguments);
5469
5097
  }
@@ -6221,15 +5849,14 @@ var EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES = 100;
6221
5849
  * Load a persistent session, based on its `sessionId`, on the given
6222
5850
  * MediaKeySession.
6223
5851
  *
6224
- * Returns an Observable which emits:
6225
- * - true if the persistent MediaKeySession was found and loaded
6226
- * - false if no persistent MediaKeySession was found with that `sessionId`.
6227
- * 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`.
6228
5855
  *
6229
- * The Observable throws if anything goes wrong in the process.
5856
+ * The Promise rejects if anything goes wrong in the process.
6230
5857
  * @param {MediaKeySession} session
6231
5858
  * @param {string} sessionId
6232
- * @returns {Observable}
5859
+ * @returns {Promise.<boolean>}
6233
5860
  */
6234
5861
 
6235
5862
  function loadSession(_x, _x2) {
@@ -6459,6 +6086,8 @@ function closeSession(session) {
6459
6086
  return _tryUpdatingSession.apply(this, arguments);
6460
6087
  }
6461
6088
  }
6089
+ // EXTERNAL MODULE: ./src/utils/assert.ts
6090
+ var assert = __webpack_require__(811);
6462
6091
  ;// CONCATENATED MODULE: ./src/core/decrypt/utils/key_id_comparison.ts
6463
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."); }
6464
6093
 
@@ -6778,6 +6407,7 @@ function loaded_sessions_store_arrayLikeToArray(arr, len) { if (len == null || l
6778
6407
 
6779
6408
 
6780
6409
 
6410
+
6781
6411
  /**
6782
6412
  * Create and store MediaKeySessions linked to a single MediaKeys
6783
6413
  * instance.
@@ -7266,6 +6896,36 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
7266
6896
 
7267
6897
  return closeAllSessions;
7268
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
+ }
7269
6929
  /**
7270
6930
  * Get the index of a stored MediaKeySession entry based on its
7271
6931
  * `KeySessionRecord`.
@@ -7404,8 +7064,6 @@ function _safelyCloseMediaKeySession() {
7404
7064
  }));
7405
7065
  return _safelyCloseMediaKeySession.apply(this, arguments);
7406
7066
  }
7407
- // EXTERNAL MODULE: ./src/utils/assert.ts
7408
- var assert = __webpack_require__(811);
7409
7067
  // EXTERNAL MODULE: ./src/utils/base64.ts
7410
7068
  var utils_base64 = __webpack_require__(9689);
7411
7069
  // EXTERNAL MODULE: ./src/utils/hash_buffer.ts
@@ -11164,12 +10822,12 @@ var switchMap = __webpack_require__(4978);
11164
10822
  var of = __webpack_require__(2817);
11165
10823
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/observable/merge.js
11166
10824
  var merge = __webpack_require__(3071);
10825
+ // EXTERNAL MODULE: ./src/compat/clear_element_src.ts
10826
+ var clear_element_src = __webpack_require__(5767);
11167
10827
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js + 1 modules
11168
10828
  var Observable = __webpack_require__(1480);
11169
10829
  // EXTERNAL MODULE: ./src/log.ts + 1 modules
11170
10830
  var log = __webpack_require__(3887);
11171
- // EXTERNAL MODULE: ./src/compat/clear_element_src.ts
11172
- var clear_element_src = __webpack_require__(5767);
11173
10831
  ;// CONCATENATED MODULE: ./src/compat/set_element_src.ts
11174
10832
  /**
11175
10833
  * Copyright 2015 CANAL+ Group
@@ -11397,6 +11055,8 @@ var merge = __webpack_require__(3071);
11397
11055
  var map = __webpack_require__(9127);
11398
11056
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js + 1 modules
11399
11057
  var Observable = __webpack_require__(1480);
11058
+ // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
11059
+ var event_listeners = __webpack_require__(1381);
11400
11060
  // EXTERNAL MODULE: ./src/compat/eme/custom_media_keys/index.ts + 7 modules
11401
11061
  var custom_media_keys = __webpack_require__(6139);
11402
11062
  ;// CONCATENATED MODULE: ./src/compat/has_eme_apis.ts
@@ -11425,8 +11085,6 @@ var custom_media_keys = __webpack_require__(6139);
11425
11085
  function hasEMEAPIs() {
11426
11086
  return typeof custom_media_keys/* requestMediaKeySystemAccess */.N === "function";
11427
11087
  }
11428
- // EXTERNAL MODULE: ./src/compat/event_listeners.ts + 1 modules
11429
- var event_listeners = __webpack_require__(1381);
11430
11088
  // EXTERNAL MODULE: ./src/errors/encrypted_media_error.ts
11431
11089
  var encrypted_media_error = __webpack_require__(5157);
11432
11090
  // EXTERNAL MODULE: ./src/features/index.ts
@@ -15753,7 +15411,6 @@ var EncryptedMediaError = /*#__PURE__*/function (_Error) {
15753
15411
  /**
15754
15412
  * @param {string} code
15755
15413
  * @param {string} reason
15756
- * @Param {Boolean} fatal
15757
15414
  */
15758
15415
  function EncryptedMediaError(code, reason) {
15759
15416
  var _this;
@@ -16030,7 +15687,6 @@ var MediaError = /*#__PURE__*/function (_Error) {
16030
15687
  /**
16031
15688
  * @param {string} code
16032
15689
  * @param {string} reason
16033
- * @param {Boolean} fatal
16034
15690
  */
16035
15691
  function MediaError(code, reason) {
16036
15692
  var _this;
@@ -16099,7 +15755,6 @@ var NetworkError = /*#__PURE__*/function (_Error) {
16099
15755
  /**
16100
15756
  * @param {string} code
16101
15757
  * @param {Error} baseError
16102
- * @param {Boolean} fatal
16103
15758
  */
16104
15759
  function NetworkError(code, baseError) {
16105
15760
  var _this;
@@ -16182,7 +15837,6 @@ var OtherError = /*#__PURE__*/function (_Error) {
16182
15837
  /**
16183
15838
  * @param {string} code
16184
15839
  * @param {string} reason
16185
- * @param {Boolean} fatal
16186
15840
  */
16187
15841
  function OtherError(code, reason) {
16188
15842
  var _this;
@@ -17318,6 +16972,7 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17318
16972
  end: Number.MAX_VALUE,
17319
16973
  duration: Number.MAX_VALUE,
17320
16974
  complete: true,
16975
+ privateInfos: {},
17321
16976
  timescale: 1
17322
16977
  }];
17323
16978
  }
@@ -17327,7 +16982,7 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17327
16982
  */
17328
16983
  ;
17329
16984
 
17330
- _proto.getFirstPosition = function getFirstPosition() {
16985
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
17331
16986
  return;
17332
16987
  }
17333
16988
  /**
@@ -17336,9 +16991,36 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17336
16991
  */
17337
16992
  ;
17338
16993
 
17339
- _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() {
17340
17005
  return;
17341
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
+ }
17342
17024
  /**
17343
17025
  * Returns false as a static file never need to be refreshed.
17344
17026
  * @returns {Boolean}
@@ -17356,14 +17038,6 @@ var StaticRepresentationIndex = /*#__PURE__*/function () {
17356
17038
  _proto.checkDiscontinuity = function checkDiscontinuity() {
17357
17039
  return null;
17358
17040
  }
17359
- /**
17360
- * @returns {boolean}
17361
- */
17362
- ;
17363
-
17364
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
17365
- return true;
17366
- }
17367
17041
  /**
17368
17042
  * Returns true as a static file should never need lose availability.
17369
17043
  * @returns {Boolean}
@@ -17951,7 +17625,7 @@ var Manifest = /*#__PURE__*/function (_EventEmitter) {
17951
17625
  * and mark them as being impossible to decrypt.
17952
17626
  * Then trigger a "decipherabilityUpdate" event to notify everyone of the
17953
17627
  * changes performed.
17954
- * @param {Object} keyUpdates
17628
+ * @param {Function} isDecipherableCb
17955
17629
  */
17956
17630
  ;
17957
17631
 
@@ -19831,7 +19505,7 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19831
19505
  */
19832
19506
  ;
19833
19507
 
19834
- _proto.getFirstPosition = function getFirstPosition() {
19508
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
19835
19509
  var index = this._index;
19836
19510
 
19837
19511
  if (index.timeline.length === 0) {
@@ -19846,7 +19520,7 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19846
19520
  */
19847
19521
  ;
19848
19522
 
19849
- _proto.getLastPosition = function getLastPosition() {
19523
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
19850
19524
  var _a;
19851
19525
 
19852
19526
  var timeline = this._index.timeline;
@@ -19859,6 +19533,33 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19859
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);
19860
19534
  return (0,_utils_index_helpers__WEBPACK_IMPORTED_MODULE_1__/* .fromIndexTime */ .zG)(lastTime, this._index);
19861
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
+ }
19862
19563
  /**
19863
19564
  * Segments in a segmentBase scheme should stay available.
19864
19565
  * @returns {Boolean|undefined}
@@ -19877,16 +19578,6 @@ var BaseRepresentationIndex = /*#__PURE__*/function () {
19877
19578
  _proto.checkDiscontinuity = function checkDiscontinuity() {
19878
19579
  return null;
19879
19580
  }
19880
- /**
19881
- * `BaseRepresentationIndex` should just already all be generated.
19882
- * Return `true` as a default value here.
19883
- * @returns {boolean}
19884
- */
19885
- ;
19886
-
19887
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
19888
- return true;
19889
- }
19890
19581
  /**
19891
19582
  * No segment in a `BaseRepresentationIndex` are known initially.
19892
19583
  * It is only defined generally in an "index segment" that will thus need to
@@ -20282,7 +19973,7 @@ function createDashUrlDetokenizer(time, nb) {
20282
19973
 
20283
19974
  /***/ }),
20284
19975
 
20285
- /***/ 4846:
19976
+ /***/ 4541:
20286
19977
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
20287
19978
 
20288
19979
  "use strict";
@@ -20406,7 +20097,7 @@ function getLastPositionFromAdaptation(adaptation) {
20406
20097
  var min = null;
20407
20098
 
20408
20099
  for (var i = 0; i < representations.length; i++) {
20409
- var lastPosition = representations[i].index.getLastPosition();
20100
+ var lastPosition = representations[i].index.getLastAvailablePosition();
20410
20101
 
20411
20102
  if (lastPosition === undefined) {
20412
20103
  // we cannot tell
@@ -20553,7 +20244,7 @@ function getFirstPositionFromAdaptation(adaptation) {
20553
20244
  var max = null;
20554
20245
 
20555
20246
  for (var i = 0; i < representations.length; i++) {
20556
- var firstPosition = representations[i].index.getFirstPosition();
20247
+ var firstPosition = representations[i].index.getFirstAvailablePosition();
20557
20248
 
20558
20249
  if (firstPosition === undefined) {
20559
20250
  // we cannot tell
@@ -21367,7 +21058,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21367
21058
  }
21368
21059
  /**
21369
21060
  * @param {Number} fromTime
21370
- * @param {Number} duration
21061
+ * @param {Number} dur
21371
21062
  * @returns {Array.<Object>}
21372
21063
  */
21373
21064
  ;
@@ -21435,7 +21126,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21435
21126
  */
21436
21127
  ;
21437
21128
 
21438
- _proto.getFirstPosition = function getFirstPosition() {
21129
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
21439
21130
  return this._periodStart;
21440
21131
  }
21441
21132
  /**
@@ -21444,7 +21135,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21444
21135
  */
21445
21136
  ;
21446
21137
 
21447
- _proto.getLastPosition = function getLastPosition() {
21138
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
21448
21139
  var _a;
21449
21140
 
21450
21141
  var index = this._index;
@@ -21452,10 +21143,36 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21452
21143
  list = index.list;
21453
21144
  return Math.min(list.length * duration / index.timescale + this._periodStart, (_a = this._periodEnd) !== null && _a !== void 0 ? _a : Infinity);
21454
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
+ }
21455
21173
  /**
21456
21174
  * Returns true if a Segment returned by this index is still considered
21457
21175
  * available.
21458
- * @param {Object} segment
21459
21176
  * @returns {Boolean}
21460
21177
  */
21461
21178
  ;
@@ -21472,14 +21189,6 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21472
21189
  _proto.checkDiscontinuity = function checkDiscontinuity() {
21473
21190
  return null;
21474
21191
  }
21475
- /**
21476
- * @returns {boolean}
21477
- */
21478
- ;
21479
-
21480
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
21481
- return true;
21482
- }
21483
21192
  /**
21484
21193
  * SegmentList should not be updated.
21485
21194
  * @returns {Boolean}
@@ -21512,11 +21221,7 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21512
21221
 
21513
21222
  _proto._replace = function _replace(newIndex) {
21514
21223
  this._index = newIndex._index;
21515
- }
21516
- /**
21517
- * @param {Object} newIndex
21518
- */
21519
- ;
21224
+ };
21520
21225
 
21521
21226
  _proto._update = function _update() {
21522
21227
  log/* default.error */.Z.error("List RepresentationIndex: Cannot update a SegmentList");
@@ -21528,6 +21233,8 @@ var ListRepresentationIndex = /*#__PURE__*/function () {
21528
21233
 
21529
21234
  // EXTERNAL MODULE: ./src/errors/network_error.ts
21530
21235
  var network_error = __webpack_require__(9362);
21236
+ // EXTERNAL MODULE: ./src/utils/assert.ts
21237
+ var assert = __webpack_require__(811);
21531
21238
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/clear_timeline_from_position.ts
21532
21239
  var clear_timeline_from_position = __webpack_require__(8232);
21533
21240
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/is_segment_still_available.ts
@@ -21536,7 +21243,7 @@ var is_segment_still_available = __webpack_require__(1091);
21536
21243
  var update_segment_timeline = __webpack_require__(5505);
21537
21244
  // EXTERNAL MODULE: ./src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts
21538
21245
  var get_segments_from_timeline = __webpack_require__(6394);
21539
- ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts
21246
+ ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/utils.ts
21540
21247
  /**
21541
21248
  * Copyright 2015 CANAL+ Group
21542
21249
  *
@@ -21557,18 +21264,14 @@ var get_segments_from_timeline = __webpack_require__(6394);
21557
21264
  * In Javascript, numbers are encoded in a way that a floating number may be
21558
21265
  * represented internally with a rounding error.
21559
21266
  *
21560
- * As the period end is the result of a multiplication between a floating or integer
21561
- * number (period end * timescale), this function takes into account the potential
21562
- * 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.
21563
21269
  * @param {number} timescale
21564
- * @param {number} lastSegmentEnd
21565
- * @param {number} periodEnd
21566
21270
  * @returns {boolean}
21567
21271
  */
21568
21272
 
21569
- function isPeriodFulfilled(timescale, lastSegmentEnd, periodEnd) {
21570
- var scaledRoundingError = config/* default.getCurrent */.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
21571
- return lastSegmentEnd + scaledRoundingError >= periodEnd;
21273
+ function getSegmentTimeRoundingError(timescale) {
21274
+ return config/* default.getCurrent */.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
21572
21275
  }
21573
21276
  ;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.ts
21574
21277
  /**
@@ -22021,6 +21724,7 @@ function constructTimelineFromPreviousTimeline(newElements, prevTimeline) {
22021
21724
 
22022
21725
 
22023
21726
 
21727
+
22024
21728
  // eslint-disable-next-line max-len
22025
21729
 
22026
21730
 
@@ -22147,7 +21851,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22147
21851
  */
22148
21852
  ;
22149
21853
 
22150
- _proto.getFirstPosition = function getFirstPosition() {
21854
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
22151
21855
  this._refreshTimeline();
22152
21856
 
22153
21857
  if (this._index.timeline === null) {
@@ -22165,7 +21869,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22165
21869
  */
22166
21870
  ;
22167
21871
 
22168
- _proto.getLastPosition = function getLastPosition() {
21872
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
22169
21873
  this._refreshTimeline();
22170
21874
 
22171
21875
  if (this._index.timeline === null) {
@@ -22175,6 +21879,72 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22175
21879
  var lastTime = TimelineRepresentationIndex.getIndexEnd(this._index.timeline, this._scaledPeriodEnd);
22176
21880
  return lastTime === null ? null : (0,index_helpers/* fromIndexTime */.zG)(lastTime, this._index);
22177
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
+ }
22178
21948
  /**
22179
21949
  * Returns true if a Segment returned by this index is still considered
22180
21950
  * available.
@@ -22196,10 +21966,10 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22196
21966
  this._index.timeline = this._getTimeline();
22197
21967
  }
22198
21968
 
22199
- var _this$_index2 = this._index,
22200
- timeline = _this$_index2.timeline,
22201
- timescale = _this$_index2.timescale,
22202
- 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;
22203
21973
  return (0,is_segment_still_available/* default */.Z)(segment, timeline, timescale, indexTimeOffset);
22204
21974
  }
22205
21975
  /**
@@ -22240,10 +22010,6 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22240
22010
  }
22241
22011
 
22242
22012
  return error instanceof network_error/* default */.Z && error.isHttpError(404);
22243
- };
22244
-
22245
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
22246
- return true;
22247
22013
  }
22248
22014
  /**
22249
22015
  * Replace this RepresentationIndex with one from a new version of the
@@ -22321,7 +22087,8 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22321
22087
 
22322
22088
  var lastTimelineElement = timeline[timeline.length - 1];
22323
22089
  var lastTime = (0,index_helpers/* getIndexSegmentEnd */.jH)(lastTimelineElement, null, this._scaledPeriodEnd);
22324
- return isPeriodFulfilled(this._index.timescale, lastTime, this._scaledPeriodEnd);
22090
+ var segmentTimeRounding = getSegmentTimeRoundingError(this._index.timescale);
22091
+ return lastTime + segmentTimeRounding >= this._scaledPeriodEnd;
22325
22092
  }
22326
22093
  /**
22327
22094
  * @returns {Boolean}
@@ -22481,6 +22248,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
22481
22248
 
22482
22249
 
22483
22250
 
22251
+
22484
22252
  /**
22485
22253
  * IRepresentationIndex implementation for DASH' SegmentTemplate without a
22486
22254
  * SegmentTimeline.
@@ -22538,7 +22306,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22538
22306
  };
22539
22307
  this._isDynamic = isDynamic;
22540
22308
  this._periodStart = periodStart;
22541
- this._scaledPeriodEnd = periodEnd === undefined ? undefined : (periodEnd - periodStart) * timescale;
22309
+ this._scaledRelativePeriodEnd = periodEnd === undefined ? undefined : (periodEnd - periodStart) * timescale;
22542
22310
  this._isEMSGWhitelisted = isEMSGWhitelisted;
22543
22311
  }
22544
22312
  /**
@@ -22566,7 +22334,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22566
22334
  timescale = index.timescale,
22567
22335
  mediaURLs = index.mediaURLs;
22568
22336
  var scaledStart = this._periodStart * timescale;
22569
- 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
22570
22338
  // relatively to the Period's start.
22571
22339
 
22572
22340
  var upFromPeriodStart = fromTime * timescale - scaledStart;
@@ -22629,7 +22397,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22629
22397
  */
22630
22398
  ;
22631
22399
 
22632
- _proto.getFirstPosition = function getFirstPosition() {
22400
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
22633
22401
  var firstSegmentStart = this._getFirstSegmentStart();
22634
22402
 
22635
22403
  if (firstSegmentStart == null) {
@@ -22644,21 +22412,75 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22644
22412
  */
22645
22413
  ;
22646
22414
 
22647
- _proto.getLastPosition = function getLastPosition() {
22415
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
22648
22416
  var _a;
22649
22417
 
22650
22418
  var lastSegmentStart = this._getLastSegmentStart();
22651
22419
 
22652
22420
  if (lastSegmentStart == null) {
22653
- // In that case (null or undefined), getLastPosition should reflect
22421
+ // In that case (null or undefined), getLastAvailablePosition should reflect
22654
22422
  // the result of getLastSegmentStart, as the meaning is the same for
22655
22423
  // the two functions. So, we return the result of the latter.
22656
22424
  return lastSegmentStart;
22657
22425
  }
22658
22426
 
22659
- 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);
22660
22428
  return lastSegmentEnd / this._index.timescale + this._periodStart;
22661
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
+ }
22662
22484
  /**
22663
22485
  * Returns true if, based on the arguments, the index should be refreshed.
22664
22486
  * We never have to refresh a SegmentTemplate-based manifest.
@@ -22678,14 +22500,6 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22678
22500
  _proto.checkDiscontinuity = function checkDiscontinuity() {
22679
22501
  return null;
22680
22502
  }
22681
- /**
22682
- * @returns {Boolean}
22683
- */
22684
- ;
22685
-
22686
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
22687
- return true;
22688
- }
22689
22503
  /**
22690
22504
  * Returns `true` if the given segment should still be available as of now
22691
22505
  * (not removed since and still request-able).
@@ -22728,7 +22542,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22728
22542
  return true;
22729
22543
  }
22730
22544
 
22731
- if (this._scaledPeriodEnd === undefined) {
22545
+ if (this._scaledRelativePeriodEnd === undefined) {
22732
22546
  return false;
22733
22547
  }
22734
22548
 
@@ -22743,7 +22557,8 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22743
22557
  }
22744
22558
 
22745
22559
  var lastSegmentEnd = lastSegmentStart + this._index.duration;
22746
- return isPeriodFulfilled(timescale, lastSegmentEnd, this._scaledPeriodEnd);
22560
+ var segmentTimeRounding = getSegmentTimeRoundingError(timescale);
22561
+ return lastSegmentEnd + segmentTimeRounding >= this._scaledRelativePeriodEnd;
22747
22562
  }
22748
22563
  /**
22749
22564
  * @returns {Boolean}
@@ -22763,7 +22578,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22763
22578
  this._aggressiveMode = newIndex._aggressiveMode;
22764
22579
  this._isDynamic = newIndex._isDynamic;
22765
22580
  this._periodStart = newIndex._periodStart;
22766
- this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
22581
+ this._scaledRelativePeriodEnd = newIndex._scaledRelativePeriodEnd;
22767
22582
  this._manifestBoundsCalculator = newIndex._manifestBoundsCalculator;
22768
22583
  }
22769
22584
  /**
@@ -22789,7 +22604,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22789
22604
  } // 1 - check that this index is already available
22790
22605
 
22791
22606
 
22792
- if (this._scaledPeriodEnd === 0 || this._scaledPeriodEnd === undefined) {
22607
+ if (this._scaledRelativePeriodEnd === 0 || this._scaledRelativePeriodEnd === undefined) {
22793
22608
  // /!\ The scaled max position augments continuously and might not
22794
22609
  // reflect exactly the real server-side value. As segments are
22795
22610
  // generated discretely.
@@ -22840,12 +22655,12 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22840
22655
 
22841
22656
  var agressiveModeOffset = this._aggressiveMode ? duration / timescale : 0;
22842
22657
 
22843
- if (this._scaledPeriodEnd != null && this._scaledPeriodEnd < (lastPos + agressiveModeOffset - this._periodStart) * this._index.timescale) {
22844
- if (this._scaledPeriodEnd < duration) {
22658
+ if (this._scaledRelativePeriodEnd != null && this._scaledRelativePeriodEnd < (lastPos + agressiveModeOffset - this._periodStart) * this._index.timescale) {
22659
+ if (this._scaledRelativePeriodEnd < duration) {
22845
22660
  return null;
22846
22661
  }
22847
22662
 
22848
- return (Math.floor(this._scaledPeriodEnd / duration) - 1) * duration;
22663
+ return (Math.floor(this._scaledRelativePeriodEnd / duration) - 1) * duration;
22849
22664
  } // /!\ The scaled last position augments continuously and might not
22850
22665
  // reflect exactly the real server-side value. As segments are
22851
22666
  // generated discretely.
@@ -22862,7 +22677,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
22862
22677
  var numberOfSegmentsAvailable = Math.floor((scaledLastPosition + availabilityTimeOffset) / duration);
22863
22678
  return numberOfSegmentsAvailable <= 0 ? null : (numberOfSegmentsAvailable - 1) * duration;
22864
22679
  } else {
22865
- var maximumTime = (_a = this._scaledPeriodEnd) !== null && _a !== void 0 ? _a : 0;
22680
+ var maximumTime = (_a = this._scaledRelativePeriodEnd) !== null && _a !== void 0 ? _a : 0;
22866
22681
  var numberIndexedToZero = Math.ceil(maximumTime / duration) - 1;
22867
22682
  var regularLastSegmentStart = numberIndexedToZero * duration; // In some SegmentTemplate, we could think that there is one more
22868
22683
  // segment that there actually is due to a very little difference between
@@ -24016,7 +23831,7 @@ function getMaximumLastPosition(adaptationsPerType) {
24016
23831
 
24017
23832
  for (var _iterator2 = parse_periods_createForOfIteratorHelperLoose(representations), _step2; !(_step2 = _iterator2()).done;) {
24018
23833
  var representation = _step2.value;
24019
- var position = representation.index.getLastPosition();
23834
+ var position = representation.index.getLastAvailablePosition();
24020
23835
 
24021
23836
  if (position !== null) {
24022
23837
  allIndexAreEmpty = false;
@@ -32002,7 +31817,7 @@ var generate_manifest_loader = __webpack_require__(8791);
32002
31817
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
32003
31818
  var asyncToGenerator = __webpack_require__(5861);
32004
31819
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
32005
- var regenerator = __webpack_require__(7757);
31820
+ var regenerator = __webpack_require__(4687);
32006
31821
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
32007
31822
  // EXTERNAL MODULE: ./src/utils/request/index.ts + 1 modules
32008
31823
  var request = __webpack_require__(4597);
@@ -34543,7 +34358,7 @@ __webpack_require__.d(__webpack_exports__, {
34543
34358
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
34544
34359
  var asyncToGenerator = __webpack_require__(5861);
34545
34360
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
34546
- var regenerator = __webpack_require__(7757);
34361
+ var regenerator = __webpack_require__(4687);
34547
34362
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
34548
34363
  // EXTERNAL MODULE: ./src/features/index.ts
34549
34364
  var features = __webpack_require__(7874);
@@ -34553,416 +34368,10 @@ var log = __webpack_require__(3887);
34553
34368
  var src_manifest = __webpack_require__(1989);
34554
34369
  // EXTERNAL MODULE: ./src/parsers/containers/isobmff/read.ts
34555
34370
  var read = __webpack_require__(6807);
34556
- // EXTERNAL MODULE: ./src/manifest/adaptation.ts + 3 modules
34557
- var adaptation = __webpack_require__(8999);
34558
- // EXTERNAL MODULE: ./src/utils/array_includes.ts
34559
- var array_includes = __webpack_require__(7714);
34560
- // EXTERNAL MODULE: ./src/utils/assert.ts
34561
- var assert = __webpack_require__(811);
34562
- // EXTERNAL MODULE: ./src/utils/byte_parsing.ts
34563
- var byte_parsing = __webpack_require__(6968);
34564
- // EXTERNAL MODULE: ./src/utils/is_non_empty_string.ts
34565
- var is_non_empty_string = __webpack_require__(6923);
34566
- // EXTERNAL MODULE: ./src/utils/object_assign.ts
34567
- var object_assign = __webpack_require__(8026);
34568
- // EXTERNAL MODULE: ./src/utils/resolve_url.ts
34569
- var resolve_url = __webpack_require__(9829);
34570
- // EXTERNAL MODULE: ./src/utils/string_parsing.ts
34571
- var string_parsing = __webpack_require__(3635);
34572
- // EXTERNAL MODULE: ./src/utils/take_first_set.ts
34573
- var take_first_set = __webpack_require__(5278);
34574
- // EXTERNAL MODULE: ./src/parsers/containers/isobmff/constants.ts
34575
- var constants = __webpack_require__(2689);
34576
- ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/create_box.ts
34577
- /**
34578
- * Copyright 2015 CANAL+ Group
34579
- *
34580
- * Licensed under the Apache License, Version 2.0 (the "License");
34581
- * you may not use this file except in compliance with the License.
34582
- * You may obtain a copy of the License at
34583
- *
34584
- * http://www.apache.org/licenses/LICENSE-2.0
34585
- *
34586
- * Unless required by applicable law or agreed to in writing, software
34587
- * distributed under the License is distributed on an "AS IS" BASIS,
34588
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34589
- * See the License for the specific language governing permissions and
34590
- * limitations under the License.
34591
- */
34592
-
34593
-
34594
-
34595
- /**
34596
- * Speed up string to bytes conversion by memorizing the result
34597
- *
34598
- * The keys here are ISOBMFF box names. The values are the corresponding
34599
- * bytes conversion for putting as an ISOBMFF boxes.
34600
- *
34601
- * Used by the boxName method.
34602
- * @type {Object}
34603
- */
34604
-
34605
- var boxNamesMem = {};
34606
- /**
34607
- * Convert the string name of an ISOBMFF box into the corresponding bytes.
34608
- * Has a memorization mechanism to speed-up if you want to translate the
34609
- * same string multiple times.
34610
- * @param {string} str
34611
- * @returns {Uint8Array}
34612
- */
34613
-
34614
- function boxName(str) {
34615
- if (boxNamesMem[str] != null) {
34616
- return boxNamesMem[str];
34617
- }
34618
-
34619
- var nameInBytes = (0,string_parsing/* strToUtf8 */.tG)(str);
34620
- boxNamesMem[str] = nameInBytes;
34621
- return nameInBytes;
34622
- }
34623
- /**
34624
- * Create a new ISOBMFF "box" with the given name.
34625
- * @param {string} name - name of the box you want to create, must always
34626
- * be 4 characters (uuid boxes not supported)
34627
- * @param {Uint8Array} buff - content of the box
34628
- * @returns {Uint8Array} - The entire ISOBMFF box (length+name+content)
34629
- */
34630
-
34631
-
34632
- function createBox(name, buff) {
34633
- var len = buff.length + 8;
34634
- 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);
34635
- }
34636
- /**
34637
- * @param {string} name
34638
- * @param {Array.<Uint8Array>} children
34639
- * @returns {Uint8Array}
34640
- */
34641
-
34642
-
34643
- function createBoxWithChildren(name, children) {
34644
- return createBox(name, byte_parsing/* concat.apply */.zo.apply(void 0, children));
34645
- }
34646
-
34647
-
34648
- ;// CONCATENATED MODULE: ./src/parsers/manifest/utils/check_manifest_ids.ts
34649
- /**
34650
- * Copyright 2015 CANAL+ Group
34651
- *
34652
- * Licensed under the Apache License, Version 2.0 (the "License");
34653
- * you may not use this file except in compliance with the License.
34654
- * You may obtain a copy of the License at
34655
- *
34656
- * http://www.apache.org/licenses/LICENSE-2.0
34657
- *
34658
- * Unless required by applicable law or agreed to in writing, software
34659
- * distributed under the License is distributed on an "AS IS" BASIS,
34660
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34661
- * See the License for the specific language governing permissions and
34662
- * limitations under the License.
34663
- */
34664
-
34665
-
34666
- /**
34667
- * Ensure that no two periods, adaptations from the same period and
34668
- * representations from the same adaptation, have the same ID.
34669
- *
34670
- * Log and mutate their ID if not until this is verified.
34671
- *
34672
- * @param {Object} manifest
34673
- */
34674
-
34675
- function checkManifestIDs(manifest) {
34676
- var periodIDS = [];
34677
- manifest.periods.forEach(function (period) {
34678
- var periodID = period.id;
34679
-
34680
- if ((0,array_includes/* default */.Z)(periodIDS, periodID)) {
34681
- log/* default.warn */.Z.warn("Two periods with the same ID found. Updating.");
34682
- var newID = periodID + "-dup";
34683
- period.id = newID;
34684
- checkManifestIDs(manifest);
34685
- periodIDS.push(newID);
34686
- } else {
34687
- periodIDS.push(periodID);
34688
- }
34689
-
34690
- var adaptations = period.adaptations;
34691
- var adaptationIDs = [];
34692
- Object.keys(adaptations).forEach(function (type) {
34693
- var adaptationsForType = adaptations[type];
34694
-
34695
- if (adaptationsForType === undefined) {
34696
- return;
34697
- }
34698
-
34699
- adaptationsForType.forEach(function (adaptation) {
34700
- var adaptationID = adaptation.id;
34701
-
34702
- if ((0,array_includes/* default */.Z)(adaptationIDs, adaptationID)) {
34703
- log/* default.warn */.Z.warn("Two adaptations with the same ID found. Updating.", adaptationID);
34704
- var newID = adaptationID + "-dup";
34705
- adaptation.id = newID;
34706
- checkManifestIDs(manifest);
34707
- adaptationIDs.push(newID);
34708
- } else {
34709
- adaptationIDs.push(adaptationID);
34710
- }
34711
-
34712
- var representationIDs = [];
34713
- adaptation.representations.forEach(function (representation) {
34714
- var representationID = representation.id;
34715
-
34716
- if ((0,array_includes/* default */.Z)(representationIDs, representationID)) {
34717
- log/* default.warn */.Z.warn("Two representations with the same ID found. Updating.", representationID);
34718
-
34719
- var _newID = representationID + "-dup";
34720
-
34721
- representation.id = _newID;
34722
- checkManifestIDs(manifest);
34723
- representationIDs.push(_newID);
34724
- } else {
34725
- representationIDs.push(representationID);
34726
- }
34727
- });
34728
- });
34729
- });
34730
- });
34731
- }
34732
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/get_codecs.ts
34733
- /**
34734
- * Copyright 2015 CANAL+ Group
34735
- *
34736
- * Licensed under the Apache License, Version 2.0 (the "License");
34737
- * you may not use this file except in compliance with the License.
34738
- * You may obtain a copy of the License at
34739
- *
34740
- * http://www.apache.org/licenses/LICENSE-2.0
34741
- *
34742
- * Unless required by applicable law or agreed to in writing, software
34743
- * distributed under the License is distributed on an "AS IS" BASIS,
34744
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34745
- * See the License for the specific language governing permissions and
34746
- * limitations under the License.
34747
- */
34748
-
34749
- /**
34750
- * @param {string} codecPrivateData
34751
- * @param {string|undefined} fourCC
34752
- * @returns {string}
34753
- */
34754
-
34755
- function getAudioCodecs(codecPrivateData, fourCC) {
34756
- var mpProfile;
34757
-
34758
- if (fourCC === "AACH") {
34759
- mpProfile = 5; // High Efficiency AAC Profile
34760
- } else {
34761
- mpProfile = (0,is_non_empty_string/* default */.Z)(codecPrivateData) ? (parseInt(codecPrivateData.substring(0, 2), 16) & 0xF8) >> 3 : 2;
34762
- }
34763
-
34764
- if (mpProfile === 0) {
34765
- // Return default audio codec
34766
- return "mp4a.40.2";
34767
- }
34768
-
34769
- return "mp4a.40." + mpProfile;
34770
- }
34771
- /**
34772
- * @param {string} codecPrivateData
34773
- * @returns {string}
34774
- */
34775
-
34776
- function getVideoCodecs(codecPrivateData) {
34777
- // we can extract codes only if fourCC is on of "H264", "X264", "DAVC", "AVC1"
34778
- var arr = /00000001\d7([0-9a-fA-F]{6})/.exec(codecPrivateData);
34779
-
34780
- if (arr === null || !(0,is_non_empty_string/* default */.Z)(arr[1])) {
34781
- // Return default video codec
34782
- return "avc1.4D401E";
34783
- }
34784
-
34785
- return "avc1." + arr[1];
34786
- }
34787
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_C_nodes.ts
34788
- /**
34789
- * Copyright 2015 CANAL+ Group
34790
- *
34791
- * Licensed under the Apache License, Version 2.0 (the "License");
34792
- * you may not use this file except in compliance with the License.
34793
- * You may obtain a copy of the License at
34794
- *
34795
- * http://www.apache.org/licenses/LICENSE-2.0
34796
- *
34797
- * Unless required by applicable law or agreed to in writing, software
34798
- * distributed under the License is distributed on an "AS IS" BASIS,
34799
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34800
- * See the License for the specific language governing permissions and
34801
- * limitations under the License.
34802
- */
34803
-
34804
- /**
34805
- * Parse C nodes to build index timeline.
34806
- * @param {Element} nodes
34807
- */
34808
-
34809
- function parseCNodes(nodes) {
34810
- return nodes.reduce(function (timeline, node, i) {
34811
- var dAttr = node.getAttribute("d");
34812
- var tAttr = node.getAttribute("t");
34813
- var rAttr = node.getAttribute("r");
34814
- var repeatCount = rAttr !== null ? +rAttr - 1 : 0;
34815
- var start = tAttr !== null ? +tAttr : undefined;
34816
- var duration = dAttr !== null ? +dAttr : undefined;
34817
-
34818
- if (i === 0) {
34819
- // first node
34820
- start = start === undefined || isNaN(start) ? 0 : start;
34821
- } else {
34822
- // from second node to the end
34823
- var prev = timeline[i - 1];
34824
-
34825
- if (start == null || isNaN(start)) {
34826
- if (prev.duration == null || isNaN(prev.duration)) {
34827
- throw new Error("Smooth: Invalid CNodes. Missing timestamp.");
34828
- }
34829
-
34830
- start = prev.start + prev.duration * (prev.repeatCount + 1);
34831
- }
34832
- }
34833
-
34834
- if (duration == null || isNaN(duration)) {
34835
- var nextNode = nodes[i + 1];
34836
-
34837
- if (nextNode !== undefined) {
34838
- var nextTAttr = nextNode.getAttribute("t");
34839
- var nextStart = (0,is_non_empty_string/* default */.Z)(nextTAttr) ? +nextTAttr : null;
34840
-
34841
- if (nextStart === null) {
34842
- throw new Error("Can't build index timeline from Smooth Manifest.");
34843
- }
34844
-
34845
- duration = nextStart - start;
34846
- } else {
34847
- return timeline;
34848
- }
34849
- }
34850
-
34851
- timeline.push({
34852
- duration: duration,
34853
- start: start,
34854
- repeatCount: repeatCount
34855
- });
34856
- return timeline;
34857
- }, []);
34858
- }
34859
- // EXTERNAL MODULE: ./src/utils/base64.ts
34860
- var base64 = __webpack_require__(9689);
34861
- ;// CONCATENATED MODULE: ./src/parsers/containers/isobmff/drm/playready.ts
34862
- /**
34863
- * Copyright 2015 CANAL+ Group
34864
- *
34865
- * Licensed under the Apache License, Version 2.0 (the "License");
34866
- * you may not use this file except in compliance with the License.
34867
- * You may obtain a copy of the License at
34868
- *
34869
- * http://www.apache.org/licenses/LICENSE-2.0
34870
- *
34871
- * Unless required by applicable law or agreed to in writing, software
34872
- * distributed under the License is distributed on an "AS IS" BASIS,
34873
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34874
- * See the License for the specific language governing permissions and
34875
- * limitations under the License.
34876
- */
34877
-
34878
-
34879
-
34880
- /**
34881
- * Parse PlayReady privateData to get its Hexa-coded KeyID.
34882
- * @param {Uint8Array} privateData
34883
- * @returns {string}
34884
- */
34885
-
34886
- function getPlayReadyKIDFromPrivateData(data) {
34887
- var xmlLength = (0,byte_parsing/* le2toi */.qb)(data, 8);
34888
- var xml = (0,string_parsing/* utf16LEToStr */.wV)(data.subarray(10, xmlLength + 10));
34889
- var doc = new DOMParser().parseFromString(xml, "application/xml");
34890
- var kidElement = doc.querySelector("KID");
34891
-
34892
- if (kidElement === null) {
34893
- throw new Error("Cannot parse PlayReady private data: invalid XML");
34894
- }
34895
-
34896
- var b64guidKid = kidElement.textContent === null ? "" : kidElement.textContent;
34897
- var uuidKid = (0,string_parsing/* guidToUuid */.wO)((0,base64/* base64ToBytes */.K)(b64guidKid));
34898
- return (0,string_parsing/* bytesToHex */.ci)(uuidKid).toLowerCase();
34899
- }
34900
- ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/parse_protection_node.ts
34901
- /**
34902
- * Copyright 2015 CANAL+ Group
34903
- *
34904
- * Licensed under the Apache License, Version 2.0 (the "License");
34905
- * you may not use this file except in compliance with the License.
34906
- * You may obtain a copy of the License at
34907
- *
34908
- * http://www.apache.org/licenses/LICENSE-2.0
34909
- *
34910
- * Unless required by applicable law or agreed to in writing, software
34911
- * distributed under the License is distributed on an "AS IS" BASIS,
34912
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34913
- * See the License for the specific language governing permissions and
34914
- * limitations under the License.
34915
- */
34916
-
34917
-
34918
-
34919
-
34920
- /**
34921
- * @param {Uint8Array} keyIdBytes
34922
- * @returns {Array.<Object>}
34923
- */
34924
-
34925
- function createWidevineKeySystem(keyIdBytes) {
34926
- return [{
34927
- systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
34928
- privateData: (0,byte_parsing/* concat */.zo)([0x08, 0x01, 0x12, 0x10], keyIdBytes)
34929
- }];
34930
- }
34931
- /**
34932
- * Parse "Protection" Node, which contains DRM information
34933
- * @param {Element} protectionNode
34934
- * @returns {Object}
34935
- */
34936
-
34937
-
34938
- function parseProtectionNode(protectionNode, keySystemCreator) {
34939
- if (keySystemCreator === void 0) {
34940
- keySystemCreator = createWidevineKeySystem;
34941
- }
34942
-
34943
- if (protectionNode.firstElementChild === null || protectionNode.firstElementChild.nodeName !== "ProtectionHeader") {
34944
- throw new Error("Protection should have ProtectionHeader child");
34945
- }
34946
-
34947
- var header = protectionNode.firstElementChild;
34948
- var privateData = (0,base64/* base64ToBytes */.K)(header.textContent === null ? "" : header.textContent);
34949
- var keyIdHex = getPlayReadyKIDFromPrivateData(privateData);
34950
- var keyIdBytes = (0,string_parsing/* hexToBytes */.nr)(keyIdHex); // remove possible braces
34951
-
34952
- var systemIdAttr = header.getAttribute("SystemID");
34953
- var systemId = (systemIdAttr !== null ? systemIdAttr : "").toLowerCase().replace(/\{|\}/g, "");
34954
- return {
34955
- keyId: keyIdBytes,
34956
- keySystems: [{
34957
- systemId: systemId,
34958
- privateData: privateData
34959
- /* keyIds: [keyIdBytes], */
34960
-
34961
- }].concat(keySystemCreator(keyIdBytes))
34962
- };
34963
- }
34964
34371
  // EXTERNAL MODULE: ./src/errors/network_error.ts
34965
34372
  var network_error = __webpack_require__(9362);
34373
+ // EXTERNAL MODULE: ./src/utils/assert.ts
34374
+ var assert = __webpack_require__(811);
34966
34375
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/clear_timeline_from_position.ts
34967
34376
  var clear_timeline_from_position = __webpack_require__(8232);
34968
34377
  // EXTERNAL MODULE: ./src/parsers/manifest/utils/index_helpers.ts
@@ -35100,6 +34509,7 @@ function replaceSegmentSmoothTokens(url, time) {
35100
34509
 
35101
34510
 
35102
34511
 
34512
+
35103
34513
  /**
35104
34514
  * @param {Number} start
35105
34515
  * @param {Number} up
@@ -35226,7 +34636,7 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35226
34636
  * Generate a list of Segments for a particular period of time.
35227
34637
  *
35228
34638
  * @param {Number} from
35229
- * @param {Number} duration
34639
+ * @param {Number} dur
35230
34640
  * @returns {Array.<Object>}
35231
34641
  */
35232
34642
  ;
@@ -35337,13 +34747,11 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35337
34747
  }
35338
34748
  /**
35339
34749
  * Returns first position available in the index.
35340
- *
35341
- * @param {Object} index
35342
34750
  * @returns {Number|null}
35343
34751
  */
35344
34752
  ;
35345
34753
 
35346
- _proto.getFirstPosition = function getFirstPosition() {
34754
+ _proto.getFirstAvailablePosition = function getFirstAvailablePosition() {
35347
34755
  this._refreshTimeline();
35348
34756
 
35349
34757
  var index = this._index;
@@ -35356,12 +34764,11 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35356
34764
  }
35357
34765
  /**
35358
34766
  * Returns last position available in the index.
35359
- * @param {Object} index
35360
34767
  * @returns {Number}
35361
34768
  */
35362
34769
  ;
35363
34770
 
35364
- _proto.getLastPosition = function getLastPosition() {
34771
+ _proto.getLastAvailablePosition = function getLastAvailablePosition() {
35365
34772
  this._refreshTimeline();
35366
34773
 
35367
34774
  var index = this._index;
@@ -35390,6 +34797,50 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35390
34797
 
35391
34798
  return undefined;
35392
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
+ }
35393
34844
  /**
35394
34845
  * Checks if `timeSec` is in a discontinuity.
35395
34846
  * That is, if there's no segment available for the `timeSec` position.
@@ -35406,16 +34857,6 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35406
34857
 
35407
34858
  return (0,index_helpers/* checkDiscontinuity */._j)(this._index, timeSec, undefined);
35408
34859
  }
35409
- /**
35410
- * Returns `true` as Smooth segments should always be generated in
35411
- * chronological order.
35412
- * @returns {boolean}
35413
- */
35414
- ;
35415
-
35416
- _proto.areSegmentsChronologicallyGenerated = function areSegmentsChronologicallyGenerated() {
35417
- return true;
35418
- }
35419
34860
  /**
35420
34861
  * Returns `true` if a Segment returned by this index is still considered
35421
34862
  * available.
@@ -35602,6 +35043,412 @@ var SmoothRepresentationIndex = /*#__PURE__*/function () {
35602
35043
  }();
35603
35044
 
35604
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
+ }
35605
35452
  ;// CONCATENATED MODULE: ./src/parsers/manifest/smooth/utils/parseBoolean.ts
35606
35453
  /**
35607
35454
  * Copyright 2015 CANAL+ Group
@@ -36140,8 +35987,8 @@ function createSmoothStreamingParser(parserOptions) {
36140
35987
  var firstVideoRepresentation = firstVideoAdaptation.representations[0];
36141
35988
 
36142
35989
  if (firstVideoRepresentation !== undefined) {
36143
- var firstVideoTimeReference = firstVideoRepresentation.index.getFirstPosition();
36144
- var lastVideoTimeReference = firstVideoRepresentation.index.getLastPosition();
35990
+ var firstVideoTimeReference = firstVideoRepresentation.index.getFirstAvailablePosition();
35991
+ var lastVideoTimeReference = firstVideoRepresentation.index.getLastAvailablePosition();
36145
35992
 
36146
35993
  if (firstVideoTimeReference != null) {
36147
35994
  firstTimeReferences.push(firstVideoTimeReference);
@@ -36157,8 +36004,8 @@ function createSmoothStreamingParser(parserOptions) {
36157
36004
  var firstAudioRepresentation = firstAudioAdaptation.representations[0];
36158
36005
 
36159
36006
  if (firstAudioRepresentation !== undefined) {
36160
- var firstAudioTimeReference = firstAudioRepresentation.index.getFirstPosition();
36161
- var lastAudioTimeReference = firstAudioRepresentation.index.getLastPosition();
36007
+ var firstAudioTimeReference = firstAudioRepresentation.index.getFirstAvailablePosition();
36008
+ var lastAudioTimeReference = firstAudioRepresentation.index.getLastAvailablePosition();
36162
36009
 
36163
36010
  if (firstAudioTimeReference != null) {
36164
36011
  firstTimeReferences.push(firstAudioTimeReference);
@@ -37438,7 +37285,7 @@ function isMP4EmbeddedTrack(representation) {
37438
37285
 
37439
37286
  /**
37440
37287
  * Segment loader triggered if there was no custom-defined one in the API.
37441
- * @param {string} uri
37288
+ * @param {string} url
37442
37289
  * @param {Object} content
37443
37290
  * @param {Object} callbacks
37444
37291
  * @param {Object} cancelSignal
@@ -39552,6 +39399,8 @@ __webpack_require__.d(__webpack_exports__, {
39552
39399
  "Z": function() { return /* binding */ deferSubscriptions; }
39553
39400
  });
39554
39401
 
39402
+ // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
39403
+ var subscribeOn = __webpack_require__(8720);
39555
39404
  // EXTERNAL MODULE: ./node_modules/rxjs/node_modules/tslib/tslib.es6.js
39556
39405
  var tslib_es6 = __webpack_require__(5987);
39557
39406
  // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js + 2 modules
@@ -39683,8 +39532,6 @@ var AsapScheduler = (function (_super) {
39683
39532
  var asapScheduler = new AsapScheduler(AsapAction);
39684
39533
  var asap = (/* unused pure expression or super */ null && (asapScheduler));
39685
39534
  //# sourceMappingURL=asap.js.map
39686
- // EXTERNAL MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
39687
- var subscribeOn = __webpack_require__(8720);
39688
39535
  ;// CONCATENATED MODULE: ./src/utils/defer_subscriptions.ts
39689
39536
  /**
39690
39537
  * Copyright 2015 CANAL+ Group
@@ -42842,9 +42689,6 @@ var CancellationSignal = /*#__PURE__*/function () {
42842
42689
  var CancellationError = /*#__PURE__*/function (_Error) {
42843
42690
  (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(CancellationError, _Error);
42844
42691
 
42845
- /**
42846
- * @param {string} message
42847
- */
42848
42692
  function CancellationError() {
42849
42693
  var _this4;
42850
42694
 
@@ -46232,6 +46076,405 @@ function __classPrivateFieldSet(receiver, privateMap, value) {
46232
46076
  }
46233
46077
 
46234
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
+
46235
46478
  /***/ }),
46236
46479
 
46237
46480
  /***/ 7326:
@@ -46979,7 +47222,7 @@ var warn_once = __webpack_require__(8806);
46979
47222
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
46980
47223
  var asyncToGenerator = __webpack_require__(5861);
46981
47224
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
46982
- var regenerator = __webpack_require__(7757);
47225
+ var regenerator = __webpack_require__(4687);
46983
47226
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
46984
47227
  // EXTERNAL MODULE: ./src/compat/eme/custom_media_keys/index.ts + 7 modules
46985
47228
  var custom_media_keys = __webpack_require__(6139);
@@ -48684,7 +48927,7 @@ var generateRequestID = (0,id_generator/* default */.Z)();
48684
48927
  * `options` argument, which may retry a segment request when it fails.
48685
48928
  *
48686
48929
  * @param {string} bufferType
48687
- * @param {Object} transport
48930
+ * @param {Object} pipeline
48688
48931
  * @param {Object} callbacks
48689
48932
  * @param {Object} options
48690
48933
  * @returns {Function}
@@ -53406,10 +53649,16 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53406
53649
  if ( // Next buffered segment starts after the start of the current range
53407
53650
  nextBufferedSegment.bufferedStart !== undefined && nextBufferedSegment.bufferedStart > checkedRange.start && ( // and no segment will fill in that hole
53408
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
+
53409
53658
  log/* default.debug */.Z.debug("RS: current discontinuity encountered", adaptation.type, nextBufferedSegment.bufferedStart);
53410
53659
  return {
53411
53660
  start: undefined,
53412
- end: nextBufferedSegment.bufferedStart
53661
+ end: _discontinuityEnd
53413
53662
  };
53414
53663
  } // Check if there's a discontinuity BETWEEN segments of the current range
53415
53664
 
@@ -53417,15 +53666,26 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53417
53666
  var nextHoleIdx = getIndexOfFirstDiscontinuityBetweenChunks(bufferedSegments, checkedRange, nextBufferedInRangeIdx + 1); // If there was a hole between two consecutives segments, and if this hole
53418
53667
  // comes before the next segment to load, there is a discontinuity (that hole!)
53419
53668
 
53420
- if (nextHoleIdx !== null && (nextSegmentStart === null || bufferedSegments[nextHoleIdx].infos.segment.end <= nextSegmentStart)) {
53421
- var start = bufferedSegments[nextHoleIdx - 1].bufferedEnd;
53422
- var end = bufferedSegments[nextHoleIdx].bufferedStart;
53423
- log/* default.debug */.Z.debug("RS: future discontinuity encountered", adaptation.type, start, end);
53424
- return {
53425
- start: start,
53426
- end: end
53427
- };
53428
- } 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) {
53429
53689
  // If no hole between segments and no segment to load, check for a
53430
53690
  // discontinuity at the end of the Period
53431
53691
  if (hasFinishedLoading && period.end !== undefined) {
@@ -53468,12 +53728,12 @@ function checkForDiscontinuity(content, checkedRange, nextSegmentStart, hasFinis
53468
53728
 
53469
53729
  if (bufSeg.bufferedStart < checkedRange.end) {
53470
53730
  if (bufSeg.bufferedEnd !== undefined && bufSeg.bufferedEnd < checkedRange.end) {
53471
- var _discontinuityEnd = representation.index.checkDiscontinuity(checkedRange.end);
53731
+ var _discontinuityEnd2 = representation.index.checkDiscontinuity(checkedRange.end);
53472
53732
 
53473
- if (_discontinuityEnd !== null) {
53733
+ if (_discontinuityEnd2 !== null) {
53474
53734
  return {
53475
53735
  start: bufSeg.bufferedEnd,
53476
- end: _discontinuityEnd
53736
+ end: _discontinuityEnd2
53477
53737
  };
53478
53738
  }
53479
53739
  }
@@ -54219,37 +54479,29 @@ function getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitc
54219
54479
  * needed segments for this Representation until the end of the Period.
54220
54480
  */
54221
54481
 
54222
- var hasFinishedLoading = neededRange.hasReachedPeriodEnd && prioritizedNeededSegments.length === 0 && segmentsOnHold.length === 0;
54223
- var imminentDiscontinuity;
54224
-
54225
- if (!representation.index.isInitialized() || // TODO better handle contents not chronologically generated
54226
- !representation.index.areSegmentsChronologicallyGenerated() && !hasFinishedLoading) {
54227
- // We might be missing information about future segments
54228
- imminentDiscontinuity = null;
54229
- } else {
54230
- /**
54231
- * Start time in seconds of the next available not-yet pushed segment.
54232
- * `null` if no segment is wanted for the current wanted range.
54233
- */
54234
- 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
+ */
54235
54487
 
54236
- if (segmentsBeingPushed.length > 0) {
54237
- nextSegmentStart = Math.min.apply(Math, segmentsBeingPushed.map(function (info) {
54238
- return info.segment.time;
54239
- }));
54240
- }
54488
+ var nextSegmentStart = null;
54241
54489
 
54242
- if (segmentsOnHold.length > 0) {
54243
- nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, segmentsOnHold[0].time) : segmentsOnHold[0].time;
54244
- }
54490
+ if (segmentsBeingPushed.length > 0) {
54491
+ nextSegmentStart = Math.min.apply(Math, segmentsBeingPushed.map(function (info) {
54492
+ return info.segment.time;
54493
+ }));
54494
+ }
54245
54495
 
54246
- if (prioritizedNeededSegments.length > 0) {
54247
- nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, prioritizedNeededSegments[0].segment.time) : prioritizedNeededSegments[0].segment.time;
54248
- }
54496
+ if (segmentsOnHold.length > 0) {
54497
+ nextSegmentStart = nextSegmentStart !== null ? Math.min(nextSegmentStart, segmentsOnHold[0].time) : segmentsOnHold[0].time;
54498
+ }
54249
54499
 
54250
- 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;
54251
54502
  }
54252
54503
 
54504
+ var imminentDiscontinuity = checkForDiscontinuity(content, neededRange, nextSegmentStart, hasFinishedLoading, bufferedSegments);
54253
54505
  return {
54254
54506
  imminentDiscontinuity: imminentDiscontinuity,
54255
54507
  hasFinishedLoading: hasFinishedLoading,
@@ -54275,7 +54527,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
54275
54527
  var manifest = content.manifest,
54276
54528
  period = content.period,
54277
54529
  representation = content.representation;
54278
- var lastIndexPosition = representation.index.getLastPosition();
54530
+ var lastIndexPosition = representation.index.getLastAvailablePosition();
54279
54531
  var representationIndex = representation.index; // There is an exception for when the current initially wanted time is already
54280
54532
  // after the last position with segments AND when we're playing the absolute
54281
54533
  // last Period in the Manifest.
@@ -56810,6 +57062,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
56810
57062
 
56811
57063
 
56812
57064
 
57065
+
56813
57066
  // NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
56814
57067
  // first type parameter as `any` instead of the perfectly fine `unknown`,
56815
57068
  // leading to linter issues, as it forbids the usage of `any`.
@@ -56849,7 +57102,7 @@ function ContentTimeBoundariesObserver(manifest, streams, playbackObserver) {
56849
57102
  if (wantedPosition < manifest.getMinimumSafePosition()) {
56850
57103
  var warning = new media_error/* default */.Z("MEDIA_TIME_BEFORE_MANIFEST", "The current position is behind the " + "earliest time announced in the Manifest.");
56851
57104
  return events_generators/* default.warning */.Z.warning(warning);
56852
- } else if (wantedPosition > maximumPositionCalculator.getCurrentMaximumPosition()) {
57105
+ } else if (wantedPosition > maximumPositionCalculator.getMaximumAvailablePosition()) {
56853
57106
  var _warning = new media_error/* default */.Z("MEDIA_TIME_AFTER_MANIFEST", "The current position is after the latest " + "time announced in the Manifest.");
56854
57107
 
56855
57108
  return events_generators/* default.warning */.Z.warning(_warning);
@@ -56865,31 +57118,27 @@ function ContentTimeBoundariesObserver(manifest, streams, playbackObserver) {
56865
57118
 
56866
57119
  var contentDuration = (0,reference/* default */.ZP)(undefined);
56867
57120
  var updateDurationOnManifestUpdate$ = (0,event_emitter/* fromEvent */.R)(manifest, "manifestUpdate").pipe((0,startWith/* startWith */.O)(null), (0,tap/* tap */.b)(function () {
56868
- if (!manifest.isDynamic) {
56869
- var maxPos = maximumPositionCalculator.getCurrentMaximumPosition();
56870
- contentDuration.setValue(maxPos);
56871
- } else {
56872
- // TODO handle finished dynamic contents?
56873
- contentDuration.setValue(undefined);
56874
- }
57121
+ var duration = manifest.isDynamic ? maximumPositionCalculator.getEndingPosition() : maximumPositionCalculator.getMaximumAvailablePosition();
57122
+ contentDuration.setValue(duration);
56875
57123
  }), (0,ignoreElements/* ignoreElements */.l)());
56876
57124
  var updateDurationAndTimeBoundsOnTrackChange$ = streams.pipe((0,tap/* tap */.b)(function (message) {
56877
57125
  if (message.type === "adaptationChange") {
57126
+ if (!manifest.isLastPeriodKnown) {
57127
+ return;
57128
+ }
57129
+
56878
57130
  var lastPeriod = manifest.periods[manifest.periods.length - 1];
56879
57131
 
56880
57132
  if (message.value.period.id === (lastPeriod === null || lastPeriod === void 0 ? void 0 : lastPeriod.id)) {
56881
- if (message.value.type === "audio") {
56882
- maximumPositionCalculator.updateLastAudioAdaptation(message.value.adaptation);
56883
-
56884
- if (!manifest.isDynamic) {
56885
- 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);
56886
57138
  }
56887
- } else if (message.value.type === "video") {
56888
- maximumPositionCalculator.updateLastVideoAdaptation(message.value.adaptation);
56889
57139
 
56890
- if (!manifest.isDynamic) {
56891
- contentDuration.setValue(maximumPositionCalculator.getCurrentMaximumPosition());
56892
- }
57140
+ var newDuration = manifest.isDynamic ? maximumPositionCalculator.getMaximumAvailablePosition() : maximumPositionCalculator.getEndingPosition();
57141
+ contentDuration.setValue(newDuration);
56893
57142
  }
56894
57143
  }
56895
57144
  }
@@ -56923,7 +57172,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56923
57172
  * If no Adaptation has been set, it should be set to `null`.
56924
57173
  *
56925
57174
  * Allows to calculate the maximum position more precizely in
56926
- * `getCurrentMaximumPosition`.
57175
+ * `getMaximumAvailablePosition` and `getEndingPosition`.
56927
57176
  * @param {Object|null} adaptation
56928
57177
  */
56929
57178
 
@@ -56938,7 +57187,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56938
57187
  * If no Adaptation has been set, it should be set to `null`.
56939
57188
  *
56940
57189
  * Allows to calculate the maximum position more precizely in
56941
- * `getCurrentMaximumPosition`.
57190
+ * `getMaximumAvailablePosition` and `getEndingPosition`.
56942
57191
  * @param {Object|null} adaptation
56943
57192
  */
56944
57193
  ;
@@ -56947,13 +57196,13 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56947
57196
  this._lastVideoAdaptation = adaptation;
56948
57197
  }
56949
57198
  /**
56950
- * Returns an estimate of the maximum position reachable under the current
56951
- * circumstances.
57199
+ * Returns an estimate of the maximum position currently reachable (i.e.
57200
+ * segments are available) under the current circumstances.
56952
57201
  * @returns {number}
56953
57202
  */
56954
57203
  ;
56955
57204
 
56956
- _proto.getCurrentMaximumPosition = function getCurrentMaximumPosition() {
57205
+ _proto.getMaximumAvailablePosition = function getMaximumAvailablePosition() {
56957
57206
  var _a;
56958
57207
 
56959
57208
  if (this._manifest.isDynamic) {
@@ -56966,7 +57215,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56966
57215
  if (this._lastVideoAdaptation === null) {
56967
57216
  return this._manifest.getMaximumSafePosition();
56968
57217
  } else {
56969
- var lastVideoPosition = getLastPositionFromAdaptation(this._lastVideoAdaptation);
57218
+ var lastVideoPosition = getLastAvailablePositionFromAdaptation(this._lastVideoAdaptation);
56970
57219
 
56971
57220
  if (typeof lastVideoPosition !== "number") {
56972
57221
  return this._manifest.getMaximumSafePosition();
@@ -56975,7 +57224,7 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56975
57224
  return lastVideoPosition;
56976
57225
  }
56977
57226
  } else if (this._lastVideoAdaptation === null) {
56978
- var lastAudioPosition = getLastPositionFromAdaptation(this._lastAudioAdaptation);
57227
+ var lastAudioPosition = getLastAvailablePositionFromAdaptation(this._lastAudioAdaptation);
56979
57228
 
56980
57229
  if (typeof lastAudioPosition !== "number") {
56981
57230
  return this._manifest.getMaximumSafePosition();
@@ -56983,9 +57232,9 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56983
57232
 
56984
57233
  return lastAudioPosition;
56985
57234
  } else {
56986
- var _lastAudioPosition = getLastPositionFromAdaptation(this._lastAudioAdaptation);
57235
+ var _lastAudioPosition = getLastAvailablePositionFromAdaptation(this._lastAudioAdaptation);
56987
57236
 
56988
- var _lastVideoPosition = getLastPositionFromAdaptation(this._lastVideoAdaptation);
57237
+ var _lastVideoPosition = getLastAvailablePositionFromAdaptation(this._lastVideoAdaptation);
56989
57238
 
56990
57239
  if (typeof _lastAudioPosition !== "number" || typeof _lastVideoPosition !== "number") {
56991
57240
  return this._manifest.getMaximumSafePosition();
@@ -56993,24 +57242,60 @@ var MaximumPositionCalculator = /*#__PURE__*/function () {
56993
57242
  return Math.min(_lastAudioPosition, _lastVideoPosition);
56994
57243
  }
56995
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
+ }
56996
57281
  };
56997
57282
 
56998
57283
  return MaximumPositionCalculator;
56999
57284
  }();
57000
57285
  /**
57001
- * Returns "last time of reference" from the adaptation given.
57286
+ * Returns last currently available position from the Adaptation given.
57002
57287
  * `undefined` if a time could not be found.
57003
- * 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
57004
57289
  * that it already finished for example).
57005
57290
  *
57006
- * We consider the earliest last time from every representations in the given
57007
- * adaptation.
57291
+ * We consider the earliest last available position from every Representation
57292
+ * in the given Adaptation.
57008
57293
  * @param {Object} adaptation
57009
57294
  * @returns {Number|undefined|null}
57010
57295
  */
57011
57296
 
57012
57297
 
57013
- function getLastPositionFromAdaptation(adaptation) {
57298
+ function getLastAvailablePositionFromAdaptation(adaptation) {
57014
57299
  var representations = adaptation.representations;
57015
57300
  var min = null;
57016
57301
  /**
@@ -57025,7 +57310,7 @@ function getLastPositionFromAdaptation(adaptation) {
57025
57310
  for (var i = 0; i < representations.length; i++) {
57026
57311
  if (representations[i].index !== lastIndex) {
57027
57312
  lastIndex = representations[i].index;
57028
- var lastPosition = representations[i].index.getLastPosition();
57313
+ var lastPosition = representations[i].index.getLastAvailablePosition();
57029
57314
 
57030
57315
  if (lastPosition === undefined) {
57031
57316
  // we cannot tell
@@ -57033,14 +57318,53 @@ function getLastPositionFromAdaptation(adaptation) {
57033
57318
  }
57034
57319
 
57035
57320
  if (lastPosition !== null) {
57036
- min = min == null ? lastPosition : Math.min(min, lastPosition);
57321
+ min = (0,is_null_or_undefined/* default */.Z)(min) ? lastPosition : Math.min(min, lastPosition);
57037
57322
  }
57038
57323
  }
57039
57324
  }
57040
57325
 
57041
- if (min === null) {
57042
- // It means that all positions were null === no segments (yet?)
57043
- 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
+ }
57044
57368
  }
57045
57369
 
57046
57370
  return min;
@@ -61303,7 +61627,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
61303
61627
  videoElement.preload = "auto";
61304
61628
  _this.version =
61305
61629
  /* PLAYER_VERSION */
61306
- "3.28.0";
61630
+ "3.28.1-dev.2022083000";
61307
61631
  _this.log = log/* default */.Z;
61308
61632
  _this.state = "STOPPED";
61309
61633
  _this.videoElement = videoElement;
@@ -64124,7 +64448,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
64124
64448
 
64125
64449
  Player.version =
64126
64450
  /* PLAYER_VERSION */
64127
- "3.28.0";
64451
+ "3.28.1-dev.2022083000";
64128
64452
  /* harmony default export */ var public_api = (Player);
64129
64453
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
64130
64454
  /**
@@ -64196,7 +64520,7 @@ function initializeFeaturesObject() {
64196
64520
 
64197
64521
  if (true) {
64198
64522
  features_object/* default.transports.dash */.Z.transports.dash = (__webpack_require__(5877)/* ["default"] */ .Z);
64199
- 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);
64200
64524
  }
64201
64525
 
64202
64526
  if (false) {}