rx-player 3.33.4 → 3.33.5-dev.2025040100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/compat/browser_detection.js +1 -1
  4. package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +1 -1
  5. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +39 -1
  6. package/dist/_esm5.processed/core/api/public_api.js +2 -2
  7. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +5 -1
  8. package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -66
  9. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +26 -18
  10. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +4 -2
  11. package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +4 -0
  12. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +27 -45
  13. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +0 -3
  14. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +0 -3
  15. package/dist/mpd-parser.wasm +0 -0
  16. package/dist/rx-player.js +248 -206
  17. package/dist/rx-player.min.js +1 -1
  18. package/package.json +3 -3
  19. package/.vscode/settings.json +0 -9
  20. package/experimental/features/index.d.ts-E +0 -16
  21. package/experimental/features/index.js-E +0 -16
  22. package/experimental/index.d.ts-E +0 -16
  23. package/experimental/index.js-E +0 -16
  24. package/experimental/tools/VideoThumbnailLoader/index.d.ts-E +0 -18
  25. package/experimental/tools/VideoThumbnailLoader/index.js-E +0 -18
  26. package/experimental/tools/index.d.ts-E +0 -16
  27. package/experimental/tools/index.js-E +0 -16
  28. package/features/index.d.ts-E +0 -16
  29. package/features/index.js-E +0 -16
  30. package/logger/index.d.ts-E +0 -17
  31. package/logger/index.js-E +0 -17
  32. package/minimal/index.d.ts-E +0 -17
  33. package/minimal/index.js-E +0 -17
  34. package/tools/TextTrackRenderer.d.ts-E +0 -18
  35. package/tools/TextTrackRenderer.js-E +0 -18
  36. package/tools/index.d.ts-E +0 -16
  37. package/tools/index.js-E +0 -16
  38. package/tools/string-utils.d.ts-E +0 -18
  39. package/tools/string-utils.js-E +0 -18
  40. package/types/index.d.ts-E +0 -16
  41. package/types/index.js-E +0 -15
package/dist/rx-player.js CHANGED
@@ -180,7 +180,7 @@ var isA1KStb40xx = false;
180
180
  isPanasonic = true;
181
181
  } else if (navigator.userAgent.indexOf("Xbox") !== -1) {
182
182
  isXbox = true;
183
- } else if (navigator.userAgent.indexOf("Model/a1-kstb40xx")) {
183
+ } else if (navigator.userAgent.indexOf("Model/a1-kstb40xx") !== -1) {
184
184
  isA1KStb40xx = true;
185
185
  }
186
186
  })();
@@ -4139,7 +4139,7 @@ function getEmeApiImplementation(preferredApiType) {
4139
4139
  initDataTypes: ["cenc"],
4140
4140
  distinctiveIdentifier: "not-allowed",
4141
4141
  persistentState: "required",
4142
- sessionTypes: ["temporary", "persistent-license"]
4142
+ sessionTypes: ["persistent-license"]
4143
4143
  };
