rx-player 3.30.0-dev.2023022200 → 3.30.0

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 (39) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +4 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/browser_detection.d.ts +23 -12
  5. package/dist/_esm5.processed/compat/browser_detection.js +80 -38
  6. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +2 -2
  7. package/dist/_esm5.processed/config.d.ts +2 -0
  8. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +0 -1
  9. package/dist/_esm5.processed/core/api/public_api.js +3 -3
  10. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +27 -8
  11. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
  12. package/dist/_esm5.processed/core/decrypt/find_key_system.js +33 -24
  13. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +27 -13
  14. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +13 -4
  15. package/dist/_esm5.processed/core/init/utils/media_duration_updater.js +1 -1
  16. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +1 -1
  17. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +15 -5
  18. package/dist/_esm5.processed/default_config.d.ts +16 -0
  19. package/dist/_esm5.processed/default_config.js +19 -0
  20. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +5 -2
  21. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +5 -2
  22. package/dist/rx-player.js +162 -72
  23. package/dist/rx-player.min.js +1 -1
  24. package/package.json +2 -1
  25. package/sonar-project.properties +1 -1
  26. package/src/compat/browser_detection.ts +99 -52
  27. package/src/compat/can_reuse_media_keys.ts +5 -2
  28. package/src/core/api/debug/buffer_size_graph.ts +0 -1
  29. package/src/core/api/public_api.ts +3 -3
  30. package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
  31. package/src/core/decrypt/find_key_system.ts +36 -35
  32. package/src/core/decrypt/session_events_listener.ts +28 -15
  33. package/src/core/fetchers/utils/schedule_request.ts +14 -4
  34. package/src/core/init/utils/media_duration_updater.ts +1 -1
  35. package/src/core/init/utils/rebuffering_controller.ts +1 -1
  36. package/src/core/stream/adaptation/adaptation_stream.ts +18 -8
  37. package/src/default_config.ts +30 -9
  38. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +4 -1
  39. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +5 -2
@@ -823,6 +823,22 @@ declare const DEFAULT_CONFIG: {
823
823
  * @type {number}
824
824
  */
825
825
  MIN_CANCELABLE_PRIORITY: number;
826
+ /**
827
+ * Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
828
+ * (DRM).
829
+ *
830
+ * Defined in order of importance (first will be tested first etc.)
831
+ * @type {Array.<string>}
832
+ */
833
+ EME_DEFAULT_VIDEO_CODECS: string[];
834
+ /**
835
+ * Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
836
+ * (DRM).
837
+ *
838
+ * Defined in order of importance (first will be tested first etc.)
839
+ * @type {Array.<string>}
840
+ */
841
+ EME_DEFAULT_AUDIO_CODECS: string[];
826
842
  /**
827
843
  * Robustnesses used in the {audio,video}Capabilities of the
828
844
  * MediaKeySystemConfiguration (DRM).
@@ -853,6 +853,25 @@ var DEFAULT_CONFIG = {
853
853
  * @type {number}
854
854
  */
855
855
  MIN_CANCELABLE_PRIORITY: 3,
856
+ /**
857
+ * Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
858
+ * (DRM).
859
+ *
860
+ * Defined in order of importance (first will be tested first etc.)
861
+ * @type {Array.<string>}
862
+ */
863
+ EME_DEFAULT_VIDEO_CODECS: ["video/mp4;codecs=\"avc1.4d401e\"",
864
+ "video/mp4;codecs=\"avc1.42e01e\"",
865
+ "video/webm;codecs=\"vp8\""],
866
+ /**
867
+ * Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
868
+ * (DRM).
869
+ *
870
+ * Defined in order of importance (first will be tested first etc.)
871
+ * @type {Array.<string>}
872
+ */
873
+ EME_DEFAULT_AUDIO_CODECS: ["audio/mp4;codecs=\"mp4a.40.2\"",
874
+ "audio/webm;codecs=opus"],
856
875
  /**
857
876
  * Robustnesses used in the {audio,video}Capabilities of the
858
877
  * MediaKeySystemConfiguration (DRM).
@@ -230,11 +230,14 @@ var VideoThumbnailLoader = /** @class */ (function () {
230
230
  }
231
231
  else {
232
232
  var requestCanceller = new TaskCanceller();
233
- var unlinkSignal = requestCanceller
233
+ var unlinkSignal_1 = requestCanceller
234
234
  .linkToSignal(lastRepInfo.cleaner.signal);
235
235
  var segmentInfo = objectAssign({ segment: segment }, content);
236
236
  var prom = loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, requestCanceller.signal)
237
- .finally(unlinkSignal);
237
+ .then(unlinkSignal_1, function (err) {
238
+ unlinkSignal_1();
239
+ throw err;
240
+ });
238
241
  var newReq_1 = {
239
242
  segmentId: segment.id,
240
243
  canceller: requestCanceller,
@@ -54,8 +54,8 @@ export default function addSegmentIntegrityChecks(segmentLoader) {
54
54
  reject(err);
55
55
  }
56
56
  } }))
