rx-player 3.30.0-dev.2023020100 → 3.30.0-dev.2023030200

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 (183) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +5 -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/compat/eme/close_session.js +2 -2
  8. package/dist/_esm5.processed/compat/event_listeners.js +1 -1
  9. package/dist/_esm5.processed/config.d.ts +2 -0
  10. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +4 -2
  11. package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
  12. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
  13. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
  14. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +104 -0
  15. package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
  16. package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
  17. package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
  18. package/dist/_esm5.processed/core/api/debug/index.js +2 -0
  19. package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
  20. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +199 -0
  21. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
  22. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
  23. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
  24. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
  25. package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
  26. package/dist/_esm5.processed/core/api/debug/render.js +32 -0
  27. package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
  28. package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
  29. package/dist/_esm5.processed/core/api/playback_observer.js +3 -2
  30. package/dist/_esm5.processed/core/api/public_api.d.ts +3 -0
  31. package/dist/_esm5.processed/core/api/public_api.js +25 -14
  32. package/dist/_esm5.processed/core/api/utils.js +3 -3
  33. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +32 -13
  34. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
  35. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
  36. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
  37. package/dist/_esm5.processed/core/decrypt/find_key_system.js +33 -24
  38. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +54 -50
  39. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
  40. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
  41. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
  42. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
  43. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
  44. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
  45. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
  46. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +17 -7
  47. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
  48. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +27 -31
  49. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +2 -2
  50. package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
  51. package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
  52. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
  53. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
  54. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
  55. package/dist/_esm5.processed/core/init/utils/media_duration_updater.js +23 -19
  56. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +1 -1
  57. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
  58. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
  59. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +7 -10
  60. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +4 -2
  61. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
  62. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +25 -16
  63. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +26 -12
  64. package/dist/_esm5.processed/core/stream/period/period_stream.js +11 -10
  65. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +15 -15
  66. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +1 -1
  67. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
  68. package/dist/_esm5.processed/default_config.d.ts +16 -0
  69. package/dist/_esm5.processed/default_config.js +19 -0
  70. package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
  71. package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
  72. package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
  73. package/dist/_esm5.processed/experimental/features/index.js +1 -0
  74. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +7 -4
  75. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +8 -4
  76. package/dist/_esm5.processed/features/features_object.js +1 -0
  77. package/dist/_esm5.processed/features/initialize_features.js +13 -10
  78. package/dist/_esm5.processed/features/types.d.ts +3 -0
  79. package/dist/_esm5.processed/manifest/adaptation.js +4 -0
  80. package/dist/_esm5.processed/manifest/manifest.js +2 -0
  81. package/dist/_esm5.processed/manifest/representation.js +11 -4
  82. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
  83. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
  84. package/dist/_esm5.processed/public_types.d.ts +1 -0
  85. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +15 -11
  86. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
  87. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  88. package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
  89. package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
  90. package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
  91. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  92. package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
  93. package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
  94. package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
  95. package/dist/_esm5.processed/utils/reference.js +6 -0
  96. package/dist/_esm5.processed/utils/request/xhr.js +1 -1
  97. package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
  98. package/dist/_esm5.processed/utils/task_canceller.js +55 -22
  99. package/dist/rx-player.js +880 -677
  100. package/dist/rx-player.min.js +1 -1
  101. package/jest.config.js +1 -0
  102. package/package.json +19 -18
  103. package/scripts/build/constants.d.ts +1 -0
  104. package/scripts/report_build_sizes +4 -0
  105. package/sonar-project.properties +1 -1
  106. package/src/compat/browser_detection.ts +99 -52
  107. package/src/compat/can_reuse_media_keys.ts +5 -2
  108. package/src/compat/eme/close_session.ts +2 -2
  109. package/src/compat/event_listeners.ts +1 -1
  110. package/src/core/adaptive/adaptive_representation_selector.ts +4 -2
  111. package/src/core/api/debug/buffer_graph.ts +247 -0
  112. package/src/core/api/debug/buffer_size_graph.ts +130 -0
  113. package/src/core/api/debug/constants.ts +2 -0
  114. package/src/core/api/debug/index.ts +3 -0
  115. package/src/core/api/debug/modules/general_info.ts +204 -0
  116. package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
  117. package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
  118. package/src/core/api/debug/render.ts +40 -0
  119. package/src/core/api/debug/utils.ts +103 -0
  120. package/src/core/api/playback_observer.ts +4 -2
  121. package/src/core/api/public_api.ts +28 -14
  122. package/src/core/api/utils.ts +3 -3
  123. package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
  124. package/src/core/decrypt/attach_media_keys.ts +1 -1
  125. package/src/core/decrypt/content_decryptor.ts +1 -1
  126. package/src/core/decrypt/find_key_system.ts +36 -35
  127. package/src/core/decrypt/session_events_listener.ts +57 -56
  128. package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
  129. package/src/core/fetchers/cdn_prioritizer.ts +18 -9
  130. package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
  131. package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
  132. package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
  133. package/src/core/fetchers/utils/schedule_request.ts +18 -7
  134. package/src/core/init/directfile_content_initializer.ts +1 -1
  135. package/src/core/init/media_source_content_initializer.ts +37 -41
  136. package/src/core/init/utils/content_time_boundaries_observer.ts +2 -2
  137. package/src/core/init/utils/create_media_source.ts +4 -16
  138. package/src/core/init/utils/end_of_stream.ts +6 -3
  139. package/src/core/init/utils/get_loaded_reference.ts +2 -1
  140. package/src/core/init/utils/initial_seek_and_play.ts +9 -5
  141. package/src/core/init/utils/initialize_content_decryption.ts +2 -1
  142. package/src/core/init/utils/media_duration_updater.ts +25 -20
  143. package/src/core/init/utils/rebuffering_controller.ts +1 -1
  144. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
  145. package/src/core/init/utils/throw_on_media_error.ts +1 -1
  146. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +7 -11
  147. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +4 -2
  148. package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
  149. package/src/core/stream/adaptation/adaptation_stream.ts +28 -19
  150. package/src/core/stream/orchestrator/stream_orchestrator.ts +26 -12
  151. package/src/core/stream/period/period_stream.ts +11 -10
  152. package/src/core/stream/representation/representation_stream.ts +15 -15
  153. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
  154. package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
  155. package/src/default_config.ts +30 -9
  156. package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
  157. package/src/experimental/features/debug_element.ts +13 -0
  158. package/src/experimental/features/index.ts +1 -0
  159. package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
  160. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +8 -4
  161. package/src/features/__tests__/initialize_features.test.ts +11 -0
  162. package/src/features/features_object.ts +1 -0
  163. package/src/features/initialize_features.ts +15 -10
  164. package/src/features/types.ts +9 -0
  165. package/src/manifest/adaptation.ts +7 -0
  166. package/src/manifest/manifest.ts +4 -0
  167. package/src/manifest/representation.ts +10 -4
  168. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
  169. package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
  170. package/src/public_types.ts +1 -0
  171. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +31 -22
  172. package/src/transports/dash/low_latency_segment_loader.ts +2 -2
  173. package/src/transports/dash/manifest_parser.ts +1 -1
  174. package/src/transports/dash/segment_loader.ts +4 -4
  175. package/src/transports/local/segment_loader.ts +14 -30
  176. package/src/transports/smooth/segment_loader.ts +4 -4
  177. package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
  178. package/src/typings/globals.d.ts +2 -0
  179. package/src/utils/cancellable_sleep.ts +5 -14
  180. package/src/utils/create_cancellable_promise.ts +69 -0
  181. package/src/utils/reference.ts +6 -0
  182. package/src/utils/request/xhr.ts +1 -1
  183. package/src/utils/task_canceller.ts +63 -34
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
  /***/ }),
