rx-player 4.0.0-dev.2023111400 → 4.0.0-dev.2023120600

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 (407) hide show
  1. package/CHANGELOG.md +11 -227
  2. package/FILES.md +1 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -3
  5. package/dist/_esm5.processed/compat/add_text_track.js +4 -7
  6. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -7
  7. package/dist/_esm5.processed/compat/event_listeners.d.ts +2 -15
  8. package/dist/_esm5.processed/compat/event_listeners.js +2 -37
  9. package/dist/_esm5.processed/compat/index.d.ts +1 -3
  10. package/dist/_esm5.processed/compat/index.js +1 -3
  11. package/dist/_esm5.processed/config.d.ts +9 -21
  12. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -58
  13. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +14 -54
  14. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +2 -8
  15. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +2 -11
  16. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
  17. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +13 -32
  18. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
  19. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
  20. package/dist/_esm5.processed/core/api/option_utils.d.ts +12 -35
  21. package/dist/_esm5.processed/core/api/option_utils.js +41 -230
  22. package/dist/_esm5.processed/core/api/public_api.d.ts +91 -266
  23. package/dist/_esm5.processed/core/api/public_api.js +439 -805
  24. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.d.ts +3 -2
  25. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.js +3 -2
  26. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +15 -75
  27. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +74 -193
  28. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +84 -0
  29. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +158 -0
  30. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +406 -0
  31. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +932 -0
  32. package/dist/_esm5.processed/core/api/utils.d.ts +1 -0
  33. package/dist/_esm5.processed/core/api/utils.js +28 -11
  34. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
  35. package/dist/_esm5.processed/core/decrypt/find_key_system.js +83 -71
  36. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +6 -5
  37. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +10 -72
  38. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
  39. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +6 -4
  40. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +1 -3
  41. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +7 -26
  42. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +3 -9
  43. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +16 -9
  44. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -3
  45. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  46. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +1 -6
  47. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +4 -41
  48. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
  49. package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +1 -8
  50. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -19
  51. package/dist/_esm5.processed/core/init/types.d.ts +5 -15
  52. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
  53. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
  54. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
  55. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
  56. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  57. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  58. package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
  59. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
  60. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
  61. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
  62. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
  63. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
  64. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
  65. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +0 -15
  66. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +183 -93
  67. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
  68. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
  69. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +27 -13
  70. package/dist/_esm5.processed/core/stream/index.d.ts +2 -3
  71. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +2 -0
  72. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -7
  73. package/dist/_esm5.processed/core/stream/period/period_stream.js +13 -12
  74. package/dist/_esm5.processed/core/stream/period/types.d.ts +5 -14
  75. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +2 -4
  76. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +10 -46
  77. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +29 -23
  78. package/dist/_esm5.processed/core/stream/representation/types.d.ts +11 -1
  79. package/dist/_esm5.processed/default_config.d.ts +35 -98
  80. package/dist/_esm5.processed/default_config.js +36 -113
  81. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +1 -3
  82. package/dist/_esm5.processed/errors/custom_loader_error.js +1 -3
  83. package/dist/_esm5.processed/errors/media_error.js +2 -2
  84. package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
  85. package/dist/_esm5.processed/errors/network_error.js +0 -1
  86. package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
  87. package/dist/_esm5.processed/errors/request_error.js +2 -5
  88. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
  89. package/dist/_esm5.processed/features/features_object.js +0 -2
  90. package/dist/_esm5.processed/features/list/directfile.js +2 -5
  91. package/dist/_esm5.processed/features/list/index.d.ts +0 -2
  92. package/dist/_esm5.processed/features/list/index.js +0 -2
  93. package/dist/_esm5.processed/features/types.d.ts +3 -27
  94. package/dist/_esm5.processed/manifest/adaptation.d.ts +9 -11
  95. package/dist/_esm5.processed/manifest/adaptation.js +41 -30
  96. package/dist/_esm5.processed/manifest/index.d.ts +3 -4
  97. package/dist/_esm5.processed/manifest/manifest.d.ts +5 -54
  98. package/dist/_esm5.processed/manifest/manifest.js +5 -110
  99. package/dist/_esm5.processed/manifest/period.d.ts +4 -5
  100. package/dist/_esm5.processed/manifest/representation.d.ts +10 -5
  101. package/dist/_esm5.processed/manifest/representation.js +15 -5
  102. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  103. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +2 -0
  104. package/dist/_esm5.processed/manifest/representation_index/static.js +6 -0
  105. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +42 -21
  106. package/dist/_esm5.processed/manifest/types.d.ts +0 -2
  107. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +17 -31
  108. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +26 -19
  109. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -0
  110. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +7 -1
  111. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +2 -6
  112. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +11 -8
  113. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
  114. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +6 -0
  115. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  116. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
  117. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
  118. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
  119. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
  120. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  121. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
  122. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
  123. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +10 -6
  124. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +4 -2
  125. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
  126. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
  127. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
  128. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +3 -6
  129. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +1 -2
  130. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
  131. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +6 -0
  132. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
  133. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
  134. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
  135. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
  136. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +11 -17
  137. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -83
  138. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +53 -125
  139. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
  140. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
  141. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
  142. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  143. package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
  144. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
  145. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
  146. package/dist/_esm5.processed/public_types.d.ts +396 -308
  147. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +5 -4
  148. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +5 -4
  149. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  150. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  151. package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
  152. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  153. package/dist/_esm5.processed/transports/dash/segment_loader.js +26 -20
  154. package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
  155. package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
  156. package/dist/_esm5.processed/transports/dash/text_parser.js +28 -33
  157. package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
  158. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
  159. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  160. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  161. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  162. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  163. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -52
  164. package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/smooth/is_mp4_embedded_track.d.ts} +5 -5
  165. package/dist/_esm5.processed/{features/list/image_buffer.d.ts → transports/smooth/is_mp4_embedded_track.js} +7 -6
  166. package/dist/_esm5.processed/transports/smooth/pipelines.js +33 -190
  167. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  168. package/dist/_esm5.processed/transports/smooth/segment_loader.js +28 -22
  169. package/dist/_esm5.processed/transports/smooth/utils.d.ts +1 -26
  170. package/dist/_esm5.processed/transports/smooth/utils.js +1 -55
  171. package/dist/_esm5.processed/transports/types.d.ts +94 -89
  172. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  173. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  174. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
  175. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
  176. package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
  177. package/dist/_esm5.processed/utils/array_includes.d.ts +2 -1
  178. package/dist/_esm5.processed/utils/array_includes.js +30 -28
  179. package/dist/_esm5.processed/utils/request/xhr.js +5 -5
  180. package/dist/commonjs/compat/is_codec_supported.js +22 -1
  181. package/dist/commonjs/config.d.ts +1 -0
  182. package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
  183. package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
  184. package/dist/commonjs/core/api/option_utils.d.ts +2 -0
  185. package/dist/commonjs/core/api/option_utils.js +2 -3
  186. package/dist/commonjs/core/api/public_api.d.ts +9 -0
  187. package/dist/commonjs/core/api/public_api.js +34 -9
  188. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  189. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
  190. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  191. package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
  192. package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  193. package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
  194. package/dist/commonjs/core/init/directfile_content_initializer.js +24 -7
  195. package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
  196. package/dist/commonjs/core/init/media_source_content_initializer.js +4 -6
  197. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  198. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +16 -17
  199. package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
  200. package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
  201. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +3 -3
  202. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
  203. package/dist/commonjs/default_config.d.ts +5 -0
  204. package/dist/commonjs/default_config.js +5 -0
  205. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  206. package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  207. package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
  208. package/dist/commonjs/manifest/representation_index/static.js +2 -2
  209. package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
  210. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  211. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
  212. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  213. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  214. package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  215. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  216. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
  217. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  218. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
  219. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  220. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  221. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
  222. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  223. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  224. package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
  225. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
  226. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  227. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
  228. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  229. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
  230. package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +7 -3
  231. package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
  232. package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
  233. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  234. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
  235. package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
  236. package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
  237. package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
  238. package/dist/commonjs/public_types.d.ts +78 -34
  239. package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
  240. package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
  241. package/dist/commonjs/transports/dash/segment_loader.js +2 -1
  242. package/dist/commonjs/transports/dash/text_loader.js +2 -0
  243. package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
  244. package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
  245. package/dist/commonjs/transports/smooth/pipelines.js +4 -2
  246. package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
  247. package/dist/commonjs/transports/types.d.ts +12 -0
  248. package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
  249. package/dist/commonjs/utils/request/fetch.d.ts +6 -0
  250. package/dist/commonjs/utils/request/fetch.js +29 -8
  251. package/dist/commonjs/utils/request/xhr.d.ts +11 -5
  252. package/dist/commonjs/utils/request/xhr.js +29 -8
  253. package/dist/es2017/compat/is_codec_supported.js +22 -1
  254. package/dist/es2017/config.d.ts +1 -0
  255. package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
  256. package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
  257. package/dist/es2017/core/api/option_utils.d.ts +2 -0
  258. package/dist/es2017/core/api/option_utils.js +2 -3
  259. package/dist/es2017/core/api/public_api.d.ts +9 -0
  260. package/dist/es2017/core/api/public_api.js +33 -8
  261. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  262. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
  263. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  264. package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
  265. package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  266. package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
  267. package/dist/es2017/core/init/directfile_content_initializer.js +24 -7
  268. package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
  269. package/dist/es2017/core/init/media_source_content_initializer.js +4 -6
  270. package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  271. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +16 -15
  272. package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
  273. package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
  274. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +3 -3
  275. package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
  276. package/dist/es2017/default_config.d.ts +5 -0
  277. package/dist/es2017/default_config.js +5 -0
  278. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  279. package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  280. package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
  281. package/dist/es2017/manifest/representation_index/static.js +2 -2
  282. package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
  283. package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  284. package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
  285. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  286. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  287. package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  288. package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  289. package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
  290. package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  291. package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
  292. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  293. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  294. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
  295. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  296. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  297. package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
  298. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
  299. package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  300. package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
  301. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  302. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
  303. package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +7 -3
  304. package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
  305. package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
  306. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  307. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
  308. package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
  309. package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
  310. package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
  311. package/dist/es2017/public_types.d.ts +78 -34
  312. package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
  313. package/dist/es2017/transports/dash/manifest_parser.js +3 -0
  314. package/dist/es2017/transports/dash/segment_loader.js +1 -0
  315. package/dist/es2017/transports/dash/text_loader.js +2 -0
  316. package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
  317. package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
  318. package/dist/es2017/transports/smooth/pipelines.js +2 -0
  319. package/dist/es2017/transports/smooth/segment_loader.js +1 -0
  320. package/dist/es2017/transports/types.d.ts +12 -0
  321. package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
  322. package/dist/es2017/utils/request/fetch.d.ts +6 -0
  323. package/dist/es2017/utils/request/fetch.js +29 -8
  324. package/dist/es2017/utils/request/xhr.d.ts +11 -5
  325. package/dist/es2017/utils/request/xhr.js +30 -9
  326. package/dist/rx-player.js +723 -376
  327. package/dist/rx-player.min.js +1 -1
  328. package/package.json +3 -4
  329. package/scripts/update-version +2 -0
  330. package/sonar-project.properties +1 -1
  331. package/src/compat/is_codec_supported.ts +23 -1
  332. package/src/core/api/debug/buffer_graph.ts +2 -5
  333. package/src/core/api/debug/modules/general_info.ts +15 -10
  334. package/src/core/api/option_utils.ts +3 -3
  335. package/src/core/api/public_api.ts +35 -7
  336. package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
  337. package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
  338. package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
  339. package/src/core/fetchers/utils/schedule_request.ts +1 -1
  340. package/src/core/init/directfile_content_initializer.ts +23 -7
  341. package/src/core/init/media_source_content_initializer.ts +13 -7
  342. package/src/core/init/utils/content_time_boundaries_observer.ts +23 -22
  343. package/src/core/init/utils/get_initial_time.ts +25 -12
  344. package/src/core/stream/representation/utils/get_buffer_status.ts +3 -3
  345. package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
  346. package/src/default_config.ts +5 -0
  347. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
  348. package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
  349. package/src/manifest/representation_index/static.ts +2 -2
  350. package/src/manifest/representation_index/types.ts +4 -4
  351. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
  352. package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
  353. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
  354. package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
  355. package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
  356. package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
  357. package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
  358. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
  359. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
  360. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
  361. package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
  362. package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
  363. package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
  364. package/src/parsers/manifest/dash/common/parse_representations.ts +9 -3
  365. package/src/parsers/manifest/local/representation_index.ts +3 -3
  366. package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
  367. package/src/parsers/manifest/smooth/representation_index.ts +23 -9
  368. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
  369. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
  370. package/src/parsers/manifest/utils/index_helpers.ts +1 -1
  371. package/src/public_types.ts +79 -34
  372. package/src/transports/dash/init_segment_loader.ts +5 -0
  373. package/src/transports/dash/manifest_parser.ts +6 -0
  374. package/src/transports/dash/segment_loader.ts +1 -0
  375. package/src/transports/dash/text_loader.ts +2 -0
  376. package/src/transports/metaplaylist/manifest_loader.ts +1 -0
  377. package/src/transports/metaplaylist/pipelines.ts +4 -1
  378. package/src/transports/smooth/pipelines.ts +2 -0
  379. package/src/transports/smooth/segment_loader.ts +1 -0
  380. package/src/transports/types.ts +12 -0
  381. package/src/transports/utils/generate_manifest_loader.ts +3 -0
  382. package/src/utils/request/fetch.ts +35 -8
  383. package/src/utils/request/xhr.ts +45 -14
  384. package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
  385. package/dist/_esm5.processed/compat/fullscreen.js +0 -78
  386. package/dist/_esm5.processed/compat/is_offline.d.ts +0 -39
  387. package/dist/_esm5.processed/compat/is_offline.js +0 -43
  388. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +0 -258
  389. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +0 -989
  390. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -75
  391. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -133
  392. package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
  393. package/dist/_esm5.processed/features/list/bif_parser.js +0 -27
  394. package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
  395. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -38
  396. package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -129
  397. package/dist/_esm5.processed/utils/list_to_map.js +0 -28
  398. package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
  399. package/dist/_esm5.processed/utils/simple_set.js +0 -57
  400. package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
  401. package/dist/_esm5.processed/utils/uniq.js +0 -43
  402. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  403. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
  404. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  405. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
  406. package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
  407. package/src/typings/object-assign.d.ts +0 -48