57
- .finally(function () { return cleanUpCancellers(); })
58
57
  .then(function (info) {
58
+ cleanUpCancellers();
59
59
  if (requestCanceller.isUsed()) {
60
60
  return;
61
61
  }
@@ -69,7 +69,10 @@ export default function addSegmentIntegrityChecks(segmentLoader) {
69
69
  }
70
70
  }
71
71
  resolve(info);
72
- }, reject);
72
+ }, function (err) {
73
+ cleanUpCancellers();
74
+ reject(err);
75
+ });
73
76
  function cleanUpCancellers() {
74
77
  requestCanceller.signal.deregister(reject);
75
78
  unlinkCanceller();
package/dist/rx-player.js CHANGED
@@ -63,6 +63,7 @@ var READY_STATES = {
63
63
  /* harmony export */ "YM": function() { return /* binding */ isIEOrEdge; },
64
64
  /* harmony export */ "fq": function() { return /* binding */ isIE11; },
65
65
  /* harmony export */ "kD": function() { return /* binding */ isEdgeChromium; },
66
+ /* harmony export */ "l_": function() { return /* binding */ isPanasonic; },
66
67
  /* harmony export */ "op": function() { return /* binding */ isSamsungBrowser; },
67
68
  /* harmony export */ "vS": function() { return /* binding */ isSafariDesktop; },
68
69
  /* harmony export */ "vU": function() { return /* binding */ isFirefox; },
@@ -85,27 +86,72 @@ var READY_STATES = {
85
86
  * See the License for the specific language governing permissions and
86
87
  * limitations under the License.
87
88
  */
88
- var _a, _b;
89
89
 
90
- // true on IE11
91
- // false on Edge and other IEs/browsers.
92
- var isIE11 = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && typeof window.MSInputMethodContext !== "undefined" && typeof document.documentMode !== "undefined";
93
- // true for IE / Edge
94
- var isIEOrEdge = _is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z ? false : navigator.appName === "Microsoft Internet Explorer" || navigator.appName === "Netscape" && /(Trident|Edge)\//.test(navigator.userAgent);
95
- var isEdgeChromium = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && navigator.userAgent.toLowerCase().indexOf("edg/") !== -1;
96
- var isFirefox = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
97
- var isSamsungBrowser = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && /SamsungBrowser/.test(navigator.userAgent);
98
- var isTizen = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && /Tizen/.test(navigator.userAgent);
99
- var isWebOs = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && navigator.userAgent.indexOf("Web0S") >= 0;
100
- // Inspired form: http://webostv.developer.lge.com/discover/specifications/web-engine/
101
- // Note: even that page doesn't correspond to what we've actually seen in the
102
- // wild
103
- var isWebOs2021 = isWebOs && (/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent) || /[Cc]hr[o0]me\/79/.test(navigator.userAgent));
104
- var isWebOs2022 = isWebOs && (/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent) || /[Cc]hr[o0]me\/87/.test(navigator.userAgent));
90
+ /** Edge Chromium, regardless of the device */
91
+ var isEdgeChromium = false;
92
+ /** IE11, regardless of the device */
93
+ var isIE11 = false;
94
+ /** IE11 or Edge __Legacy__ (not Edge Chromium), regardless of the device */
95
+ var isIEOrEdge = false;
96
+ /** Firefox, regardless of the device */
97
+ var isFirefox = false;
105
98
  /** `true` on Safari on a PC platform (i.e. not iPhone / iPad etc.) */
106
- var isSafariDesktop = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") >= 0 || ((_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) === "[object SafariRemoteNotification]");
99
+ var isSafariDesktop = false;
107
100
  /** `true` on Safari on an iPhone, iPad & iPod platform */
108
- var isSafariMobile = !_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z && typeof navigator.platform === "string" && /iPad|iPhone|iPod/.test(navigator.platform);
101
+ var isSafariMobile = false;
102
+ /** Samsung's own browser application */
103
+ var isSamsungBrowser = false;
104
+ /** `true` on devices where Tizen is the OS (e.g. Samsung TVs). */
105
+ var isTizen = false;
106
+ /** `true` on devices where WebOS is the OS (e.g. LG TVs). */
107
+ var isWebOs = false;
108
+ /** `true` specifically for WebOS 2021 version. */
109
+ var isWebOs2021 = false;
110
+ /** `true` specifically for WebOS 2022 version. */
111
+ var isWebOs2022 = false;
112
+ /** `true` for Panasonic devices. */
113
+ var isPanasonic = false;
114
+ (function findCurrentBrowser() {
115
+ var _a, _b;
116
+ if (_is_node__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z) {
117
+ return;
118
+ }
119
+ // 1 - Find out browser between IE/Edge Legacy/Edge Chromium/Firefox/Safari
120
+ if (typeof window.MSInputMethodContext !== "undefined" && typeof document.documentMode !== "undefined") {
121
+ isIE11 = true;
122
+ isIEOrEdge = true;
123
+ } else if (navigator.appName === "Microsoft Internet Explorer" || navigator.appName === "Netscape" && /(Trident|Edge)\//.test(navigator.userAgent)) {
124
+ isIEOrEdge = true;
125
+ } else if (navigator.userAgent.toLowerCase().indexOf("edg/") !== -1) {
126
+ isEdgeChromium = true;
127
+ } else if (navigator.userAgent.toLowerCase().indexOf("firefox") !== -1) {
128
+ isFirefox = true;
129
+ } else if (typeof navigator.platform === "string" && /iPad|iPhone|iPod/.test(navigator.platform)) {
130
+ isSafariMobile = true;
131
+ } else if (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") >= 0 || ((_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) === "[object SafariRemoteNotification]") {
132
+ isSafariDesktop = true;
133
+ }
134
+ // 2 - Find out specific device/platform information
135
+ // Samsung browser e.g. on Android
136
+ if (/SamsungBrowser/.test(navigator.userAgent)) {
137
+ isSamsungBrowser = true;
138
+ }
139
+ if (/Tizen/.test(navigator.userAgent)) {
140
+ isTizen = true;
141
+ // Inspired form: http://webostv.developer.lge.com/discover/specifications/web-engine/
142
+ // Note: even that page doesn't correspond to what we've actually seen in the
143
+ // wild
144
+ } else if (/[Ww]eb[O0]S/.test(navigator.userAgent)) {
145
+ isWebOs = true;
146
+ if (/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent) || /[Cc]hr[o0]me\/87/.test(navigator.userAgent)) {
147
+ isWebOs2022 = true;
148
+ } else if (/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent) || /[Cc]hr[o0]me\/79/.test(navigator.userAgent)) {
149
+ isWebOs2021 = true;
150
+ }
151
+ } else if (/[Pp]anasonic/.test(navigator.userAgent)) {
152
+ isPanasonic = true;
153
+ }
154
+ })();
109
155
 