4144
4144
  if (videoCapabilities !== undefined) {
4145
4145
  keySystemConfigurationResponse.videoCapabilities = videoCapabilities;
@@ -5116,38 +5116,71 @@ var flat_map = __webpack_require__(3262);
5116
5116
 
5117
5117
 
5118
5118
  /**
5119
- * @param {Array.<Object>} keySystems
5120
- * @param {Object} askedConfiguration
5121
- * @param {MediaKeySystemAccess} currentKeySystemAccess
5122
- * @param {Object} currentKeySystemOptions
5123
- * @returns {null|Object}
5124
- */
5125
- function checkCachedMediaKeySystemAccess(keySystems, askedConfiguration, currentKeySystemAccess, currentKeySystemOptions) {
5126
- var mksConfiguration = currentKeySystemAccess.getConfiguration();
5127
- if (shouldRenewMediaKeySystemAccess() || mksConfiguration == null) {
5128
- return null;
5119
+ * Takes a `newConfiguration` `MediaKeySystemConfiguration`, that is intended
5120
+ * for the creation of a `MediaKeySystemAccess`, and a `prevConfiguration`
5121
+ * `MediaKeySystemConfiguration`, that was the one used at creation of the
5122
+ * current `MediaKeySystemAccess`.
5123
+ *
5124
+ * This function will then return `true` if it determined that the new
5125
+ * configuration is conceptually compatible with the one used before, and
5126
+ * `false` otherwise.
5127
+ * @param {Object} newConfiguration - New wanted `MediaKeySystemConfiguration`
5128
+ * @param {Object} prevConfiguration - The `MediaKeySystemConfiguration` that is
5129
+ * relied on util now.
5130
+ * @returns {boolean} - `true` if `newConfiguration` is compatible with
5131
+ * `prevConfiguration`.
5132
+ */
5133
+ function isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(newConfiguration, prevConfiguration) {
5134
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
5135
+ if (newConfiguration.label !== prevConfiguration.label) {
5136
+ return false;
5129
5137
  }
5130
- var firstCompatibleOption = keySystems.filter(function (ks) {
5131
- // TODO Do it with MediaKeySystemAccess.prototype.keySystem instead
5132
- if (ks.type !== currentKeySystemOptions.type) {
5133
- return false;
5134
- }
5135
- if ((ks.persistentLicense === true || ks.persistentStateRequired === true) && mksConfiguration.persistentState !== "required") {
5136
- return false;
5137
- }
5138
- if (ks.distinctiveIdentifierRequired === true && mksConfiguration.distinctiveIdentifier !== "required") {
5139
- return false;
5140
- }
5141
- return true;
5142
- })[0];
5143
- if (firstCompatibleOption != null) {
5144
- return {
5145
- keySystemOptions: firstCompatibleOption,
5146
- keySystemAccess: currentKeySystemAccess,
5147
- askedConfiguration: askedConfiguration
5148
- };
5138
+ var prevDistinctiveIdentifier = (_a = prevConfiguration.distinctiveIdentifier) !== null && _a !== void 0 ? _a : "optional";
5139
+ var newDistinctiveIdentifier = (_b = newConfiguration.distinctiveIdentifier) !== null && _b !== void 0 ? _b : "optional";
5140
+ if (prevDistinctiveIdentifier !== newDistinctiveIdentifier) {
5141
+ return false;
5149
5142
  }
5150
- return null;
5143
+ var prevPersistentState = (_c = prevConfiguration.persistentState) !== null && _c !== void 0 ? _c : "optional";
5144
+ var newPersistentState = (_d = newConfiguration.persistentState) !== null && _d !== void 0 ? _d : "optional";
5145
+ if (prevPersistentState !== newPersistentState) {
5146
+ return false;
5147
+ }
5148
+ var prevInitDataTypes = (_e = prevConfiguration.initDataTypes) !== null && _e !== void 0 ? _e : [];
5149
+ var newInitDataTypes = (_f = newConfiguration.initDataTypes) !== null && _f !== void 0 ? _f : [];
5150
+ if (!isArraySubsetOf(newInitDataTypes, prevInitDataTypes)) {
5151
+ return false;
5152
+ }
5153
+ var prevSessionTypes = (_g = prevConfiguration.sessionTypes) !== null && _g !== void 0 ? _g : [];
5154
+ var newSessionTypes = (_h = newConfiguration.sessionTypes) !== null && _h !== void 0 ? _h : [];
5155
+ if (!isArraySubsetOf(newSessionTypes, prevSessionTypes)) {
5156
+ return false;
5157
+ }
5158
+ var _loop = function _loop() {
5159
+ var prop = _arr[_i];
5160
+ var newCapabilities = (_j = newConfiguration[prop]) !== null && _j !== void 0 ? _j : [];
5161
+ var prevCapabilities = (_k = prevConfiguration[prop]) !== null && _k !== void 0 ? _k : [];
5162
+ var wasFound = newCapabilities.every(function (n) {
5163
+ var _a, _b, _c, _d, _e, _f;
5164
+ for (var i = 0; i < prevCapabilities.length; i++) {
5165
+ var prevCap = prevCapabilities[i];
5166
+ if (((_a = prevCap.robustness) !== null && _a !== void 0 ? _a : "") === ((_b = n.robustness) !== null && _b !== void 0 ? _b : "") || ((_c = prevCap.encryptionScheme) !== null && _c !== void 0 ? _c : null) === ((_d = n.encryptionScheme) !== null && _d !== void 0 ? _d : null) || ((_e = prevCap.robustness) !== null && _e !== void 0 ? _e : "") === ((_f = n.robustness) !== null && _f !== void 0 ? _f : "")) {
5167
+ return true;
5168
+ }
5169
+ }
5170
+ return false;
5171
+ });
5172
+ if (!wasFound) {
5173
+ return {
5174
+ v: false
5175
+ };
5176
+ }
5177
+ },
5178
+ _ret;
5179
+ for (var _i = 0, _arr = ["audioCapabilities", "videoCapabilities"]; _i < _arr.length; _i++) {
5180
+ _ret = _loop();
5181
+ if (_ret) return _ret.v;
5182
+ }
5183
+ return true;
5151
5184
  }
5152
5185
  /**
5153
5186
  * Find key system canonical name from key system type.
@@ -5157,8 +5190,8 @@ function checkCachedMediaKeySystemAccess(keySystems, askedConfiguration, current
5157
5190
  function findKeySystemCanonicalName(ksType) {
5158
5191
  var _config$getCurrent = config/* default */.A.getCurrent(),
5159
5192
  EME_KEY_SYSTEMS = _config$getCurrent.EME_KEY_SYSTEMS;
5160
- for (var _i = 0, _Object$keys = Object.keys(EME_KEY_SYSTEMS); _i < _Object$keys.length; _i++) {
5161
- var ksName = _Object$keys[_i];
5193
+ for (var _i2 = 0, _Object$keys = Object.keys(EME_KEY_SYSTEMS); _i2 < _Object$keys.length; _i2++) {
5194
+ var ksName = _Object$keys[_i2];
5162
5195
  if ((0,array_includes/* default */.A)(EME_KEY_SYSTEMS[ksName], ksType)) {
5163
5196
  return ksName;
5164
5197
  }
@@ -5183,7 +5216,7 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
5183
5216
  var distinctiveIdentifier = "optional";
5184
5217
  if (keySystem.persistentLicense === true) {
5185
5218
  persistentState = "required";
5186
- sessionTypes.push("persistent-license");
5219
+ sessionTypes = ["persistent-license"];
5187
5220
  }
5188
5221
  if (keySystem.persistentStateRequired === true) {
5189
5222
  persistentState = "required";
@@ -5297,33 +5330,7 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
5297
5330
  */
5298
5331
  function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal) {
5299
5332
  log/* default */.A.info("DRM: Searching for compatible MediaKeySystemAccess");
5300
- var currentState = media_keys_infos_store/* default */.A.getState(mediaElement);
5301
- if (currentState !== null) {
5302
- if (eme.implementation === currentState.emeImplementation.implementation) {
5303
- // Fast way to find a compatible keySystem if the currently loaded
5304
- // one as exactly the same compatibility options.
5305
- var cachedKeySystemAccess = checkCachedMediaKeySystemAccess(keySystemsConfigs, currentState.askedConfiguration, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
5306
- if (cachedKeySystemAccess !== null) {
5307
- log/* default */.A.info("DRM: Found cached compatible keySystem");
5308
- return Promise.resolve({
5309
- type: "reuse-media-key-system-access",
5310
- value: {
5311
- mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
5312
- askedConfiguration: cachedKeySystemAccess.askedConfiguration,
5313
- options: cachedKeySystemAccess.keySystemOptions
5314
- }
5315
- });
5316
- }
5317
- }
5318
- }
5319
- /**
5320
- * Array of set keySystems for this content.
5321
- * Each item of this array is an object containing the following keys:
5322
- * - keyName {string}: keySystem canonical name (e.g. "widevine")
5323
- * - keyType {string}: keySystem type (e.g. "com.widevine.alpha")
5324
- * - keySystem {Object}: the original keySystem object
5325
- * @type {Array.<Object>}
5326
- */
5333
+ /** Array of set keySystems for this content. */
5327
5334
  var keySystemsType = keySystemsConfigs.reduce(function (arr, keySystemOptions) {
5328
5335
  var _config$getCurrent3 = config/* default */.A.getCurrent(),
5329
5336
  EME_KEY_SYSTEMS = _config$getCurrent3.EME_KEY_SYSTEMS;
@@ -5365,7 +5372,7 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
5365
5372
  }
5366
5373
  function _recursivelyTestKeySystems() {
5367
5374
  _recursivelyTestKeySystems = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee(index) {
5368
- var _keySystemsType$index, keyName, keyType, keySystemOptions, keySystemConfigurations, keySystemAccess, configIdx, keySystemConfiguration;
5375
+ var chosenType, keyName, keyType, keySystemOptions, keySystemConfigurations, keySystemAccess, currentState, configIdx, keySystemConfiguration;
5369
5376
  return regenerator_default().wrap(function _callee$(_context) {
5370
5377
  while (1) switch (_context.prev = _context.next) {
5371
5378
  case 0:
@@ -5381,20 +5388,38 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
5381
5388
  }
5382
5389
  throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");
5383
5390
  case 4:
5384
- _keySystemsType$index = keySystemsType[index], keyName = _keySystemsType$index.keyName, keyType = _keySystemsType$index.keyType, keySystemOptions = _keySystemsType$index.keySystemOptions;
5391
+ chosenType = keySystemsType[index];
5392
+ keyName = chosenType.keyName, keyType = chosenType.keyType, keySystemOptions = chosenType.keySystemOptions;
5385
5393
  keySystemConfigurations = buildKeySystemConfigurations(keyName, keyType, keySystemOptions);
5386
5394
  log/* default */.A.debug("DRM: Request keysystem access " + keyType + "," + (index + 1 + " of " + keySystemsType.length));
5395
+ currentState = media_keys_infos_store/* default */.A.getState(mediaElement);
5387
5396
  configIdx = 0;
5388
- case 8:
5397
+ case 10:
5389
5398
  if (!(configIdx < keySystemConfigurations.length)) {
5390
- _context.next = 26;
5399
+ _context.next = 31;
5391
5400
  break;
5392
5401
  }
5393
- keySystemConfiguration = keySystemConfigurations[configIdx];
5394
- _context.prev = 10;
5395
- _context.next = 13;
5402
+ keySystemConfiguration = keySystemConfigurations[configIdx]; // Check if the current `MediaKeySystemAccess` created cannot be reused here
5403
+ if (!(currentState !== null && !shouldRenewMediaKeySystemAccess() &&
5404
+ // TODO: Do it with MediaKeySystemAccess.prototype.keySystem instead?
5405
+ keyType === currentState.mediaKeySystemAccess.keySystem && eme.implementation === currentState.emeImplementation.implementation && isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(keySystemConfiguration, currentState.askedConfiguration))) {
5406
+ _context.next = 15;
5407
+ break;
5408
+ }
5409
+ log/* default */.A.info("DRM: Found cached compatible keySystem");
5410
+ return _context.abrupt("return", Promise.resolve({
5411
+ type: "reuse-media-key-system-access",
5412
+ value: {
5413
+ mediaKeySystemAccess: currentState.mediaKeySystemAccess,
5414
+ askedConfiguration: currentState.askedConfiguration,
5415
+ options: keySystemOptions
5416
+ }
5417
+ }));
5418
+ case 15:
5419
+ _context.prev = 15;
5420
+ _context.next = 18;
5396
5421
  return testKeySystem(keyType, [keySystemConfiguration]);
5397
- case 13:
5422
+ case 18:
5398
5423
  keySystemAccess = _context.sent;
5399
5424
  log/* default */.A.info("DRM: Found compatible keysystem", keyType, index + 1);
5400
5425
  return _context.abrupt("return", {
@@ -5405,26 +5430,26 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
5405
5430
  mediaKeySystemAccess: keySystemAccess
5406
5431
  }
5407
5432
  });
5408
- case 18:
5409
- _context.prev = 18;
5410
- _context.t0 = _context["catch"](10);
5433
+ case 23:
5434
+ _context.prev = 23;
5435
+ _context.t0 = _context["catch"](15);
5411
5436
  log/* default */.A.debug("DRM: Rejected access to keysystem", keyType, index + 1, configIdx);
5412
5437
  if (!(cancelSignal.cancellationError !== null)) {
5413
- _context.next = 23;
5438
+ _context.next = 28;
5414
5439
  break;
5415
5440
  }
5416
5441
  throw cancelSignal.cancellationError;
5417
- case 23:
5442
+ case 28:
5418
5443
  configIdx++;
5419
- _context.next = 8;
5444
+ _context.next = 10;
5420
5445
  break;
5421
- case 26:
5446
+ case 31:
5422
5447
  return _context.abrupt("return", recursivelyTestKeySystems(index + 1));
5423
- case 27:
5448
+ case 32:
5424
5449
  case "end":
5425
5450
  return _context.stop();
5426
5451
  }
5427
- }, _callee, null, [[10, 18]]);
5452
+ }, _callee, null, [[15, 23]]);
5428
5453
  }));
5429
5454
  return _recursivelyTestKeySystems.apply(this, arguments);
5430
5455
  }
@@ -5441,6 +5466,12 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
5441
5466
  function testKeySystem(_x2, _x3) {
5442
5467
  return _testKeySystem.apply(this, arguments);
5443
5468
  }
5469
+ /**
5470
+ * Returns `true` if `arr1`'s values are entirely contained in `arr2`.
5471
+ * @param {string} arr1
5472
+ * @param {string} arr2
5473
+ * @return {boolean}
5474
+ */
5444
5475
  function _testKeySystem() {
5445
5476
  _testKeySystem = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee2(keyType, keySystemConfigurations) {
5446
5477
  var keySystemAccess, mediaKeys, session, initData;
@@ -5482,6 +5513,14 @@ function _testKeySystem() {
5482
5513
  }));
5483
5514
  return _testKeySystem.apply(this, arguments);
5484
5515
  }
5516
+ function isArraySubsetOf(arr1, arr2) {
5517
+ for (var i = 0; i < arr1.length; i++) {
5518
+ if (!(0,array_includes/* default */.A)(arr2, arr1[i])) {
5519
+ return false;
5520
+ }
5521
+ }
5522
+ return true;
5523
+ }
5485
5524
  // EXTERNAL MODULE: ./src/parsers/containers/isobmff/get_box.ts
5486
5525
  var get_box = __webpack_require__(8797);
5487
5526
  ;// CONCATENATED MODULE: ./src/compat/eme/generate_key_request.ts
@@ -7904,21 +7943,46 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7904
7943
  var backoffOptions = getLicenseBackoffOptions(getLicenseConfig.retry);
7905
7944
  retryPromiseWithBackoff(function () {
7906
7945
  return runGetLicense(message, messageType);
7907
- }, backoffOptions, manualCanceller.signal).then(function (licenseObject) {
7908
- if (manualCanceller.isUsed()) {
7909
- return Promise.resolve();
7910
- }
7911
- if ((0,is_null_or_undefined/* default */.A)(licenseObject)) {
7912
- log/* default */.A.info("DRM: No license given, skipping session.update");
7913
- } else {
7914
- try {
7915
- return updateSessionWithMessage(session, licenseObject);
7916
- } catch (err) {
7917
- manualCanceller.cancel();
7918
- callbacks.onError(err);
7919
- }
7920
- }
7921
- })["catch"](function (err) {
7946
+ }, backoffOptions, manualCanceller.signal).then( /*#__PURE__*/function () {
7947
+ var _ref = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee(licenseObject) {
7948
+ return regenerator_default().wrap(function _callee$(_context) {
7949
+ while (1) switch (_context.prev = _context.next) {
7950
+ case 0:
7951
+ if (!manualCanceller.isUsed()) {
7952
+ _context.next = 2;
7953
+ break;
7954
+ }
7955
+ return _context.abrupt("return");
7956
+ case 2:
7957
+ if (!(0,is_null_or_undefined/* default */.A)(licenseObject)) {
7958
+ _context.next = 6;
7959
+ break;
7960
+ }
7961
+ log/* default */.A.info("DRM: No license given, skipping session.update");
7962
+ _context.next = 15;
7963
+ break;
7964
+ case 6:
7965
+ _context.prev = 6;
7966
+ _context.next = 9;
7967
+ return updateSessionWithMessage(session, licenseObject);
7968
+ case 9:
7969
+ _context.next = 15;
7970
+ break;
7971
+ case 11:
7972
+ _context.prev = 11;
7973
+ _context.t0 = _context["catch"](6);
7974
+ manualCanceller.cancel();
7975
+ callbacks.onError(_context.t0);
7976
+ case 15:
7977
+ case "end":
7978
+ return _context.stop();
7979
+ }
7980
+ }, _callee, null, [[6, 11]]);
7981
+ }));
7982
+ return function (_x) {
7983
+ return _ref.apply(this, arguments);
7984
+ };
7985
+ }(), function (err) {
7922
7986
  if (manualCanceller.isUsed()) {
7923
7987
  return;
7924
7988
  }
@@ -7941,7 +8005,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7941
8005
  * @param {Event} keyStatusesEvent
7942
8006
  * @returns {Promise}
7943
8007
  */
7944
- function handleKeyStatusesChangeEvent(_x) {
8008
+ function handleKeyStatusesChangeEvent(_x2) {
7945
8009
  return _handleKeyStatusesChangeEvent.apply(this, arguments);
7946
8010
  }
7947
8011
  /**
@@ -7951,70 +8015,70 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7951
8015
  * - call onKeyUpdate callback when the MediaKeyStatus of any key is updated
7952
8016
  */
7953
8017
  function _handleKeyStatusesChangeEvent() {
7954
- _handleKeyStatusesChangeEvent = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee2(keyStatusesEvent) {
8018
+ _handleKeyStatusesChangeEvent = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee3(keyStatusesEvent) {
7955
8019
  var runOnKeyStatusesChangeCallback, _runOnKeyStatusesChangeCallback;
7956
- return regenerator_default().wrap(function _callee2$(_context2) {
7957
- while (1) switch (_context2.prev = _context2.next) {
8020
+ return regenerator_default().wrap(function _callee3$(_context3) {
8021
+ while (1) switch (_context3.prev = _context3.next) {
7958
8022
  case 0:
7959
8023
  _runOnKeyStatusesChangeCallback = function _runOnKeyStatusesChan2() {
7960
- _runOnKeyStatusesChangeCallback = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee() {
8024
+ _runOnKeyStatusesChangeCallback = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee2() {
7961
8025
  var ret, err;
7962
- return regenerator_default().wrap(function _callee$(_context) {
7963
- while (1) switch (_context.prev = _context.next) {
8026
+ return regenerator_default().wrap(function _callee2$(_context2) {
8027
+ while (1) switch (_context2.prev = _context2.next) {
7964
8028
  case 0:
7965
8029
  if (!manualCanceller.isUsed()) {
7966
- _context.next = 2;
8030
+ _context2.next = 2;
7967
8031
  break;
7968
8032
  }
7969
- return _context.abrupt("return");
8033
+ return _context2.abrupt("return");
7970
8034
  case 2:
7971
8035
  if (!(typeof keySystemOptions.onKeyStatusesChange === "function")) {
7972
- _context.next = 24;
8036
+ _context2.next = 24;
7973
8037
  break;
7974
8038
  }
7975
- _context.prev = 3;
7976
- _context.next = 6;
8039
+ _context2.prev = 3;
8040
+ _context2.next = 6;
7977
8041
  return keySystemOptions.onKeyStatusesChange(keyStatusesEvent, session);
7978
8042
  case 6:
7979
- ret = _context.sent;
8043
+ ret = _context2.sent;
7980
8044
  if (!manualCanceller.isUsed()) {
7981
- _context.next = 9;
8045
+ _context2.next = 9;
7982
8046
  break;
7983
8047
  }
7984
- return _context.abrupt("return");
8048
+ return _context2.abrupt("return");
7985
8049
  case 9:
7986
- _context.next = 18;
8050
+ _context2.next = 18;
7987
8051
  break;
7988
8052
  case 11:
7989
- _context.prev = 11;
7990
- _context.t0 = _context["catch"](3);
8053
+ _context2.prev = 11;
8054
+ _context2.t0 = _context2["catch"](3);
7991
8055
  if (!cancelSignal.isCancelled()) {
7992
- _context.next = 15;
8056
+ _context2.next = 15;
7993
8057
  break;
7994
8058
  }
7995
- return _context.abrupt("return");
8059
+ return _context2.abrupt("return");
7996
8060
  case 15:
7997
8061
  err = new encrypted_media_error/* default */.A("KEY_STATUS_CHANGE_ERROR", "Unknown `onKeyStatusesChange` error");
7998
- if (!(0,is_null_or_undefined/* default */.A)(_context.t0) && (0,is_non_empty_string/* default */.A)(_context.t0.message)) {
7999
- err.message = _context.t0.message;
8062
+ if (!(0,is_null_or_undefined/* default */.A)(_context2.t0) && (0,is_non_empty_string/* default */.A)(_context2.t0.message)) {
8063
+ err.message = _context2.t0.message;
8000
8064
  }
8001
8065
  throw err;
8002
8066
  case 18:
8003
8067
  if (!(0,is_null_or_undefined/* default */.A)(ret)) {
8004
- _context.next = 22;
8068
+ _context2.next = 22;
8005
8069
  break;
8006
8070
  }
8007
8071
  log/* default */.A.info("DRM: No license given, skipping session.update");
8008
- _context.next = 24;
8072
+ _context2.next = 24;
8009
8073
  break;
8010
8074
  case 22:
8011
- _context.next = 24;
8075
+ _context2.next = 24;
8012
8076
  return updateSessionWithMessage(session, ret);
8013
8077
  case 24:
8014
8078
  case "end":
8015
- return _context.stop();
8079
+ return _context2.stop();
8016
8080
  }
8017
- }, _callee, null, [[3, 11]]);
8081
+ }, _callee2, null, [[3, 11]]);
8018
8082
  }));
8019
8083
  return _runOnKeyStatusesChangeCallback.apply(this, arguments);
8020
8084
  };
@@ -8022,13 +8086,13 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
8022
8086
  return _runOnKeyStatusesChangeCallback.apply(this, arguments);
8023
8087
  };
8024
8088
  log/* default */.A.info("DRM: keystatuseschange event received", session.sessionId);
8025
- _context2.next = 5;
8089
+ _context3.next = 5;
8026
8090
  return Promise.all([runOnKeyStatusesChangeCallback(), Promise.resolve(checkAndHandleCurrentKeyStatuses())]);
8027
8091
  case 5:
8028
8092
  case "end":
8029
- return _context2.stop();
8093
+ return _context3.stop();
8030
8094
  }
8031
- }, _callee2);
8095
+ }, _callee3);
8032
8096
  }));
8033
8097
  return _handleKeyStatusesChangeEvent.apply(this, arguments);
8034
8098
  }
@@ -8123,7 +8187,7 @@ function formatGetLicenseError(error) {
8123
8187
  * @param {ArrayBuffer|TypedArray|null} message
8124
8188
  * @returns {Promise}
8125
8189
  */
8126
- function updateSessionWithMessage(_x2, _x3) {
8190
+ function updateSessionWithMessage(_x3, _x4) {
8127
8191
  return _updateSessionWithMessage.apply(this, arguments);
8128
8192
  }
8129
8193
  /**
@@ -8134,30 +8198,30 @@ function updateSessionWithMessage(_x2, _x3) {
8134
8198
  * @extends Error
8135
8199
  */
8136
8200
  function _updateSessionWithMessage() {
8137
- _updateSessionWithMessage = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee3(session, message) {
8201
+ _updateSessionWithMessage = (0,asyncToGenerator/* default */.A)( /*#__PURE__*/regenerator_default().mark(function _callee4(session, message) {
8138
8202
  var reason;
8139
- return regenerator_default().wrap(function _callee3$(_context3) {
8140
- while (1) switch (_context3.prev = _context3.next) {
8203
+ return regenerator_default().wrap(function _callee4$(_context4) {
8204
+ while (1) switch (_context4.prev = _context4.next) {
8141
8205
  case 0:
8142
8206
  log/* default */.A.info("DRM: Updating MediaKeySession with message");
8143
- _context3.prev = 1;
8144
- _context3.next = 4;
8207
+ _context4.prev = 1;
8208
+ _context4.next = 4;
8145
8209
  return session.update(message);
8146
8210
  case 4:
8147
- _context3.next = 10;
8211
+ _context4.next = 10;
8148
8212
  break;
8149
8213
  case 6:
8150
- _context3.prev = 6;
8151
- _context3.t0 = _context3["catch"](1);
8152
- reason = _context3.t0 instanceof Error ? _context3.t0.toString() : "`session.update` failed";
8214
+ _context4.prev = 6;
8215
+ _context4.t0 = _context4["catch"](1);
8216
+ reason = _context4.t0 instanceof Error ? _context4.t0.toString() : "`session.update` failed";
8153
8217
  throw new encrypted_media_error/* default */.A("KEY_UPDATE_ERROR", reason);
8154
8218
  case 10:
8155
8219
  log/* default */.A.info("DRM: MediaKeySession update succeeded.");
8156
8220
  case 11:
8157
8221
  case "end":
8158
- return _context3.stop();
8222
+ return _context4.stop();
8159
8223
  }
8160
- }, _callee3, null, [[1, 6]]);
8224
+ }, _callee4, null, [[1, 6]]);
8161
8225
  }));
8162
8226
  return _updateSessionWithMessage.apply(this, arguments);
8163
8227
  }
@@ -14961,6 +15025,7 @@ var WeakMapMemory = /*#__PURE__*/function () {
14961
15025
  */
14962
15026
 
14963
15027
 
15028
+
14964
15029
  /**
14965
15030
  * Perform cleaning of the buffer according to the values set by the user
14966
15031
  * each time `playbackObserver` emits and each times the
@@ -14987,6 +15052,9 @@ function BufferGarbageCollector(_ref, cancellationSignal) {
14987
15052
  });
14988
15053
  function clean() {
14989
15054
  clearBuffer(segmentBuffer, lastPosition, maxBufferBehind.getValue(), maxBufferAhead.getValue(), cancellationSignal)["catch"](function (e) {
15055
+ if (cancellationSignal.isCancelled() && task_canceller/* default */.Ay.isCancellationError(e)) {
15056
+ return;
15057
+ }
14990
15058
  var errMsg = e instanceof Error ? e.message : "Unknown error";
14991
15059
  log/* default */.A.error("Could not run BufferGarbageCollector:", errMsg);
14992
15060
  });
@@ -16679,12 +16747,6 @@ function _pushInitSegment() {
16679
16747
  while (1) switch (_context.prev = _context.next) {
16680
16748
  case 0:
16681
16749
  playbackObserver = _ref.playbackObserver, content = _ref.content, initSegmentUniqueId = _ref.initSegmentUniqueId, segment = _ref.segment, segmentData = _ref.segmentData, segmentBuffer = _ref.segmentBuffer;
16682
- if (!(cancelSignal.cancellationError !== null)) {
16683
- _context.next = 3;
16684
- break;
16685
- }
16686
- throw cancelSignal.cancellationError;
16687
- case 3:
16688
16750
  codec = content.representation.getMimeTypeString();
16689
16751
  data = {
16690
16752
  initSegmentUniqueId: initSegmentUniqueId,
@@ -16699,12 +16761,12 @@ function _pushInitSegment() {
16699
16761
  start: 0,
16700
16762
  end: 0
16701
16763
  }, content);
16702
- _context.next = 8;
16764
+ _context.next = 6;
16703
16765
  return appendSegmentToBuffer(playbackObserver, segmentBuffer, {
16704
16766
  data: data,
16705
16767
  inventoryInfos: inventoryInfos
16706
16768
  }, cancelSignal);
16707
- case 8:
16769
+ case 6:
16708
16770
  buffered = segmentBuffer.getBufferedRanges();
16709
16771
  return _context.abrupt("return", {
16710
16772
  content: content,
@@ -16712,7 +16774,7 @@ function _pushInitSegment() {
16712
16774
  buffered: buffered,
16713
16775
  segmentData: segmentData
16714
16776
  });
16715
- case 10:
16777
+ case 8:
16716
16778
  case "end":
16717
16779
  return _context.stop();
16718
16780
  }
@@ -16763,12 +16825,6 @@ function _pushMediaSegment() {
16763
16825
  }
16764
16826
  return _context.abrupt("return", null);
16765
16827
  case 3:
16766
- if (!(cancelSignal.cancellationError !== null)) {
16767
- _context.next = 5;
16768
- break;
16769
- }
16770
- throw cancelSignal.cancellationError;
16771
- case 5:
16772
16828
  chunkData = parsedSegment.chunkData, chunkInfos = parsedSegment.chunkInfos, chunkOffset = parsedSegment.chunkOffset, chunkSize = parsedSegment.chunkSize, appendWindow = parsedSegment.appendWindow;
16773
16829
  codec = content.representation.getMimeTypeString();
16774
16830
  _config$getCurrent = config/* default */.A.getCurrent(), APPEND_WINDOW_SECURITIES = _config$getCurrent.APPEND_WINDOW_SECURITIES; // Cutting exactly at the start or end of the appendWindow can lead to
@@ -16797,12 +16853,12 @@ function _pushMediaSegment() {
16797
16853
  start: estimatedStart,
16798
16854
  end: estimatedEnd
16799
16855
  }, content);
16800
- _context.next = 18;
16856
+ _context.next = 16;
16801
16857
  return appendSegmentToBuffer(playbackObserver, segmentBuffer, {
16802
16858
  data: data,
16803
16859
  inventoryInfos: inventoryInfos
16804
16860
  }, cancelSignal);
16805
- case 18:
16861
+ case 16:
16806
16862
  buffered = segmentBuffer.getBufferedRanges();
16807
16863
  return _context.abrupt("return", {
16808
16864
  content: content,
@@ -16810,7 +16866,7 @@ function _pushMediaSegment() {
16810
16866
  buffered: buffered,
16811
16867
  segmentData: chunkData
16812
16868
  });
16813
- case 20:
16869
+ case 18:
16814
16870
  case "end":
16815
16871
  return _context.stop();
16816
16872
  }
@@ -16902,23 +16958,16 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16902
16958
  drmSystemId = options.drmSystemId,
16903
16959
  fastSwitchThreshold = options.fastSwitchThreshold;
16904
16960
  var bufferType = adaptation.type;
16905
- /** `TaskCanceller` stopping ALL operations performed by the `RepresentationStream` */
16906
- var globalCanceller = new task_canceller/* default */.Ay();
16907
- globalCanceller.linkToSignal(parentCancelSignal);
16908
- /**
16909
- * `TaskCanceller` allowing to only stop segment loading and checking operations.
16910
- * This allows to stop only tasks linked to network resource usage, which is
16911
- * often a limited resource, while still letting buffer operations to finish.
16912
- */
16913
- var segmentsLoadingCanceller = new task_canceller/* default */.Ay();
16914
- segmentsLoadingCanceller.linkToSignal(globalCanceller.signal);
16961
+ /** `TaskCanceller` stopping operations performed by the `RepresentationStream` */
16962
+ var canceller = new task_canceller/* default */.Ay();
16963
+ canceller.linkToSignal(parentCancelSignal);
16915
16964
  /** Saved initialization segment state for this representation. */
16916
16965
  var initSegmentState = {
16917
16966
  segment: representation.index.getInitSegment(),
16918
16967
  uniqueId: null,
16919
16968
  isLoaded: false
16920
16969
  };
16921
- globalCanceller.signal.register(function () {
16970
+ canceller.signal.register(function () {
16922
16971
  // Free initialization segment if one has been declared
16923
16972
  if (initSegmentState.uniqueId !== null) {
16924
16973
  segmentBuffer.freeInitSegment(initSegmentState.uniqueId);
@@ -16928,7 +16977,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16928
16977
  var lastSegmentQueue = new reference/* default */.A({
16929
16978
  initSegment: null,
16930
16979
  segmentQueue: []
16931
- }, segmentsLoadingCanceller.signal);
16980
+ }, canceller.signal);
16932
16981
  /** If `true`, the current Representation has a linked initialization segment. */
16933
16982
  var hasInitSegment = initSegmentState.segment !== null;
16934
16983
  if (!hasInitSegment) {
@@ -16956,7 +17005,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16956
17005
  content: content
16957
17006
  }, d);
16958
17007
  }));
16959
- if (globalCanceller.isUsed()) {
17008
+ if (canceller.isUsed()) {
16960
17009
  return; // previous callback has stopped everything by side-effect
16961
17010
  }
16962
17011
  }
@@ -16964,10 +17013,10 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16964
17013
  /** Will load every segments in `lastSegmentQueue` */
16965
17014
  var downloadingQueue = new DownloadingQueue(content, lastSegmentQueue, segmentFetcher, hasInitSegment);
16966
17015
  downloadingQueue.addEventListener("error", function (err) {
16967
- if (segmentsLoadingCanceller.signal.isCancelled()) {
17016
+ if (canceller.signal.isCancelled()) {
16968
17017
  return; // ignore post requests-cancellation loading-related errors,
16969
17018
  }
16970
- globalCanceller.cancel(); // Stop every operations
17019
+ canceller.cancel(); // Stop every operations
16971
17020
  callbacks.error(err);
16972
17021
  });
16973
17022
  downloadingQueue.addEventListener("parsedInitSegment", onParsedChunk);
@@ -16975,7 +17024,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16975
17024
  downloadingQueue.addEventListener("emptyQueue", checkStatus);
16976
17025
  downloadingQueue.addEventListener("requestRetry", function (payload) {
16977
17026
  callbacks.warning(payload.error);
16978
- if (segmentsLoadingCanceller.signal.isCancelled()) {
17027
+ if (canceller.signal.isCancelled()) {
16979
17028
  return; // If the previous callback led to loading operations being stopped, skip
16980
17029
  }
16981
17030
  var retriedSegment = payload.segment;
@@ -16989,29 +17038,29 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
16989
17038
  downloadingQueue.addEventListener("fullyLoadedSegment", function (segment) {
16990
17039
  segmentBuffer.endOfSegment((0,object_assign/* default */.A)({
16991
17040
  segment: segment
16992
- }, content), globalCanceller.signal)["catch"](onFatalBufferError);
17041
+ }, content), canceller.signal)["catch"](onFatalBufferError);
16993
17042
  });
16994
17043
  downloadingQueue.start();
16995
- segmentsLoadingCanceller.signal.register(function () {
17044
+ canceller.signal.register(function () {
16996
17045
  downloadingQueue.removeEventListener();
16997
17046
  downloadingQueue.stop();
16998
17047
  });
16999
17048
  playbackObserver.listen(checkStatus, {
17000
17049
  includeLastObservation: false,
17001
- clearSignal: segmentsLoadingCanceller.signal
17050
+ clearSignal: canceller.signal
17002
17051
  });
17003
- content.manifest.addEventListener("manifestUpdate", checkStatus, segmentsLoadingCanceller.signal);
17052
+ content.manifest.addEventListener("manifestUpdate", checkStatus, canceller.signal);
17004
17053
  bufferGoal.onUpdate(checkStatus, {
17005
17054
  emitCurrentValue: false,
17006
- clearSignal: segmentsLoadingCanceller.signal
17055
+ clearSignal: canceller.signal
17007
17056
  });
17008
17057
  maxBufferSize.onUpdate(checkStatus, {
17009
17058
  emitCurrentValue: false,
17010
- clearSignal: segmentsLoadingCanceller.signal
17059
+ clearSignal: canceller.signal
17011
17060
  });
17012
17061
  terminate.onUpdate(checkStatus, {
17013
17062
  emitCurrentValue: false,
17014
- clearSignal: segmentsLoadingCanceller.signal
17063
+ clearSignal: canceller.signal
17015
17064
  });
17016
17065
  checkStatus();
17017
17066
  return;
@@ -17022,7 +17071,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17022
17071
  */
17023
17072
  function checkStatus() {
17024
17073
  var _a, _b;
17025
- if (segmentsLoadingCanceller.isUsed()) {
17074
+ if (canceller.isUsed()) {
17026
17075
  return; // Stop all buffer status checking if load operations are stopped
17027
17076
  }
17028
17077
  var observation = playbackObserver.getReference().getValue();
@@ -17063,7 +17112,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17063
17112
  segmentQueue: []
17064
17113
  });
17065
17114
  lastSegmentQueue.finish();
17066
- segmentsLoadingCanceller.cancel();
17115
+ canceller.cancel();
17067
17116
  callbacks.terminating();
17068
17117
  return;
17069
17118
  } else {
@@ -17083,7 +17132,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17083
17132
  if (nextQueue.length === 0 && nextInit === null) {
17084
17133
  log/* default */.A.debug("Stream: No request left, terminate", bufferType);
17085
17134
  lastSegmentQueue.finish();
17086
- segmentsLoadingCanceller.cancel();
17135
+ canceller.cancel();
17087
17136
  callbacks.terminating();
17088
17137
  return;
17089
17138
  }
@@ -17097,7 +17146,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17097
17146
  hasFinishedLoading: status.hasFinishedLoading,
17098
17147
  neededSegments: status.neededSegments
17099
17148
  });
17100
- if (segmentsLoadingCanceller.signal.isCancelled()) {
17149
+ if (canceller.signal.isCancelled()) {
17101
17150
  return; // previous callback has stopped loading operations by side-effect
17102
17151
  }
17103
17152
  var _config$getCurrent = config/* default */.A.getCurrent(),
@@ -17105,7 +17154,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17105
17154
  if (status.isBufferFull) {
17106
17155
  var gcedPosition = Math.max(0, initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
17107
17156
  if (gcedPosition > 0) {
17108
- segmentBuffer.removeBuffer(0, gcedPosition, globalCanceller.signal)["catch"](onFatalBufferError);
17157
+ segmentBuffer.removeBuffer(0, gcedPosition, canceller.signal)["catch"](onFatalBufferError);
17109
17158
  }
17110
17159
  }
17111
17160
  if (status.shouldRefreshManifest) {
@@ -17118,11 +17167,6 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17118
17167
  * @param {Object} evt
17119
17168
  */
17120
17169
  function onParsedChunk(evt) {
17121
- if (globalCanceller.isUsed()) {
17122
- // We should not do anything with segments if the `RepresentationStream`
17123
- // is not running anymore.
17124
- return;
17125
- }
17126
17170
  if (evt.segmentType === "init") {
17127
17171
  initSegmentState.isLoaded = true;
17128
17172
  // Now that the initialization segment has been parsed - which may have
@@ -17136,9 +17180,6 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17136
17180
  content: content
17137
17181
  }, p);
17138
17182
  }));
17139
- if (globalCanceller.isUsed()) {
17140
- return; // previous callback has stopped everything by side-effect
17141
- }
17142
17183
  }
17143
17184
  }
17144
17185
  if (evt.initializationData !== null) {
@@ -17152,7 +17193,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17152
17193
  segment: evt.segment,
17153
17194
  segmentData: evt.initializationData,
17154
17195
  segmentBuffer: segmentBuffer
17155
- }, globalCanceller.signal).then(function (result) {
17196
+ }, canceller.signal).then(function (result) {
17156
17197
  if (result !== null) {
17157
17198
  callbacks.addedSegment(result);
17158
17199
  }
@@ -17175,20 +17216,17 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17175
17216
  content: content
17176
17217
  }, p);
17177
17218
  }));