@@ -126,7 +126,7 @@ export default function createSegmentFetcher(bufferType, pipeline, cdnPrioritize
126
126
  * @returns {Promise}
127
127
  */
128
128
  function callLoaderWithUrl(cdnMetadata) {
129
- return loadSegment(cdnMetadata, content, requestOptions, cancellationSignal, loaderCallbacks);
129
+ return loadSegment(cdnMetadata, context, requestOptions, cancellationSignal, loaderCallbacks);
130
130
  }
131
131
  /**
132
132
  * Generate function allowing to parse a loaded segment.
@@ -140,7 +140,7 @@ export default function createSegmentFetcher(bufferType, pipeline, cdnPrioritize
140
140
  return function parse(initTimescale) {
141
141
  var loaded = { data: data, isChunked: isChunked };
142
142
  try {
143
- var parsed = parseSegment(loaded, content, initTimescale);
143
+ var parsed = parseSegment(loaded, context, initTimescale);
144
144
  if (!parsedChunks[parsedChunkId]) {
145
145
  segmentDurationAcc = segmentDurationAcc !== undefined &&
146
146
  parsed.segmentType === "media" &&
@@ -189,15 +189,24 @@ export default function createSegmentFetcher(bufferType, pipeline, cdnPrioritize
189
189
  });
190
190
  }
191
191
  }
192
- var segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, loaderCallbacks, cached, res, loadedData, err_1;
192
+ var segment, adaptation, representation, manifest, period, segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, context, loaderCallbacks, cached, res, loadedData, err_1;
193
193
  return __generator(this, function (_d) {
194
194
  switch (_d.label) {
195
195
  case 0:
196
+ segment = content.segment, adaptation = content.adaptation, representation = content.representation, manifest = content.manifest, period = content.period;
196
197
  segmentIdString = getLoggableSegmentId(content);
197
198
  requestId = generateRequestID();
198
199
  parsedChunks = [];
199
200
  segmentDurationAcc = 0;
200
201
  metricsSent = false;
202
+ context = { segment: segment, type: adaptation.type,
203
+ language: adaptation.language,
204
+ isLive: manifest.isLive,
205
+ periodStart: period.start,
206
+ periodEnd: period.end,
207
+ mimeType: representation.mimeType,
208
+ codecs: representation.codec,
209
+ manifestPublishTime: manifest.publishTime };
201
210
  loaderCallbacks = {
202
211
  /**
203
212
  * Callback called when the segment loader has progress information on
@@ -293,12 +302,10 @@ export default function createSegmentFetcher(bufferType, pipeline, cdnPrioritize
293
302
  * @param {Object}
294
303
  * @returns {Object}
295
304
  */
296
- export function getSegmentFetcherOptions(bufferType, _a) {
297
- var maxRetryRegular = _a.maxRetryRegular, maxRetryOffline = _a.maxRetryOffline, lowLatencyMode = _a.lowLatencyMode, requestTimeout = _a.requestTimeout;
298
- var _b = config.getCurrent(), DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR = _b.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR, DEFAULT_REQUEST_TIMEOUT = _b.DEFAULT_REQUEST_TIMEOUT, DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE = _b.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE, INITIAL_BACKOFF_DELAY_BASE = _b.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = _b.MAX_BACKOFF_DELAY_BASE;
299
- return { maxRetryRegular: bufferType === "image" ? 0 :
300
- maxRetryRegular !== null && maxRetryRegular !== void 0 ? maxRetryRegular : DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,
301
- maxRetryOffline: maxRetryOffline !== null && maxRetryOffline !== void 0 ? maxRetryOffline : DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,
305
+ export function getSegmentFetcherOptions(_a) {
306
+ var maxRetry = _a.maxRetry, lowLatencyMode = _a.lowLatencyMode, requestTimeout = _a.requestTimeout;
307
+ var _b = config.getCurrent(), DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR = _b.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR, DEFAULT_REQUEST_TIMEOUT = _b.DEFAULT_REQUEST_TIMEOUT, INITIAL_BACKOFF_DELAY_BASE = _b.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = _b.MAX_BACKOFF_DELAY_BASE;
308
+ return { maxRetry: maxRetry !== null && maxRetry !== void 0 ? maxRetry : DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,
302
309
  baseDelay: lowLatencyMode ? INITIAL_BACKOFF_DELAY_BASE.LOW_LATENCY :
303
310
  INITIAL_BACKOFF_DELAY_BASE.REGULAR,
304
311
  maxDelay: lowLatencyMode ? MAX_BACKOFF_DELAY_BASE.LOW_LATENCY :
@@ -66,9 +66,7 @@ export interface ISegmentFetcherCreatorBackoffOptions {
66
66
  */
67
67
  lowLatencyMode: boolean;
68
68
  /** Maximum number of time a request on error will be retried. */
69
- maxRetryRegular: number | undefined;
70
- /** Maximum number of time a request be retried when the user is offline. */
71
- maxRetryOffline: number | undefined;
69
+ maxRetry: number | undefined;
72
70
  /**
73
71
  * Timeout after which request are aborted and, depending on other options,
74
72
  * retried.
@@ -47,7 +47,7 @@ var SegmentFetcherCreator = /** @class */ (function () {
47
47
  * @returns {Object}
48
48
  */
49
49
  SegmentFetcherCreator.prototype.createSegmentFetcher = function (bufferType, callbacks) {
50
- var backoffOptions = getSegmentFetcherOptions(bufferType, this._backoffOptions);
50
+ var backoffOptions = getSegmentFetcherOptions(this._backoffOptions);
51
51
  var pipelines = this._transport[bufferType];
52
52
  // Types are very complicated here as they are per-type of buffer.
53
53
  var segmentFetcher = createSegmentFetcher(bufferType, pipelines, this._cdnPrioritizer, callbacks, backoffOptions);
@@ -32,12 +32,7 @@ export interface IBackoffSettings {
32
32
  * Maximum number of retries to perform on "regular" errors (e.g. due to HTTP
33
33
  * status, integrity errors, timeouts...).
34
34
  */
35
- maxRetryRegular: number;
36
- /**
37
- * Maximum number of retries to perform when it appears that the user is
38
- * currently offline.
39
- */
40
- maxRetryOffline: number;
35
+ maxRetry: number;
41
36
  /** Callback called when a request is retried. */
42
37
  onRetry: (err: unknown) => void;
43
38
  }
@@ -49,7 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
50
  }
51
51
  };
52
- import { isOffline } from "../../../compat";
53
52
  import { CustomLoaderError, isKnownError, NetworkErrorTypes, RequestError, } from "../../../errors";
54
53
  import log from "../../../log";
55
54
  import cancellableSleep from "../../../utils/cancellable_sleep";
@@ -97,31 +96,6 @@ function shouldRetry(error) {
97
96
  }
98
97
  return isKnownError(error) && error.code === "INTEGRITY_ERROR";
99
98
  }
100
- /**
101
- * Returns true if we're pretty sure that the current error is due to the
102
- * user being offline.
103
- * @param {Error} error
104
- * @returns {Boolean}
105
- */
106
- function isOfflineRequestError(error) {
107
- if (error instanceof RequestError) {
108
- return error.type === NetworkErrorTypes.ERROR_EVENT &&
109
- isOffline();
110
- }
111
- else if (error instanceof CustomLoaderError) {
112
- return error.isOfflineError;
113
- }
114
- return false; // under doubt, return false
115
- }
116
- /**
117
- * Guess the type of error obtained.
118
- * @param {*} error
119
- * @returns {number}
120
- */
121
- function getRequestErrorType(error) {
122
- return isOfflineRequestError(error) ? 2 /* REQUEST_ERROR_TYPES.Offline */ :
123
- 1 /* REQUEST_ERROR_TYPES.Regular */;
124
- }
125
99
  /**
126
100
  * Specific algorithm used to perform segment and manifest requests.
127
101
  *
@@ -214,7 +188,7 @@ export function scheduleRequestWithCdns(cdns, cdnPrioritizer, performRequest, op
214
188
  */
215
189
  function requestCdn(cdn) {
216
190
  return __awaiter(this, void 0, void 0, function () {
217
- var res, error_1, currentErrorType, missedAttemptsObj, maxRetry, errorCounter, delay, fuzzedDelay;
191
+ var res, error_1, missedAttemptsObj, errorCounter, delay, fuzzedDelay;
218
192
  return __generator(this, function (_a) {
219
193
  switch (_a.label) {
220
194
  case 0:
@@ -233,32 +207,21 @@ export function scheduleRequestWithCdns(cdns, cdnPrioritizer, performRequest, op
233
207
  // Globally give priority to the next CDN through the CdnPrioritizer.
234
208
  cdnPrioritizer.downgradeCdn(cdn);
235
209
  }
236
- currentErrorType = getRequestErrorType(error_1);
237
210
  missedAttemptsObj = missedAttempts.get(cdn);
238
211
  if (missedAttemptsObj === undefined) {
239
212
  missedAttemptsObj = { errorCounter: 1,
240
- lastErrorType: currentErrorType,
241
213
  blockedUntil: undefined,
242
214
  isBlacklisted: false };
243
215
  missedAttempts.set(cdn, missedAttemptsObj);
244
216
  }
245
217
  else {
246
- if (currentErrorType !== missedAttemptsObj.lastErrorType) {
247
- missedAttemptsObj.errorCounter = 1;
248
- missedAttemptsObj.lastErrorType = currentErrorType;
249
- }
250
- else {
251
- missedAttemptsObj.errorCounter++;
252
- }
218
+ missedAttemptsObj.errorCounter++;
253
219
  }
254
220
  if (!shouldRetry(error_1)) {
255
221
  missedAttemptsObj.blockedUntil = undefined;
256
222
  missedAttemptsObj.isBlacklisted = true;
257
223
  return [2 /*return*/, retryWithNextCdn(error_1)];
258
224
  }
259
- maxRetry = currentErrorType === 2 /* REQUEST_ERROR_TYPES.Offline */ ?
260
- maxRetryOffline :
261
- maxRetryRegular;
262
225
  if (missedAttemptsObj.errorCounter > maxRetry) {
263
226
  missedAttemptsObj.blockedUntil = undefined;
264
227
  missedAttemptsObj.isBlacklisted = true;
@@ -393,12 +356,12 @@ export function scheduleRequestWithCdns(cdns, cdnPrioritizer, performRequest, op
393
356
  acc;
394
357
  }, undefined)) === null || _a === void 0 ? void 0 : _a[0];
395
358
  }
396
- var baseDelay, maxDelay, maxRetryRegular, maxRetryOffline, onRetry, missedAttempts, initialCdnToRequest;
359
+ var baseDelay, maxDelay, maxRetry, onRetry, missedAttempts, initialCdnToRequest;
397
360
  return __generator(this, function (_a) {
398
361
  if (cancellationSignal.cancellationError !== null) {
399
362
  return [2 /*return*/, Promise.reject(cancellationSignal.cancellationError)];
400
363
  }
401
- baseDelay = options.baseDelay, maxDelay = options.maxDelay, maxRetryRegular = options.maxRetryRegular, maxRetryOffline = options.maxRetryOffline, onRetry = options.onRetry;
364
+ baseDelay = options.baseDelay, maxDelay = options.maxDelay, maxRetry = options.maxRetry, onRetry = options.onRetry;
402
365
  if (cdns !== null && cdns.length === 0) {
403
366
  log.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`.");
404
367
  }
@@ -98,7 +98,7 @@ var DirectFileContentInitializer = /** @class */ (function (_super) {
98
98
  * Class trying to avoid various stalling situations, emitting "stalled"
99
99
  * events when it cannot, as well as "unstalled" events when it get out of one.
100
100
  */
101
- var rebufferingController = new RebufferingController(playbackObserver, null, null, speed);
101
+ var rebufferingController = new RebufferingController(playbackObserver, null, speed);
102
102
  rebufferingController.addEventListener("stalled", function (evt) {
103
103
  return _this.trigger("stalled", evt);
104
104
  });
@@ -20,7 +20,6 @@ import { IAdaptiveRepresentationSelectorArguments } from "../adaptive";
20
20
  import { PlaybackObserver } from "../api";
21
21
  import { IManifestFetcherSettings } from "../fetchers/manifest/manifest_fetcher";
22
22
  import { ITextTrackSegmentBufferOptions } from "../segment_buffers";
23
- import { IAudioTrackSwitchingMode } from "../stream";
24
23
  import { ContentInitializer } from "./types";
25
24
  import { IInitialTimeOptions } from "./utils/get_initial_time";
26
25
  /**
@@ -136,15 +135,11 @@ export interface IInitializeArguments {
136
135
  maxBufferAhead: IReadOnlySharedReference<number>;
137
136
  /** Max buffer size before the current position, in seconds (we GC further down). */
138
137
  maxBufferBehind: IReadOnlySharedReference<number>;
139
- /** Strategy when switching the current bitrate manually (smooth vs reload). */
140
- manualBitrateSwitchingMode: "seamless" | "direct";
141
138
  /**
142
139
  * Enable/Disable fastSwitching: allow to replace lower-quality segments by
143
140
  * higher-quality ones to have a faster transition.
144
141
  */
145
142
  enableFastSwitching: boolean;
146
- /** Strategy when switching of audio track. */
147
- audioTrackSwitchingMode: IAudioTrackSwitchingMode;
148
143
  /** Behavior when a new video and/or audio codec is encountered. */
149
144
  onCodecSwitch: "continue" | "reload";
150
145
  };
@@ -166,9 +161,7 @@ export interface IInitializeArguments {
166
161
  */
167
162
  requestTimeout: number | undefined;
168
163
  /** Maximum number of time a request on error will be retried. */
169
- maxRetryRegular: number | undefined;
170
- /** Maximum number of time a request be retried when the user is offline. */
171
- maxRetryOffline: number | undefined;
164
+ maxRetry: number | undefined;
172
165
  };
173
166
  /** Emit the playback rate (speed) set by the user. */
174
167
  speed: IReadOnlySharedReference<number>;
@@ -288,9 +288,6 @@ var MediaSourceContentInitializer = /** @class */ (function (_super) {
288
288
  manifest.addEventListener("manifestUpdate", function () {
289
289
  _this.trigger("manifestUpdate", null);
290
290
  }, initCanceller.signal);
291
- manifest.addEventListener("decipherabilityUpdate", function (args) {
292
- _this.trigger("decipherabilityUpdate", args);
293
- }, initCanceller.signal);
294
291
  log.debug("Init: Calculating initial time");
295
292
  initialTime = getInitialTime(manifest, lowLatencyMode, startAt);
296
293
  log.debug("Init: Initial time calculated:", initialTime);
@@ -352,18 +349,7 @@ var MediaSourceContentInitializer = /** @class */ (function (_super) {
352
349
  }
353
350
  }, { clearSignal: cancelSignal, emitCurrentValue: true });
354
351
  var streamObserver = createStreamPlaybackObserver(playbackObserver, { autoPlay: autoPlay, manifest: manifest, initialPlayPerformed: initialPlayPerformed, initialSeekPerformed: initialSeekPerformed, speed: speed, startTime: initialTime }, cancelSignal);
355
- var rebufferingController = this._createRebufferingController(playbackObserver, manifest, segmentBuffersStore, speed, cancelSignal);
356
- rebufferingController.addEventListener("needsReload", function () {
357
- // NOTE couldn't both be always calculated at event destination?
358
- // Maybe there are exceptions?
359
- var position = initialSeekPerformed.getValue() ?
360
- playbackObserver.getCurrentTime() :
361
- initialTime;
362
- var autoplay = initialPlayPerformed.getValue() ?
363
- !playbackObserver.getIsPaused() :
364
- autoPlay;
365
- onReloadOrder({ position: position, autoPlay: autoplay });
366
- }, cancelSignal);
352
+ var rebufferingController = this._createRebufferingController(playbackObserver, manifest, speed, cancelSignal);
367
353
  var contentTimeBoundariesObserver = this
368
354
  ._createContentTimeBoundariesObserver(manifest, mediaSource, streamObserver, segmentBuffersStore, cancelSignal);
369
355
  /**
@@ -493,8 +479,8 @@ var MediaSourceContentInitializer = /** @class */ (function (_super) {
493
479
  }
494
480
  self.trigger("periodStreamCleared", value);
495
481
  },
496
- bitrateEstimationChange: function (value) {
497
- return self.trigger("bitrateEstimationChange", value);
482
+ bitrateEstimateChange: function (value) {
483
+ return self.trigger("bitrateEstimateChange", value);
498
484
  },
499
485
  addedSegment: function (value) { return self.trigger("addedSegment", value); },
500
486
  needsMediaSourceReload: function (payload) {
@@ -620,9 +606,9 @@ var MediaSourceContentInitializer = /** @class */ (function (_super) {
620
606
  * @param {Object} cancelSignal
621
607
  * @returns {Object}
622
608
  */
623
- MediaSourceContentInitializer.prototype._createRebufferingController = function (playbackObserver, manifest, segmentBuffersStore, speed, cancelSignal) {
609
+ MediaSourceContentInitializer.prototype._createRebufferingController = function (playbackObserver, manifest, speed, cancelSignal) {
624
610
  var _this = this;
625
- var rebufferingController = new RebufferingController(playbackObserver, manifest, segmentBuffersStore, speed);
611
+ var rebufferingController = new RebufferingController(playbackObserver, manifest, speed);
626
612
  // Bubble-up events
627
613
  rebufferingController.addEventListener("stalled", function (evt) { return _this.trigger("stalled", evt); });
628
614
  rebufferingController.addEventListener("unstalled", function () { return _this.trigger("unstalled", null); });
@@ -19,7 +19,7 @@ import EventEmitter from "../../utils/event_emitter";
19
19
  import SharedReference from "../../utils/reference";
20
20
  import { PlaybackObserver } from "../api";
21
21
  import SegmentBuffersStore, { IBufferType } from "../segment_buffers";
22
- import { IInbandEvent } from "../stream";
22
+ import { IAdaptationChoice, IInbandEvent } from "../stream";
23
23
  import { IPublicNonFiniteStreamEvent, IPublicStreamEvent } from "./utils/stream_events_emitter";
24
24
  /**
25
25
  * Class allowing to start playing a content on an `HTMLMediaElement`.
@@ -115,18 +115,6 @@ export interface IContentInitializerEvents {
115
115
  loaded: {
116
116
  segmentBuffersStore: SegmentBuffersStore | null;
117
117
  };
118
- /**
119
- * Event sent after updating the decipherability status of at least one
120
- * Manifest's Representation.
121
- * This generally means that some Representation(s) were detected to be
122
- * undecipherable on the current device.
123
- */
124
- decipherabilityUpdate: Array<{
125
- manifest: Manifest;
126
- period: Period;
127
- adaptation: Adaptation;
128
- representation: Representation;
129
- }>;
130
118
  /** Event emitted when a stream event is encountered. */
131
119
  streamEvent: IPublicStreamEvent | IPublicNonFiniteStreamEvent;
132
120
  streamEventSkip: IPublicStreamEvent | IPublicNonFiniteStreamEvent;
@@ -142,6 +130,8 @@ export interface IContentInitializerEvents {
142
130
  periodStreamReady: {
143
131
  /** The type of buffer linked to the `PeriodStream` we want to create. */
144
132
  type: IBufferType;
133
+ /** The `Manifest` linked to the `PeriodStream` we have created. */
134
+ manifest: Manifest;
145
135
  /** The `Period` linked to the `PeriodStream` we have created. */
146
136
  period: Period;
147
137
  /**
@@ -155,7 +145,7 @@ export interface IContentInitializerEvents {
155
145
  * It is set to `undefined` by default, you SHOULD NOT set it to `undefined`
156
146
  * yourself.
157
147
  */
158
- adaptationRef: SharedReference<Adaptation | null | undefined>;
148
+ adaptationRef: SharedReference<IAdaptationChoice | null | undefined>;
159
149
  };
160
150
  /**
161
151
  * A `PeriodStream` has been removed.
@@ -182,7 +172,7 @@ export interface IContentInitializerEvents {
182
172
  /** Emitted when a new `Adaptation` is being considered. */
183
173
  adaptationChange: IAdaptationChangeEventPayload;
184
174
  /** Emitted as new bitrate estimates are done. */
185
- bitrateEstimationChange: {
175
+ bitrateEstimateChange: {
186
176
  /** The type of buffer for which the estimation is done. */
187
177
  type: IBufferType;
188
178
  /**
@@ -18,7 +18,7 @@ import { IPlayerError } from "../../../public_types";
18
18
  import EventEmitter from "../../../utils/event_emitter";
19
19
  import { IReadOnlySharedReference } from "../../../utils/reference";
20
20
  import { PlaybackObserver } from "../../api";
21
- import SegmentBuffersStore, { IBufferType } from "../../segment_buffers";
21
+ import { IBufferType } from "../../segment_buffers";
22
22
  import { IStallingSituation } from "../types";
23
23
  /**
24
24
  * Monitor playback, trying to avoid stalling situation.
@@ -32,7 +32,6 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
32
32
  /** Emit the current playback conditions */
33
33
  private _playbackObserver;
34
34
  private _manifest;
35
- private _segmentBuffersStore;
36
35
  private _speed;
37
36
  private _isStarted;
38
37
  /**
@@ -41,23 +40,12 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
41
40
  */
42
41
  private _discontinuitiesStore;
43
42
  private _canceller;
44
- /**
45
- * If set to something else than `null`, this is the DOMHighResTimestamp as
46
- * outputed by `performance.now()` when playback begin to seem to not start
47
- * despite having decipherable data in the buffer(s).
48
- *
49
- * If enough time in that condition is spent, special considerations are
50
- * taken at which point `_currentFreezeTimestamp` is reset to `null`.
51
- *
52
- * It is also reset to `null` when and if there is no such issue anymore.
53
- */
54
- private _currentFreezeTimestamp;
55
43
  /**
56
44
  * @param {object} playbackObserver - emit the current playback conditions.
57
45
  * @param {Object} manifest - The Manifest of the currently-played content.
58
46
  * @param {Object} speed - The last speed set by the user
59
47
  */
60
- constructor(playbackObserver: PlaybackObserver, manifest: Manifest | null, segmentBuffersStore: SegmentBuffersStore | null, speed: IReadOnlySharedReference<number>);
48
+ constructor(playbackObserver: PlaybackObserver, manifest: Manifest | null, speed: IReadOnlySharedReference<number>);
61
49
  start(): void;
62
50
  /**
63
51
  * Update information on an upcoming discontinuity for a given buffer type and
@@ -80,32 +68,10 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
80
68
  * forever.
81
69
  */
82
70
  destroy(): void;
83
- /**
84
- * Support of contents with DRM on all the platforms out there is a pain in
85
- * the *ss considering all the DRM-related bugs there are.
86
- *
87
- * We found out a frequent issue which is to be unable to play despite having
88
- * all the decryption keys to play what is currently buffered.
89
- * When this happens, re-creating the buffers from scratch, with a reload, is
90
- * usually sufficient to unlock the situation.
91
- *
92
- * Although we prefer providing more targeted fixes or telling to platform
93
- * developpers to fix their implementation, it's not always possible.
94
- * We thus resorted to developping an heuristic which detects such situation
95
- * and reload in that case.
96
- *
97
- * @param {Object} observation - The last playback observation produced, it
98
- * has to be recent (just triggered for example).
99
- * @returns {boolean} - Returns `true` if it seems to be such kind of
100
- * decipherability freeze, in which case this method already performed the
101
- * right handling steps.
102
- */
103
- private _checkDecipherabilityFreeze;
104
71
  }
105
72
  export interface IRebufferingControllerEvent {
106
73
  stalled: IStallingSituation;
107
74
  unstalled: null;
108
- needsReload: null;
109
75
  warning: IPlayerError;
110
76
  }
111
77
  /**
@@ -55,16 +55,14 @@ var RebufferingController = /** @class */ (function (_super) {
55
55
  * @param {Object} manifest - The Manifest of the currently-played content.
56
56
  * @param {Object} speed - The last speed set by the user
57
57
  */
58
- function RebufferingController(playbackObserver, manifest, segmentBuffersStore, speed) {
58
+ function RebufferingController(playbackObserver, manifest, speed) {
59
59
  var _this = _super.call(this) || this;
60
60
  _this._playbackObserver = playbackObserver;
61
61
  _this._manifest = manifest;
62
- _this._segmentBuffersStore = segmentBuffersStore;
63
62
  _this._speed = speed;
64
63
  _this._discontinuitiesStore = [];
65
64
  _this._isStarted = false;
66
65
  _this._canceller = new TaskCanceller();
67
- _this._currentFreezeTimestamp = null;
68
66
  return _this;
69
67
  }
70
68
  RebufferingController.prototype.start = function () {
@@ -119,9 +117,6 @@ var RebufferingController = /** @class */ (function (_super) {
119
117
  lastSeekingPosition = observation.seeking ?
120
118
  Math.max((_a = observation.pendingInternalSeek) !== null && _a !== void 0 ? _a : 0, observation.position) :
121
119
  null;
122
- if (_this._checkDecipherabilityFreeze(observation)) {
123
- return;
124
- }
125
120
  if (freezing !== null) {
126
121
  var now = performance.now();
127
122
  var referenceTimestamp = prevFreezingState === null ?
@@ -180,7 +175,7 @@ var RebufferingController = /** @class */ (function (_super) {
180
175
  return;
181
176
  }
182
177
  else {
183
- log.warn("Init: ignored stall for too long, considering it", now - ignoredStallTimeStamp);
178
+ log.warn("Init: ignored stall for too long, checking discontinuity", now - ignoredStallTimeStamp);
184
179
  }
185
180
  }
186
181
  ignoredStallTimeStamp = null;
@@ -296,81 +291,6 @@ var RebufferingController = /** @class */ (function (_super) {
296
291
  RebufferingController.prototype.destroy = function () {
297
292
  this._canceller.cancel();
298
293
  };
299
- /**
300
- * Support of contents with DRM on all the platforms out there is a pain in
301
- * the *ss considering all the DRM-related bugs there are.
302
- *
303
- * We found out a frequent issue which is to be unable to play despite having
304
- * all the decryption keys to play what is currently buffered.
305
- * When this happens, re-creating the buffers from scratch, with a reload, is
306
- * usually sufficient to unlock the situation.
307
- *
308
- * Although we prefer providing more targeted fixes or telling to platform
309
- * developpers to fix their implementation, it's not always possible.
310
- * We thus resorted to developping an heuristic which detects such situation
311
- * and reload in that case.
312
- *
313
- * @param {Object} observation - The last playback observation produced, it
314
- * has to be recent (just triggered for example).
315
- * @returns {boolean} - Returns `true` if it seems to be such kind of
316
- * decipherability freeze, in which case this method already performed the
317
- * right handling steps.
318
- */
319
- RebufferingController.prototype._checkDecipherabilityFreeze = function (observation) {
320
- var readyState = observation.readyState, rebuffering = observation.rebuffering, freezing = observation.freezing;
321
- var bufferGap = observation.bufferGap !== undefined &&
322
- isFinite(observation.bufferGap) ? observation.bufferGap :
323
- 0;
324
- if (this._segmentBuffersStore === null ||
325
- bufferGap < 6 ||
326
- (rebuffering === null && freezing === null) ||
327
- readyState > 1) {
328
- this._currentFreezeTimestamp = null;
329
- return false;
330
- }
331
- var now = performance.now();
332
- if (this._currentFreezeTimestamp === null) {
333
- this._currentFreezeTimestamp = now;
334
- }
335
- var rebufferingForTooLong = rebuffering !== null && now - rebuffering.timestamp > 4000;
336
- var frozenForTooLong = freezing !== null && now - freezing.timestamp > 4000;
337
- if ((rebufferingForTooLong || frozenForTooLong) &&
338
- this._currentFreezeTimestamp > 4000) {
339
- var statusAudio = this._segmentBuffersStore.getStatus("audio");
340
- var statusVideo = this._segmentBuffersStore.getStatus("video");
341
- var hasOnlyDecipherableSegments = true;
342
- var isClear = true;
343
- for (var _i = 0, _a = [statusAudio, statusVideo]; _i < _a.length; _i++) {
344
- var status_1 = _a[_i];
345
- if (status_1.type === "initialized") {
346
- for (var _b = 0, _c = status_1.value.getInventory(); _b < _c.length; _b++) {
347
- var segment = _c[_b];
348
- var representation = segment.infos.representation;
349
- if (representation.decipherable === false) {
350
- log.warn("Init: we have undecipherable segments left in the buffer, reloading");
351
- this._currentFreezeTimestamp = null;
352
- this.trigger("needsReload", null);
353
- return true;
354
- }
355
- else if (representation.contentProtections !== undefined) {
356
- isClear = false;
357
- if (representation.decipherable !== true) {
358
- hasOnlyDecipherableSegments = false;
359
- }
360
- }
361
- }
362
- }
363
- }
364
- if (!isClear && hasOnlyDecipherableSegments) {
365
- log.warn("Init: we are frozen despite only having decipherable " +
366
- "segments left in the buffer, reloading");
367
- this._currentFreezeTimestamp = null;
368
- this.trigger("needsReload", null);
369
- return true;
370
- }
371
- }
372
- return false;
373
- };
374
294
  return RebufferingController;
375
295
  }(EventEmitter));
376
296
  export default RebufferingController;
@@ -29,9 +29,8 @@ export default class NativeTextSegmentBuffer extends SegmentBuffer {
29
29
  private _buffered;
30
30
  /**
31
31
  * @param {HTMLMediaElement} videoElement
32
- * @param {Boolean} hideNativeSubtitle
33
32
  */
34
- constructor(videoElement: HTMLMediaElement, hideNativeSubtitle: boolean);
33
+ constructor(videoElement: HTMLMediaElement);
35
34
  /**
36
35
  * @param {string} uniqueId
37
36
  */
@@ -44,13 +44,12 @@ var NativeTextSegmentBuffer = /** @class */ (function (_super) {
44
44
  __extends(NativeTextSegmentBuffer, _super);
45
45
  /**
46
46
  * @param {HTMLMediaElement} videoElement
47
- * @param {Boolean} hideNativeSubtitle
48
47
  */
49
- function NativeTextSegmentBuffer(videoElement, hideNativeSubtitle) {
48
+ function NativeTextSegmentBuffer(videoElement) {
50
49
  var _this = this;
51
50
  log.debug("NTSB: Creating NativeTextSegmentBuffer");
52
51
  _this = _super.call(this) || this;
53
- var _a = addTextTrack(videoElement, hideNativeSubtitle), track = _a.track, trackElement = _a.trackElement;
52
+ var _a = addTextTrack(videoElement), track = _a.track, trackElement = _a.trackElement;
54
53
  _this.bufferType = "text";
55
54
  _this._buffered = new ManualTimeRanges();
56
55
  _this._videoElement = videoElement;
@@ -54,7 +54,7 @@ import SegmentInventory, { IBufferedChunk, IBufferedHistoryEntry, IChunkContext,
54
54
  * array.
55
55
  */
56
56
  export declare abstract class SegmentBuffer {
57
- /** "Type" of the buffer (e.g. "audio", "video", "text", "image"). */
57
+ /** "Type" of the buffer (e.g. "audio", "video", "text"). */
58
58
  abstract readonly bufferType: IBufferType;
59
59
  /** Default implementation of an inventory of segment metadata. */
60
60
  protected _segmentInventory: SegmentInventory;
@@ -171,7 +171,7 @@ export declare abstract class SegmentBuffer {
171
171
  abstract dispose(): void;
172
172
  }
173
173
  /** Every SegmentBuffer types. */
174
- export type IBufferType = "audio" | "video" | "text" | "image";
174
+ export type IBufferType = "audio" | "video" | "text";
175
175
  /**
176
176
  * Content of the `data` property when pushing a new chunk.
177
177
  *
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import BufferGarbageCollector from "./garbage_collector";
17
17
  import { IBufferType, IEndOfSegmentInfos, IEndOfSegmentOperation, IPushChunkInfos, IPushedChunkData, IPushOperation, IRemoveOperation, ISBOperation, SegmentBuffer, SegmentBufferOperation } from "./implementations";
18
- import { IBufferedChunk, IChunkContext, IInsertedChunkInfos } from "./inventory";
18
+ import { IBufferedChunk, IChunkContext, IInsertedChunkInfos, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod } from "./inventory";
19
19
  import SegmentBuffersStore, { ISegmentBufferOptions, ITextTrackSegmentBufferOptions } from "./segment_buffers_store";
20
20
  export default SegmentBuffersStore;
21
- export { BufferGarbageCollector, ISegmentBufferOptions, ITextTrackSegmentBufferOptions, SegmentBuffer, IBufferType, IBufferedChunk, IChunkContext, IInsertedChunkInfos, IPushChunkInfos, IPushedChunkData, IEndOfSegmentInfos, SegmentBufferOperation, ISBOperation, IEndOfSegmentOperation, IPushOperation, IRemoveOperation, };
21
+ export { BufferGarbageCollector, ISegmentBufferOptions, ITextTrackSegmentBufferOptions, SegmentBuffer, IBufferType, IBufferedChunk, IChunkContext, IInsertedChunkInfos, IPushChunkInfos, IPushedChunkData, IEndOfSegmentInfos, SegmentBufferOperation, ISBOperation, IEndOfSegmentOperation, IPushOperation, IRemoveOperation, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, };
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import BufferGarbageCollector from "./garbage_collector";
17
17
  import { SegmentBuffer, SegmentBufferOperation, } from "./implementations";
18
+ import { getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, } from "./inventory";
18
19
  import SegmentBuffersStore from "./segment_buffers_store";
19
20
  export default SegmentBuffersStore;
20
- export { BufferGarbageCollector, SegmentBuffer, SegmentBufferOperation, };
21
+ export { BufferGarbageCollector, SegmentBuffer, SegmentBufferOperation, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, };
@@ -18,3 +18,4 @@ export default SegmentInventory;
18
18
  export { IBufferedChunk, IInsertedChunkInfos, };
19
19
  export { IBufferedHistoryEntry } from "./buffered_history";
20
20
  export { IChunkContext } from "./types";
21
+ export { getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, } from "./utils";
@@ -15,3 +15,4 @@
15
15
  */
16
16
  import SegmentInventory from "./segment_inventory";
17
17
  export default SegmentInventory;
18
+ export { getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, } from "./utils";