110
156
 
111
157
  /***/ }),
@@ -2685,6 +2731,22 @@ var DEFAULT_CONFIG = {
2685
2731
  * @type {number}
2686
2732
  */
2687
2733
  MIN_CANCELABLE_PRIORITY: 3,
2734
+ /**
2735
+ * Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
2736
+ * (DRM).
2737
+ *
2738
+ * Defined in order of importance (first will be tested first etc.)
2739
+ * @type {Array.<string>}
2740
+ */
2741
+ EME_DEFAULT_VIDEO_CODECS: ["video/mp4;codecs=\"avc1.4d401e\"", "video/mp4;codecs=\"avc1.42e01e\"", "video/webm;codecs=\"vp8\""],
2742
+ /**
2743
+ * Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
2744
+ * (DRM).
2745
+ *
2746
+ * Defined in order of importance (first will be tested first etc.)
2747
+ * @type {Array.<string>}
2748
+ */
2749
+ EME_DEFAULT_AUDIO_CODECS: ["audio/mp4;codecs=\"mp4a.40.2\"", "audio/webm;codecs=opus"],
2688
2750
  /**
2689
2751
  * Robustnesses used in the {audio,video}Capabilities of the
2690
2752
  * MediaKeySystemConfiguration (DRM).
@@ -4637,7 +4699,7 @@ var browser_detection = __webpack_require__(3666);
4637
4699
  * @returns {boolean}
4638
4700
  */
4639
4701
  function canReuseMediaKeys() {
4640
- return !browser_detection/* isWebOs */.$u;
4702
+ return !browser_detection/* isWebOs */.$u && !browser_detection/* isPanasonic */.l_;
4641
4703
  }
4642
4704
  ;// CONCATENATED MODULE: ./src/compat/should_renew_media_key_system_access.ts
4643
4705
  /**
@@ -4767,6 +4829,8 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
4767
4829
  distinctiveIdentifier = "required";
4768
4830
  }
4769
4831
  var _config$getCurrent2 = config/* default.getCurrent */.Z.getCurrent(),
4832
+ EME_DEFAULT_AUDIO_CODECS = _config$getCurrent2.EME_DEFAULT_AUDIO_CODECS,
4833
+ EME_DEFAULT_VIDEO_CODECS = _config$getCurrent2.EME_DEFAULT_VIDEO_CODECS,
4770
4834
  EME_DEFAULT_WIDEVINE_ROBUSTNESSES = _config$getCurrent2.EME_DEFAULT_WIDEVINE_ROBUSTNESSES,
4771
4835
  EME_DEFAULT_PLAYREADY_ROBUSTNESSES = _config$getCurrent2.EME_DEFAULT_PLAYREADY_ROBUSTNESSES;
4772
4836
  // Set robustness, in order of consideration:
@@ -4812,46 +4876,41 @@ function buildKeySystemConfigurations(ksName, ksType, keySystem) {
4812
4876
  // https://storage.googleapis.com/wvdocs/Chrome_EME_Changes_and_Best_Practices.pdf
4813
4877
  // https://www.w3.org/TR/encrypted-media/#get-supported-configuration-and-consent
4814
4878
  var videoCapabilities = (0,flat_map/* default */.Z)(videoRobustnesses, function (robustness) {
4815
- return ["video/mp4;codecs=\"avc1.4d401e\"", "video/mp4;codecs=\"avc1.42e01e\"", "video/webm;codecs=\"vp8\""].map(function (contentType) {
4816
- return robustness !== undefined ? {
4879
+ return EME_DEFAULT_VIDEO_CODECS.map(function (contentType) {
4880
+ return robustness === undefined ? {
4881
+ contentType: contentType
4882
+ } : {
4817
4883
  contentType: contentType,
4818
4884
  robustness: robustness
4819
- } : {
4820
- contentType: contentType
4821
4885
  };
4822
4886
  });
4823
4887
  });
4824
4888
  var audioCapabilities = (0,flat_map/* default */.Z)(audioRobustnesses, function (robustness) {
4825
- return ["audio/mp4;codecs=\"mp4a.40.2\"", "audio/webm;codecs=opus"].map(function (contentType) {
4826
- return robustness !== undefined ? {
4889
+ return EME_DEFAULT_AUDIO_CODECS.map(function (contentType) {
4890
+ return robustness === undefined ? {
4891
+ contentType: contentType
4892
+ } : {
4827
4893
  contentType: contentType,
4828
4894
  robustness: robustness
4829
- } : {
4830
- contentType: contentType
4831
4895
  };
4832
4896
  });
4833
4897
  });
4834
- // TODO Re-test with a set contentType but an undefined robustness on the
4835
- // STBs on which this problem was found.
4836
- //
4837
- // add another with no {audio,video}Capabilities for some legacy browsers.
4838
- // As of today's spec, this should return NotSupported but the first
4839
- // candidate configuration should be good, so we should have no downside
4840
- // doing that.
4841
- // initDataTypes: ["cenc"],
4842
- // videoCapabilities: undefined,
4843
- // audioCapabilities: undefined,
4844
- // distinctiveIdentifier,
4845
- // persistentState,
4846
- // sessionTypes,
4847
- return [{
4898
+ var wantedMediaKeySystemConfiguration = {
4848
4899
  initDataTypes: ["cenc"],
4849
4900
  videoCapabilities: videoCapabilities,
4850
4901
  audioCapabilities: audioCapabilities,
4851
4902
  distinctiveIdentifier: distinctiveIdentifier,
4852
4903
  persistentState: persistentState,
4853
4904
  sessionTypes: sessionTypes
4854
- }];
4905
+ };
4906
+ return [wantedMediaKeySystemConfiguration,
4907
+ // Some legacy implementations have issues with `audioCapabilities` and
4908
+ // `videoCapabilities`, so we're including a supplementary
4909
+ // `MediaKeySystemConfiguration` without those properties.
4910
+ Object.assign(Object.assign({}, wantedMediaKeySystemConfiguration), {
4911
+ audioCapabilities: undefined,
4912
+ videoCapabilities: undefined
4913
+ })];
4855
4914
  }
4856
4915
  /**
4857
4916
  * Try to find a compatible key system from the keySystems array given.
@@ -7545,18 +7604,30 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7545
7604
  function runGetLicense(message, messageType) {
7546
7605
  var timeoutId;
7547
7606
  return new Promise(function (res, rej) {
7548
- log/* default.debug */.Z.debug("DRM: Calling `getLicense`", messageType);
7549
- var getLicense = keySystemOptions.getLicense(message, messageType);
7550
- var getLicenseTimeout = (0,is_null_or_undefined/* default */.Z)(getLicenseConfig.timeout) ? 10 * 1000 : getLicenseConfig.timeout;
7551
- if (getLicenseTimeout >= 0) {
7552
- timeoutId = setTimeout(function () {
7553
- rej(new GetLicenseTimeoutError("\"getLicense\" timeout exceeded (" + getLicenseTimeout + " ms)"));
7554
- }, getLicenseTimeout);
7555
- }
7556
- Promise.resolve(getLicense).then(res, rej);
7557
- })["finally"](function () {
7558
- if (timeoutId !== undefined) {
7559
- clearTimeout(timeoutId);
7607
+ try {
7608
+ log/* default.debug */.Z.debug("DRM: Calling `getLicense`", messageType);
7609
+ var getLicense = keySystemOptions.getLicense(message, messageType);
7610
+ var getLicenseTimeout = (0,is_null_or_undefined/* default */.Z)(getLicenseConfig.timeout) ? 10 * 1000 : getLicenseConfig.timeout;
7611
+ if (getLicenseTimeout >= 0) {
7612
+ timeoutId = setTimeout(function () {
7613
+ rej(new GetLicenseTimeoutError("\"getLicense\" timeout exceeded (" + getLicenseTimeout + " ms)"));
7614
+ }, getLicenseTimeout);
7615
+ }
7616
+ Promise.resolve(getLicense).then(clearTimeoutAndResolve, clearTimeoutAndReject);
7617
+ } catch (err) {
7618
+ clearTimeoutAndReject(err);
7619
+ }
7620
+ function clearTimeoutAndResolve(data) {
7621
+ if (timeoutId !== undefined) {
7622
+ clearTimeout(timeoutId);
7623
+ }
7624
+ res(data);
7625
+ }
7626
+ function clearTimeoutAndReject(err) {
7627
+ if (timeoutId !== undefined) {
7628
+ clearTimeout(timeoutId);
7629
+ }
7630
+ rej(err);
7560
7631
  }
7561
7632
  });
7562
7633
  }
@@ -9956,7 +10027,7 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
9956
10027
  this._canceller.signal.register(function () {
9957
10028
  playbackRateUpdater.dispose();
9958
10029
  });
9959
- var prevFreezingState;
10030
+ var prevFreezingState = null;
9960
10031
  this._playbackObserver.listen(function (observation) {
9961
10032
  var _a;
9962
10033
  var discontinuitiesStore = _this2._discontinuitiesStore;
@@ -28413,9 +28484,8 @@ function addSegmentIntegrityChecks(segmentLoader) {
28413
28484
  reject(err);
28414
28485
  }
28415
28486
  }
28416
- }))["finally"](function () {
28417
- return cleanUpCancellers();
28418
- }).then(function (info) {
28487
+ })).then(function (info) {
28488
+ cleanUpCancellers();
28419
28489
  if (requestCanceller.isUsed()) {
28420
28490
  return;
28421
28491
  }
@@ -28428,7 +28498,10 @@ function addSegmentIntegrityChecks(segmentLoader) {
28428
28498
  }
28429
28499
  }
28430
28500
  resolve(info);
28431
- }, reject);
28501
+ }, function (err) {
28502
+ cleanUpCancellers();
28503
+ reject(err);
28504
+ });
28432
28505
  function cleanUpCancellers() {
28433
28506
  requestCanceller.signal.deregister(reject);
28434
28507
  unlinkCanceller();
@@ -40433,17 +40506,25 @@ function _scheduleRequestWithCdns() {
40433
40506
  throw cancellationSignal.cancellationError;
40434
40507
  }
40435
40508
  if (updatedPrioritaryCdn === undefined) {
40436
- return rej(prevRequestError);
40509
+ return cleanAndReject(prevRequestError);
40437
40510
  }
40438
40511
  if (updatedPrioritaryCdn !== nextWantedCdn) {
40439
40512
  canceller.cancel();
40440
- waitPotentialBackoffAndRequest(updatedPrioritaryCdn, prevRequestError).then(res, rej);
40513
+ waitPotentialBackoffAndRequest(updatedPrioritaryCdn, prevRequestError).then(cleanAndResolve, cleanAndReject);
40441
40514
  }
40442
40515
  }, canceller.signal);