17178
- if (globalCanceller.isUsed()) {
17179
- return; // previous callback has stopped everything by side-effect
17180
- }
17181
17219
  }
17182
17220
  }
17183
17221
  if (needsManifestRefresh === true) {
17184
17222
  callbacks.needsManifestRefresh();
17185
- if (globalCanceller.isUsed()) {
17223
+ if (canceller.isUsed()) {
17186
17224
  return; // previous callback has stopped everything by side-effect
17187
17225
  }
17188
17226
  }
17189
17227
  if (inbandEvents !== undefined && inbandEvents.length > 0) {
17190
17228
  callbacks.inbandEvent(inbandEvents);
17191
- if (globalCanceller.isUsed()) {
17229
+ if (canceller.isUsed()) {
17192
17230
  return; // previous callback has stopped everything by side-effect
17193
17231
  }
17194
17232
  }
@@ -17200,7 +17238,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17200
17238
  parsedSegment: evt,
17201
17239
  segment: evt.segment,
17202
17240
  segmentBuffer: segmentBuffer
17203
- }, globalCanceller.signal).then(function (result) {
17241
+ }, canceller.signal).then(function (result) {
17204
17242
  if (result !== null) {
17205
17243
  callbacks.addedSegment(result);
17206
17244
  }
@@ -17214,13 +17252,13 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
17214
17252
  * @param {*} err
17215
17253
  */
17216
17254
  function onFatalBufferError(err) {
17217
- if (globalCanceller.isUsed() && err instanceof task_canceller/* CancellationError */.AL) {
17255
+ if (canceller.isUsed() && err instanceof task_canceller/* CancellationError */.AL) {
17218
17256
  // The error is linked to cancellation AND we explicitely cancelled buffer
17219
17257
  // operations.
17220
17258
  // We can thus ignore it, it is very unlikely to lead to true buffer issues.
17221
17259
  return;
17222
17260
  }
17223
- globalCanceller.cancel();
17261
+ canceller.cancel();
17224
17262
  callbacks.error(err);
17225
17263
  }
17226
17264
  }
@@ -22077,7 +22115,7 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
22077
22115
  }
22078
22116
  ignoredStallTimeStamp = null;
22079
22117
  playbackRateUpdater.startRebuffering();
22080
- if (_this2._manifest === null) {
22118
+ if (_this2._manifest === null || _compat_is_seeking_approximate__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A && performance.now() - rebuffering.timestamp <= 1000) {
22081
22119
  _this2.trigger("stalled", stalledReason);
22082
22120
  return;
22083
22121
  }
@@ -22106,7 +22144,7 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
22106
22144
  // implementation that might drop an injected segment, or in
22107
22145
  // case of small discontinuity in the content.
22108
22146
  var nextBufferRangeGap = (0,_utils_ranges__WEBPACK_IMPORTED_MODULE_5__/* .getNextRangeGap */ .Td)(buffered, freezePosition);
22109
- if (_this2._speed.getValue() > 0 && nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD) {
22147
+ if ((!_compat_is_seeking_approximate__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A || performance.now() - rebuffering.timestamp > 1000) && _this2._speed.getValue() > 0 && nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD) {
22110
22148
  var seekTo = freezePosition + nextBufferRangeGap + EPSILON;
22111
22149
  if (_this2._playbackObserver.getCurrentTime() < seekTo) {
22112
22150
  _log__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A.warn("Init: discontinuity encountered inferior to the threshold", freezePosition, seekTo, BUFFER_DISCONTINUITY_THRESHOLD);
@@ -50797,11 +50835,11 @@ module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.e
50797
50835
  function _typeof(o) {
50798
50836
  "@babel/helpers - typeof";
50799
50837
 
50800
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
50838
+ return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
50801
50839
  return typeof o;
50802
50840
  } : function (o) {
50803
50841
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
50804
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
50842
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
50805
50843
  }
50806
50844
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
50807
50845
 
@@ -52691,12 +52729,14 @@ var TrackChoiceManager = /*#__PURE__*/function () {
52691
52729
  * @param {Object} adaptationRef
52692
52730
  */;
52693
52731
  _proto.addPeriod = function addPeriod(bufferType, period, adaptationRef) {
52732
+ var _a;
52733
+ src_log/* default */.A.debug("TCM: Adding Track Reference", bufferType, period.id);
52694
52734
  var periodItem = getPeriodItem(this._periods, period);
52695
52735
  var adaptations = period.getSupportedAdaptations(bufferType);
52696
52736
  if (periodItem !== undefined) {
52697
52737
  if (periodItem[bufferType] !== undefined) {
52698
52738
  src_log/* default */.A.warn("TrackChoiceManager: " + bufferType + " already added for period", period.start);
52699
- return;
52739
+ (_a = periodItem[bufferType]) === null || _a === void 0 ? void 0 : _a.adaptationRef.finish();
52700
52740
  } else {
52701
52741
  periodItem[bufferType] = {
52702
52742
  adaptations: adaptations,
@@ -52720,6 +52760,7 @@ var TrackChoiceManager = /*#__PURE__*/function () {
52720
52760
  * @param {Period} period - The concerned Period.
52721
52761
  */;
52722
52762
  _proto.removePeriod = function removePeriod(bufferType, period) {
52763
+ src_log/* default */.A.debug("TCM: Removing Track Reference", bufferType, period.id);
52723
52764
  var periodIndex = findPeriodIndex(this._periods, period);
52724
52765
  if (periodIndex === undefined) {
52725
52766
  src_log/* default */.A.warn("TrackChoiceManager: " + bufferType + " not found for period", period.start);
@@ -52736,6 +52777,7 @@ var TrackChoiceManager = /*#__PURE__*/function () {
52736
52777
  }
52737
52778
  };
52738
52779
  _proto.resetPeriods = function resetPeriods() {
52780
+ src_log/* default */.A.debug("TCM: Resetting Period Objects");
52739
52781
  while (this._periods.length() > 0) {
52740
52782
  this._periods.pop();
52741
52783
  }
@@ -53790,7 +53832,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
53790
53832
  // Workaround to support Firefox autoplay on FF 42.
53791
53833
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
53792
53834
  videoElement.preload = "auto";
53793
- _this.version = /* PLAYER_VERSION */"3.33.4";
53835
+ _this.version = /* PLAYER_VERSION */"3.33.5-dev.2025040100";
53794
53836
  _this.log = src_log/* default */.A;
53795
53837
  _this.state = "STOPPED";
53796
53838
  _this.videoElement = videoElement;
@@ -56278,7 +56320,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
56278
56320
  * Use of a WeakSet ensure the object is garbage collected if it's not used anymore.
56279
56321
  */
56280
56322
  Player._priv_currentlyUsedVideoElements = new WeakSet();
56281
- Player.version = /* PLAYER_VERSION */"3.33.4";
56323
+ Player.version = /* PLAYER_VERSION */"3.33.5-dev.2025040100";
56282
56324
  /* harmony default export */ var public_api = (Player);
56283
56325
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
56284
56326
  /**