@@ -1276,7 +1322,7 @@ function createCompatibleEventListener(eventNames, prefixes) {
1276
1322
  var mem;
1277
1323
  var prefixedEvents = eventPrefixed(eventNames, prefixes);
1278
1324
  return function (element, listener, cancelSignal) {
1279
- if (cancelSignal.isCancelled) {
1325
+ if (cancelSignal.isCancelled()) {
1280
1326
  return;
1281
1327
  }
1282
1328
  // if the element is a HTMLElement we can detect
@@ -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).
@@ -4147,7 +4209,7 @@ function _attachMediaKeys() {
4147
4209
  _context.next = 5;
4148
4210
  return closeAllSessions;
4149
4211
  case 5:
4150
- if (!cancelSignal.isCancelled) {
4212
+ if (!cancelSignal.isCancelled()) {
4151
4213
  _context.next = 7;
4152
4214
  break;
4153
4215
  }
@@ -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.
@@ -5311,7 +5370,7 @@ function closeSession(session) {
5311
5370
  case 5:
5312
5371
  _context2.prev = 5;
5313
5372
  _context2.t0 = _context2["catch"](0);
5314
- if (!timeoutCanceller.isUsed) {
5373
+ if (!timeoutCanceller.isUsed()) {
5315
5374
  _context2.next = 9;
5316
5375
  break;
5317
5376
  }
@@ -5326,7 +5385,7 @@ function closeSession(session) {
5326
5385
  _context2.next = 13;
5327
5386
  return (0,cancellable_sleep/* default */.Z)(1000, timeoutCanceller.signal);
5328
5387
  case 13:
5329
- if (!timeoutCanceller.isUsed) {
5388
+ if (!timeoutCanceller.isUsed()) {
5330
5389
  _context2.next = 15;
5331
5390
  break;
5332
5391
  }
@@ -7182,6 +7241,7 @@ var assert_unreachable = __webpack_require__(7904);
7182
7241
 
7183
7242
 
7184
7243
 
7244
+
7185
7245
  /**
7186
7246
  * Error thrown when the MediaKeySession has to be closed due to a trigger
7187
7247
  * specified by user configuration.
@@ -7244,6 +7304,9 @@ function checkKeyStatuses(session, options, keySystem) {
7244
7304
  keyId: keyId.buffer,
7245
7305
  keyStatus: keyStatus
7246
7306
  };
7307
+ if (log/* default.hasLevel */.Z.hasLevel("DEBUG")) {
7308
+ log/* default.debug */.Z.debug("DRM: key status update (" + (0,string_parsing/* bytesToHex */.ci)(keyId) + "): " + keyStatus);
7309
+ }
7247
7310
  switch (keyStatus) {
7248
7311
  case KEY_STATUSES.EXPIRED:
7249
7312
  {
@@ -7358,14 +7421,13 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7358
7421
  var _keySystemOptions$get = keySystemOptions.getLicenseConfig,
7359
7422
  getLicenseConfig = _keySystemOptions$get === void 0 ? {} : _keySystemOptions$get;
7360
7423
  /** Allows to manually cancel everything the `SessionEventsListener` is doing. */
7361
- var manualCanceller = new task_canceller/* default */.ZP({
7362
- cancelOn: cancelSignal
7363
- });
7424
+ var manualCanceller = new task_canceller/* default */.ZP();
7425
+ manualCanceller.linkToSignal(cancelSignal);
7364
7426
  if (!(0,is_null_or_undefined/* default */.Z)(session.closed)) {
7365
7427
  session.closed.then(function () {
7366
7428
  return manualCanceller.cancel();
7367
7429
  })["catch"](function (err) {
7368
- if (cancelSignal.isCancelled) {
7430
+ if (cancelSignal.isCancelled()) {
7369
7431
  return;
7370
7432
  }
7371
7433
  manualCanceller.cancel();
@@ -7378,7 +7440,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7378
7440
  }, manualCanceller.signal);
7379
7441
  onKeyStatusesChange(session, function (keyStatusesEvent) {
7380
7442
  handleKeyStatusesChangeEvent(keyStatusesEvent)["catch"](function (error) {
7381
- if (cancelSignal.isCancelled || manualCanceller.isUsed && error instanceof task_canceller/* CancellationSignal */.XG) {
7443
+ if (cancelSignal.isCancelled() || manualCanceller.isUsed() && error instanceof task_canceller/* CancellationSignal */.XG) {
7382
7444
  return;
7383
7445
  }
7384
7446
  manualCanceller.cancel();
@@ -7394,7 +7456,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7394
7456
  retryPromiseWithBackoff(function () {
7395
7457
  return runGetLicense(message, messageType);
7396
7458
  }, backoffOptions, manualCanceller.signal).then(function (licenseObject) {
7397
- if (manualCanceller.isUsed) {
7459
+ if (manualCanceller.isUsed()) {
7398
7460
  return Promise.resolve();
7399
7461
  }
7400
7462
  if ((0,is_null_or_undefined/* default */.Z)(licenseObject)) {
@@ -7403,7 +7465,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7403
7465
  return updateSessionWithMessage(session, licenseObject);
7404
7466
  }
7405
7467
  })["catch"](function (err) {
7406
- if (manualCanceller.isUsed) {
7468
+ if (manualCanceller.isUsed()) {
7407
7469
  return;
7408
7470
  }
7409
7471
  manualCanceller.cancel();
@@ -7419,6 +7481,8 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7419
7481
  callbacks.onError(formattedError);
7420
7482
  });
7421
7483
  }, manualCanceller.signal);
7484
+ checkAndHandleCurrentKeyStatuses();
7485
+ return;
7422
7486
  /**
7423
7487
  * @param {Event} keyStatusesEvent
7424
7488
  * @returns {Promise}
@@ -7426,32 +7490,19 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7426
7490
  function handleKeyStatusesChangeEvent(_x) {
7427
7491
  return _handleKeyStatusesChangeEvent.apply(this, arguments);
7428
7492
  }
7493
+ /**
7494
+ * Check current MediaKeyStatus for each key in the given MediaKeySession and:
7495
+ * - throw if at least one status is a non-recoverable error
7496
+ * - call warning callback for recoverable errors
7497
+ * - call onKeyUpdate callback when the MediaKeyStatus of any key is updated
7498
+ */
7429
7499
  function _handleKeyStatusesChangeEvent() {
7430
7500
  _handleKeyStatusesChangeEvent = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(keyStatusesEvent) {
7431
- var runOnKeyStatusesChangeCallback, _runOnKeyStatusesChangeCallback, handleKeyStatusEvent;
7501
+ var runOnKeyStatusesChangeCallback, _runOnKeyStatusesChangeCallback;
7432
7502
  return regenerator_default().wrap(function _callee2$(_context2) {
7433
7503
  while (1) {
7434
7504
  switch (_context2.prev = _context2.next) {
7435
7505
  case 0:
7436
- handleKeyStatusEvent = function _handleKeyStatusEvent() {
7437
- if (manualCanceller.isUsed || session.keyStatuses.size === 0) {
7438
- return;
7439
- }
7440
- var _checkKeyStatuses = checkKeyStatuses(session, keySystemOptions, keySystem),
7441
- warning = _checkKeyStatuses.warning,
7442
- blacklistedKeyIds = _checkKeyStatuses.blacklistedKeyIds,
7443
- whitelistedKeyIds = _checkKeyStatuses.whitelistedKeyIds;
7444
- if (warning !== undefined) {
7445
- callbacks.onWarning(warning);
7446
- if (manualCanceller.isUsed) {
7447
- return;
7448
- }
7449
- }
7450
- callbacks.onKeyUpdate({
7451
- whitelistedKeyIds: whitelistedKeyIds,
7452
- blacklistedKeyIds: blacklistedKeyIds
7453
- });
7454
- };
7455
7506
  _runOnKeyStatusesChangeCallback = function _runOnKeyStatusesChan2() {
7456
7507
  _runOnKeyStatusesChangeCallback = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
7457
7508
  var ret, err;
@@ -7459,7 +7510,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7459
7510
  while (1) {
7460
7511
  switch (_context.prev = _context.next) {
7461
7512
  case 0:
7462
- if (!manualCanceller.isUsed) {
7513
+ if (!manualCanceller.isUsed()) {
7463
7514
  _context.next = 2;
7464
7515
  break;
7465
7516
  }
@@ -7474,7 +7525,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7474
7525
  return keySystemOptions.onKeyStatusesChange(keyStatusesEvent, session);
7475
7526
  case 6:
7476
7527
  ret = _context.sent;
7477
- if (!manualCanceller.isUsed) {
7528
+ if (!manualCanceller.isUsed()) {
7478
7529
  _context.next = 9;
7479
7530
  break;
7480
7531
  }
@@ -7485,7 +7536,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7485
7536
  case 11:
7486
7537
  _context.prev = 11;
7487
7538
  _context.t0 = _context["catch"](3);
7488
- if (!cancelSignal.isCancelled) {
7539
+ if (!cancelSignal.isCancelled()) {
7489
7540
  _context.next = 15;
7490
7541
  break;
7491
7542
  }
@@ -7520,9 +7571,9 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7520
7571
  return _runOnKeyStatusesChangeCallback.apply(this, arguments);
7521
7572
  };
7522
7573
  log/* default.info */.Z.info("DRM: keystatuseschange event received", session.sessionId);
7523
- _context2.next = 6;
7524
- return Promise.all([runOnKeyStatusesChangeCallback(), Promise.resolve(handleKeyStatusEvent())]);
7525
- case 6:
7574
+ _context2.next = 5;
7575
+ return Promise.all([runOnKeyStatusesChangeCallback(), Promise.resolve(checkAndHandleCurrentKeyStatuses())]);
7576
+ case 5:
7526
7577
  case "end":
7527
7578
  return _context2.stop();
7528
7579
  }
@@ -7531,33 +7582,52 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
7531
7582
  }));
7532
7583
  return _handleKeyStatusesChangeEvent.apply(this, arguments);
7533
7584
  }
7585
+ function checkAndHandleCurrentKeyStatuses() {
7586
+ if (manualCanceller.isUsed() || session.keyStatuses.size === 0) {
7587
+ return;
7588
+ }
7589
+ var _checkKeyStatuses = checkKeyStatuses(session, keySystemOptions, keySystem),
7590
+ warning = _checkKeyStatuses.warning,
7591
+ blacklistedKeyIds = _checkKeyStatuses.blacklistedKeyIds,
7592
+ whitelistedKeyIds = _checkKeyStatuses.whitelistedKeyIds;
7593
+ if (warning !== undefined) {
7594
+ callbacks.onWarning(warning);
7595
+ if (manualCanceller.isUsed()) {
7596
+ return;
7597
+ }
7598
+ }
7599
+ callbacks.onKeyUpdate({
7600
+ whitelistedKeyIds: whitelistedKeyIds,
7601
+ blacklistedKeyIds: blacklistedKeyIds
7602
+ });
7603
+ }
7534
7604
  function runGetLicense(message, messageType) {
7605
+ var timeoutId;
7535
7606
  return new Promise(function (res, rej) {
7536
- log/* default.debug */.Z.debug("DRM: Calling `getLicense`", messageType);
7537
- var getLicense = keySystemOptions.getLicense(message, messageType);
7538
- var getLicenseTimeout = (0,is_null_or_undefined/* default */.Z)(getLicenseConfig.timeout) ? 10 * 1000 : getLicenseConfig.timeout;
7539
- var timeoutId;
7540
- if (getLicenseTimeout >= 0) {
7541
- timeoutId = setTimeout(function () {
7542
- rej(new GetLicenseTimeoutError("\"getLicense\" timeout exceeded (" + getLicenseTimeout + " ms)"));
7543
- }, getLicenseTimeout);
7544
- }
7545
7607
  try {
7546
- Promise.resolve(getLicense).then(function (val) {
7547
- clearTimeoutIfOne();
7548
- res(val);
7549
- }, function (err) {
7550
- clearTimeoutIfOne();
7551
- rej(err);
7552
- });
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);
7553
7617
  } catch (err) {
7554
- clearTimeoutIfOne();
7555
- rej(err);
7618
+ clearTimeoutAndReject(err);
7556
7619
  }
7557
- function clearTimeoutIfOne() {
7620
+ function clearTimeoutAndResolve(data) {
7558
7621
  if (timeoutId !== undefined) {
7559
7622
  clearTimeout(timeoutId);
7560
7623
  }
7624
+ res(data);
7625
+ }
7626
+ function clearTimeoutAndReject(err) {
7627
+ if (timeoutId !== undefined) {
7628
+ clearTimeout(timeoutId);
7629
+ }
7630
+ rej(err);
7561
7631
  }
7562
7632
  });
7563
7633
  }
@@ -8630,7 +8700,7 @@ var ContentDecryptor = /*#__PURE__*/function (_EventEmitter) {
8630
8700
  * formatted and sent in an "error" event.
8631
8701
  */;
8632
8702
  _proto._onFatalError = function _onFatalError(err) {
8633
- if (this._canceller.isUsed) {
8703
+ if (this._canceller.isUsed()) {
8634
8704
  return;
8635
8705
  }
8636
8706
  var formattedErr = err instanceof Error ? err : new other_error/* default */.Z("NONE", "Unknown decryption error");
@@ -9270,7 +9340,7 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
9270
9340
  clearSignal: cancelSignal
9271
9341
  });
9272
9342
  })["catch"](function (err) {
9273
- if (!cancelSignal.isCancelled) {
9343
+ if (!cancelSignal.isCancelled()) {
9274
9344
  _this3._onFatalError(err);
9275
9345
  }
9276
9346
  });
@@ -9443,9 +9513,8 @@ var task_canceller = __webpack_require__(288);
9443
9513
  * @returns {Object}
9444
9514
  */
9445
9515
  function getLoadedReference(playbackObserver, mediaElement, isDirectfile, cancelSignal) {
9446
- var listenCanceller = new task_canceller/* default */.ZP({
9447
- cancelOn: cancelSignal
9448
- });
9516
+ var listenCanceller = new task_canceller/* default */.ZP();
9517
+ listenCanceller.linkToSignal(cancelSignal);
9449
9518
  var isLoaded = (0,reference/* default */.ZP)(false, listenCanceller.signal);
9450
9519
  playbackObserver.listen(function (observation) {
9451
9520
  if (observation.rebuffering !== null || observation.freezing !== null || observation.readyState === 0) {
@@ -9530,7 +9599,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
9530
9599
  if (mediaElement.readyState >= _compat_browser_compatibility_types__WEBPACK_IMPORTED_MODULE_1__/* .READY_STATES.HAVE_METADATA */ .c.HAVE_METADATA) {
9531
9600
  onLoadedMetadata();
9532
9601
  }
9533
- cancelSignal.register(function (err) {
9602
+ var deregisterCancellation = cancelSignal.register(function (err) {
9534
9603
  mediaElement.removeEventListener("loadedmetadata", onLoadedMetadata);
9535
9604
  rejectAutoPlay(err);
9536
9605
  });
@@ -9550,7 +9619,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
9550
9619
  var error = new _errors__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z("MEDIA_ERR_NOT_LOADED_METADATA", "Cannot load automatically: your browser " + "falsely announced having loaded the content.");
9551
9620
  onWarning(error);
9552
9621
  }
9553
- if (cancelSignal.isCancelled) {
9622
+ if (cancelSignal.isCancelled()) {
9554
9623
  return;
9555
9624
  }
9556
9625
  playbackObserver.listen(function (observation, stopListening) {
@@ -9572,6 +9641,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
9572
9641
  }
9573
9642
  initialPlayPerformed.setValue(true);
9574
9643
  initialPlayPerformed.finish();
9644
+ deregisterCancellation();
9575
9645
  return resolveAutoPlay({
9576
9646
  type: "skipped"
9577
9647
  });
@@ -9580,19 +9650,22 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
9580
9650
  try {
9581
9651
  playResult = (_a = mediaElement.play()) !== null && _a !== void 0 ? _a : Promise.resolve();
9582
9652
  } catch (playError) {
9653
+ deregisterCancellation();
9583
9654
  return rejectAutoPlay(playError);
9584
9655
  }
9585
9656
  playResult.then(function () {
9586
- if (cancelSignal.isCancelled) {
9657
+ if (cancelSignal.isCancelled()) {
9587
9658
  return;
9588
9659
  }
9589
9660
  initialPlayPerformed.setValue(true);
9590
9661
  initialPlayPerformed.finish();
9662
+ deregisterCancellation();
9591
9663
  return resolveAutoPlay({
9592
9664
  type: "autoplay"
9593
9665
  });
9594
9666
  })["catch"](function (playError) {
9595
- if (cancelSignal.isCancelled) {
9667
+ deregisterCancellation();
9668
+ if (cancelSignal.isCancelled()) {
9596
9669
  return;
9597
9670
  }
9598
9671
  if (playError instanceof Error && playError.name === "NotAllowedError") {
@@ -9600,7 +9673,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
9600
9673
  _log__WEBPACK_IMPORTED_MODULE_2__/* ["default"].warn */ .Z.warn("Init: Media element can't play." + " It may be due to browser auto-play policies.");
9601
9674
  var error = new _errors__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z("MEDIA_ERR_BLOCKED_AUTOPLAY", "Cannot trigger auto-play automatically: " + "your browser does not allow it.");
9602
9675
  onWarning(error);
9603
- if (cancelSignal.isCancelled) {
9676
+ if (cancelSignal.isCancelled()) {
9604
9677
  return;
9605
9678
  }
9606
9679
  return resolveAutoPlay({
@@ -9740,9 +9813,8 @@ function initializeContentDecryption(mediaElement, keySystems, protectionRef, ca
9740
9813
  _ref.finish(); // We know that no new value will be triggered
9741
9814
  return _ref;
9742
9815
  }
9743
- var decryptorCanceller = new task_canceller/* default */.ZP({
9744
- cancelOn: cancelSignal
9745
- });
9816
+ var decryptorCanceller = new task_canceller/* default */.ZP();
9817
+ decryptorCanceller.linkToSignal(cancelSignal);
9746
9818
  var drmStatusRef = (0,reference/* default */.ZP)({
9747
9819
  initializationState: {
9748
9820
  type: "uninitialized",
@@ -9955,7 +10027,7 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
9955
10027
  this._canceller.signal.register(function () {
9956
10028
  playbackRateUpdater.dispose();
9957
10029
  });
9958
- var prevFreezingState;
10030
+ var prevFreezingState = null;
9959
10031
  this._playbackObserver.listen(function (observation) {
9960
10032
  var _a;
9961
10033
  var discontinuitiesStore = _this2._discontinuitiesStore;
@@ -10356,7 +10428,7 @@ var PlaybackRateUpdater = /*#__PURE__*/function () {
10356
10428
  * @param {Object} cancelSignal
10357
10429
  */
10358
10430
  function listenToMediaError(mediaElement, onError, cancelSignal) {
10359
- if (cancelSignal.isCancelled) {
10431
+ if (cancelSignal.isCancelled()) {
10360
10432
  return;
10361
10433
  }
10362
10434
  mediaElement.addEventListener("error", onMediaError);
@@ -11485,9 +11557,8 @@ var HTMLTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
11485
11557
  return cue.resolution !== null;
11486
11558
  });
11487
11559
  if (proportionalCues.length > 0) {
11488
- this._sizeUpdateCanceller = new task_canceller/* default */.ZP({
11489
- cancelOn: this._canceller.signal
11490
- });
11560
+ this._sizeUpdateCanceller = new task_canceller/* default */.ZP();
11561
+ this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);
11491
11562
  var _config$getCurrent = config/* default.getCurrent */.Z.getCurrent(),
11492
11563
  TEXT_TRACK_SIZE_CHECKS_INTERVAL = _config$getCurrent.TEXT_TRACK_SIZE_CHECKS_INTERVAL;
11493
11564
  // update propertionally-sized elements periodically
@@ -11519,9 +11590,8 @@ var HTMLTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
11519
11590
  MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL = _config$getCurrent2.MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;
11520
11591
  var startAutoRefresh = function startAutoRefresh() {
11521
11592
  stopAutoRefresh();
11522
- autoRefreshCanceller = new task_canceller/* default */.ZP({
11523
- cancelOn: cancellationSignal
11524
- });
11593
+ autoRefreshCanceller = new task_canceller/* default */.ZP();
11594
+ autoRefreshCanceller.linkToSignal(cancellationSignal);
11525
11595
  var intervalId = setInterval(function () {
11526
11596
  return _this2.refreshSubtitles();
11527
11597
  }, MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL);
@@ -13805,6 +13875,7 @@ var features = {
13805
13875
  wasm: null,
13806
13876
  js: null
13807
13877
  },
13878
+ createDebugElement: null,
13808
13879
  directfile: null,
13809
13880
  ContentDecryptor: null,
13810
13881
  htmlTextTracksBuffer: null,
@@ -13985,6 +14056,8 @@ __webpack_require__.d(__webpack_exports__, {
13985
14056
  "Z": function() { return /* binding */ Adaptation; }
13986
14057
  });
13987
14058
 
14059
+ // EXTERNAL MODULE: ./src/log.ts + 1 modules
14060
+ var log = __webpack_require__(3887);
13988
14061
  // EXTERNAL MODULE: ./src/utils/array_find.ts
13989
14062
  var array_find = __webpack_require__(3274);
13990
14063
  // EXTERNAL MODULE: ./src/utils/is_null_or_undefined.ts
@@ -14074,8 +14147,6 @@ function isCodecSupported(mimeType) {
14074
14147
  }
14075
14148
  return true;
14076
14149
  }
14077
- // EXTERNAL MODULE: ./src/log.ts + 1 modules
14078
- var log = __webpack_require__(3887);
14079
14150
  // EXTERNAL MODULE: ./src/utils/are_arrays_of_numbers_equal.ts
14080
14151
  var are_arrays_of_numbers_equal = __webpack_require__(4791);
14081
14152
  ;// CONCATENATED MODULE: ./src/manifest/representation.ts
@@ -14132,7 +14203,16 @@ var Representation = /*#__PURE__*/function () {
14132
14203
  }
14133
14204
  this.cdnMetadata = args.cdnMetadata;
14134
14205
  this.index = args.index;
14135
- this.isSupported = opts.type === "audio" || opts.type === "video" ? isCodecSupported(this.getMimeTypeString()) : true; // TODO for other types
14206
+ if (opts.type === "audio" || opts.type === "video") {
14207
+ var mimeTypeStr = this.getMimeTypeString();
14208
+ var isSupported = isCodecSupported(mimeTypeStr);
14209
+ if (!isSupported) {
14210
+ log/* default.info */.Z.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
14211
+ }
14212
+ this.isSupported = isSupported;
14213
+ } else {
14214
+ this.isSupported = true; // TODO for other types
14215
+ }
14136
14216
  }
14137
14217
  /**
14138
14218
  * Returns "mime-type string" which includes both the mime-type and the codec,
@@ -14344,6 +14424,7 @@ var Representation = /*#__PURE__*/function () {
14344
14424
 
14345
14425
 
14346
14426
 
14427
+
14347
14428
  /** List in an array every possible value for the Adaptation's `type` property. */
14348
14429
  var SUPPORTED_ADAPTATIONS_TYPE = ["audio", "video", "text", "image"];
14349
14430
  /**
@@ -14421,6 +14502,8 @@ var Adaptation = /*#__PURE__*/function () {
14421
14502
  if (!isSupported && representation.isSupported) {
14422
14503
  isSupported = true;
14423
14504
  }
14505
+ } else {
14506
+ log/* default.debug */.Z.debug("Filtering Representation due to representationFilter", this.type, "Adaptation: " + this.id, "Representation: " + representation.id, "(" + representation.bitrate + ")");
14424
14507
  }
14425
14508
  }
14426
14509
  representations.sort(function (a, b) {
@@ -14489,6 +14572,8 @@ __webpack_require__.d(__webpack_exports__, {
14489
14572
  var inheritsLoose = __webpack_require__(4578);
14490
14573
  // EXTERNAL MODULE: ./src/errors/media_error.ts
14491
14574
  var media_error = __webpack_require__(3714);
14575
+ // EXTERNAL MODULE: ./src/log.ts + 1 modules
14576
+ var log = __webpack_require__(3887);
14492
14577
  // EXTERNAL MODULE: ./src/utils/array_find.ts
14493
14578
  var array_find = __webpack_require__(3274);
14494
14579
  // EXTERNAL MODULE: ./src/utils/event_emitter.ts
@@ -14641,8 +14726,6 @@ var Period = /*#__PURE__*/function () {
14641
14726
  return Period;
14642
14727
  }();
14643
14728
 
14644
- // EXTERNAL MODULE: ./src/log.ts + 1 modules
14645
- var log = __webpack_require__(3887);
14646
14729
  ;// CONCATENATED MODULE: ./src/manifest/representation_index/static.ts
14647
14730
  /**
14648
14731
  * Copyright 2015 CANAL+ Group
@@ -15142,6 +15225,7 @@ function manifest_arrayLikeToArray(arr, len) { if (len == null || len > arr.leng
15142
15225
 
15143
15226
 
15144
15227
 
15228
+
15145
15229
  var generateSupplementaryTrackID = (0,id_generator/* default */.Z)();
15146
15230
  var generateNewManifestId = (0,id_generator/* default */.Z)();
15147
15231
  /**
@@ -15588,6 +15672,7 @@ function updateDeciperability(manifest, isDecipherable) {
15588
15672
  adaptation: adaptation,
15589
15673
  representation: representation
15590
15674
  });
15675
+ log/* default.debug */.Z.debug("Decipherability changed for \"" + representation.id + "\"", "(" + representation.bitrate + ")", String(representation.decipherable));
15591
15676
  representation.decipherable = result;
15592
15677
  }
15593
15678
  }
@@ -19941,12 +20026,11 @@ function combineInbandEventStreams(representation, adaptation) {
19941
20026
  */
19942
20027
  function getHDRInformation(_ref) {
19943
20028
  var adaptationProfiles = _ref.adaptationProfiles,
20029
+ essentialProperties = _ref.essentialProperties,
20030
+ supplementalProperties = _ref.supplementalProperties,
19944
20031
  manifestProfiles = _ref.manifestProfiles,
19945
20032
  codecs = _ref.codecs;
19946
20033
  var profiles = (adaptationProfiles !== null && adaptationProfiles !== void 0 ? adaptationProfiles : "") + (manifestProfiles !== null && manifestProfiles !== void 0 ? manifestProfiles : "");
19947
- if (codecs === undefined) {
19948
- return undefined;
19949
- }
19950
20034
  if (profiles.indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10") !== -1) {
19951
20035
  if (codecs === "hvc1.2.4.L153.B0" || codecs === "hev1.2.4.L153.B0") {
19952
20036
  return {
@@ -19956,7 +20040,25 @@ function getHDRInformation(_ref) {
19956
20040
  };
19957
20041
  }
19958
20042
  }
19959
- if (/^vp(08|09|10)/.exec(codecs)) {
20043
+ var transferCharacteristicScheme = (0,array_find/* default */.Z)([].concat(essentialProperties !== null && essentialProperties !== void 0 ? essentialProperties : [], supplementalProperties !== null && supplementalProperties !== void 0 ? supplementalProperties : []), function (p) {
20044
+ return p.schemeIdUri === "urn:mpeg:mpegB:cicp:TransferCharacteristics";
20045
+ });
20046
+ if (transferCharacteristicScheme !== undefined) {
20047
+ switch (transferCharacteristicScheme.value) {
20048
+ case "15":
20049
+ return undefined;
20050
+ // SDR
20051
+ case "16":
20052
+ return {
20053
+ eotf: "pq"
20054
+ };
20055
+ case "18":
20056
+ return {
20057
+ eotf: "hlg"
20058
+ };
20059
+ }
20060
+ }
20061
+ if (codecs !== undefined && /^vp(08|09|10)/.exec(codecs)) {
19960
20062
  return getWEBMHDRInformation(codecs);
19961
20063
  }
19962
20064
  }
@@ -20110,6 +20212,8 @@ function parseRepresentations(representationsIR, adaptation, context) {
20110
20212
  }
20111
20213
  parsedRepresentation.hdrInfo = getHDRInformation({
20112
20214
  adaptationProfiles: adaptation.attributes.profiles,
20215
+ supplementalProperties: adaptation.children.supplementalProperties,
20216
+ essentialProperties: adaptation.children.essentialProperties,
20113
20217
  manifestProfiles: context.manifestProfiles,
20114
20218
  codecs: codecs
20115
20219
  });
@@ -20285,7 +20389,7 @@ function getAdaptationSetSwitchingIDs(adaptation) {
20285
20389
  * @returns {Array.<Object>}
20286
20390
  */
20287
20391
  function parseAdaptationSets(adaptationsIR, context) {
20288
- var _a, _b, _c, _d, _e, _f, _g, _h;
20392
+ var _a, _b, _c, _d, _e, _f;
20289
20393
  var parsedAdaptations = {
20290
20394
  video: [],
20291
20395
  audio: [],
@@ -20295,14 +20399,6 @@ function parseAdaptationSets(adaptationsIR, context) {
20295
20399
  var trickModeAdaptations = [];
20296
20400
  var adaptationSwitchingInfos = {};
20297
20401
  var parsedAdaptationsIDs = [];
20298
- /**
20299
- * Index of the last parsed Video AdaptationSet with a Role set as "main" in
20300
- * `parsedAdaptations.video`.
20301
- * `-1` if not yet encountered.
20302
- * Used as we merge all main video AdaptationSet due to a comprehension of the
20303
- * DASH-IF IOP.
20304
- */
20305
- var lastMainVideoAdapIdx = -1;
20306
20402
  for (var adaptationIdx = 0; adaptationIdx < adaptationsIR.length; adaptationIdx++) {
20307
20403
  var adaptation = adaptationsIR[adaptationIdx];
20308
20404
  var adaptationChildren = adaptation.children;
@@ -20325,7 +20421,6 @@ function parseAdaptationSets(adaptationsIR, context) {
20325
20421
  }
20326
20422
  var priority = (_c = adaptation.attributes.selectionPriority) !== null && _c !== void 0 ? _c : 1;
20327
20423
  var originalID = adaptation.attributes.id;
20328
- var newID = void 0;
20329
20424
  var adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
20330
20425
  var parentSegmentTemplates = [];
20331
20426
  if (context.segmentTemplate !== undefined) {
@@ -20355,133 +20450,118 @@ function parseAdaptationSets(adaptationsIR, context) {
20355
20450
  }) : undefined;
20356
20451
  var trickModeAttachedAdaptationIds = (_d = trickModeProperty === null || trickModeProperty === void 0 ? void 0 : trickModeProperty.value) === null || _d === void 0 ? void 0 : _d.split(" ");
20357
20452
  var isTrickModeTrack = trickModeAttachedAdaptationIds !== undefined;
20358
- if (type === "video" && isMainAdaptation && lastMainVideoAdapIdx >= 0 && parsedAdaptations.video.length > lastMainVideoAdapIdx && !isTrickModeTrack) {
20359
- var _videoMainAdaptation$;
20360
- var videoMainAdaptation = parsedAdaptations.video[lastMainVideoAdapIdx][0];
20361
- reprCtxt.unsafelyBaseOnPreviousAdaptation = (_f = (_e = context.unsafelyBaseOnPreviousPeriod) === null || _e === void 0 ? void 0 : _e.getAdaptation(videoMainAdaptation.id)) !== null && _f !== void 0 ? _f : null;
20362
- var representations = parseRepresentations(representationsIR, adaptation, reprCtxt);
20363
- (_videoMainAdaptation$ = videoMainAdaptation.representations).push.apply(_videoMainAdaptation$, representations);
20364
- newID = videoMainAdaptation.id;
20453
+ var _adaptationChildren = adaptationChildren,
20454
+ accessibilities = _adaptationChildren.accessibilities;
20455
+ var isDub = void 0;
20456
+ if (roles !== undefined && roles.some(function (role) {
20457
+ return role.value === "dub";
20458
+ })) {
20459
+ isDub = true;
20460
+ }
20461
+ var isClosedCaption = void 0;
20462
+ if (type !== "text") {
20463
+ isClosedCaption = false;
20365
20464
  } else {
20366
- var _adaptationChildren = adaptationChildren,
20367
- accessibilities = _adaptationChildren.accessibilities;
20368
- var isDub = void 0;
20369
- if (roles !== undefined && roles.some(function (role) {
20370
- return role.value === "dub";
20371
- })) {
20372
- isDub = true;
20373
- }
20374
- var isClosedCaption = void 0;
20375
- if (type !== "text") {
20376
- isClosedCaption = false;
20377
- } else {
20378
- isClosedCaption = isCaptionning(accessibilities, roles);
20379
- }
20380
- var isForcedSubtitle = void 0;
20381
- if (type === "text" && roles !== undefined && roles.some(function (role) {
20382
- return role.value === "forced-subtitle" || role.value === "forced_subtitle";
20383
- })) {
20384
- isForcedSubtitle = true;
20385
- }
20386
- var isAudioDescription = void 0;
20387
- if (type !== "audio") {
20388
- isAudioDescription = false;
20389
- } else if (accessibilities !== undefined) {
20390
- isAudioDescription = accessibilities.some(isVisuallyImpaired);
20391
- }
20392
- var isSignInterpreted = void 0;
20393
- if (type !== "video") {
20394
- isSignInterpreted = false;
20395
- } else if (accessibilities !== undefined) {
20396
- isSignInterpreted = accessibilities.some(hasSignLanguageInterpretation);
20397
- }
20398
- var adaptationID = getAdaptationID(adaptation, {
20399
- isAudioDescription: isAudioDescription,
20400
- isForcedSubtitle: isForcedSubtitle,
20401
- isClosedCaption: isClosedCaption,
20402
- isSignInterpreted: isSignInterpreted,
20403
- isTrickModeTrack: isTrickModeTrack,
20404
- type: type
20465
+ isClosedCaption = isCaptionning(accessibilities, roles);
20466
+ }
20467
+ var isForcedSubtitle = void 0;
20468
+ if (type === "text" && roles !== undefined && roles.some(function (role) {
20469
+ return role.value === "forced-subtitle" || role.value === "forced_subtitle";
20470
+ })) {
20471
+ isForcedSubtitle = true;
20472
+ }
20473
+ var isAudioDescription = void 0;
20474
+ if (type !== "audio") {
20475
+ isAudioDescription = false;
20476
+ } else if (accessibilities !== undefined) {
20477
+ isAudioDescription = accessibilities.some(isVisuallyImpaired);
20478
+ }
20479
+ var isSignInterpreted = void 0;
20480
+ if (type !== "video") {
20481
+ isSignInterpreted = false;
20482
+ } else if (accessibilities !== undefined) {
20483
+ isSignInterpreted = accessibilities.some(hasSignLanguageInterpretation);
20484
+ }
20485
+ var adaptationID = getAdaptationID(adaptation, {
20486
+ isAudioDescription: isAudioDescription,
20487
+ isForcedSubtitle: isForcedSubtitle,
20488
+ isClosedCaption: isClosedCaption,
20489
+ isSignInterpreted: isSignInterpreted,
20490
+ isTrickModeTrack: isTrickModeTrack,
20491
+ type: type
20492
+ });
20493
+ // Avoid duplicate IDs
20494
+ while ((0,array_includes/* default */.Z)(parsedAdaptationsIDs, adaptationID)) {
20495
+ adaptationID += "-dup";
20496
+ }
20497
+ var newID = adaptationID;
20498
+ parsedAdaptationsIDs.push(adaptationID);
20499
+ reprCtxt.unsafelyBaseOnPreviousAdaptation = (_f = (_e = context.unsafelyBaseOnPreviousPeriod) === null || _e === void 0 ? void 0 : _e.getAdaptation(adaptationID)) !== null && _f !== void 0 ? _f : null;
20500
+ var representations = parseRepresentations(representationsIR, adaptation, reprCtxt);
20501
+ var parsedAdaptationSet = {
20502
+ id: adaptationID,
20503
+ representations: representations,
20504
+ type: type,
20505
+ isTrickModeTrack: isTrickModeTrack
20506
+ };
20507
+ if (adaptation.attributes.language != null) {
20508
+ parsedAdaptationSet.language = adaptation.attributes.language;
20509
+ }
20510
+ if (isClosedCaption != null) {
20511
+ parsedAdaptationSet.closedCaption = isClosedCaption;
20512
+ }
20513
+ if (isAudioDescription != null) {
20514
+ parsedAdaptationSet.audioDescription = isAudioDescription;
20515
+ }
20516
+ if (isDub === true) {
20517
+ parsedAdaptationSet.isDub = true;
20518
+ }
20519
+ if (isForcedSubtitle !== undefined) {
20520
+ parsedAdaptationSet.forcedSubtitles = isForcedSubtitle;
20521
+ }
20522
+ if (isSignInterpreted === true) {
20523
+ parsedAdaptationSet.isSignInterpreted = true;
20524
+ }
20525
+ if (label !== undefined) {
20526
+ parsedAdaptationSet.label = label;
20527
+ }
20528
+ if (trickModeAttachedAdaptationIds !== undefined) {
20529
+ trickModeAdaptations.push({
20530
+ adaptation: parsedAdaptationSet,
20531
+ trickModeAttachedAdaptationIds: trickModeAttachedAdaptationIds
20405
20532
  });
20406
- // Avoid duplicate IDs
20407
- while ((0,array_includes/* default */.Z)(parsedAdaptationsIDs, adaptationID)) {
20408
- adaptationID += "-dup";
20409
- }
20410
- newID = adaptationID;
20411
- parsedAdaptationsIDs.push(adaptationID);
20412
- reprCtxt.unsafelyBaseOnPreviousAdaptation = (_h = (_g = context.unsafelyBaseOnPreviousPeriod) === null || _g === void 0 ? void 0 : _g.getAdaptation(adaptationID)) !== null && _h !== void 0 ? _h : null;
20413
- var _representations = parseRepresentations(representationsIR, adaptation, reprCtxt);
20414
- var parsedAdaptationSet = {
20415
- id: adaptationID,
20416
- representations: _representations,
20417
- type: type,
20418
- isTrickModeTrack: isTrickModeTrack
20419
- };
20420
- if (adaptation.attributes.language != null) {
20421
- parsedAdaptationSet.language = adaptation.attributes.language;
20422
- }
20423
- if (isClosedCaption != null) {
20424
- parsedAdaptationSet.closedCaption = isClosedCaption;
20425
- }
20426
- if (isAudioDescription != null) {
20427
- parsedAdaptationSet.audioDescription = isAudioDescription;
20428
- }
20429
- if (isDub === true) {
20430
- parsedAdaptationSet.isDub = true;
20431
- }
20432
- if (isForcedSubtitle !== undefined) {
20433
- parsedAdaptationSet.forcedSubtitles = isForcedSubtitle;
20434
- }
20435
- if (isSignInterpreted === true) {
20436
- parsedAdaptationSet.isSignInterpreted = true;
20437
- }
20438
- if (label !== undefined) {
20439
- parsedAdaptationSet.label = label;
20440
- }
20441
- if (trickModeAttachedAdaptationIds !== undefined) {
20442
- trickModeAdaptations.push({
20443
- adaptation: parsedAdaptationSet,
20444
- trickModeAttachedAdaptationIds: trickModeAttachedAdaptationIds
20445
- });
20446
- } else {
20447
- // look if we have to merge this into another Adaptation
20448
- var mergedIntoIdx = -1;
20449
- var _loop = function _loop() {
20450
- var id = _step2.value;
20451
- var switchingInfos = adaptationSwitchingInfos[id];
20452
- if (switchingInfos !== undefined && switchingInfos.newID !== newID && (0,array_includes/* default */.Z)(switchingInfos.adaptationSetSwitchingIDs, originalID)) {
20453
- mergedIntoIdx = (0,array_find_index/* default */.Z)(parsedAdaptations[type], function (a) {
20454
- return a[0].id === id;
20455
- });
20456
- var mergedInto = parsedAdaptations[type][mergedIntoIdx];
20457
- if (mergedInto !== undefined && mergedInto[0].audioDescription === parsedAdaptationSet.audioDescription && mergedInto[0].closedCaption === parsedAdaptationSet.closedCaption && mergedInto[0].language === parsedAdaptationSet.language) {
20458
- var _mergedInto$0$represe;
20459
- log/* default.info */.Z.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
20460
- (_mergedInto$0$represe = mergedInto[0].representations).push.apply(_mergedInto$0$represe, parsedAdaptationSet.representations);
20461
- if (type === "video" && isMainAdaptation && !mergedInto[1].isMainAdaptation) {
20462
- lastMainVideoAdapIdx = Math.max(lastMainVideoAdapIdx, mergedIntoIdx);
20463
- }
20464
- mergedInto[1] = {
20465
- priority: Math.max(priority, mergedInto[1].priority),
20466
- isMainAdaptation: isMainAdaptation || mergedInto[1].isMainAdaptation,
20467
- indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd)
20468
- };
20469
- }
20470
- }
20471
- };
20472
- for (var _iterator2 = parse_adaptation_sets_createForOfIteratorHelperLoose(adaptationSetSwitchingIDs), _step2; !(_step2 = _iterator2()).done;) {
20473
- _loop();
20474
- }
20475
- if (mergedIntoIdx < 0) {
20476
- parsedAdaptations[type].push([parsedAdaptationSet, {
20477
- priority: priority,
20478
- isMainAdaptation: isMainAdaptation,
20479
- indexInMpd: adaptationIdx
20480
- }]);
20481
- if (type === "video" && isMainAdaptation) {
20482
- lastMainVideoAdapIdx = parsedAdaptations.video.length - 1;
20533
+ } else {
20534
+ // look if we have to merge this into another Adaptation
20535
+ var mergedIntoIdx = -1;
20536
+ var _loop = function _loop() {
20537
+ var id = _step2.value;
20538
+ var switchingInfos = adaptationSwitchingInfos[id];
20539
+ if (switchingInfos !== undefined && switchingInfos.newID !== newID && (0,array_includes/* default */.Z)(switchingInfos.adaptationSetSwitchingIDs, originalID)) {
20540
+ mergedIntoIdx = (0,array_find_index/* default */.Z)(parsedAdaptations[type], function (a) {
20541
+ return a[0].id === id;
20542
+ });
20543
+ var mergedInto = parsedAdaptations[type][mergedIntoIdx];
20544
+ if (mergedInto !== undefined && mergedInto[0].audioDescription === parsedAdaptationSet.audioDescription && mergedInto[0].closedCaption === parsedAdaptationSet.closedCaption && mergedInto[0].language === parsedAdaptationSet.language) {
20545
+ var _mergedInto$0$represe;
20546
+ log/* default.info */.Z.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
20547
+ (_mergedInto$0$represe = mergedInto[0].representations).push.apply(_mergedInto$0$represe, parsedAdaptationSet.representations);
20548
+ mergedInto[1] = {
20549
+ priority: Math.max(priority, mergedInto[1].priority),
20550
+ isMainAdaptation: isMainAdaptation || mergedInto[1].isMainAdaptation,
20551
+ indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd)
20552
+ };
20483
20553
  }
20484
20554
  }
20555
+ };
20556
+ for (var _iterator2 = parse_adaptation_sets_createForOfIteratorHelperLoose(adaptationSetSwitchingIDs), _step2; !(_step2 = _iterator2()).done;) {
20557
+ _loop();
20558
+ }
20559
+ if (mergedIntoIdx < 0) {
20560
+ parsedAdaptations[type].push([parsedAdaptationSet, {
20561
+ priority: priority,
20562
+ isMainAdaptation: isMainAdaptation,
20563
+ indexInMpd: adaptationIdx
20564
+ }]);
20485
20565
  }
20486
20566
  }
20487
20567
  if (originalID != null && adaptationSwitchingInfos[originalID] == null) {
@@ -27958,7 +28038,7 @@ function generateManifestParser(options) {
27958
28038
  if (parserResponse.value.warnings.length > 0) {
27959
28039
  onWarnings(parserResponse.value.warnings);
27960
28040
  }
27961
- if (cancelSignal.isCancelled) {
28041
+ if (cancelSignal.isCancelled()) {
27962
28042
  return Promise.reject(cancelSignal.cancellationError);
27963
28043
  }
27964
28044
  var manifest = new src_manifest/* default */.ZP(parserResponse.value.parsed, options);
@@ -28387,12 +28467,9 @@ var check_isobmff_integrity = __webpack_require__(4460);
28387
28467
  function addSegmentIntegrityChecks(segmentLoader) {
28388
28468
  return function (url, content, loaderOptions, initialCancelSignal, callbacks) {
28389
28469
  return new Promise(function (resolve, reject) {
28390
- var requestCanceller = new task_canceller/* default */.ZP({
28391
- cancelOn: initialCancelSignal
28392
- });
28393
- // Reject the `CancellationError` when `requestCanceller`'s signal emits
28394
- // `stopRejectingOnCancel` here is a function allowing to stop this mechanism
28395
- var stopRejectingOnCancel = requestCanceller.signal.register(reject);
28470
+ var requestCanceller = new task_canceller/* default */.ZP();
28471
+ var unlinkCanceller = requestCanceller.linkToSignal(initialCancelSignal);
28472
+ requestCanceller.signal.register(reject);
28396
28473
  segmentLoader(url, content, loaderOptions, requestCanceller.signal, Object.assign(Object.assign({}, callbacks), {
28397
28474
  onNewChunk: function onNewChunk(data) {
28398
28475
  try {
@@ -28400,7 +28477,7 @@ function addSegmentIntegrityChecks(segmentLoader) {
28400
28477
  callbacks.onNewChunk(data);
28401
28478
  } catch (err) {
28402
28479
  // Do not reject with a `CancellationError` after cancelling the request
28403
- stopRejectingOnCancel();
28480
+ cleanUpCancellers();
28404
28481
  // Cancel the request
28405
28482
  requestCanceller.cancel();
28406
28483
  // Reject with thrown error
@@ -28408,10 +28485,10 @@ function addSegmentIntegrityChecks(segmentLoader) {
28408
28485
  }
28409
28486
  }
28410
28487
  })).then(function (info) {
28411
- if (requestCanceller.isUsed) {
28488
+ cleanUpCancellers();
28489
+ if (requestCanceller.isUsed()) {
28412
28490
  return;
28413
28491
  }
28414
- stopRejectingOnCancel();
28415
28492
  if (info.resultType === "segment-loaded") {
28416
28493
  try {
28417
28494
  trowOnIntegrityError(info.resultData.responseData);
@@ -28421,10 +28498,14 @@ function addSegmentIntegrityChecks(segmentLoader) {
28421
28498
  }
28422
28499
  }
28423
28500
  resolve(info);
28424
- }, function (error) {
28425
- stopRejectingOnCancel();
28426
- reject(error);
28501
+ }, function (err) {
28502
+ cleanUpCancellers();
28503
+ reject(err);
28427
28504
  });
28505
+ function cleanUpCancellers() {
28506
+ requestCanceller.signal.deregister(reject);
28507
+ unlinkCanceller();
28508
+ }
28428
28509
  });
28429
28510
  /**
28430
28511
  * If the data's seems to be corrupted, throws an `INTEGRITY_ERROR` error.
@@ -28669,7 +28750,7 @@ function lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal)
28669
28750
  partialChunk = res[1];
28670
28751
  for (var i = 0; i < completeChunks.length; i++) {
28671
28752
  callbacks.onNewChunk(completeChunks[i]);
28672
- if (cancelSignal.isCancelled) {
28753
+ if (cancelSignal.isCancelled()) {
28673
28754
  return;
28674
28755
  }
28675
28756
  }
@@ -28678,7 +28759,7 @@ function lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal)
28678
28759
  size: info.size,
28679
28760
  totalSize: info.totalSize
28680
28761
  });
28681
- if (cancelSignal.isCancelled) {
28762
+ if (cancelSignal.isCancelled()) {
28682
28763
  return;
28683
28764
  }
28684
28765
  }
@@ -28801,7 +28882,7 @@ function generateSegmentLoader(_ref) {
28801
28882
  * @param {Object} _args
28802
28883
  */
28803
28884
  var resolve = function resolve(_args) {
28804
- if (hasFinished || cancelSignal.isCancelled) {
28885
+ if (hasFinished || cancelSignal.isCancelled()) {
28805
28886
  return;
28806
28887
  }
28807
28888
  hasFinished = true;
@@ -28821,7 +28902,7 @@ function generateSegmentLoader(_ref) {
28821
28902
  */
28822
28903
  var reject = function reject(err) {
28823
28904
  var _a, _b, _c;
28824
- if (hasFinished || cancelSignal.isCancelled) {
28905
+ if (hasFinished || cancelSignal.isCancelled()) {
28825
28906
  return;
28826
28907
  }
28827
28908
  hasFinished = true;
@@ -28833,7 +28914,7 @@ function generateSegmentLoader(_ref) {
28833
28914
  rej(emittedErr);
28834
28915
  };
28835
28916
  var progress = function progress(_args) {
28836
- if (hasFinished || cancelSignal.isCancelled) {
28917
+ if (hasFinished || cancelSignal.isCancelled()) {
28837
28918
  return;
28838
28919
  }
28839
28920
  callbacks.onProgress({
@@ -28847,7 +28928,7 @@ function generateSegmentLoader(_ref) {
28847
28928
  * the "regular" implementation
28848
28929
  */
28849
28930
  var fallback = function fallback() {
28850
- if (hasFinished || cancelSignal.isCancelled) {
28931
+ if (hasFinished || cancelSignal.isCancelled()) {
28851
28932
  return;
28852
28933
  }
28853
28934
  hasFinished = true;
@@ -32700,7 +32781,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
32700
32781
  * @param {Object} args
32701
32782
  */
32702
32783
  var resolve = function resolve(_args) {
32703
- if (hasFinished || cancelSignal.isCancelled) {
32784
+ if (hasFinished || cancelSignal.isCancelled()) {
32704
32785
  return;
32705
32786
  }
32706
32787
  hasFinished = true;
@@ -32733,7 +32814,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
32733
32814
  */
32734
32815
  var reject = function reject(err) {
32735
32816
  var _a, _b, _c;
32736
- if (hasFinished || cancelSignal.isCancelled) {
32817
+ if (hasFinished || cancelSignal.isCancelled()) {
32737
32818
  return;
32738
32819
  }
32739
32820
  hasFinished = true;
@@ -32745,7 +32826,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
32745
32826
  rej(emittedErr);
32746
32827
  };
32747
32828
  var progress = function progress(_args) {
32748
- if (hasFinished || cancelSignal.isCancelled) {
32829
+ if (hasFinished || cancelSignal.isCancelled()) {
32749
32830
  return;
32750
32831
  }
32751
32832
  callbacks.onProgress({
@@ -32755,7 +32836,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
32755
32836
  });
32756
32837
  };
32757
32838
  var fallback = function fallback() {
32758
- if (hasFinished || cancelSignal.isCancelled) {
32839
+ if (hasFinished || cancelSignal.isCancelled()) {
32759
32840
  return;
32760
32841
  }
32761
32842
  hasFinished = true;
@@ -33478,7 +33559,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
33478
33559
  * @param {Object} args
33479
33560
  */
33480
33561
  var resolve = function resolve(_args) {
33481
- if (hasFinished || cancelSignal.isCancelled) {
33562
+ if (hasFinished || cancelSignal.isCancelled()) {
33482
33563
  return;
33483
33564
  }
33484
33565
  hasFinished = true;
@@ -33500,7 +33581,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
33500
33581
  */
33501
33582
  var reject = function reject(err) {
33502
33583
  var _a, _b, _c;
33503
- if (hasFinished || cancelSignal.isCancelled) {
33584
+ if (hasFinished || cancelSignal.isCancelled()) {
33504
33585
  return;
33505
33586
  }
33506
33587
  hasFinished = true;
@@ -33516,7 +33597,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
33516
33597
  * the "regular" implementation
33517
33598
  */
33518
33599
  var fallback = function fallback() {
33519
- if (hasFinished || cancelSignal.isCancelled) {
33600
+ if (hasFinished || cancelSignal.isCancelled()) {
33520
33601
  return;
33521
33602
  }
33522
33603
  hasFinished = true;
@@ -34368,6 +34449,7 @@ function toUint8Array(input) {
34368
34449
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34369
34450
  /* harmony export */ "Z": function() { return /* binding */ cancellableSleep; }
34370
34451
  /* harmony export */ });
34452
+ /* harmony import */ var _create_cancellable_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7733);
34371
34453
  /**
34372
34454
  * Copyright 2015 CANAL+ Group
34373
34455
  *
@@ -34383,6 +34465,7 @@ function toUint8Array(input) {
34383
34465
  * See the License for the specific language governing permissions and
34384
34466
  * limitations under the License.
34385
34467
  */
34468
+
34386
34469
  /**
34387
34470
  * Wait the given `delay`, resolving the Promise when finished.
34388
34471
  *
@@ -34397,15 +34480,75 @@ function toUint8Array(input) {
34397
34480
  * cancellation with the corresponding `CancellationError`.
34398
34481
  */
34399
34482
  function cancellableSleep(delay, cancellationSignal) {
34400
- return new Promise(function (res, rej) {
34483
+ return (0,_create_cancellable_promise__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(cancellationSignal, function (res) {
34401
34484
  var timeout = setTimeout(function () {
34402
- unregisterCancelSignal();
34403
- res();
34485
+ return res();
34404
34486
  }, delay);
34405
- var unregisterCancelSignal = cancellationSignal.register(function onCancel(cancellationError) {
34406
- clearTimeout(timeout);
34407
- rej(cancellationError);
34487
+ return function () {
34488
+ return clearTimeout(timeout);
34489
+ };
34490
+ });
34491
+ }
34492
+
34493
+ /***/ }),
34494
+
34495
+ /***/ 7733:
34496
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
34497
+
34498
+ "use strict";
34499
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34500
+ /* harmony export */ "Z": function() { return /* binding */ createCancellablePromise; }
34501
+ /* harmony export */ });
34502
+ /**
34503
+ * Returns a Promise linked to a `CancellationSignal`, which will reject the
34504
+ * corresponding `CancellationError` if that signal emits before the wanted
34505
+ * task finishes (either on success or on error).
34506
+ *
34507
+ * The given callback mimicks the Promise interface with the added possibility
34508
+ * of returning a callback which will be called when and if the task is
34509
+ * cancelled before being either resolved or rejected.
34510
+ * In that case, that logic will be called just before the Promise is rejected
34511
+ * with the corresponding `CancellationError`.
34512
+ * The point of this callback is to implement aborting logic, such as for
34513
+ * example aborting a request.
34514
+ *
34515
+ * @param {Object} cancellationSignal - The `CancellationSignal` the returned
34516
+ * Promise will be linked to.
34517
+ * @param {Function} cb - The function implementing the cancellable Promise. Its
34518
+ * arguments follow Promise's semantics but it can also return a function which
34519
+ * will be called when and if `cancellationSignal` emits before either arguments
34520
+ * are called.
34521
+ * @returns {Promise} - The created Promise, which will resolve when and if the
34522
+ * first argument to `cb` is called first and reject either if the second
34523
+ * argument to `cb` is called first or if the given `CancellationSignal` emits
34524
+ * before either of the two previous conditions.
34525
+ */
34526
+ function createCancellablePromise(cancellationSignal, cb) {
34527
+ var abortingLogic;
34528
+ return new Promise(function (res, rej) {
34529
+ if (cancellationSignal.cancellationError !== null) {
34530
+ // If the signal was already triggered before, do not even call `cb`
34531
+ return rej(cancellationSignal.cancellationError);
34532
+ }
34533
+ var hasUnregistered = false;
34534
+ abortingLogic = cb(function onCancellablePromiseSuccess(val) {
34535
+ cancellationSignal.deregister(onCancellablePromiseCancellation);
34536
+ hasUnregistered = true;
34537
+ res(val);
34538
+ }, function onCancellablePromiseFailure(err) {
34539
+ cancellationSignal.deregister(onCancellablePromiseCancellation);
34540
+ hasUnregistered = true;
34541
+ rej(err);
34408
34542
  });
34543
+ if (!hasUnregistered) {
34544
+ cancellationSignal.register(onCancellablePromiseCancellation);
34545
+ }
34546
+ function onCancellablePromiseCancellation(error) {
34547
+ if (abortingLogic !== undefined) {
34548
+ abortingLogic();
34549
+ }
34550
+ rej(error);
34551
+ }
34409
34552
  });
34410
34553
  }
34411
34554
 
@@ -35908,6 +36051,9 @@ function createSharedReference(initialValue, cancelSignal) {
35908
36051
  }
35909
36052
  options.clearSignal.register(unlisten);
35910
36053
  function unlisten() {
36054
+ if ((options === null || options === void 0 ? void 0 : options.clearSignal) !== undefined) {
36055
+ options.clearSignal.deregister(unlisten);
36056
+ }
35911
36057
  if (cbObj.hasBeenCleared) {
35912
36058
  return;
35913
36059
  }
@@ -35950,6 +36096,9 @@ function createSharedReference(initialValue, cancelSignal) {
35950
36096
  finish: finish
35951
36097
  };
35952
36098
  function finish() {
36099
+ if (cancelSignal !== undefined) {
36100
+ cancelSignal.deregister(finish);
36101
+ }
35953
36102
  isFinished = true;
35954
36103
  var clonedCbs = cbs.slice();
35955
36104
  for (var _iterator2 = _createForOfIteratorHelperLoose(clonedCbs), _step2; !(_step2 = _iterator2()).done;) {
@@ -36083,7 +36232,7 @@ function request(options) {
36083
36232
  }
36084
36233
  reject(err);
36085
36234
  });
36086
- if (cancelSignal.isCancelled) {
36235
+ if (cancelSignal.isCancelled()) {
36087
36236
  return;
36088
36237
  }
36089
36238
  }
@@ -36785,11 +36934,12 @@ function takeFirstSet() {
36785
36934
  /* harmony export */ "XG": function() { return /* binding */ CancellationSignal; },
36786
36935
  /* harmony export */ "ZP": function() { return /* binding */ TaskCanceller; }
36787
36936
  /* harmony export */ });
36788
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7326);
36789
- /* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4578);
36790
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2146);
36791
- /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(811);
36792
- /* harmony import */ var _noop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8894);
36937
+ /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7326);
36938
+ /* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4578);
36939
+ /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2146);
36940
+ /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3887);
36941
+ /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(811);
36942
+ /* harmony import */ var _noop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8894);
36793
36943
 
36794
36944
 
36795
36945
 
@@ -36810,6 +36960,7 @@ function takeFirstSet() {
36810
36960
  */
36811
36961
 
36812
36962
 
36963
+
36813
36964
  /**
36814
36965
  * Class facilitating asynchronous task cancellation.
36815
36966
  *
@@ -36912,22 +37063,44 @@ var TaskCanceller = /*#__PURE__*/function () {
36912
37063
  * Creates a new `TaskCanceller`, with its own `CancellationSignal` created
36913
37064
  * as its `signal` provide.
36914
37065
  * You can then pass this property to async task you wish to be cancellable.
36915
- * @param {Object|undefined} options
36916
37066
  */
36917
- function TaskCanceller(options) {
36918
- var _this = this;
37067
+ function TaskCanceller() {
36919
37068
  var _createCancellationFu = createCancellationFunctions(),
36920
37069
  trigger = _createCancellationFu[0],
36921
37070
  register = _createCancellationFu[1];
36922
- this.isUsed = false;
37071
+ this._isUsed = false;
36923
37072
  this._trigger = trigger;
36924
37073
  this.signal = new CancellationSignal(register);
36925
- if ((options === null || options === void 0 ? void 0 : options.cancelOn) !== undefined) {
36926
- var unregisterParent = options.cancelOn.register(function () {
36927
- _this.cancel();
36928
- });
36929
- this.signal.register(unregisterParent);
36930
- }
37074
+ }
37075
+ /**
37076
+ * Returns `true` if this `TaskCanceller` has already been triggered.
37077
+ * `false` otherwise.
37078
+ */
37079
+ var _proto = TaskCanceller.prototype;
37080
+ _proto.isUsed = function isUsed() {
37081
+ return this._isUsed;
37082
+ }
37083
+ /**
37084
+ * Bind this `TaskCanceller` to a `CancellationSignal`, so the former
37085
+ * is automatically cancelled when the latter is triggered.
37086
+ *
37087
+ * Note that this call registers a callback on the given signal, until either
37088
+ * the current `TaskCanceller` is cancelled or until this given
37089
+ * `CancellationSignal` is triggered.
37090
+ * To avoid leaking memory, the returned callback allow to undo this link.
37091
+ * It should be called if/when that link is not needed anymore, such as when
37092
+ * there is no need for this `TaskCanceller` anymore.
37093
+ *
37094
+ * @param {Object} signal
37095
+ * @returns {Function}
37096
+ */;
37097
+ _proto.linkToSignal = function linkToSignal(signal) {
37098
+ var _this = this;
37099
+ var unregister = signal.register(function () {
37100
+ _this.cancel();
37101
+ });
37102
+ this.signal.register(unregister);
37103
+ return unregister;
36931
37104
  }
36932
37105
  /**
36933
37106
  * "Trigger" the `TaskCanceller`, notify through its associated
@@ -36939,13 +37112,12 @@ var TaskCanceller = /*#__PURE__*/function () {
36939
37112
  * cancellation is actually triggered as a chain reaction from a previous
36940
37113
  * cancellation.
36941
37114
  * @param {Error} [srcError]
36942
- */
36943
- var _proto = TaskCanceller.prototype;
37115
+ */;
36944
37116
  _proto.cancel = function cancel(srcError) {
36945
- if (this.isUsed) {
37117
+ if (this._isUsed) {
36946
37118
  return;
36947
37119
  }
36948
- this.isUsed = true;
37120
+ this._isUsed = true;
36949
37121
  var cancellationError = srcError !== null && srcError !== void 0 ? srcError : new CancellationError();
36950
37122
  this._trigger(cancellationError);
36951
37123
  }
@@ -36975,18 +37147,31 @@ var CancellationSignal = /*#__PURE__*/function () {
36975
37147
  */
36976
37148
  function CancellationSignal(registerToSource) {
36977
37149
  var _this2 = this;
36978
- this.isCancelled = false;
37150
+ this._isCancelled = false;
36979
37151
  this.cancellationError = null;
36980
37152
  this._listeners = [];
36981
37153
  registerToSource(function (cancellationError) {
36982
37154
  _this2.cancellationError = cancellationError;
36983
- _this2.isCancelled = true;
37155
+ _this2._isCancelled = true;
36984
37156
  while (_this2._listeners.length > 0) {
36985
- var listener = _this2._listeners.splice(_this2._listeners.length - 1, 1)[0];
36986
- listener(cancellationError);
37157
+ try {
37158
+ var listener = _this2._listeners.pop();
37159
+ listener === null || listener === void 0 ? void 0 : listener(cancellationError);
37160
+ } catch (err) {
37161
+ _log__WEBPACK_IMPORTED_MODULE_0__/* ["default"].error */ .Z.error("Error while calling clean up listener", err instanceof Error ? err.toString() : "Unknown error");
37162
+ }
36987
37163
  }
36988
37164
  });
36989
37165
  }
37166
+ /**
37167
+ * Returns `true` when the cancellation order was already triggered, meaning
37168
+ * that the linked task needs to be aborted.
37169
+ * @returns boolean
37170
+ */
37171
+ var _proto2 = CancellationSignal.prototype;
37172
+ _proto2.isCancelled = function isCancelled() {
37173
+ return this._isCancelled;
37174
+ }
36990
37175
  /**
36991
37176
  * Registers a function that will be called when/if the current task is
36992
37177
  * cancelled.
@@ -37007,13 +37192,13 @@ var CancellationSignal = /*#__PURE__*/function () {
37007
37192
  * task succeeded or failed).
37008
37193
  * You don't need to call that function when cancellation has already been
37009
37194
  * performed.
37010
- */
37011
- var _proto2 = CancellationSignal.prototype;
37195
+ */;
37012
37196
  _proto2.register = function register(fn) {
37013
37197
  var _this3 = this;
37014
- if (this.isCancelled) {
37015
- (0,_assert__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this.cancellationError !== null);
37198
+ if (this._isCancelled) {
37199
+ (0,_assert__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(this.cancellationError !== null);
37016
37200
  fn(this.cancellationError);
37201
+ return _noop__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
37017
37202
  }
37018
37203
  this._listeners.push(fn);
37019
37204
  return function () {
@@ -37029,13 +37214,9 @@ var CancellationSignal = /*#__PURE__*/function () {
37029
37214
  * @param {Function} fn
37030
37215
  */;
37031
37216
  _proto2.deregister = function deregister(fn) {
37032
- if (this.isCancelled) {
37033
- return;
37034
- }
37035
- for (var i = 0; i < this._listeners.length; i++) {
37217
+ for (var i = this._listeners.length - 1; i >= 0; i--) {
37036
37218
  if (this._listeners[i] === fn) {
37037
37219
  this._listeners.splice(i, 1);
37038
- return;
37039
37220
  }
37040
37221
  }
37041
37222
  };
@@ -37047,25 +37228,25 @@ var CancellationSignal = /*#__PURE__*/function () {
37047
37228
  * @extends Error
37048
37229
  */
37049
37230
  var CancellationError = /*#__PURE__*/function (_Error) {
37050
- (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(CancellationError, _Error);
37231
+ (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(CancellationError, _Error);
37051
37232
  function CancellationError() {
37052
37233
  var _this4;
37053
37234
  _this4 = _Error.call(this) || this;
37054
37235
  // @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
37055
- Object.setPrototypeOf((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(_this4), CancellationError.prototype);
37236
+ Object.setPrototypeOf((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(_this4), CancellationError.prototype);
37056
37237
  _this4.name = "CancellationError";
37057
37238
  _this4.message = "This task was cancelled.";
37058
37239
  return _this4;
37059
37240
  }
37060
37241
  return CancellationError;
37061
- }( /*#__PURE__*/(0,_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(Error));
37242
+ }( /*#__PURE__*/(0,_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(Error));
37062
37243
  /**
37063
37244
  * Helper function allowing communication between a `TaskCanceller` and a
37064
37245
  * `CancellationSignal`.
37065
37246
  * @returns {Array.<Function>}
37066
37247
  */
37067
37248
  function createCancellationFunctions() {
37068
- var listener = _noop__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z;
37249
+ var listener = _noop__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
37069
37250
  return [function trigger(error) {
37070
37251
  listener(error);
37071
37252
  }, function register(newListener) {
@@ -38335,6 +38516,8 @@ function clearOnStop(mediaElement) {
38335
38516
  function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem) {
38336
38517
  return currentKeySystem === undefined || currentKeySystem.indexOf("widevine") < 0;
38337
38518
  }
38519
+ // EXTERNAL MODULE: ./src/utils/create_cancellable_promise.ts
38520
+ var create_cancellable_promise = __webpack_require__(7733);
38338
38521
  // EXTERNAL MODULE: ./src/utils/noop.ts
38339
38522
  var noop = __webpack_require__(8894);
38340
38523
  // EXTERNAL MODULE: ./src/utils/take_first_set.ts
@@ -39727,9 +39910,8 @@ function getEstimateReference(_ref, stopAllEstimates) {
39727
39910
  * This TaskCanceller is used both for restarting estimates with a new
39728
39911
  * configuration and to cancel them altogether.
39729
39912
  */
39730
- var currentEstimatesCanceller = new task_canceller/* default */.ZP({
39731
- cancelOn: stopAllEstimates
39732
- });
39913
+ var currentEstimatesCanceller = new task_canceller/* default */.ZP();
39914
+ currentEstimatesCanceller.linkToSignal(stopAllEstimates);
39733
39915
  // Create `ISharedReference` on which estimates will be emitted.
39734
39916
  var estimateRef = createEstimateReference(manualBitrate.getValue(), representationsRef.getValue(), currentEstimatesCanceller.signal);
39735
39917
  manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, {
@@ -39955,9 +40137,8 @@ function getEstimateReference(_ref, stopAllEstimates) {
39955
40137
  var manualBitrateVal = manualBitrate.getValue();
39956
40138
  var representations = representationsRef.getValue();
39957
40139
  currentEstimatesCanceller.cancel();
39958
- currentEstimatesCanceller = new task_canceller/* default */.ZP({
39959
- cancelOn: stopAllEstimates
39960
- });
40140
+ currentEstimatesCanceller = new task_canceller/* default */.ZP();
40141
+ currentEstimatesCanceller.linkToSignal(stopAllEstimates);
39961
40142
  var newRef = createEstimateReference(manualBitrateVal, representations, currentEstimatesCanceller.signal);
39962
40143
  newRef.onUpdate(function onNewEstimate(newEstimate) {
39963
40144
  estimateRef.setValue(newEstimate);
@@ -40315,27 +40496,34 @@ function _scheduleRequestWithCdns() {
40315
40496
  if (blockedFor <= 0) {
40316
40497
  return requestCdn(nextWantedCdn);
40317
40498
  }
40318
- var canceller = new task_canceller/* default */.ZP({
40319
- cancelOn: cancellationSignal
40320
- });
40499
+ var canceller = new task_canceller/* default */.ZP();
40500
+ var unlinkCanceller = canceller.linkToSignal(cancellationSignal);
40321
40501
  return new Promise(function (res, rej) {
40322
40502
  /* eslint-disable-next-line @typescript-eslint/no-misused-promises */
40323
40503
  cdnPrioritizer === null || cdnPrioritizer === void 0 ? void 0 : cdnPrioritizer.addEventListener("priorityChange", function () {
40324
40504
  var updatedPrioritaryCdn = getCdnToRequest();
40325
- if (cancellationSignal.isCancelled) {
40505
+ if (cancellationSignal.isCancelled()) {
40326
40506
  throw cancellationSignal.cancellationError;
40327
40507
  }
40328
40508
  if (updatedPrioritaryCdn === undefined) {
40329
- return rej(prevRequestError);
40509
+ return cleanAndReject(prevRequestError);
40330
40510
  }
40331
40511
  if (updatedPrioritaryCdn !== nextWantedCdn) {
40332
40512
  canceller.cancel();
40333
- waitPotentialBackoffAndRequest(updatedPrioritaryCdn, prevRequestError).then(res, rej);
40513
+ waitPotentialBackoffAndRequest(updatedPrioritaryCdn, prevRequestError).then(cleanAndResolve, cleanAndReject);
40334
40514
  }
40335
40515
  }, canceller.signal);
40336
40516
  (0,cancellable_sleep/* default */.Z)(blockedFor, canceller.signal).then(function () {
40337
- return requestCdn(nextWantedCdn).then(res, rej);
40517
+ return requestCdn(nextWantedCdn).then(cleanAndResolve, cleanAndReject);
40338
40518
  }, noop/* default */.Z);
40519
+ function cleanAndResolve(response) {
40520
+ unlinkCanceller();
40521
+ res(response);
40522
+ }
40523
+ function cleanAndReject(err) {
40524
+ unlinkCanceller();
40525
+ rej(err);
40526
+ }
40339
40527
  });
40340
40528
  };
40341
40529
  _retryWithNextCdn = function _retryWithNextCdn3() {
@@ -40346,7 +40534,7 @@ function _scheduleRequestWithCdns() {
40346
40534
  switch (_context2.prev = _context2.next) {
40347
40535
  case 0:
40348
40536
  nextCdn = getCdnToRequest();
40349
- if (!cancellationSignal.isCancelled) {
40537
+ if (!cancellationSignal.isCancelled()) {
40350
40538
  _context2.next = 3;
40351
40539
  break;
40352
40540
  }
@@ -40359,7 +40547,7 @@ function _scheduleRequestWithCdns() {
40359
40547
  throw prevRequestError;
40360
40548
  case 5:
40361
40549
  onRetry(prevRequestError);
40362
- if (!cancellationSignal.isCancelled) {
40550
+ if (!cancellationSignal.isCancelled()) {
40363
40551
  _context2.next = 8;
40364
40552
  break;
40365
40553
  }
@@ -40609,7 +40797,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
40609
40797
  }
40610
40798
  manifestProm.then(function (val) {
40611
40799
  _this2.trigger("manifestReady", val.manifest);
40612
- if (!_this2._canceller.isUsed) {
40800
+ if (!_this2._canceller.isUsed()) {
40613
40801
  _this2._recursivelyRefreshManifest(val.manifest, val);
40614
40802
  }
40615
40803
  })["catch"](function (err) {
@@ -40764,7 +40952,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
40764
40952
  onWarnings = function _onWarnings(warnings) {
40765
40953
  for (var _iterator = manifest_fetcher_createForOfIteratorHelperLoose(warnings), _step; !(_step = _iterator()).done;) {
40766
40954
  var warning = _step.value;
40767
- if (cancelSignal.isCancelled) {
40955
+ if (cancelSignal.isCancelled()) {
40768
40956
  return;
40769
40957
  }
40770
40958
  var _formattedError = (0,format_error/* default */.Z)(warning, {
@@ -40920,9 +41108,8 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
40920
41108
  * be effectively considered.
40921
41109
  * `nextRefreshCanceller` will allow to cancel every other when one is triggered.
40922
41110
  */
40923
- var nextRefreshCanceller = new task_canceller/* default */.ZP({
40924
- cancelOn: this._canceller.signal
40925
- });
41111
+ var nextRefreshCanceller = new task_canceller/* default */.ZP();
41112
+ nextRefreshCanceller.linkToSignal(this._canceller.signal);
40926
41113
  /* Function to manually schedule a Manifest refresh */
40927
41114
  this.scheduleManualRefresh = function (settings) {
40928
41115
  var enablePartialRefresh = settings.enablePartialRefresh,
@@ -41099,7 +41286,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
41099
41286
  });
41100
41287
  };
41101
41288
  _proto._onFatalError = function _onFatalError(err) {
41102
- if (this._canceller.isUsed) {
41289
+ if (this._canceller.isUsed()) {
41103
41290
  return;
41104
41291
  }
41105
41292
  this.trigger("error", err);
@@ -41159,13 +41346,17 @@ function cdn_prioritizer_arrayLikeToArray(arr, len) { if (len == null || len > a
41159
41346
 
41160
41347
 
41161
41348
  /**
41162
- * Class signaling the priority between multiple CDN available for any given
41163
- * resource.
41349
+ * Class storing and signaling the priority between multiple CDN available for
41350
+ * any given resource.
41164
41351
  *
41165
- * This class might perform requests and schedule timeouts by itself to keep its
41166
- * internal list of CDN priority up-to-date.
41167
- * When it is not needed anymore, you should call the `dispose` method to clear
41168
- * all resources.
41352
+ * This class was first created to implement the complexities behind
41353
+ * Content Steering features, though its handling hasn't been added yet as we
41354
+ * wait for its specification to be both standardized and relied on in the wild.
41355
+ * In the meantime, it acts as an abstraction for the simple concept of
41356
+ * avoiding to request a CDN for any segment when an issue is encountered with
41357
+ * one (e.g. HTTP 500 statuses) and several CDN exist for a given resource. It
41358
+ * should be noted that this is also one of the planified features of the
41359
+ * Content Steering specification.
41169
41360
  *
41170
41361
  * @class CdnPrioritizer
41171
41362
  */
@@ -41476,10 +41667,22 @@ var generateRequestID = (0,id_generator/* default */.Z)();
41476
41667
  * An `ISegmentFetcher` also implements a retry mechanism, based on the given
41477
41668
  * `options` argument, which may retry a segment request when it fails.
41478
41669
  *
41479
- * @param {string} bufferType
41480
- * @param {Object} pipeline
41481
- * @param {Object} lifecycleCallbacks
41482
- * @param {Object} options
41670
+ * @param {string} bufferType - Type of buffer concerned (e.g. `"audio"`,
41671
+ * `"video"`, `"text" etc.)
41672
+ * @param {Object} pipeline - The transport-specific logic allowing to load
41673
+ * segments of the given buffer type and transport protocol (e.g. DASH).
41674
+ * @param {Object|null} cdnPrioritizer - Abstraction allowing to synchronize,
41675
+ * update and keep track of the priorization of the CDN to use to load any given
41676
+ * segment, in cases where multiple ones are available.
41677
+ *
41678
+ * Can be set to `null` in which case a minimal priorization logic will be used
41679
+ * instead.
41680
+ * @param {Object} lifecycleCallbacks - Callbacks that can be registered to be
41681
+ * informed when new requests are made, ended, new metrics are available etc.
41682
+ * This should be mainly useful to implement an adaptive logic relying on those
41683
+ * metrics and events.
41684
+ * @param {Object} options - Various tweaking options allowing to configure the
41685
+ * behavior of the returned `ISegmentFetcher`.
41483
41686
  * @returns {Function}
41484
41687
  */
41485
41688
  function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritizer, lifecycleCallbacks, options) {
@@ -41503,7 +41706,7 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
41503
41706
  */
41504
41707
  return /*#__PURE__*/function () {
41505
41708
  var _fetchSegment = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(content, fetcherCallbacks, cancellationSignal) {
41506
- var _a, _b, segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, loaderCallbacks, cached, res, loadedData, callLoaderWithUrl, generateParserFunction, onRetry, sendNetworkMetricsIfAvailable;
41709
+ var _a, _b, _c, segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, loaderCallbacks, cached, res, loadedData, onCancellation, callLoaderWithUrl, generateParserFunction, onRetry, sendNetworkMetricsIfAvailable;
41507
41710
  return regenerator_default().wrap(function _callee$(_context) {
41508
41711
  while (1) {
41509
41712
  switch (_context.prev = _context.next) {
@@ -41555,6 +41758,18 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
41555
41758
  callLoaderWithUrl = function _callLoaderWithUrl(cdnMetadata) {
41556
41759
  return loadSegment(cdnMetadata, content, requestOptions, cancellationSignal, loaderCallbacks);
41557
41760
  };
41761
+ onCancellation = function _onCancellation() {
41762
+ var _a;
41763
+ if (requestInfo !== undefined) {
41764
+ return; // Request already terminated
41765
+ }
41766
+
41767
+ log/* default.debug */.Z.debug("SF: Segment request cancelled", segmentIdString);
41768
+ requestInfo = null;
41769
+ (_a = lifecycleCallbacks.onRequestEnd) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
41770
+ id: requestId
41771
+ });
41772
+ };
41558
41773
  // used by logs
41559
41774
  segmentIdString = (0,utils/* getLoggableSegmentId */.K)(content);
41560
41775
  requestId = generateRequestID();
@@ -41618,37 +41833,26 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
41618
41833
  }; // Retrieve from cache if it exists
41619
41834
  cached = cache !== undefined ? cache.get(content) : null;
41620
41835
  if (!(cached !== null)) {
41621
- _context.next = 15;
41836
+ _context.next = 16;
41622
41837
  break;
41623
41838
  }
41624
41839
  log/* default.debug */.Z.debug("SF: Found wanted segment in cache", segmentIdString);
41625
41840
  fetcherCallbacks.onChunk(generateParserFunction(cached, false));
41626
41841
  return _context.abrupt("return", Promise.resolve());
41627
- case 15:
41842
+ case 16:
41628
41843
  log/* default.debug */.Z.debug("SF: Beginning request", segmentIdString);
41629
41844
  (_a = lifecycleCallbacks.onRequestBegin) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
41630
41845
  requestTimestamp: performance.now(),
41631
41846
  id: requestId,
41632
41847
  content: content
41633
41848
  });
41634
- cancellationSignal.register(function () {
41635
- var _a;
41636
- if (requestInfo !== undefined) {
41637
- return; // Request already terminated
41638
- }
41639
-
41640
- log/* default.debug */.Z.debug("SF: Segment request cancelled", segmentIdString);
41641
- requestInfo = null;
41642
- (_a = lifecycleCallbacks.onRequestEnd) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
41643
- id: requestId
41644
- });
41645
- });
41646
- _context.prev = 18;
41647
- _context.next = 21;
41849
+ cancellationSignal.register(onCancellation);
41850
+ _context.prev = 19;
41851
+ _context.next = 22;
41648
41852
  return scheduleRequestWithCdns(content.representation.cdnMetadata, cdnPrioritizer, callLoaderWithUrl, (0,object_assign/* default */.Z)({
41649
41853
  onRetry: onRetry
41650
41854
  }, options), cancellationSignal);
41651
- case 21:
41855
+ case 22:
41652
41856
  res = _context.sent;
41653
41857
  if (res.resultType === "segment-loaded") {
41654
41858
  loadedData = res.resultData.responseData;
@@ -41667,7 +41871,7 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
41667
41871
  } else {
41668
41872
  requestInfo = null;
41669
41873
  }
41670
- if (!cancellationSignal.isCancelled) {
41874
+ if (!cancellationSignal.isCancelled()) {
41671
41875
  // The current task could have been canceled as a result of one
41672
41876
  // of the previous callbacks call. In that case, we don't want to send
41673
41877
  // a "requestEnd" again as it has already been sent on cancellation.
@@ -41675,27 +41879,32 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
41675
41879
  id: requestId
41676
41880
  });
41677
41881
  }
41678
- _context.next = 37;
41882
+ cancellationSignal.deregister(onCancellation);
41883
+ _context.next = 41;
41679
41884
  break;
41680
- case 29:
41681
- _context.prev = 29;
41682
- _context.t0 = _context["catch"](18);
41885
+ case 31:
41886
+ _context.prev = 31;
41887
+ _context.t0 = _context["catch"](19);
41888
+ cancellationSignal.deregister(onCancellation);
41683
41889
  requestInfo = null;
41684
41890
  if (!(_context.t0 instanceof task_canceller/* CancellationError */.FU)) {
41685
- _context.next = 35;
41891
+ _context.next = 38;
41686
41892
  break;
41687
41893
  }
41688
41894
  log/* default.debug */.Z.debug("SF: Segment request aborted", segmentIdString);
41689
41895
  throw _context.t0;
41690
- case 35:
41896
+ case 38:
41691
41897
  log/* default.debug */.Z.debug("SF: Segment request failed", segmentIdString);
41898
+ (_c = lifecycleCallbacks.onRequestEnd) === null || _c === void 0 ? void 0 : _c.call(lifecycleCallbacks, {
41899
+ id: requestId
41900
+ });
41692
41901
  throw errorSelector(_context.t0);
41693
- case 37:
41902
+ case 41:
41694
41903
  case "end":
41695
41904
  return _context.stop();
41696
41905
  }
41697
41906
  }
41698
- }, _callee, null, [[18, 29]]);
41907
+ }, _callee, null, [[19, 31]]);
41699
41908
  }));
41700
41909
  function fetchSegment(_x, _x2, _x3) {
41701
41910
  return _fetchSegment.apply(this, arguments);
@@ -41731,6 +41940,7 @@ function getSegmentFetcherOptions(bufferType, _ref) {
41731
41940
 
41732
41941
 
41733
41942
 
41943
+
41734
41944
  var TaskPrioritizer = /*#__PURE__*/function () {
41735
41945
  /**
41736
41946
  * @param {Options} prioritizerOptions
@@ -41771,49 +41981,43 @@ var TaskPrioritizer = /*#__PURE__*/function () {
41771
41981
  _proto.create = function create(taskFn, priority, callbacks, cancelSignal) {
41772
41982
  var _this = this;
41773
41983
  var newTask;
41774
- return new Promise(function (resolve, reject) {
41984
+ return (0,create_cancellable_promise/* default */.Z)(cancelSignal, function (resolve, reject) {
41775
41985
  /** Function allowing to start the underlying Promise. */
41776
41986
  var trigger = function trigger() {
41777
41987
  if (newTask.hasEnded) {
41778
- unregisterCancelSignal();
41779
41988
  return;
41780
41989
  }
41781
- var interrupter = new task_canceller/* default */.ZP({
41782
- cancelOn: cancelSignal
41783
- });
41990
+ var finishTask = function finishTask() {
41991
+ unlinkInterrupter();
41992
+ _this._endTask(newTask);
41993
+ };
41994
+ var onResolve = function onResolve(value) {
41995
+ callbacks.beforeEnded();
41996
+ finishTask();
41997
+ resolve(value);
41998
+ };
41999
+ var onReject = function onReject(err) {
42000
+ finishTask();
42001
+ reject(err);
42002
+ };
42003
+ var interrupter = new task_canceller/* default */.ZP();
42004
+ var unlinkInterrupter = interrupter.linkToSignal(cancelSignal);
41784
42005
  newTask.interrupter = interrupter;
41785
42006
  interrupter.signal.register(function () {
41786
42007
  newTask.interrupter = null;
41787
- if (!cancelSignal.isCancelled) {
42008
+ if (!cancelSignal.isCancelled()) {
41788
42009
  callbacks.beforeInterrupted();
41789
42010
  }
41790
42011
  });
41791
42012
  _this._minPendingPriority = _this._minPendingPriority === null ? newTask.priority : Math.min(_this._minPendingPriority, newTask.priority);
41792
42013
  _this._pendingTasks.push(newTask);
41793
42014
  newTask.taskFn(interrupter.signal).then(onResolve)["catch"](function (err) {
41794
- if (!cancelSignal.isCancelled && interrupter.isUsed && err instanceof task_canceller/* CancellationError */.FU) {
42015
+ if (!cancelSignal.isCancelled() && interrupter.isUsed() && err instanceof task_canceller/* CancellationError */.FU) {
41795
42016
  return;
41796
42017
  }
41797
42018
  onReject(err);
41798
42019
  });
41799
42020
  };
41800
- var unregisterCancelSignal = cancelSignal.register(function (cancellationError) {
41801
- _this._endTask(newTask);
41802
- reject(cancellationError);
41803
- });
41804
- var finishTask = function finishTask() {
41805
- unregisterCancelSignal();
41806
- _this._endTask(newTask);
41807
- };
41808
- var onResolve = function onResolve(value) {
41809
- callbacks.beforeEnded();
41810
- finishTask();
41811
- resolve(value);
41812
- };
41813
- var onReject = function onReject(err) {
41814
- finishTask();
41815
- reject(err);
41816
- };
41817
42021
  newTask = {
41818
42022
  hasEnded: false,
41819
42023
  priority: priority,
@@ -41837,6 +42041,9 @@ var TaskPrioritizer = /*#__PURE__*/function () {
41837
42041
  _this._interruptCancellableTasks();
41838
42042
  }
41839
42043
  }
42044
+ return function () {
42045
+ return _this._endTask(newTask);
42046
+ };
41840
42047
  });
41841
42048
  };
41842
42049
  _proto._endTask = function _endTask(task) {
@@ -42205,6 +42412,7 @@ var types = __webpack_require__(9612);
42205
42412
 
42206
42413
 
42207
42414
 
42415
+
42208
42416
  /**
42209
42417
  * Allows to push and remove new segments to a SourceBuffer in a FIFO queue (not
42210
42418
  * doing so can lead to browser Errors) while keeping an inventory of what has
@@ -42407,17 +42615,17 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
42407
42615
  */;
42408
42616
  _proto._addToQueue = function _addToQueue(operation, cancellationSignal) {
42409
42617
  var _this2 = this;
42410
- return new Promise(function (resolve, reject) {
42411
- if (cancellationSignal.cancellationError !== null) {
42412
- return reject(cancellationSignal.cancellationError);
42413
- }
42618
+ return (0,create_cancellable_promise/* default */.Z)(cancellationSignal, function (resolve, reject) {
42414
42619
  var shouldRestartQueue = _this2._queue.length === 0 && _this2._pendingTask === null;
42415
42620
  var queueItem = (0,object_assign/* default */.Z)({
42416
42621
  resolve: resolve,
42417
42622
  reject: reject
42418
42623
  }, operation);
42419
42624
  _this2._queue.push(queueItem);
42420
- cancellationSignal.register(function (error) {
42625
+ if (shouldRestartQueue) {
42626
+ _this2._flush();
42627
+ }
42628
+ return function () {
42421
42629
  // Remove the corresponding element from the AudioVideoSegmentBuffer's
42422
42630
  // queue.
42423
42631
  // If the operation was a pending task, it should still continue to not
@@ -42428,11 +42636,7 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
42428
42636
  }
42429
42637
  queueItem.resolve = noop/* default */.Z;
42430
42638
  queueItem.reject = noop/* default */.Z;
42431
- reject(error);
42432
- });
42433
- if (shouldRestartQueue) {
42434
- _this2._flush();
42435
- }
42639
+ };
42436
42640
  });
42437
42641
  }
42438
42642
  /**
@@ -42672,6 +42876,7 @@ function assertPushedDataIsBufferSource(pushedData) {
42672
42876
 
42673
42877
 
42674
42878
 
42879
+
42675
42880
  var POSSIBLE_BUFFER_TYPES = ["audio", "video", "text", "image"];
42676
42881
  /**
42677
42882
  * Allows to easily create and dispose SegmentBuffers, which are interfaces to
@@ -42796,20 +43001,23 @@ var SegmentBuffersStore = /*#__PURE__*/function () {
42796
43001
  if (this._areNativeBuffersUsable()) {
42797
43002
  return Promise.resolve();
42798
43003
  }
42799
- return new Promise(function (res, rej) {
42800
- var onAddedOrDisabled = function onAddedOrDisabled() {
43004
+ return (0,create_cancellable_promise/* default */.Z)(cancelWaitSignal, function (res) {
43005
+ /* eslint-disable-next-line prefer-const */
43006
+ var onAddedOrDisabled;
43007
+ var removeCallback = function removeCallback() {
43008
+ var indexOf = _this._onNativeBufferAddedOrDisabled.indexOf(onAddedOrDisabled);
43009
+ if (indexOf >= 0) {
43010
+ _this._onNativeBufferAddedOrDisabled.splice(indexOf, 1);
43011
+ }
43012
+ };
43013
+ onAddedOrDisabled = function onAddedOrDisabled() {
42801
43014
  if (_this._areNativeBuffersUsable()) {
43015
+ removeCallback();
42802
43016
  res();
42803
43017
  }
42804
43018
  };
42805
43019
  _this._onNativeBufferAddedOrDisabled.push(onAddedOrDisabled);
42806
- cancelWaitSignal.register(function (error) {
42807
- var indexOf = _this._onNativeBufferAddedOrDisabled.indexOf(onAddedOrDisabled);
42808
- if (indexOf >= 0) {
42809
- _this._onNativeBufferAddedOrDisabled.splice(indexOf, 1);
42810
- }
42811
- rej(error);
42812
- });
43020
+ return removeCallback;
42813
43021
  });
42814
43022
  }
42815
43023
  /**
@@ -43457,6 +43665,7 @@ function _clearBuffer() {
43457
43665
 
43458
43666
 
43459
43667
 
43668
+
43460
43669
  /**
43461
43670
  * Class scheduling segment downloads for a single Representation.
43462
43671
  *
@@ -43596,6 +43805,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43596
43805
  _proto.stop = function stop() {
43597
43806
  var _a;
43598
43807
  (_a = this._currentCanceller) === null || _a === void 0 ? void 0 : _a.cancel();
43808
+ this._currentCanceller = null;
43599
43809
  }
43600
43810
  /**
43601
43811
  * Internal logic performing media segment requests.
@@ -43609,8 +43819,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43609
43819
  segmentQueue = _this$_downloadQueue$.segmentQueue;
43610
43820
  var currentNeededSegment = segmentQueue[0];
43611
43821
  var recursivelyRequestSegments = function recursivelyRequestSegments(startingSegment) {
43612
- var _a;
43613
- if (_this3._currentCanceller !== null && _this3._currentCanceller.isUsed) {
43822
+ if (_this3._currentCanceller !== null && _this3._currentCanceller.isUsed()) {
43614
43823
  _this3._mediaSegmentRequest = null;
43615
43824
  return;
43616
43825
  }
@@ -43619,9 +43828,8 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43619
43828
  _this3.trigger("emptyQueue", null);
43620
43829
  return;
43621
43830
  }
43622
- var canceller = new task_canceller/* default */.ZP({
43623
- cancelOn: (_a = _this3._currentCanceller) === null || _a === void 0 ? void 0 : _a.signal
43624
- });
43831
+ var canceller = new task_canceller/* default */.ZP();
43832
+ var unlinkCanceller = _this3._currentCanceller === null ? noop/* default */.Z : canceller.linkToSignal(_this3._currentCanceller.signal);
43625
43833
  var segment = startingSegment.segment,
43626
43834
  priority = startingSegment.priority;
43627
43835
  var context = (0,object_assign/* default */.Z)({
@@ -43726,6 +43934,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43726
43934
  * requests are scheduled. It is used to schedule the next segment.
43727
43935
  */
43728
43936
  beforeEnded: function beforeEnded() {
43937
+ unlinkCanceller();
43729
43938
  _this3._mediaSegmentRequest = null;
43730
43939
  if (isWaitingOnInitSegment) {
43731
43940
  _this3._initSegmentInfoRef.waitUntilDefined(continueToNextSegment, {
@@ -43737,6 +43946,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43737
43946
  }
43738
43947
  }, canceller.signal);
43739
43948
  request["catch"](function (error) {
43949
+ unlinkCanceller();
43740
43950
  if (!isComplete) {
43741
43951
  isComplete = true;
43742
43952
  _this3.stop();
@@ -43758,8 +43968,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43758
43968
  */;
43759
43969
  _proto._restartInitSegmentDownloadingQueue = function _restartInitSegmentDownloadingQueue(queuedInitSegment) {
43760
43970
  var _this4 = this;
43761
- var _a;
43762
- if (this._currentCanceller !== null && this._currentCanceller.isUsed) {
43971
+ if (this._currentCanceller !== null && this._currentCanceller.isUsed()) {
43763
43972
  return;
43764
43973
  }
43765
43974
  if (this._initSegmentRequest !== null) {
@@ -43768,9 +43977,8 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43768
43977
  if (queuedInitSegment === null) {
43769
43978
  return;
43770
43979
  }
43771
- var canceller = new task_canceller/* default */.ZP({
43772
- cancelOn: (_a = this._currentCanceller) === null || _a === void 0 ? void 0 : _a.signal
43773
- });
43980
+ var canceller = new task_canceller/* default */.ZP();
43981
+ var unlinkCanceller = this._currentCanceller === null ? noop/* default */.Z : canceller.linkToSignal(this._currentCanceller.signal);
43774
43982
  var segment = queuedInitSegment.segment,
43775
43983
  priority = queuedInitSegment.priority;
43776
43984
  var context = (0,object_assign/* default */.Z)({
@@ -43792,6 +44000,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43792
44000
  log/* default.info */.Z.info("Stream: init segment request interrupted temporarly.", segment.id);
43793
44001
  },
43794
44002
  beforeEnded: function beforeEnded() {
44003
+ unlinkCanceller();
43795
44004
  _this4._initSegmentRequest = null;
43796
44005
  isComplete = true;
43797
44006
  },
@@ -43811,6 +44020,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
43811
44020
  }
43812
44021
  }, canceller.signal);
43813
44022
  request["catch"](function (error) {
44023
+ unlinkCanceller();
43814
44024
  if (!isComplete) {
43815
44025
  isComplete = true;
43816
44026
  _this4.stop();
@@ -44937,7 +45147,7 @@ function _appendSegmentToBuffer() {
44937
45147
  case 5:
44938
45148
  _context.prev = 5;
44939
45149
  _context.t0 = _context["catch"](0);
44940
- if (!(cancellationSignal.isCancelled && _context.t0 instanceof task_canceller/* CancellationError */.FU)) {
45150
+ if (!(cancellationSignal.isCancelled() && _context.t0 instanceof task_canceller/* CancellationError */.FU)) {
44941
45151
  _context.next = 11;
44942
45152
  break;
44943
45153
  }
@@ -45238,17 +45448,15 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45238
45448
  fastSwitchThreshold = options.fastSwitchThreshold;
45239
45449
  var bufferType = adaptation.type;
45240
45450
  /** `TaskCanceller` stopping ALL operations performed by the `RepresentationStream` */
45241
- var globalCanceller = new task_canceller/* default */.ZP({
45242
- cancelOn: parentCancelSignal
45243
- });
45451
+ var globalCanceller = new task_canceller/* default */.ZP();
45452
+ globalCanceller.linkToSignal(parentCancelSignal);
45244
45453
  /**
45245
45454
  * `TaskCanceller` allowing to only stop segment loading and checking operations.
45246
45455
  * This allows to stop only tasks linked to network resource usage, which is
45247
45456
  * often a limited resource, while still letting buffer operations to finish.
45248
45457
  */
45249
- var segmentsLoadingCanceller = new task_canceller/* default */.ZP({
45250
- cancelOn: globalCanceller.signal
45251
- });
45458
+ var segmentsLoadingCanceller = new task_canceller/* default */.ZP();
45459
+ segmentsLoadingCanceller.linkToSignal(globalCanceller.signal);
45252
45460
  /** Saved initialization segment state for this representation. */
45253
45461
  var initSegmentState = {
45254
45462
  segment: representation.index.getInitSegment(),
@@ -45288,7 +45496,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45288
45496
  content: content
45289
45497
  }, d);
45290
45498
  }));
45291
- if (globalCanceller.isUsed) {
45499
+ if (globalCanceller.isUsed()) {
45292
45500
  return; // previous callback has stopped everything by side-effect
45293
45501
  }
45294
45502
  }
@@ -45296,7 +45504,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45296
45504
  /** Will load every segments in `lastSegmentQueue` */
45297
45505
  var downloadingQueue = new DownloadingQueue(content, lastSegmentQueue, segmentFetcher, hasInitSegment);
45298
45506
  downloadingQueue.addEventListener("error", function (err) {
45299
- if (segmentsLoadingCanceller.signal.isCancelled) {
45507
+ if (segmentsLoadingCanceller.signal.isCancelled()) {
45300
45508
  return; // ignore post requests-cancellation loading-related errors,
45301
45509
  }
45302
45510
 
@@ -45308,7 +45516,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45308
45516
  downloadingQueue.addEventListener("emptyQueue", checkStatus);
45309
45517
  downloadingQueue.addEventListener("requestRetry", function (payload) {
45310
45518
  callbacks.warning(payload.error);
45311
- if (segmentsLoadingCanceller.signal.isCancelled) {
45519
+ if (segmentsLoadingCanceller.signal.isCancelled()) {
45312
45520
  return; // If the previous callback led to loading operations being stopped, skip
45313
45521
  }
45314
45522
 
@@ -45355,7 +45563,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45355
45563
  */
45356
45564
  function checkStatus() {
45357
45565
  var _a, _b;
45358
- if (segmentsLoadingCanceller.isUsed) {
45566
+ if (segmentsLoadingCanceller.isUsed()) {
45359
45567
  return; // Stop all buffer status checking if load operations are stopped
45360
45568
  }
45361
45569
 
@@ -45431,7 +45639,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45431
45639
  hasFinishedLoading: status.hasFinishedLoading,
45432
45640
  neededSegments: status.neededSegments
45433
45641
  });
45434
- if (segmentsLoadingCanceller.signal.isCancelled) {
45642
+ if (segmentsLoadingCanceller.signal.isCancelled()) {
45435
45643
  return; // previous callback has stopped loading operations by side-effect
45436
45644
  }
45437
45645
 
@@ -45440,7 +45648,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45440
45648
  if (status.isBufferFull) {
45441
45649
  var gcedPosition = Math.max(0, initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
45442
45650
  if (gcedPosition > 0) {
45443
- segmentBuffer.removeBuffer(0, gcedPosition, segmentsLoadingCanceller.signal)["catch"](onFatalBufferError);
45651
+ segmentBuffer.removeBuffer(0, gcedPosition, globalCanceller.signal)["catch"](onFatalBufferError);
45444
45652
  }
45445
45653
  }
45446
45654
  if (status.shouldRefreshManifest) {
@@ -45453,7 +45661,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45453
45661
  * @param {Object} evt
45454
45662
  */
45455
45663
  function onParsedChunk(evt) {
45456
- if (globalCanceller.isUsed) {
45664
+ if (globalCanceller.isUsed()) {
45457
45665
  // We should not do anything with segments if the `RepresentationStream`
45458
45666
  // is not running anymore.
45459
45667
  return;
@@ -45502,7 +45710,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45502
45710
  content: content
45503
45711
  }, p);
45504
45712
  }));
45505
- if (globalCanceller.isUsed) {
45713
+ if (globalCanceller.isUsed()) {
45506
45714
  return; // previous callback has stopped everything by side-effect
45507
45715
  }
45508
45716
  }
@@ -45510,14 +45718,14 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45510
45718
 
45511
45719
  if (needsManifestRefresh === true) {
45512
45720
  callbacks.needsManifestRefresh();
45513
- if (globalCanceller.isUsed) {
45721
+ if (globalCanceller.isUsed()) {
45514
45722
  return; // previous callback has stopped everything by side-effect
45515
45723
  }
45516
45724
  }
45517
45725
 
45518
45726
  if (inbandEvents !== undefined && inbandEvents.length > 0) {
45519
45727
  callbacks.inbandEvent(inbandEvents);
45520
- if (globalCanceller.isUsed) {
45728
+ if (globalCanceller.isUsed()) {
45521
45729
  return; // previous callback has stopped everything by side-effect
45522
45730
  }
45523
45731
  }
@@ -45544,7 +45752,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
45544
45752
  * @param {*} err
45545
45753
  */
45546
45754
  function onFatalBufferError(err) {
45547
- if (globalCanceller.isUsed && err instanceof task_canceller/* CancellationError */.FU) {
45755
+ if (globalCanceller.isUsed() && err instanceof task_canceller/* CancellationError */.FU) {
45548
45756
  // The error is linked to cancellation AND we explicitely cancelled buffer
45549
45757
  // operations.
45550
45758
  // We can thus ignore it, it is very unlikely to lead to true buffer issues.
@@ -45676,6 +45884,8 @@ function getRepresentationEstimate(content, representationEstimator, currentRepr
45676
45884
 
45677
45885
 
45678
45886
 
45887
+
45888
+
45679
45889
  /**
45680
45890
  * Create new `AdaptationStream` whose task will be to download the media data
45681
45891
  * for a given Adaptation (i.e. "track").
@@ -45720,9 +45930,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45720
45930
  period = content.period,
45721
45931
  adaptation = content.adaptation;
45722
45932
  /** Allows to cancel everything the `AdaptationStream` is doing. */
45723
- var adapStreamCanceller = new task_canceller/* default */.ZP({
45724
- cancelOn: parentCancelSignal
45725
- });
45933
+ var adapStreamCanceller = new task_canceller/* default */.ZP();
45934
+ adapStreamCanceller.linkToSignal(parentCancelSignal);
45726
45935
  /**
45727
45936
  * The buffer goal ratio base itself on the value given by `wantedBufferAhead`
45728
45937
  * to determine a more dynamic buffer goal for a given Representation.
@@ -45790,9 +45999,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45790
45999
  * terminating and as such the next one might be immediately created
45791
46000
  * recursively.
45792
46001
  */
45793
- var repStreamTerminatingCanceller = new task_canceller/* default */.ZP({
45794
- cancelOn: adapStreamCanceller.signal
45795
- });
46002
+ var repStreamTerminatingCanceller = new task_canceller/* default */.ZP();
46003
+ repStreamTerminatingCanceller.linkToSignal(adapStreamCanceller.signal);
45796
46004
  var _estimateRef$getValue = estimateRef.getValue(),
45797
46005
  representation = _estimateRef$getValue.representation,
45798
46006
  manual = _estimateRef$getValue.manual;
@@ -45884,12 +46092,12 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45884
46092
  representation: representation
45885
46093
  };
45886
46094
  currentRepresentation.setValue(representation);
45887
- if (adapStreamCanceller.isUsed) {
46095
+ if (adapStreamCanceller.isUsed()) {
45888
46096
  return; // previous callback has stopped everything by side-effect
45889
46097
  }
45890
46098
 
45891
46099
  callbacks.representationChange(repInfo);
45892
- if (adapStreamCanceller.isUsed) {
46100
+ if (adapStreamCanceller.isUsed()) {
45893
46101
  return; // previous callback has stopped everything by side-effect
45894
46102
  }
45895
46103
 
@@ -45906,13 +46114,13 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45906
46114
  },
45907
46115
  addedSegment: function addedSegment(segmentInfo) {
45908
46116
  abrCallbacks.addedSegment(segmentInfo);
45909
- if (adapStreamCanceller.isUsed) {
46117
+ if (adapStreamCanceller.isUsed()) {
45910
46118
  return;
45911
46119
  }
45912
46120
  callbacks.addedSegment(segmentInfo);
45913
46121
  },
45914
46122
  terminating: function terminating() {
45915
- if (repStreamTerminatingCanceller.isUsed) {
46123
+ if (repStreamTerminatingCanceller.isUsed()) {
45916
46124
  return; // Already handled
45917
46125
  }
45918
46126
 
@@ -45935,9 +46143,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45935
46143
  * `TaskCanceller` triggered when the `RepresentationStream` calls its
45936
46144
  * `terminating` callback.
45937
46145
  */
45938
- var terminatingRepStreamCanceller = new task_canceller/* default */.ZP({
45939
- cancelOn: adapStreamCanceller.signal
45940
- });
46146
+ var terminatingRepStreamCanceller = new task_canceller/* default */.ZP();
46147
+ terminatingRepStreamCanceller.linkToSignal(adapStreamCanceller.signal);
45941
46148
  var bufferGoal = (0,reference/* createMappedReference */.lR)(wantedBufferAhead, function (prev) {
45942
46149
  return prev * getBufferGoalRatio(representation);
45943
46150
  }, terminatingRepStreamCanceller.signal);
@@ -45950,16 +46157,23 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
45950
46157
  defaultCode: "NONE",
45951
46158
  defaultReason: "Unknown `RepresentationStream` error"
45952
46159
  });
45953
- if (formattedError.code === "BUFFER_FULL_ERROR") {
46160
+ if (formattedError.code !== "BUFFER_FULL_ERROR") {
46161
+ representationStreamCallbacks.error(err);
46162
+ } else {
45954
46163
  var wba = wantedBufferAhead.getValue();
45955
46164
  var lastBufferGoalRatio = (_a = bufferGoalRatioMap.get(representation.id)) !== null && _a !== void 0 ? _a : 1;
45956
- 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) {
45957
46168
  throw formattedError;
45958
46169
  }
45959
- bufferGoalRatioMap.set(representation.id, lastBufferGoalRatio - 0.25);
45960
- 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);
45961
46176
  }
45962
- representationStreamCallbacks.error(err);
45963
46177
  },
45964
46178
  terminating: function terminating() {
45965
46179
  terminatingRepStreamCanceller.cancel();
@@ -46394,7 +46608,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
46394
46608
  period: period,
46395
46609
  adaptationRef: adaptationRef
46396
46610
  });
46397
- if (parentCancelSignal.isCancelled) {
46611
+ if (parentCancelSignal.isCancelled()) {
46398
46612
  return;
46399
46613
  }
46400
46614
  var currentStreamCanceller;
@@ -46413,76 +46627,75 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
46413
46627
  }
46414
46628
  return _context.abrupt("return");
46415
46629
  case 2:
46416
- streamCanceller = new task_canceller/* default */.ZP({
46417
- cancelOn: parentCancelSignal
46418
- });
46630
+ streamCanceller = new task_canceller/* default */.ZP();
46631
+ streamCanceller.linkToSignal(parentCancelSignal);
46419
46632
  currentStreamCanceller === null || currentStreamCanceller === void 0 ? void 0 : currentStreamCanceller.cancel(); // Cancel oreviously created stream if one
46420
46633
  currentStreamCanceller = streamCanceller;
46421
46634
  if (!(adaptation === null)) {
46422
- _context.next = 33;
46635
+ _context.next = 34;
46423
46636
  break;
46424
46637
  }
46425
46638
  // Current type is disabled for that Period
46426
46639
  log/* default.info */.Z.info("Stream: Set no " + bufferType + " Adaptation. P:", period.start);
46427
46640
  segmentBufferStatus = segmentBuffersStore.getStatus(bufferType);
46428
46641
  if (!(segmentBufferStatus.type === "initialized")) {
46429
- _context.next = 25;
46642
+ _context.next = 26;
46430
46643
  break;
46431
46644
  }
46432
46645
  log/* default.info */.Z.info("Stream: Clearing previous " + bufferType + " SegmentBuffer");
46433
46646
  if (!segment_buffers.isNative(bufferType)) {
46434
- _context.next = 14;
46647
+ _context.next = 15;
46435
46648
  break;
46436
46649
  }
46437
46650
  return _context.abrupt("return", askForMediaSourceReload(0, streamCanceller.signal));
46438
- case 14:
46651
+ case 15:
46439
46652
  periodEnd = (_a = period.end) !== null && _a !== void 0 ? _a : Infinity;
46440
46653
  if (!(period.start > periodEnd)) {
46441
- _context.next = 19;
46654
+ _context.next = 20;
46442
46655
  break;
46443
46656
  }
46444
46657
  log/* default.warn */.Z.warn("Stream: Can't free buffer: period's start is after its end");
46445
- _context.next = 23;
46658
+ _context.next = 24;
46446
46659
  break;
46447
- case 19:
46448
- _context.next = 21;
46660
+ case 20:
46661
+ _context.next = 22;
46449
46662
  return segmentBufferStatus.value.removeBuffer(period.start, periodEnd, streamCanceller.signal);
46450
- case 21:
46451
- if (!streamCanceller.isUsed) {
46452
- _context.next = 23;
46663
+ case 22:
46664
+ if (!streamCanceller.isUsed()) {
46665
+ _context.next = 24;
46453
46666
  break;
46454
46667
  }
46455
46668
  return _context.abrupt("return");
46456
- case 23:
46457
- _context.next = 29;
46669
+ case 24:
46670
+ _context.next = 30;
46458
46671
  break;
46459
- case 25:
46672
+ case 26:
46460
46673
  if (!(segmentBufferStatus.type === "uninitialized")) {
46461
- _context.next = 29;
46674
+ _context.next = 30;
46462
46675
  break;
46463
46676
  }
46464
46677
  segmentBuffersStore.disableSegmentBuffer(bufferType);
46465
- if (!streamCanceller.isUsed) {
46466
- _context.next = 29;
46678
+ if (!streamCanceller.isUsed()) {
46679
+ _context.next = 30;
46467
46680
  break;
46468
46681
  }
46469
46682
  return _context.abrupt("return");
46470
- case 29:
46683
+ case 30:
46471
46684
  callbacks.adaptationChange({
46472
46685
  type: bufferType,
46473
46686
  adaptation: null,
46474
46687
  period: period
46475
46688
  });
46476
- if (!streamCanceller.isUsed) {
46477
- _context.next = 32;
46689
+ if (!streamCanceller.isUsed()) {
46690
+ _context.next = 33;
46478
46691
  break;
46479
46692
  }
46480
46693
  return _context.abrupt("return");
46481
- case 32:
46694
+ case 33:
46482
46695
  return _context.abrupt("return", createEmptyAdaptationStream(playbackObserver, wantedBufferAhead, bufferType, {
46483
46696
  period: period
46484
46697
  }, callbacks, streamCanceller.signal));
46485
- case 33:
46698
+ case 34:
46486
46699
  /**
46487
46700
  * If this is not the first Adaptation choice, we might want to apply a
46488
46701
  * delta to the current position so we can re-play back some media in the
@@ -46494,23 +46707,23 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
46494
46707
  relativePosAfterSwitch = isFirstAdaptationSwitch ? 0 : bufferType === "audio" ? DELTA_POSITION_AFTER_RELOAD.trackSwitch.audio : bufferType === "video" ? DELTA_POSITION_AFTER_RELOAD.trackSwitch.video : DELTA_POSITION_AFTER_RELOAD.trackSwitch.other;
46495
46708
  isFirstAdaptationSwitch = false;
46496
46709
  if (!(segment_buffers.isNative(bufferType) && segmentBuffersStore.getStatus(bufferType).type === "disabled")) {
46497
- _context.next = 38;
46710
+ _context.next = 39;
46498
46711
  break;
46499
46712
  }
46500
46713
  return _context.abrupt("return", askForMediaSourceReload(relativePosAfterSwitch, streamCanceller.signal));
46501
- case 38:
46714
+ case 39:
46502
46715
  log/* default.info */.Z.info("Stream: Updating " + bufferType + " adaptation", "A: " + adaptation.id, "P: " + period.start);
46503
46716
  callbacks.adaptationChange({
46504
46717
  type: bufferType,
46505
46718
  adaptation: adaptation,
46506
46719
  period: period
46507
46720
  });
46508
- if (!streamCanceller.isUsed) {
46509
- _context.next = 42;
46721
+ if (!streamCanceller.isUsed()) {
46722
+ _context.next = 43;
46510
46723
  break;
46511
46724
  }
46512
46725
  return _context.abrupt("return");
46513
- case 42:
46726
+ case 43:
46514
46727
  readyState = playbackObserver.getReadyState();
46515
46728
  segmentBuffer = createOrReuseSegmentBuffer(segmentBuffersStore, bufferType, adaptation, options);
46516
46729
  playbackInfos = {
@@ -46519,57 +46732,57 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
46519
46732
  };
46520
46733
  strategy = getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, playbackInfos, options);
46521
46734
  if (!(strategy.type === "needs-reload")) {
46522
- _context.next = 48;
46735
+ _context.next = 49;
46523
46736
  break;
46524
46737
  }
46525
46738
  return _context.abrupt("return", askForMediaSourceReload(relativePosAfterSwitch, streamCanceller.signal));
46526
- case 48:
46527
- _context.next = 50;
46739
+ case 49:
46740
+ _context.next = 51;
46528
46741
  return segmentBuffersStore.waitForUsableBuffers(streamCanceller.signal);
46529
- case 50:
46530
- if (!streamCanceller.isUsed) {
46531
- _context.next = 52;
46742
+ case 51:
46743
+ if (!streamCanceller.isUsed()) {
46744
+ _context.next = 53;
46532
46745
  break;
46533
46746
  }
46534
46747
  return _context.abrupt("return");
46535
- case 52:
46748
+ case 53:
46536
46749
  if (!(strategy.type === "flush-buffer" || strategy.type === "clean-buffer")) {
46537
- _context.next = 66;
46750
+ _context.next = 67;
46538
46751
  break;
46539
46752
  }
46540
46753
  _iterator = period_stream_createForOfIteratorHelperLoose(strategy.value);
46541
- case 54:
46754
+ case 55:
46542
46755
  if ((_step = _iterator()).done) {
46543
- _context.next = 62;
46756
+ _context.next = 63;
46544
46757
  break;
46545
46758
  }
46546
46759
  _step$value = _step.value, start = _step$value.start, end = _step$value.end;
46547
- _context.next = 58;
46760
+ _context.next = 59;
46548
46761
  return segmentBuffer.removeBuffer(start, end, streamCanceller.signal);
46549
- case 58:
46550
- if (!streamCanceller.isUsed) {
46551
- _context.next = 60;
46762
+ case 59:
46763
+ if (!streamCanceller.isUsed()) {
46764
+ _context.next = 61;
46552
46765
  break;
46553
46766
  }
46554
46767
  return _context.abrupt("return");
46555
- case 60:
46556
- _context.next = 54;
46768
+ case 61:
46769
+ _context.next = 55;
46557
46770
  break;
46558
- case 62:
46771
+ case 63:
46559
46772
  if (!(strategy.type === "flush-buffer")) {
46560
- _context.next = 66;
46773
+ _context.next = 67;
46561
46774
  break;
46562
46775
  }
46563
46776
  callbacks.needsBufferFlush();
46564
- if (!streamCanceller.isUsed) {
46565
- _context.next = 66;
46777
+ if (!streamCanceller.isUsed()) {
46778
+ _context.next = 67;
46566
46779
  break;
46567
46780
  }
46568
46781
  return _context.abrupt("return");
46569
- case 66:
46782
+ case 67:
46570
46783
  garbageCollectors.get(segmentBuffer)(streamCanceller.signal);
46571
46784
  createAdaptationStream(adaptation, segmentBuffer, streamCanceller.signal);
46572
- case 68:
46785
+ case 69:
46573
46786
  case "end":
46574
46787
  return _context.stop();
46575
46788
  }
@@ -46622,7 +46835,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
46622
46835
  defaultReason: "Unknown `AdaptationStream` error"
46623
46836
  });
46624
46837
  callbacks.warning(formattedError);
46625
- if (cancelSignal.isCancelled) {
46838
+ if (cancelSignal.isCancelled()) {
46626
46839
  return; // Previous callback cancelled the Stream by side-effect
46627
46840
  }
46628
46841
 
@@ -46874,6 +47087,9 @@ function getTimeRangesForContent(segmentBuffer, contents) {
46874
47087
  ;// CONCATENATED MODULE: ./src/core/stream/orchestrator/stream_orchestrator.ts
46875
47088
 
46876
47089
 
47090
+ function stream_orchestrator_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 = stream_orchestrator_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."); }
47091
+ function stream_orchestrator_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return stream_orchestrator_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return stream_orchestrator_arrayLikeToArray(o, minLen); }
47092
+ function stream_orchestrator_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
46877
47093
  /**
46878
47094
  * Copyright 2015 CANAL+ Group
46879
47095
  *
@@ -46972,9 +47188,10 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
46972
47188
  };
46973
47189
  });
46974
47190
  // Create automatically the right `PeriodStream` for every possible types
46975
- segmentBuffersStore.getBufferTypes().map(function (bufferType) {
47191
+ for (var _iterator = stream_orchestrator_createForOfIteratorHelperLoose(segmentBuffersStore.getBufferTypes()), _step; !(_step = _iterator()).done;) {
47192
+ var bufferType = _step.value;
46976
47193
  manageEveryStreams(bufferType, initialPeriod);
46977
- });
47194
+ }
46978
47195
  /**
46979
47196
  * Manage creation and removal of Streams for every Periods for a given type.
46980
47197
  *
@@ -46998,9 +47215,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
46998
47215
  */
46999
47216
  var enableOutOfBoundsCheck = false;
47000
47217
  /** Cancels currently created `PeriodStream`s. */
47001
- var currentCanceller = new task_canceller/* default */.ZP({
47002
- cancelOn: orchestratorCancelSignal
47003
- });
47218
+ var currentCanceller = new task_canceller/* default */.ZP();
47219
+ currentCanceller.linkToSignal(orchestratorCancelSignal);
47004
47220
  // Restart the current Stream when the wanted time is in another period
47005
47221
  // than the ones already considered
47006
47222
  playbackObserver.listen(function (_ref) {
@@ -47021,9 +47237,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47021
47237
  });
47022
47238
  }
47023
47239
  currentCanceller.cancel();
47024
- currentCanceller = new task_canceller/* default */.ZP({
47025
- cancelOn: orchestratorCancelSignal
47026
- });
47240
+ currentCanceller = new task_canceller/* default */.ZP();
47241
+ currentCanceller.linkToSignal(orchestratorCancelSignal);
47027
47242
  var nextPeriod = (_b = manifest.getPeriodForTime(time)) !== null && _b !== void 0 ? _b : manifest.getNextPeriod(time);
47028
47243
  if (nextPeriod === undefined) {
47029
47244
  log/* default.warn */.Z.warn("Stream: The wanted position is not found in the Manifest.");
@@ -47115,7 +47330,13 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47115
47330
  ofCurrentType = updates.filter(function (update) {
47116
47331
  return update.adaptation.type === bufferType;
47117
47332
  });
47118
- if (!(ofCurrentType.length === 0 || segmentBufferStatus.type !== "initialized")) {
47333
+ if (!(
47334
+ // No update concerns the current type of data
47335
+ ofCurrentType.length === 0 || segmentBufferStatus.type !== "initialized" ||
47336
+ // The update only notifies of now-decipherable streams
47337
+ ofCurrentType.every(function (x) {
47338
+ return x.representation.decipherable === true;
47339
+ }))) {
47119
47340
  _context.next = 4;
47120
47341
  break;
47121
47342
  }
@@ -47154,34 +47375,33 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47154
47375
  });
47155
47376
  }
47156
47377
  currentCanceller.cancel();
47157
- currentCanceller = new task_canceller/* default */.ZP({
47158
- cancelOn: orchestratorCancelSignal
47159
- });
47378
+ currentCanceller = new task_canceller/* default */.ZP();
47379
+ currentCanceller.linkToSignal(orchestratorCancelSignal);
47160
47380
  /** Remove from the `SegmentBuffer` all the concerned time ranges. */
47161
47381
  _i = 0, _arr = [].concat(undecipherableRanges, rangesToRemove);
47162
- case 15:
47382
+ case 16:
47163
47383
  if (!(_i < _arr.length)) {
47164
- _context.next = 23;
47384
+ _context.next = 24;
47165
47385
  break;
47166
47386
  }
47167
47387
  _arr$_i = _arr[_i], start = _arr$_i.start, end = _arr$_i.end;
47168
47388
  if (!(start < end)) {
47169
- _context.next = 20;
47389
+ _context.next = 21;
47170
47390
  break;
47171
47391
  }
47172
- _context.next = 20;
47392
+ _context.next = 21;
47173
47393
  return segmentBuffer.removeBuffer(start, end, orchestratorCancelSignal);
47174
- case 20:
47394
+ case 21:
47175
47395
  _i++;
47176
- _context.next = 15;
47396
+ _context.next = 16;
47177
47397
  break;
47178
- case 23:
47398
+ case 24:
47179
47399
  // Schedule micro task before checking the last playback observation
47180
47400
  // to reduce the risk of race conditions where the next observation
47181
47401
  // was going to be emitted synchronously.
47182
47402
  next_tick_default()(function () {
47183
47403
  var _a, _b;
47184
- if (orchestratorCancelSignal.isCancelled) {
47404
+ if (orchestratorCancelSignal.isCancelled()) {
47185
47405
  return;
47186
47406
  }
47187
47407
  var observation = playbackObserver.getReference().getValue();
@@ -47192,12 +47412,12 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47192
47412
  autoPlay: shouldAutoPlay,
47193
47413
  duration: observation.duration
47194
47414
  });
47195
- if (orchestratorCancelSignal.isCancelled) {
47415
+ if (orchestratorCancelSignal.isCancelled()) {
47196
47416
  return;
47197
47417
  }
47198
47418
  } else if (needsFlushingAfterClean(observation, rangesToRemove)) {
47199
47419
  callbacks.needsBufferFlush();
47200
- if (orchestratorCancelSignal.isCancelled) {
47420
+ if (orchestratorCancelSignal.isCancelled()) {
47201
47421
  return;
47202
47422
  }
47203
47423
  }
@@ -47209,7 +47429,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47209
47429
  }
47210
47430
  launchConsecutiveStreamsForPeriod(newInitialPeriod);
47211
47431
  });
47212
- case 24:
47432
+ case 25:
47213
47433
  case "end":
47214
47434
  return _context.stop();
47215
47435
  }
@@ -47258,9 +47478,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47258
47478
  */
47259
47479
  var nextStreamInfo = null;
47260
47480
  /** Emits when the `PeriodStream` linked to `basePeriod` should be destroyed. */
47261
- var currentStreamCanceller = new task_canceller/* default */.ZP({
47262
- cancelOn: cancelSignal
47263
- });
47481
+ var currentStreamCanceller = new task_canceller/* default */.ZP();
47482
+ currentStreamCanceller.linkToSignal(cancelSignal);
47264
47483
  // Stop current PeriodStream when the current position goes over the end of
47265
47484
  // that Period.
47266
47485
  playbackObserver.listen(function (_ref2, stopListeningObservations) {
@@ -47337,10 +47556,10 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
47337
47556
  });
47338
47557
  nextStreamInfo.canceller.cancel();
47339
47558
  }
47559
+ var nextStreamCanceller = new task_canceller/* default */.ZP();
47560
+ nextStreamCanceller.linkToSignal(cancelSignal);
47340
47561
  nextStreamInfo = {
47341
- canceller: new task_canceller/* default */.ZP({
47342
- cancelOn: cancelSignal
47343
- }),
47562
+ canceller: nextStreamCanceller,
47344
47563
  period: nextPeriod
47345
47564
  };
47346
47565
  manageConsecutivePeriodStreams(bufferType, nextPeriod, consecutivePeriodStreamCb, nextStreamInfo.canceller.signal);
@@ -47480,7 +47699,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
47480
47699
  });
47481
47700
  manifest.addEventListener("manifestUpdate", function () {
47482
47701
  _this.trigger("durationUpdate", getManifestDuration());
47483
- if (cancelSignal.isCancelled) {
47702
+ if (cancelSignal.isCancelled()) {
47484
47703
  return;
47485
47704
  }
47486
47705
  _this._checkEndOfStream();
@@ -47519,7 +47738,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
47519
47738
  }
47520
47739
  }
47521
47740
  }
47522
- if (this._canceller.isUsed) {
47741
+ if (this._canceller.isUsed()) {
47523
47742
  return;
47524
47743
  }
47525
47744
  if (adaptation === null) {
@@ -47973,22 +48192,11 @@ function createMediaSource(mediaElement, unlinkSignal) {
47973
48192
  * @returns {Promise}
47974
48193
  */
47975
48194
  function openMediaSource(mediaElement, unlinkSignal) {
47976
- return new Promise(function (resolve, reject) {
47977
- var hasResolved = false;
48195
+ return (0,create_cancellable_promise/* default */.Z)(unlinkSignal, function (resolve) {
47978
48196
  var mediaSource = createMediaSource(mediaElement, unlinkSignal);
47979
- var eventListenerCanceller = new task_canceller/* default */.ZP({
47980
- cancelOn: unlinkSignal
47981
- });
47982
48197
  event_listeners/* onSourceOpen */.u_(mediaSource, function () {
47983
- eventListenerCanceller.cancel();
47984
- hasResolved = true;
47985
48198
  resolve(mediaSource);
47986
- }, eventListenerCanceller.signal);
47987
- unlinkSignal.register(function (error) {
47988
- if (!hasResolved) {
47989
- reject(error);
47990
- }
47991
- });
48199
+ }, unlinkSignal);
47992
48200
  });
47993
48201
  }
47994
48202
  ;// CONCATENATED MODULE: ./src/core/init/utils/create_stream_playback_observer.ts
@@ -48134,9 +48342,8 @@ function triggerEndOfStream(mediaSource, cancelSignal) {
48134
48342
  return;
48135
48343
  }
48136
48344
  log/* default.debug */.Z.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");
48137
- var innerCanceller = new task_canceller/* default */.ZP({
48138
- cancelOn: cancelSignal
48139
- });
48345
+ var innerCanceller = new task_canceller/* default */.ZP();
48346
+ innerCanceller.linkToSignal(cancelSignal);
48140
48347
  for (var _iterator = end_of_stream_createForOfIteratorHelperLoose(updatingSourceBuffers), _step; !(_step = _iterator()).done;) {
48141
48348
  var sourceBuffer = _step.value;
48142
48349
  onSourceBufferUpdate(sourceBuffer, function () {
@@ -48156,14 +48363,12 @@ function triggerEndOfStream(mediaSource, cancelSignal) {
48156
48363
  * @param {Object} cancelSignal
48157
48364
  */
48158
48365
  function maintainEndOfStream(mediaSource, cancelSignal) {
48159
- var endOfStreamCanceller = new task_canceller/* default */.ZP({
48160
- cancelOn: cancelSignal
48161
- });
48366
+ var endOfStreamCanceller = new task_canceller/* default */.ZP();
48367
+ endOfStreamCanceller.linkToSignal(cancelSignal);
48162
48368
  onSourceOpen(mediaSource, function () {
48163
48369
  endOfStreamCanceller.cancel();
48164
- endOfStreamCanceller = new task_canceller/* default */.ZP({
48165
- cancelOn: cancelSignal
48166
- });
48370
+ endOfStreamCanceller = new task_canceller/* default */.ZP();
48371
+ endOfStreamCanceller.linkToSignal(cancelSignal);
48167
48372
  triggerEndOfStream(mediaSource, endOfStreamCanceller.signal);
48168
48373
  }, cancelSignal);
48169
48374
  triggerEndOfStream(mediaSource, endOfStreamCanceller.signal);
@@ -48312,9 +48517,8 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
48312
48517
  this._currentKnownDuration = currentKnownDuration;
48313
48518
  var isMediaSourceOpened = createMediaSourceOpenReference(mediaSource, this._canceller.signal);
48314
48519
  /** TaskCanceller triggered each time the MediaSource open status changes. */
48315
- var msUpdateCanceller = new task_canceller/* default */.ZP({
48316
- cancelOn: this._canceller.signal
48317
- });
48520
+ var msUpdateCanceller = new task_canceller/* default */.ZP();
48521
+ msUpdateCanceller.linkToSignal(this._canceller.signal);
48318
48522
  isMediaSourceOpened.onUpdate(onMediaSourceOpenedStatusChanged, {
48319
48523
  emitCurrentValue: true,
48320
48524
  clearSignal: this._canceller.signal
@@ -48324,18 +48528,15 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
48324
48528
  if (!isMediaSourceOpened.getValue()) {
48325
48529
  return;
48326
48530
  }
48327
- msUpdateCanceller = new task_canceller/* default */.ZP({
48328
- cancelOn: canceller.signal
48329
- });
48330
- /** TaskCanceller triggered each time the content's duration may have change */
48331
- var durationChangeCanceller = new task_canceller/* default */.ZP({
48332
- cancelOn: msUpdateCanceller.signal
48333
- });
48531
+ msUpdateCanceller = new task_canceller/* default */.ZP();
48532
+ msUpdateCanceller.linkToSignal(canceller.signal);
48533
+ /** TaskCanceller triggered each time the content's duration may have changed */
48534
+ var durationChangeCanceller = new task_canceller/* default */.ZP();
48535
+ durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
48334
48536
  var reSetDuration = function reSetDuration() {
48335
48537
  durationChangeCanceller.cancel();
48336
- durationChangeCanceller = new task_canceller/* default */.ZP({
48337
- cancelOn: msUpdateCanceller.signal
48338
- });
48538
+ durationChangeCanceller = new task_canceller/* default */.ZP();
48539
+ durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
48339
48540
  onDurationMayHaveChanged(durationChangeCanceller.signal);
48340
48541
  };
48341
48542
  currentKnownDuration.onUpdate(reSetDuration, {
@@ -48348,14 +48549,12 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
48348
48549
  function onDurationMayHaveChanged(cancelSignal) {
48349
48550
  var areSourceBuffersUpdating = createSourceBuffersUpdatingReference(mediaSource.sourceBuffers, cancelSignal);
48350
48551
  /** TaskCanceller triggered each time SourceBuffers' updating status changes */
48351
- var sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP({
48352
- cancelOn: cancelSignal
48353
- });
48552
+ var sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
48553
+ sourceBuffersUpdatingCanceller.linkToSignal(cancelSignal);
48354
48554
  return areSourceBuffersUpdating.onUpdate(function (areUpdating) {
48355
48555
  sourceBuffersUpdatingCanceller.cancel();
48356
- sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP({
48357
- cancelOn: cancelSignal
48358
- });
48556
+ sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
48557
+ sourceBuffersUpdatingCanceller.linkToSignal(cancelSignal);
48359
48558
  if (areUpdating) {
48360
48559
  return;
48361
48560
  }
@@ -48407,18 +48606,20 @@ function setMediaSourceDuration(mediaSource, manifest, knownDuration) {
48407
48606
  var newDuration = knownDuration;
48408
48607
  if (newDuration === undefined) {
48409
48608
  if (manifest.isDynamic) {
48410
- var maxPotentialPos = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : manifest.getMaximumSafePosition();
48411
- // Some targets poorly support setting a very high number for durations.
48412
- // Yet, in dynamic contents, we would prefer setting a value as high as possible
48413
- // to still be able to seek anywhere we want to (even ahead of the Manifest if
48414
- // we want to). As such, we put it at a safe default value of 2^32 excepted
48415
- // when the maximum position is already relatively close to that value, where
48416
- // we authorize exceptionally going over it.
48417
- newDuration = Math.max(Math.pow(2, 32), maxPotentialPos + YEAR_IN_SECONDS);
48609
+ newDuration = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : manifest.getMaximumSafePosition();
48418
48610
  } else {
48419
48611
  newDuration = manifest.getMaximumSafePosition();
48420
48612
  }
48421
48613
  }
48614
+ if (manifest.isDynamic) {
48615
+ // Some targets poorly support setting a very high number for durations.
48616
+ // Yet, in dynamic contents, we would prefer setting a value as high as possible
48617
+ // to still be able to seek anywhere we want to (even ahead of the Manifest if
48618
+ // we want to). As such, we put it at a safe default value of 2^32 excepted
48619
+ // when the maximum position is already relatively close to that value, where
48620
+ // we authorize exceptionally going over it.
48621
+ newDuration = Math.max(Math.pow(2, 32), newDuration + YEAR_IN_SECONDS);
48622
+ }
48422
48623
  var maxBufferedEnd = 0;
48423
48624
  for (var i = 0; i < mediaSource.sourceBuffers.length; i++) {
48424
48625
  var sourceBuffer = mediaSource.sourceBuffers[i];
@@ -48697,17 +48898,15 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
48697
48898
  scheduledEventsRef.setValue(refresh_scheduled_events_list(prev, manifest));
48698
48899
  }, cancelSignal);
48699
48900
  var isPollingEvents = false;
48700
- var cancelCurrentPolling = new task_canceller/* default */.ZP({
48701
- cancelOn: cancelSignal
48702
- });
48901
+ var cancelCurrentPolling = new task_canceller/* default */.ZP();
48902
+ cancelCurrentPolling.linkToSignal(cancelSignal);
48703
48903
  scheduledEventsRef.onUpdate(function (_ref) {
48704
48904
  var scheduledEventsLength = _ref.length;
48705
48905
  if (scheduledEventsLength === 0) {
48706
48906
  if (isPollingEvents) {
48707
48907
  cancelCurrentPolling.cancel();
48708
- cancelCurrentPolling = new task_canceller/* default */.ZP({
48709
- cancelOn: cancelSignal
48710
- });
48908
+ cancelCurrentPolling = new task_canceller/* default */.ZP();
48909
+ cancelCurrentPolling.linkToSignal(cancelSignal);
48711
48910
  isPollingEvents = false;
48712
48911
  }
48713
48912
  return;
@@ -48799,7 +48998,7 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
48799
48998
  } else {
48800
48999
  onEventSkip(_event.value);
48801
49000
  }
48802
- if (stopSignal.isCancelled) {
49001
+ if (stopSignal.isCancelled()) {
48803
49002
  return;
48804
49003
  }
48805
49004
  }
@@ -48810,7 +49009,7 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
48810
49009
  if (typeof _event2.onExit === "function") {
48811
49010
  _event2.onExit();
48812
49011
  }
48813
- if (stopSignal.isCancelled) {
49012
+ if (stopSignal.isCancelled()) {
48814
49013
  return;
48815
49014
  }
48816
49015
  }
@@ -48891,6 +49090,7 @@ function media_source_content_initializer_arrayLikeToArray(arr, len) { if (len =
48891
49090
 
48892
49091
 
48893
49092
 
49093
+
48894
49094
 
48895
49095
 
48896
49096
  /**
@@ -48931,11 +49131,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
48931
49131
  if (this._initialManifestProm !== null) {
48932
49132
  return;
48933
49133
  }
48934
- this._initialManifestProm = new Promise(function (res, rej) {
48935
- _this2._initCanceller.signal.register(function (err) {
48936
- _this2._manifestFetcher.dispose();
48937
- rej(err);
48938
- });
49134
+ this._initialManifestProm = (0,create_cancellable_promise/* default */.Z)(this._initCanceller.signal, function (res, rej) {
48939
49135
  _this2._manifestFetcher.addEventListener("warning", function (err) {
48940
49136
  return _this2.trigger("warning", err);
48941
49137
  });
@@ -48946,7 +49142,10 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
48946
49142
  _this2._manifestFetcher.addEventListener("manifestReady", function (manifest) {
48947
49143
  res(manifest);
48948
49144
  });
48949
- _this2._manifestFetcher.start();
49145
+ });
49146
+ this._manifestFetcher.start();
49147
+ this._initCanceller.signal.register(function () {
49148
+ _this2._manifestFetcher.dispose();
48950
49149
  });
48951
49150
  }
48952
49151
  /**
@@ -48982,7 +49181,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
48982
49181
  this._initCanceller.cancel();
48983
49182
  };
48984
49183
  _proto._onFatalError = function _onFatalError(err) {
48985
- if (this._initCanceller.isUsed) {
49184
+ if (this._initCanceller.isUsed()) {
48986
49185
  return;
48987
49186
  }
48988
49187
  this._initCanceller.cancel();
@@ -48990,12 +49189,9 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
48990
49189
  };
48991
49190
  _proto._initializeMediaSourceAndDecryption = function _initializeMediaSourceAndDecryption(mediaElement, protectionRef) {
48992
49191
  var _this4 = this;
48993
- return new Promise(function (resolve, reject) {
49192
+ var initCanceller = this._initCanceller;
49193
+ return (0,create_cancellable_promise/* default */.Z)(initCanceller.signal, function (resolve) {
48994
49194
  var keySystems = _this4._settings.keySystems;
48995
- var initCanceller = _this4._initCanceller;
48996
- var unregisterReject = initCanceller.signal.register(function (err) {
48997
- reject(err);
48998
- });
48999
49195
  /** Initialize decryption capabilities. */
49000
49196
  var drmInitRef = (0,initialize_content_decryption/* default */.Z)(mediaElement, keySystems, protectionRef, {
49001
49197
  onWarning: function onWarning(err) {
@@ -49010,9 +49206,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49010
49206
  return;
49011
49207
  }
49012
49208
  stopListeningToDrmUpdates();
49013
- var mediaSourceCanceller = new task_canceller/* default */.ZP({
49014
- cancelOn: initCanceller.signal
49015
- });
49209
+ var mediaSourceCanceller = new task_canceller/* default */.ZP();
49210
+ mediaSourceCanceller.linkToSignal(initCanceller.signal);
49016
49211
  openMediaSource(mediaElement, mediaSourceCanceller.signal).then(function (mediaSource) {
49017
49212
  var lastDrmStatus = drmInitRef.getValue();
49018
49213
  if (lastDrmStatus.initializationState.type === "awaiting-media-link") {
@@ -49020,7 +49215,6 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49020
49215
  drmInitRef.onUpdate(function (newDrmStatus, stopListeningToDrmUpdatesAgain) {
49021
49216
  if (newDrmStatus.initializationState.type === "initialized") {
49022
49217
  stopListeningToDrmUpdatesAgain();
49023
- unregisterReject();
49024
49218
  resolve({
49025
49219
  mediaSource: mediaSource,
49026
49220
  drmSystemId: newDrmStatus.drmSystemId,
@@ -49033,7 +49227,6 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49033
49227
  clearSignal: initCanceller.signal
49034
49228
  });
49035
49229
  } else if (drmStatus.initializationState.type === "initialized") {
49036
- unregisterReject();
49037
49230
  resolve({
49038
49231
  mediaSource: mediaSource,
49039
49232
  drmSystemId: drmStatus.drmSystemId,
@@ -49042,7 +49235,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49042
49235
  return;
49043
49236
  }
49044
49237
  })["catch"](function (err) {
49045
- if (mediaSourceCanceller.isUsed) {
49238
+ if (mediaSourceCanceller.isUsed()) {
49046
49239
  return;
49047
49240
  }
49048
49241
  _this4._onFatalError(err);
@@ -49078,20 +49271,19 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49078
49271
  bufferOnMediaSource(opts, onReloadMediaSource, currentCanceller.signal);
49079
49272
  function onReloadMediaSource(reloadOrder) {
49080
49273
  currentCanceller.cancel();
49081
- if (initCanceller.isUsed) {
49274
+ if (initCanceller.isUsed()) {
49082
49275
  return;
49083
49276
  }
49084
49277
  triggerEvent("reloadingMediaSource", null);
49085
- if (initCanceller.isUsed) {
49278
+ if (initCanceller.isUsed()) {
49086
49279
  return;
49087
49280
  }
49088
- var newCanceller = new task_canceller/* default */.ZP({
49089
- cancelOn: initCanceller.signal
49090
- });
49281
+ var newCanceller = new task_canceller/* default */.ZP();
49282
+ newCanceller.linkToSignal(initCanceller.signal);
49091
49283
  openMediaSource(mediaElement, newCanceller.signal).then(function (newMediaSource) {
49092
49284
  recursivelyLoadOnMediaSource(newMediaSource, reloadOrder.position, reloadOrder.autoPlay, newCanceller);
49093
49285
  })["catch"](function (err) {
49094
- if (newCanceller.isUsed) {
49286
+ if (newCanceller.isUsed()) {
49095
49287
  return;
49096
49288
  }
49097
49289
  onFatalError(err);
@@ -49131,7 +49323,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49131
49323
  }, bufferOptions);
49132
49324
  segmentFetcherCreator = new segment(transport, segmentRequestOptions, initCanceller.signal);
49133
49325
  this.trigger("manifestReady", manifest);
49134
- if (!initCanceller.isUsed) {
49326
+ if (!initCanceller.isUsed()) {
49135
49327
  _context.next = 25;
49136
49328
  break;
49137
49329
  }
@@ -49200,7 +49392,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49200
49392
  autoPlayResult = _performInitialSeekAn.autoPlayResult,
49201
49393
  initialPlayPerformed = _performInitialSeekAn.initialPlayPerformed,
49202
49394
  initialSeekPerformed = _performInitialSeekAn.initialSeekPerformed;
49203
- if (cancelSignal.isCancelled) {
49395
+ if (cancelSignal.isCancelled()) {
49204
49396
  return;
49205
49397
  }
49206
49398
  initialPlayPerformed.onUpdate(function (isPerformed, stopListening) {
@@ -49243,7 +49435,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49243
49435
  clearSignal: cancelSignal
49244
49436
  });
49245
49437
  })["catch"](function (err) {
49246
- if (cancelSignal.isCancelled) {
49438
+ if (cancelSignal.isCancelled()) {
49247
49439
  return; // Current loading cancelled, no need to trigger the error
49248
49440
  }
49249
49441
 
@@ -49277,7 +49469,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49277
49469
  discontinuity: imminentDiscontinuity,
49278
49470
  position: position
49279
49471
  });
49280
- if (cancelSignal.isCancelled) {
49472
+ if (cancelSignal.isCancelled()) {
49281
49473
  return; // Previous call has stopped streams due to a side-effect
49282
49474
  }
49283
49475
  // If the status for the last Period indicates that segments are all loaded
@@ -49312,7 +49504,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49312
49504
  },
49313
49505
  adaptationChange: function adaptationChange(value) {
49314
49506
  self.trigger("adaptationChange", value);
49315
- if (cancelSignal.isCancelled) {
49507
+ if (cancelSignal.isCancelled()) {
49316
49508
  return; // Previous call has stopped streams due to a side-effect
49317
49509
  }
49318
49510
 
@@ -49320,7 +49512,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49320
49512
  },
49321
49513
  representationChange: function representationChange(value) {
49322
49514
  self.trigger("representationChange", value);
49323
- if (cancelSignal.isCancelled) {
49515
+ if (cancelSignal.isCancelled()) {
49324
49516
  return; // Previous call has stopped streams due to a side-effect
49325
49517
  }
49326
49518
 
@@ -49337,7 +49529,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49337
49529
  },
49338
49530
  periodStreamCleared: function periodStreamCleared(value) {
49339
49531
  contentTimeBoundariesObserver.onPeriodCleared(value.type, value.period);
49340
- if (cancelSignal.isCancelled) {
49532
+ if (cancelSignal.isCancelled()) {
49341
49533
  return; // Previous call has stopped streams due to a side-effect
49342
49534
  }
49343
49535
 
@@ -49370,7 +49562,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49370
49562
  for (var _iterator = media_source_content_initializer_createForOfIteratorHelperLoose(value), _step; !(_step = _iterator()).done;) {
49371
49563
  var protectionData = _step.value;
49372
49564
  protectionRef.setValue(protectionData);
49373
- if (cancelSignal.isCancelled) {
49565
+ if (cancelSignal.isCancelled()) {
49374
49566
  return; // Previous call has stopped streams due to a side-effect
49375
49567
  }
49376
49568
  }
@@ -49424,9 +49616,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49424
49616
  });
49425
49617
  contentTimeBoundariesObserver.addEventListener("endOfStream", function () {
49426
49618
  if (endOfStreamCanceller === null) {
49427
- endOfStreamCanceller = new task_canceller/* default */.ZP({
49428
- cancelOn: cancelSignal
49429
- });
49619
+ endOfStreamCanceller = new task_canceller/* default */.ZP();
49620
+ endOfStreamCanceller.linkToSignal(cancelSignal);
49430
49621
  log/* default.debug */.Z.debug("Init: end-of-stream order received.");
49431
49622
  maintainEndOfStream(mediaSource, endOfStreamCanceller.signal);
49432
49623
  }
@@ -50075,7 +50266,7 @@ var PlaybackObserver = /*#__PURE__*/function () {
50075
50266
  */;
50076
50267
  _proto.listen = function listen(cb, options) {
50077
50268
  var _a;
50078
- if (this._canceller.isUsed || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled) === true) {
50269
+ if (this._canceller.isUsed() || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled()) === true) {
50079
50270
  return noop/* default */.Z;
50080
50271
  }
50081
50272
  this._observationRef.onUpdate(cb, {
@@ -50492,7 +50683,7 @@ function generateReadOnlyObserver(src, transform, cancellationSignal) {
50492
50683
  },
50493
50684
  listen: function listen(cb, options) {
50494
50685
  var _a;
50495
- if (cancellationSignal.isCancelled || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled) === true) {
50686
+ if (cancellationSignal.isCancelled() || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled()) === true) {
50496
50687
  return;
50497
50688
  }
50498
50689
  mappedRef.onUpdate(cb, {
@@ -51621,13 +51812,13 @@ function getRightVideoTrack(adaptation, isTrickModeEnabled) {
51621
51812
  * remove all listeners this function has registered.
51622
51813
  */
51623
51814
  function emitSeekEvents(mediaElement, playbackObserver, onSeeking, onSeeked, cancelSignal) {
51624
- if (cancelSignal.isCancelled || mediaElement === null) {
51815
+ if (cancelSignal.isCancelled() || mediaElement === null) {
51625
51816
  return;
51626
51817
  }
51627
51818
  var wasSeeking = playbackObserver.getReference().getValue().seeking;
51628
51819
  if (wasSeeking) {
51629
51820
  onSeeking();
51630
- if (cancelSignal.isCancelled) {
51821
+ if (cancelSignal.isCancelled()) {
51631
51822
  return;
51632
51823
  }
51633
51824
  }
@@ -51649,7 +51840,7 @@ function constructPlayerStateReference(initializer, mediaElement, playbackObserv
51649
51840
  initializer.addEventListener("loaded", function () {
51650
51841
  if (playerStateRef.getValue() === "LOADING" /* PLAYER_STATES.LOADING */) {
51651
51842
  playerStateRef.setValue("LOADED" /* PLAYER_STATES.LOADED */);
51652
- if (!cancelSignal.isCancelled) {
51843
+ if (!cancelSignal.isCancelled()) {
51653
51844
  var newState = getLoadedContentState(mediaElement, null);
51654
51845
  if (newState !== "PAUSED" /* PLAYER_STATES.PAUSED */) {
51655
51846
  playerStateRef.setValue(newState);
@@ -51826,7 +52017,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
51826
52017
  // Workaround to support Firefox autoplay on FF 42.
51827
52018
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
51828
52019
  videoElement.preload = "auto";
51829
- _this.version = /* PLAYER_VERSION */"3.30.0-dev.2023020100";
52020
+ _this.version = /* PLAYER_VERSION */"3.30.0-dev.2023030200";
51830
52021
  _this.log = log/* default */.Z;
51831
52022
  _this.state = "STOPPED";
51832
52023
  _this.videoElement = videoElement;
@@ -52028,6 +52219,18 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52028
52219
  newOptions.autoPlay = autoPlay;
52029
52220
  }
52030
52221
  this._priv_initializeContentPlayback(newOptions);
52222
+ };
52223
+ _proto.createDebugElement = function createDebugElement(element) {
52224
+ if (features/* default.createDebugElement */.Z.createDebugElement === null) {
52225
+ throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");
52226
+ }
52227
+ var canceller = new task_canceller/* default */.ZP();
52228
+ features/* default.createDebugElement */.Z.createDebugElement(element, this, canceller.signal);
52229
+ return {
52230
+ dispose: function dispose() {
52231
+ canceller.cancel();
52232
+ }
52233
+ };
52031
52234
  }
52032
52235
  /**
52033
52236
  * From given options, initialize content playback.
@@ -52171,7 +52374,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52171
52374
  throw new Error("DirectFile feature not activated in your build.");
52172
52375
  }
52173
52376
  mediaElementTrackChoiceManager = this._priv_initializeMediaElementTrackChoiceManager(defaultAudioTrack, defaultTextTrack, currentContentCanceller.signal);
52174
- if (currentContentCanceller.isUsed) {
52377
+ if (currentContentCanceller.isUsed()) {
52175
52378
  return;
52176
52379
  }
52177
52380
  initializer = new features/* default.directfile.initDirectFile */.Z.directfile.initDirectFile({
@@ -52346,7 +52549,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52346
52549
  playerStateRef.onUpdate(function (newState) {
52347
52550
  updateReloadingMetadata(newState);
52348
52551
  _this2._priv_setPlayerState(newState);
52349
- if (currentContentCanceller.isUsed) {
52552
+ if (currentContentCanceller.isUsed()) {
52350
52553
  return;
52351
52554
  }
52352
52555
  if (seekEventsCanceller !== null) {
@@ -52355,9 +52558,8 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52355
52558
  seekEventsCanceller = null;
52356
52559
  }
52357
52560
  } else if (isLoadedState(_this2.state)) {
52358
- seekEventsCanceller = new task_canceller/* default */.ZP({
52359
- cancelOn: currentContentCanceller.signal
52360
- });
52561
+ seekEventsCanceller = new task_canceller/* default */.ZP();
52562
+ seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
52361
52563
  emitSeekEvents(videoElement, playbackObserver, function () {
52362
52564
  return _this2.trigger("seeking", null);
52363
52565
  }, function () {
@@ -52367,7 +52569,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52367
52569
  // Previous call could have performed all kind of side-effects, thus,
52368
52570
  // we re-check the current state associated to the RxPlayer
52369
52571
  if (_this2.state === "ENDED" /* PLAYER_STATES.ENDED */ && _this2._priv_stopAtEnd) {
52370
- currentContentCanceller.cancel();
52572
+ _this2.stop();
52371
52573
  }
52372
52574
  }, {
52373
52575
  emitCurrentValue: true,
@@ -53718,16 +53920,16 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
53718
53920
  this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
53719
53921
  }
53720
53922
  this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange", this.getAvailableAudioBitrates(), cancelSignal);
53721
- if (contentInfos.currentContentCanceller.isUsed) {
53923
+ if (contentInfos.currentContentCanceller.isUsed()) {
53722
53924
  return;
53723
53925
  }
53724
53926
  this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange", this.getAvailableVideoBitrates(), cancelSignal);
53725
- if (contentInfos.currentContentCanceller.isUsed) {
53927
+ if (contentInfos.currentContentCanceller.isUsed()) {
53726
53928
  return;
53727
53929
  }
53728
53930
  var audioBitrate = (_e = (_d = (_c = this._priv_getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c.audio) === null || _d === void 0 ? void 0 : _d.bitrate) !== null && _e !== void 0 ? _e : -1;
53729
53931
  this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange", audioBitrate, cancelSignal);
53730
- if (contentInfos.currentContentCanceller.isUsed) {
53932
+ if (contentInfos.currentContentCanceller.isUsed()) {
53731
53933
  return;
53732
53934
  }
53733
53935
  var videoBitrate = (_h = (_g = (_f = this._priv_getCurrentRepresentations()) === null || _f === void 0 ? void 0 : _f.video) === null || _g === void 0 ? void 0 : _g.bitrate) !== null && _h !== void 0 ? _h : -1;
@@ -54013,7 +54215,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54013
54215
  */;
54014
54216
  _proto._priv_triggerAvailableBitratesChangeEvent = function _priv_triggerAvailableBitratesChangeEvent(event, newVal, currentContentCancelSignal) {
54015
54217
  var prevVal = this._priv_contentEventsMemory[event];
54016
- if (!currentContentCancelSignal.isCancelled && (prevVal === undefined || !(0,are_arrays_of_numbers_equal/* default */.Z)(newVal, prevVal))) {
54218
+ if (!currentContentCancelSignal.isCancelled() && (prevVal === undefined || !(0,are_arrays_of_numbers_equal/* default */.Z)(newVal, prevVal))) {
54017
54219
  this._priv_contentEventsMemory[event] = newVal;
54018
54220
  this.trigger(event, newVal);
54019
54221
  }
@@ -54026,7 +54228,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54026
54228
  * @param {Object} currentContentCancelSignal
54027
54229
  */;
54028
54230
  _proto._priv_triggerCurrentBitrateChangeEvent = function _priv_triggerCurrentBitrateChangeEvent(event, newVal, currentContentCancelSignal) {
54029
- if (!currentContentCancelSignal.isCancelled && newVal !== this._priv_contentEventsMemory[event]) {
54231
+ if (!currentContentCancelSignal.isCancelled() && newVal !== this._priv_contentEventsMemory[event]) {
54030
54232
  this._priv_contentEventsMemory[event] = newVal;
54031
54233
  this.trigger(event, newVal);
54032
54234
  }
@@ -54049,7 +54251,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54049
54251
  * @param {Object} currentContentCancelSignal
54050
54252
  */;
54051
54253
  _proto._priv_triggerEventIfNotStopped = function _priv_triggerEventIfNotStopped(evt, arg, currentContentCancelSignal) {
54052
- if (!currentContentCancelSignal.isCancelled) {
54254
+ if (!currentContentCancelSignal.isCancelled()) {
54053
54255
  this.trigger(evt, arg);
54054
54256
  }
54055
54257
  }
@@ -54130,7 +54332,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54130
54332
  }]);
54131
54333
  return Player;
54132
54334
  }(event_emitter/* default */.Z);
54133
- Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023020100";
54335
+ Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023030200";
54134
54336
  /* harmony default export */ var public_api = (Player);
54135
54337
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
54136
54338
  /**
@@ -54188,7 +54390,7 @@ function initializeFeaturesObject() {
54188
54390
  features_object/* default.imageParser */.Z.imageParser = (__webpack_require__(3203)/* ["default"] */ .Z);
54189
54391
  }
54190
54392
  // Feature switching the Native TextTrack implementation
54191
- var HAS_NATIVE_MODE = 1 || 0 || 0 || 0;
54393
+ var HAS_NATIVE_MODE = true || 0;
54192
54394
  if (true) {
54193
54395
  features_object/* default.transports.smooth */.Z.transports.smooth = (__webpack_require__(2339)/* ["default"] */ .Z);
54194
54396
  }
@@ -54198,7 +54400,8 @@ function initializeFeaturesObject() {
54198
54400
  }
54199
54401
  if (false) {}
54200
54402
  if (false) {}
54201
- if (HAS_NATIVE_MODE === 1) {
54403
+ if (false) {}
54404
+ if (HAS_NATIVE_MODE) {
54202
54405
  features_object/* default.nativeTextTracksBuffer */.Z.nativeTextTracksBuffer = (__webpack_require__(9059)/* ["default"] */ .Z);
54203
54406
  if (true) {
54204
54407
  features_object/* default.nativeTextTracksParsers.vtt */.Z.nativeTextTracksParsers.vtt = (__webpack_require__(9405)/* ["default"] */ .Z);
@@ -54214,8 +54417,8 @@ function initializeFeaturesObject() {
54214
54417
  }
54215
54418
  }
54216
54419
  // Feature switching the HTML TextTrack implementation
54217
- var HAS_HTML_MODE = 1 || 0 || 0 || 0;
54218
- if (HAS_HTML_MODE === 1) {
54420
+ var HAS_HTML_MODE = true || 0;
54421
+ if (HAS_HTML_MODE) {
54219
54422
  features_object/* default.htmlTextTracksBuffer */.Z.htmlTextTracksBuffer = (__webpack_require__(5192)/* ["default"] */ .Z);
54220
54423
  if (true) {
54221
54424
  features_object/* default.htmlTextTracksParsers.sami */.Z.htmlTextTracksParsers.sami = (__webpack_require__(5734)/* ["default"] */ .Z);