40443
40516
  (0,cancellable_sleep/* default */.Z)(blockedFor, canceller.signal).then(function () {
40444
- return requestCdn(nextWantedCdn).then(res, rej);
40517
+ return requestCdn(nextWantedCdn).then(cleanAndResolve, cleanAndReject);
40445
40518
  }, noop/* default */.Z);
40446
- })["finally"](unlinkCanceller);
40519
+ function cleanAndResolve(response) {
40520
+ unlinkCanceller();
40521
+ res(response);
40522
+ }
40523
+ function cleanAndReject(err) {
40524
+ unlinkCanceller();
40525
+ rej(err);
40526
+ }
40527
+ });
40447
40528
  };
40448
40529
  _retryWithNextCdn = function _retryWithNextCdn3() {
40449
40530
  _retryWithNextCdn = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(prevRequestError) {
@@ -45803,6 +45884,8 @@ function getRepresentationEstimate(content, representationEstimator, currentRepr
45803
45884
 
45804
45885
 
45805
45886
 
45887
+
45888
+
45806
45889
  /**
45807
45890
  * Create new `AdaptationStream` whose task will be to download the media data
45808
45891
  * for a given Adaptation (i.e. "track").
@@ -46074,16 +46157,23 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
46074
46157
  defaultCode: "NONE",
46075
46158
  defaultReason: "Unknown `RepresentationStream` error"
46076
46159
  });
46077
- if (formattedError.code === "BUFFER_FULL_ERROR") {
46160
+ if (formattedError.code !== "BUFFER_FULL_ERROR") {
46161
+ representationStreamCallbacks.error(err);
46162
+ } else {
46078
46163
  var wba = wantedBufferAhead.getValue();
46079
46164
  var lastBufferGoalRatio = (_a = bufferGoalRatioMap.get(representation.id)) !== null && _a !== void 0 ? _a : 1;
46080
- if (lastBufferGoalRatio <= 0.25 || wba * lastBufferGoalRatio <= 2) {
46165
+ // 70%, 49%, 34.3%, 24%, 16.81%, 11.76%, 8.24% and 5.76%
46166
+ var newBufferGoalRatio = lastBufferGoalRatio * 0.7;
46167
+ if (newBufferGoalRatio <= 0.05 || wba * newBufferGoalRatio <= 2) {
46081
46168
  throw formattedError;
46082
46169
  }
46083
- bufferGoalRatioMap.set(representation.id, lastBufferGoalRatio - 0.25);
46084
- return createRepresentationStream(representation, terminateCurrentStream, fastSwitchThreshold, representationStreamCallbacks);
46170
+ bufferGoalRatioMap.set(representation.id, newBufferGoalRatio);
46171
+ // We wait 4 seconds to let the situation evolve by itself before
46172
+ // retrying loading segments with a lower buffer goal
46173
+ (0,cancellable_sleep/* default */.Z)(4000, adapStreamCanceller.signal).then(function () {
46174
+ return createRepresentationStream(representation, terminateCurrentStream, fastSwitchThreshold, representationStreamCallbacks);
46175
+ })["catch"](noop/* default */.Z);
46085
46176
  }
46086
- representationStreamCallbacks.error(err);
46087
46177
  },
46088
46178
  terminating: function terminating() {
46089
46179
  terminatingRepStreamCanceller.cancel();
@@ -48546,7 +48636,7 @@ function setMediaSourceDuration(mediaSource, manifest, knownDuration) {
48546
48636
  if (maxBufferedEnd < mediaSource.duration) {
48547
48637
  try {
48548
48638
  log/* default.info */.Z.info("Init: Updating duration to what is currently buffered", maxBufferedEnd);
48549
- mediaSource.duration = newDuration;
48639
+ mediaSource.duration = maxBufferedEnd;
48550
48640
  } catch (err) {
48551
48641
  log/* default.warn */.Z.warn("Duration Updater: Can't update duration on the MediaSource.", err instanceof Error ? err : "");
48552
48642
  return "failed" /* MediaSourceDurationUpdateStatus.Failed */;
@@ -51927,7 +52017,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
51927
52017
  // Workaround to support Firefox autoplay on FF 42.
51928
52018
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
51929
52019
  videoElement.preload = "auto";
51930
- _this.version = /* PLAYER_VERSION */"3.30.0-dev.2023022200";
52020
+ _this.version = /* PLAYER_VERSION */"3.30.0";
51931
52021
  _this.log = log/* default */.Z;
51932
52022
  _this.state = "STOPPED";
51933
52023
  _this.videoElement = videoElement;
@@ -52479,7 +52569,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52479
52569
  // Previous call could have performed all kind of side-effects, thus,
52480
52570
  // we re-check the current state associated to the RxPlayer
52481
52571
  if (_this2.state === "ENDED" /* PLAYER_STATES.ENDED */ && _this2._priv_stopAtEnd) {
52482
- currentContentCanceller.cancel();
52572
+ _this2.stop();
52483
52573
  }
52484
52574
  }, {
52485
52575
  emitCurrentValue: true,
@@ -54242,7 +54332,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54242
54332
  }]);
54243
54333
  return Player;
54244
54334
  }(event_emitter/* default */.Z);
54245
- Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023022200";
54335
+ Player.version = /* PLAYER_VERSION */"3.30.0";
54246
54336
  /* harmony default export */ var public_api = (Player);
54247
54337
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
54248
54338
  /**