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

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 (326) hide show
  1. package/CHANGELOG.md +178 -2
  2. package/README.md +2 -33
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/add_text_track.d.ts +3 -1
  5. package/dist/_esm5.processed/compat/add_text_track.js +7 -4
  6. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +7 -0
  7. package/dist/_esm5.processed/compat/event_listeners.d.ts +15 -2
  8. package/dist/_esm5.processed/compat/event_listeners.js +37 -2
  9. package/dist/_esm5.processed/compat/fullscreen.d.ts +32 -0
  10. package/dist/_esm5.processed/compat/fullscreen.js +78 -0
  11. package/dist/_esm5.processed/compat/index.d.ts +3 -1
  12. package/dist/_esm5.processed/compat/index.js +3 -1
  13. package/dist/_esm5.processed/compat/is_offline.d.ts +39 -0
  14. package/dist/_esm5.processed/compat/is_offline.js +43 -0
  15. package/dist/_esm5.processed/config.d.ts +21 -9
  16. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +58 -0
  17. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +54 -14
  18. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +8 -2
  19. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +11 -2
  20. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +46 -17
  21. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
  22. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
  23. package/dist/_esm5.processed/core/api/option_utils.d.ts +35 -14
  24. package/dist/_esm5.processed/core/api/option_utils.js +230 -47
  25. package/dist/_esm5.processed/core/api/public_api.d.ts +266 -92
  26. package/dist/_esm5.processed/core/api/public_api.js +802 -444
  27. package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.d.ts → tracks_management/media_element_track_choice_manager.d.ts} +75 -15
  28. package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.js → tracks_management/media_element_track_choice_manager.js} +193 -74
  29. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +258 -0
  30. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +989 -0
  31. package/dist/_esm5.processed/core/api/utils.d.ts +0 -1
  32. package/dist/_esm5.processed/core/api/utils.js +11 -28
  33. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
  34. package/dist/_esm5.processed/core/decrypt/find_key_system.js +71 -83
  35. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +5 -6
  36. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +72 -10
  37. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
  38. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +4 -6
  39. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +3 -1
  40. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +26 -7
  41. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +9 -3
  42. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +9 -16
  43. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -1
  44. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  45. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +6 -1
  46. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +41 -4
  47. package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +8 -1
  48. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -2
  49. package/dist/_esm5.processed/core/init/types.d.ts +15 -5
  50. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  51. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +75 -0
  52. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +133 -0
  53. package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.d.ts +2 -3
  54. package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.js +2 -3
  55. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  56. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +2 -1
  57. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +4 -3
  58. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  59. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  60. package/dist/_esm5.processed/core/segment_buffers/index.js +1 -2
  61. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +2 -3
  62. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +0 -1
  63. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  64. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +19 -10
  65. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +1 -0
  66. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +16 -2
  67. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +15 -0
  68. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +93 -183
  69. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +13 -27
  70. package/dist/_esm5.processed/core/stream/index.d.ts +3 -2
  71. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +0 -2
  72. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +7 -5
  73. package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -13
  74. package/dist/_esm5.processed/core/stream/period/types.d.ts +14 -5
  75. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -2
  76. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +46 -10
  77. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +23 -29
  78. package/dist/_esm5.processed/core/stream/representation/types.d.ts +1 -11
  79. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -1
  80. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +1 -1
  81. package/dist/_esm5.processed/default_config.d.ts +98 -35
  82. package/dist/_esm5.processed/default_config.js +113 -36
  83. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -1
  84. package/dist/_esm5.processed/errors/custom_loader_error.js +3 -1
  85. package/dist/_esm5.processed/errors/media_error.js +2 -2
  86. package/dist/_esm5.processed/errors/network_error.d.ts +1 -0
  87. package/dist/_esm5.processed/errors/network_error.js +1 -0
  88. package/dist/_esm5.processed/errors/request_error.d.ts +3 -2
  89. package/dist/_esm5.processed/errors/request_error.js +5 -2
  90. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
  91. package/dist/_esm5.processed/features/features_object.js +2 -0
  92. package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.js → features/list/bif_parser.d.ts} +6 -7
  93. package/dist/_esm5.processed/features/list/bif_parser.js +27 -0
  94. package/dist/_esm5.processed/features/list/directfile.js +5 -2
  95. package/dist/_esm5.processed/features/list/image_buffer.d.ts +23 -0
  96. package/dist/_esm5.processed/features/list/image_buffer.js +25 -0
  97. package/dist/_esm5.processed/features/list/index.d.ts +2 -0
  98. package/dist/_esm5.processed/features/list/index.js +2 -0
  99. package/dist/_esm5.processed/features/types.d.ts +27 -3
  100. package/dist/_esm5.processed/manifest/adaptation.d.ts +11 -9
  101. package/dist/_esm5.processed/manifest/adaptation.js +30 -41
  102. package/dist/_esm5.processed/manifest/index.d.ts +4 -3
  103. package/dist/_esm5.processed/manifest/manifest.d.ts +54 -5
  104. package/dist/_esm5.processed/manifest/manifest.js +110 -5
  105. package/dist/_esm5.processed/manifest/period.d.ts +5 -4
  106. package/dist/_esm5.processed/manifest/representation.d.ts +5 -10
  107. package/dist/_esm5.processed/manifest/representation.js +5 -15
  108. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  109. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +0 -2
  110. package/dist/_esm5.processed/manifest/representation_index/static.js +0 -6
  111. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +21 -42
  112. package/dist/_esm5.processed/manifest/types.d.ts +2 -0
  113. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +31 -17
  114. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +19 -26
  115. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +0 -2
  116. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +1 -7
  117. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +6 -2
  118. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +8 -11
  119. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +0 -2
  120. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +0 -6
  121. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  122. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +6 -1
  123. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +5 -3
  124. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +2 -0
  125. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
  126. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  127. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -0
  128. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
  129. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +6 -10
  130. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +2 -4
  131. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +1 -10
  132. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +2 -18
  133. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
  134. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +6 -3
  135. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +2 -1
  136. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +0 -2
  137. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +0 -6
  138. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
  139. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +3 -12
  140. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +2 -11
  141. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +1 -0
  142. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +17 -11
  143. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +83 -21
  144. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +125 -53
  145. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +6 -3
  146. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  147. package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
  148. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  149. package/dist/_esm5.processed/public_types.d.ts +310 -396
  150. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +4 -5
  151. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +4 -5
  152. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  153. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +38 -0
  154. package/dist/_esm5.processed/transports/dash/image_pipelines.js +129 -0
  155. package/dist/_esm5.processed/transports/dash/manifest_parser.js +3 -2
  156. package/dist/_esm5.processed/transports/dash/pipelines.js +4 -1
  157. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  158. package/dist/_esm5.processed/transports/dash/segment_loader.js +20 -26
  159. package/dist/_esm5.processed/transports/dash/segment_parser.js +24 -19
  160. package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
  161. package/dist/_esm5.processed/transports/dash/text_parser.js +33 -28
  162. package/dist/_esm5.processed/transports/local/pipelines.js +10 -1
  163. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
  164. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  165. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  166. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  167. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  168. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +52 -34
  169. package/dist/_esm5.processed/transports/smooth/pipelines.js +190 -33
  170. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  171. package/dist/_esm5.processed/transports/smooth/segment_loader.js +22 -28
  172. package/dist/_esm5.processed/transports/smooth/utils.d.ts +26 -1
  173. package/dist/_esm5.processed/transports/smooth/utils.js +55 -1
  174. package/dist/_esm5.processed/transports/types.d.ts +89 -94
  175. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  176. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  177. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +7 -5
  178. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +12 -8
  179. package/dist/_esm5.processed/transports/utils/parse_text_track.js +21 -19
  180. package/dist/_esm5.processed/utils/array_includes.d.ts +1 -2
  181. package/dist/_esm5.processed/utils/array_includes.js +28 -30
  182. package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.d.ts → utils/list_to_map.d.ts} +5 -5
  183. package/dist/_esm5.processed/utils/list_to_map.js +28 -0
  184. package/dist/_esm5.processed/utils/request/xhr.js +5 -5
  185. package/dist/_esm5.processed/utils/simple_set.d.ts +51 -0
  186. package/dist/_esm5.processed/utils/simple_set.js +57 -0
  187. package/dist/_esm5.processed/utils/uniq.d.ts +36 -0
  188. package/dist/_esm5.processed/utils/uniq.js +43 -0
  189. package/dist/commonjs/config.d.ts +1 -1
  190. package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  191. package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +2 -2
  192. package/dist/commonjs/core/adaptive/network_analyzer.js +3 -3
  193. package/dist/commonjs/core/api/index.d.ts +1 -1
  194. package/dist/commonjs/core/api/playback_observer.d.ts +128 -8
  195. package/dist/commonjs/core/api/playback_observer.js +217 -64
  196. package/dist/commonjs/core/api/public_api.js +9 -9
  197. package/dist/commonjs/core/api/utils.js +1 -1
  198. package/dist/commonjs/core/decrypt/get_media_keys.js +2 -6
  199. package/dist/commonjs/core/init/directfile_content_initializer.js +5 -1
  200. package/dist/commonjs/core/init/media_source_content_initializer.js +28 -14
  201. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +1 -2
  202. package/dist/commonjs/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  203. package/dist/commonjs/core/init/utils/create_stream_playback_observer.js +16 -14
  204. package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +9 -11
  205. package/dist/commonjs/core/init/utils/initial_seek_and_play.js +121 -91
  206. package/dist/commonjs/core/init/utils/rebuffering_controller.js +27 -70
  207. package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  208. package/dist/commonjs/core/segment_buffers/garbage_collector.js +1 -2
  209. package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  210. package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  211. package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  212. package/dist/commonjs/core/segment_buffers/index.d.ts +2 -2
  213. package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +2 -2
  214. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  215. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +19 -10
  216. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  217. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  218. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +14 -18
  219. package/dist/commonjs/core/stream/period/period_stream.js +5 -8
  220. package/dist/commonjs/core/stream/period/types.d.ts +2 -3
  221. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  222. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  223. package/dist/commonjs/core/stream/representation/representation_stream.js +3 -4
  224. package/dist/commonjs/core/stream/representation/types.d.ts +2 -2
  225. package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +11 -12
  226. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +1 -1
  227. package/dist/commonjs/default_config.d.ts +7 -16
  228. package/dist/commonjs/default_config.js +16 -16
  229. package/dist/commonjs/manifest/adaptation.js +2 -1
  230. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  231. package/dist/commonjs/public_types.d.ts +29 -2
  232. package/dist/es2017/config.d.ts +1 -1
  233. package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  234. package/dist/es2017/core/adaptive/adaptive_representation_selector.js +2 -2
  235. package/dist/es2017/core/adaptive/network_analyzer.js +3 -3
  236. package/dist/es2017/core/api/index.d.ts +1 -1
  237. package/dist/es2017/core/api/playback_observer.d.ts +128 -8
  238. package/dist/es2017/core/api/playback_observer.js +217 -66
  239. package/dist/es2017/core/api/public_api.js +9 -9
  240. package/dist/es2017/core/api/utils.js +1 -1
  241. package/dist/es2017/core/decrypt/get_media_keys.js +2 -6
  242. package/dist/es2017/core/init/directfile_content_initializer.js +7 -1
  243. package/dist/es2017/core/init/media_source_content_initializer.js +30 -16
  244. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +1 -2
  245. package/dist/es2017/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  246. package/dist/es2017/core/init/utils/create_stream_playback_observer.js +16 -14
  247. package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +9 -11
  248. package/dist/es2017/core/init/utils/initial_seek_and_play.js +120 -91
  249. package/dist/es2017/core/init/utils/rebuffering_controller.js +27 -70
  250. package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  251. package/dist/es2017/core/segment_buffers/garbage_collector.js +1 -2
  252. package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  253. package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  254. package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  255. package/dist/es2017/core/segment_buffers/index.d.ts +2 -2
  256. package/dist/es2017/core/segment_buffers/inventory/index.d.ts +2 -2
  257. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  258. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +19 -10
  259. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  260. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  261. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +16 -18
  262. package/dist/es2017/core/stream/period/period_stream.js +4 -7
  263. package/dist/es2017/core/stream/period/types.d.ts +2 -3
  264. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  265. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  266. package/dist/es2017/core/stream/representation/representation_stream.js +3 -4
  267. package/dist/es2017/core/stream/representation/types.d.ts +2 -2
  268. package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +1 -2
  269. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +1 -1
  270. package/dist/es2017/default_config.d.ts +7 -16
  271. package/dist/es2017/default_config.js +16 -16
  272. package/dist/es2017/manifest/adaptation.js +2 -1
  273. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  274. package/dist/es2017/public_types.d.ts +29 -2
  275. package/dist/mpd-parser.wasm +0 -0
  276. package/dist/rx-player.js +614 -438
  277. package/dist/rx-player.min.js +1 -1
  278. package/package.json +5 -1
  279. package/scripts/canal-release.patch +78 -0
  280. package/scripts/make-dev-releases +65 -0
  281. package/scripts/update-version +5 -0
  282. package/sonar-project.properties +1 -1
  283. package/src/core/adaptive/adaptive_representation_selector.ts +4 -21
  284. package/src/core/adaptive/network_analyzer.ts +3 -3
  285. package/src/core/api/index.ts +1 -0
  286. package/src/core/api/playback_observer.ts +327 -107
  287. package/src/core/api/public_api.ts +9 -9
  288. package/src/core/api/utils.ts +3 -1
  289. package/src/core/decrypt/get_media_keys.ts +2 -8
  290. package/src/core/init/directfile_content_initializer.ts +8 -8
  291. package/src/core/init/media_source_content_initializer.ts +27 -20
  292. package/src/core/init/utils/content_time_boundaries_observer.ts +1 -1
  293. package/src/core/init/utils/create_stream_playback_observer.ts +19 -20
  294. package/src/core/init/utils/initial_seek_and_play.ts +140 -108
  295. package/src/core/init/utils/rebuffering_controller.ts +32 -77
  296. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +5 -2
  297. package/src/core/segment_buffers/garbage_collector.ts +1 -1
  298. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
  299. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +1 -1
  300. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +1 -1
  301. package/src/core/segment_buffers/index.ts +2 -0
  302. package/src/core/segment_buffers/inventory/index.ts +2 -0
  303. package/src/core/segment_buffers/inventory/segment_inventory.ts +49 -17
  304. package/src/core/stream/adaptation/get_representations_switch_strategy.ts +21 -12
  305. package/src/core/stream/orchestrator/stream_orchestrator.ts +14 -19
  306. package/src/core/stream/period/period_stream.ts +7 -8
  307. package/src/core/stream/period/types.ts +2 -3
  308. package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +21 -15
  309. package/src/core/stream/representation/representation_stream.ts +3 -5
  310. package/src/core/stream/representation/types.ts +2 -2
  311. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
  312. package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
  313. package/src/default_config.ts +17 -17
  314. package/src/manifest/adaptation.ts +2 -1
  315. package/src/parsers/texttracks/ttml/html/apply_line_height.ts +3 -1
  316. package/src/public_types.ts +29 -2
  317. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +0 -84
  318. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +0 -158
  319. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +0 -406
  320. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +0 -932
  321. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +0 -33
  322. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +0 -49
  323. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +0 -39
  324. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +0 -133
  325. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +0 -119
  326. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +0 -159
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright 2015 CANAL+ Group
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Some browsers have a builtin API to know if it's connected at least to a
18
+ * LAN network, at most to the internet.
19
+ *
20
+ * /!\ This feature can be dangerous as you can both have false positives and
21
+ * false negatives.
22
+ *
23
+ * False positives:
24
+ * - you can still play local contents (on localhost) if isOffline == true
25
+ * - on some browsers isOffline might be true even if we're connected to a LAN
26
+ * or a router (it would mean we're just not able to connect to the
27
+ * Internet). So we can eventually play LAN contents if isOffline == true
28
+ *
29
+ * False negatives:
30
+ * - in some cases, we even might have isOffline at false when we do not have
31
+ * any connection:
32
+ * - in browsers that do not support the feature
33
+ * - in browsers running in some virtualization softwares where the
34
+ * network adapters are always connected.
35
+ *
36
+ * Use with these cases in mind.
37
+ * @returns {Boolean}
38
+ */
39
+ export default function isOffline() {
40
+ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
41
+ return navigator.onLine === false;
42
+ /* eslint-enable @typescript-eslint/no-unnecessary-boolean-literal-compare */
43
+ }
@@ -19,7 +19,9 @@ declare class ConfigHandler {
19
19
  DEFAULT_UNMUTED_VOLUME: number;
20
20
  DEFAULT_REQUEST_TIMEOUT: number;
21
21
  DEFAULT_TEXT_TRACK_MODE: "native" | "html";
22
+ DEFAULT_MANUAL_BITRATE_SWITCHING_MODE: "direct" | "seamless";
22
23
  DEFAULT_ENABLE_FAST_SWITCHING: boolean;
24
+ DEFAULT_AUDIO_TRACK_SWITCHING_MODE: "direct" | "seamless";
23
25
  DELTA_POSITION_AFTER_RELOAD: {
24
26
  bitrateSwitch: number;
25
27
  trackSwitch: {
@@ -30,14 +32,23 @@ declare class ConfigHandler {
30
32
  };
31
33
  DEFAULT_CODEC_SWITCHING_BEHAVIOR: "reload" | "continue";
32
34
  DEFAULT_AUTO_PLAY: boolean;
35
+ DEFAULT_SHOW_NATIVE_SUBTITLE: boolean;
36
+ DEFAULT_STOP_AT_END: boolean;
33
37
  DEFAULT_WANTED_BUFFER_AHEAD: number;
34
38
  DEFAULT_MAX_BUFFER_AHEAD: number;
35
39
  DEFAULT_MAX_BUFFER_BEHIND: number;
36
40
  DEFAULT_MAX_VIDEO_BUFFER_SIZE: number;
37
- MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "text", number>>;
38
- MAXIMUM_MAX_BUFFER_BEHIND: Partial<Record<"audio" | "video" | "text", number>>;
39
- DEFAULT_BASE_BANDWIDTH: number;
41
+ MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "image" | "text", number>>;
42
+ MAXIMUM_MAX_BUFFER_BEHIND: Partial<Record<"audio" | "video" | "image" | "text", number>>;
43
+ DEFAULT_INITIAL_BITRATES: {
44
+ audio: number;
45
+ video: number;
46
+ other: number;
47
+ };
48
+ DEFAULT_MIN_BITRATES: Record<"audio" | "video" | "other", number>;
49
+ DEFAULT_MAX_BITRATES: Record<"audio" | "video" | "other", number>;
40
50
  INACTIVITY_DELAY: number;
51
+ DEFAULT_THROTTLE_WHEN_HIDDEN: boolean;
41
52
  DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN: boolean;
42
53
  DEFAULT_LIMIT_VIDEO_WIDTH: boolean;
43
54
  DEFAULT_LIVE_GAP: {
@@ -54,6 +65,7 @@ declare class ConfigHandler {
54
65
  DEFAULT_MAX_MANIFEST_REQUEST_RETRY: number;
55
66
  DEFAULT_CDN_DOWNGRADE_TIME: number;
56
67
  DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR: number;
68
+ DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE: number;
57
69
  INITIAL_BACKOFF_DELAY_BASE: {
58
70
  REGULAR: number;
59
71
  LOW_LATENCY: number;
@@ -129,7 +141,7 @@ declare class ConfigHandler {
129
141
  EME_DEFAULT_VIDEO_CODECS: string[];
130
142
  EME_DEFAULT_AUDIO_CODECS: string[];
131
143
  EME_DEFAULT_WIDEVINE_ROBUSTNESSES: string[];
132
- EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES: string[];
144
+ EME_DEFAULT_PLAYREADY_ROBUSTNESSES: string[];
133
145
  EME_KEY_SYSTEMS: Partial<Record<string, string[]>>;
134
146
  MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE: number;
135
147
  MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE: number;
@@ -141,7 +153,7 @@ declare class ConfigHandler {
141
153
  EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: number;
142
154
  EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES: number;
143
155
  FORCED_ENDED_THRESHOLD: number;
144
- ADAP_REP_SWITCH_BUFFER_PADDINGS: {
156
+ ADAPTATION_SWITCH_BUFFER_PADDINGS: {
145
157
  video: {
146
158
  before: number;
147
159
  after: number;
@@ -154,6 +166,10 @@ declare class ConfigHandler {
154
166
  before: number;
155
167
  after: number;
156
168
  };
169
+ image: {
170
+ before: number;
171
+ after: number;
172
+ };
157
173
  };
158
174
  SOURCE_BUFFER_FLUSHING_INTERVAL: number;
159
175
  CONTENT_REPLACEMENT_PADDING: number;
@@ -167,10 +183,6 @@ declare class ConfigHandler {
167
183
  BUFFERED_HISTORY_MAXIMUM_ENTRIES: number;
168
184
  MIN_BUFFER_AHEAD: number;
169
185
  UPTO_CURRENT_POSITION_CLEANUP: number;
170
- DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE: "seamless";
171
- DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE: "seamless";
172
- DEFAULT_VIDEO_TRACK_SWITCHING_MODE: "reload";
173
- DEFAULT_AUDIO_TRACK_SWITCHING_MODE: "seamless";
174
186
  };
175
187
  update(config: Partial<IDefaultConfig>): void;
176
188
  getCurrent(): IDefaultConfig;
@@ -46,6 +46,13 @@ export interface IABREstimate {
46
46
  * If `undefined`, we do not currently know the bitrate for the current type.
47
47
  */
48
48
  bitrate: undefined | number;
49
+ /**
50
+ * If `true`, the `representation` chosen in the current estimate object is
51
+ * linked to a choice chosen manually by the user.
52
+ *
53
+ * If `false`, this estimate is just due to the adaptative logic.
54
+ */
55
+ manual: boolean;
49
56
  /**
50
57
  * The Representation considered as the most adapted to the current network
51
58
  * and playback conditions.
@@ -236,6 +243,50 @@ export interface IRepresentationEstimatorArguments {
236
243
  * Such contents have specific settings.
237
244
  */
238
245
  lowLatencyMode: boolean;
246
+ /**
247
+ * Reference allowing to set manually choose a Representation:
248
+ *
249
+ * The highest-quality Representation with a bitrate lower-or-equal to that
250
+ * value will be chosen.
251
+ * If no Representation has bitrate lower or equal to that value, the
252
+ * Representation with the lowest bitrate will be chosen instead.
253
+ *
254
+ * If no Representation has a bitrate lower or equal to that value, the
255
+ * Representation with the lowest bitrate will be chosen instead.
256
+ *
257
+ * Set it to a negative value to enable "adaptative mode" instead:
258
+ * `getEstimateReference` will choose the best Representation based on the
259
+ * current network and playback conditions.
260
+ */
261
+ manualBitrate: IReadOnlySharedReference<number>;
262
+ /**
263
+ * Set a bitrate floor (the minimum reachable bitrate) for adaptative
264
+ * streaming.
265
+ *
266
+ * When `getEstimateReference` is choosing a `Representation` in
267
+ * adaptive mode (e.g. no Representation has been manually chosen through
268
+ * the `manualBitrate` reference), it will never choose a Representation
269
+ * having a bitrate inferior to that value, with a notable exception:
270
+ * If no Representation has a bitrate superior or equal to that value, the
271
+ * Representation with the lowest bitrate will be chosen instead.
272
+ *
273
+ * You can set it to `0` to disable any effect of that option.
274
+ */
275
+ minAutoBitrate: IReadOnlySharedReference<number>;
276
+ /**
277
+ * Set a bitrate ceil (the maximum reachable bitrate) for adaptative
278
+ * streaming.
279
+ *
280
+ * When `getEstimateReference` is choosing a `Representation` in
281
+ * adaptive mode (e.g. no Representation has been manually chosen through
282
+ * the `manualBitrate` reference), it will never choose a Representation
283
+ * having a bitrate superior to that value, with a notable exception:
284
+ * If no Representation has a bitrate lower or equal to that value, the
285
+ * Representation with the lowest bitrate will be chosen instead.
286
+ *
287
+ * You can set it to `Infinity` to disable any effect of that option.
288
+ */
289
+ maxAutoBitrate: IReadOnlySharedReference<number>;
239
290
  /** The list of Representations `getEstimateReference` can choose from. */
240
291
  representations: IReadOnlySharedReference<Representation[]>;
241
292
  /** Context for the list of Representations to choose. */
@@ -292,6 +343,12 @@ export interface IAdaptiveRepresentationSelectorArguments {
292
343
  * Set it to `true` if you're playing such content.
293
344
  */
294
345
  lowLatencyMode: boolean;
346
+ /** Minimum bitrate chosen when in adaptive mode, per type (0 by default) */
347
+ minAutoBitrates: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
348
+ /** Maximum bitrate chosen when in adaptive mode, per type (0 by default) */
349
+ maxAutoBitrates: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
350
+ /** Manually forced bitrate set for a given type (`-1` for adaptive mode) */
351
+ manualBitrates: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
295
352
  /** Allows to filter which Representations can be choosen. */
296
353
  throttlers: IRepresentationEstimatorThrottlers;
297
354
  }
@@ -301,5 +358,6 @@ export interface IAdaptiveRepresentationSelectorArguments {
301
358
  */
302
359
  export interface IRepresentationEstimatorThrottlers {
303
360
  limitWidth: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
361
+ throttle: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
304
362
  throttleBitrate: Partial<Record<IBufferType, IReadOnlySharedReference<number>>>;
305
363
  }
@@ -30,6 +30,12 @@ import PendingRequestsStore from "./utils/pending_requests_store";
30
30
  import RepresentationScoreCalculator from "./utils/representation_score_calculator";
31
31
  import selectOptimalRepresentation from "./utils/select_optimal_representation";
32
32
  // Create default shared references
33
+ var manualBitrateDefaultRef = new SharedReference(-1);
34
+ manualBitrateDefaultRef.finish();
35
+ var minAutoBitrateDefaultRef = new SharedReference(0);
36
+ minAutoBitrateDefaultRef.finish();
37
+ var maxAutoBitrateDefaultRef = new SharedReference(Infinity);
38
+ maxAutoBitrateDefaultRef.finish();
33
39
  var limitWidthDefaultRef = new SharedReference(undefined);
34
40
  limitWidthDefaultRef.finish();
35
41
  var throttleBitrateDefaultRef = new SharedReference(Infinity);
@@ -48,7 +54,7 @@ export default function createAdaptiveRepresentationSelector(options) {
48
54
  * One per active media type.
49
55
  */
50
56
  var bandwidthEstimators = {};
51
- var initialBitrates = options.initialBitrates, throttlers = options.throttlers, lowLatencyMode = options.lowLatencyMode;
57
+ var manualBitrates = options.manualBitrates, minAutoBitrates = options.minAutoBitrates, maxAutoBitrates = options.maxAutoBitrates, initialBitrates = options.initialBitrates, throttlers = options.throttlers, lowLatencyMode = options.lowLatencyMode;
52
58
  /**
53
59
  * Returns Object emitting Representation estimates as well as callbacks
54
60
  * allowing to helping it produce them.
@@ -62,15 +68,18 @@ export default function createAdaptiveRepresentationSelector(options) {
62
68
  * @returns {Array.<Object>}
63
69
  */
64
70
  return function getEstimates(context, currentRepresentation, representations, playbackObserver, stopAllEstimates) {
65
- var _a, _b, _c;
71
+ var _a, _b, _c, _d, _e, _f, _g;
66
72
  var type = context.adaptation.type;
67
73
  var bandwidthEstimator = _getBandwidthEstimator(type);
68
- var initialBitrate = (_a = initialBitrates[type]) !== null && _a !== void 0 ? _a : 0;
74
+ var manualBitrate = (_a = manualBitrates[type]) !== null && _a !== void 0 ? _a : manualBitrateDefaultRef;
75
+ var minAutoBitrate = (_b = minAutoBitrates[type]) !== null && _b !== void 0 ? _b : minAutoBitrateDefaultRef;
76
+ var maxAutoBitrate = (_c = maxAutoBitrates[type]) !== null && _c !== void 0 ? _c : maxAutoBitrateDefaultRef;
77
+ var initialBitrate = (_d = initialBitrates[type]) !== null && _d !== void 0 ? _d : 0;
69
78
  var filters = {
70
- limitWidth: (_b = throttlers.limitWidth[type]) !== null && _b !== void 0 ? _b : limitWidthDefaultRef,
71
- throttleBitrate: (_c = throttlers.throttleBitrate[type]) !== null && _c !== void 0 ? _c : throttleBitrateDefaultRef,
79
+ limitWidth: (_e = throttlers.limitWidth[type]) !== null && _e !== void 0 ? _e : limitWidthDefaultRef,
80
+ throttleBitrate: (_g = (_f = throttlers.throttleBitrate[type]) !== null && _f !== void 0 ? _f : throttlers.throttle[type]) !== null && _g !== void 0 ? _g : throttleBitrateDefaultRef,
72
81
  };
73
- return getEstimateReference({ bandwidthEstimator: bandwidthEstimator, context: context, currentRepresentation: currentRepresentation, filters: filters, initialBitrate: initialBitrate, playbackObserver: playbackObserver, representations: representations, lowLatencyMode: lowLatencyMode }, stopAllEstimates);
82
+ return getEstimateReference({ bandwidthEstimator: bandwidthEstimator, context: context, currentRepresentation: currentRepresentation, filters: filters, initialBitrate: initialBitrate, manualBitrate: manualBitrate, minAutoBitrate: minAutoBitrate, maxAutoBitrate: maxAutoBitrate, playbackObserver: playbackObserver, representations: representations, lowLatencyMode: lowLatencyMode }, stopAllEstimates);
74
83
  };
75
84
  /**
76
85
  * Returns interface allowing to estimate network throughtput for a given type.
@@ -108,7 +117,7 @@ export default function createAdaptiveRepresentationSelector(options) {
108
117
  * @returns {Array.<Object>}
109
118
  */
110
119
  function getEstimateReference(_a, stopAllEstimates) {
111
- var bandwidthEstimator = _a.bandwidthEstimator, context = _a.context, currentRepresentation = _a.currentRepresentation, filters = _a.filters, initialBitrate = _a.initialBitrate, lowLatencyMode = _a.lowLatencyMode, playbackObserver = _a.playbackObserver, representationsRef = _a.representations;
120
+ var bandwidthEstimator = _a.bandwidthEstimator, context = _a.context, currentRepresentation = _a.currentRepresentation, filters = _a.filters, initialBitrate = _a.initialBitrate, lowLatencyMode = _a.lowLatencyMode, manualBitrate = _a.manualBitrate, maxAutoBitrate = _a.maxAutoBitrate, minAutoBitrate = _a.minAutoBitrate, playbackObserver = _a.playbackObserver, representationsRef = _a.representations;
112
121
  var scoreCalculator = new RepresentationScoreCalculator();
113
122
  var networkAnalyzer = new NetworkAnalyzer(initialBitrate !== null && initialBitrate !== void 0 ? initialBitrate : 0, lowLatencyMode);
114
123
  var requestsStore = new PendingRequestsStore();
@@ -136,10 +145,21 @@ function getEstimateReference(_a, stopAllEstimates) {
136
145
  representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal: stopAllEstimates });
137
146
  return { estimates: estimateRef, callbacks: callbacks };
138
147
  function createEstimateReference(representations, innerCancellationSignal) {
139
- if (representations.length <= 1) {
148
+ if (representations.length === 0) {
149
+ // No Representation given, return `null` as documented
150
+ return new SharedReference({
151
+ representation: null,
152
+ bitrate: undefined,
153
+ knownStableBitrate: undefined,
154
+ manual: false,
155
+ urgent: true,
156
+ });
157
+ }
158
+ if (representations.length === 1) {
140
159
  // There's only a single Representation. Just choose it.
141
160
  return new SharedReference({ bitrate: undefined,
142
161
  representation: representations[0],
162
+ manual: false,
143
163
  urgent: true,
144
164
  knownStableBitrate: undefined });
145
165
  }
@@ -185,6 +205,9 @@ function getEstimateReference(_a, stopAllEstimates) {
185
205
  innerCancellationSignal.register(function () {
186
206
  onAddedSegment = noop;
187
207
  });
208
+ manualBitrate.onUpdate(updateEstimate, { clearSignal: innerCancellationSignal });
209
+ minAutoBitrate.onUpdate(updateEstimate, { clearSignal: innerCancellationSignal });
210
+ maxAutoBitrate.onUpdate(updateEstimate, { clearSignal: innerCancellationSignal });
188
211
  filters.limitWidth.onUpdate(updateEstimate, { clearSignal: innerCancellationSignal });
189
212
  filters.limitWidth.onUpdate(updateEstimate, { clearSignal: innerCancellationSignal });
190
213
  return innerEstimateRef;
@@ -193,10 +216,24 @@ function getEstimateReference(_a, stopAllEstimates) {
193
216
  }
194
217
  /** Returns the actual estimate based on all methods and algorithm available. */
195
218
  function getCurrentEstimate() {
219
+ var manualBitrateVal = manualBitrate.getValue();
220
+ if (manualBitrateVal >= 0) {
221
+ // A manual bitrate has been set. Just choose Representation according to it.
222
+ var manualRepresentation = selectOptimalRepresentation(representations, manualBitrateVal, 0, Infinity);
223
+ return {
224
+ representation: manualRepresentation,
225
+ bitrate: undefined,
226
+ knownStableBitrate: undefined,
227
+ manual: true,
228
+ urgent: true, // a manual bitrate switch should happen immediately
229
+ };
230
+ }
196
231
  var bufferGap = lastPlaybackObservation.bufferGap, position = lastPlaybackObservation.position, maximumPosition = lastPlaybackObservation.maximumPosition;
197
232
  var widthLimit = filters.limitWidth.getValue();
198
233
  var bitrateThrottle = filters.throttleBitrate.getValue();
199
234
  var currentRepresentationVal = currentRepresentation.getValue();
235
+ var minAutoBitrateVal = minAutoBitrate.getValue();
236
+ var maxAutoBitrateVal = maxAutoBitrate.getValue();
200
237
  var filteredReps = getFilteredRepresentations(representations, widthLimit, bitrateThrottle);
201
238
  var requests = requestsStore.getRequests();
202
239
  var _a = networkAnalyzer
@@ -222,7 +259,7 @@ function getEstimateReference(_a, stopAllEstimates) {
222
259
  * This is a safe enough choice but might be lower than what the user
223
260
  * could actually profit from.
224
261
  */
225
- var chosenRepFromBandwidth = selectOptimalRepresentation(filteredReps, bitrateChosen);
262
+ var chosenRepFromBandwidth = selectOptimalRepresentation(filteredReps, bitrateChosen, minAutoBitrateVal, maxAutoBitrateVal);
226
263
  /**
227
264
  * Current optimal Representation's bandwidth choosen by a buffer-based
228
265
  * adaptive algorithm.
@@ -243,7 +280,7 @@ function getEstimateReference(_a, stopAllEstimates) {
243
280
  if (allowBufferBasedEstimates &&
244
281
  currentBufferBasedEstimate !== undefined &&
245
282
  currentBufferBasedEstimate > currentBestBitrate) {
246
- chosenRepFromBufferSize = selectOptimalRepresentation(filteredReps, currentBufferBasedEstimate);
283
+ chosenRepFromBufferSize = selectOptimalRepresentation(filteredReps, currentBufferBasedEstimate, minAutoBitrateVal, maxAutoBitrateVal);
247
284
  currentBestBitrate = chosenRepFromBufferSize.bitrate;
248
285
  }
249
286
  /**
@@ -276,27 +313,30 @@ function getEstimateReference(_a, stopAllEstimates) {
276
313
  return { bitrate: bandwidthEstimate,
277
314
  representation: chosenRepFromGuessMode,
278
315
  urgent: currentRepresentationVal === null ||
279
- chosenRepFromGuessMode.bitrate < currentRepresentationVal.bitrate, knownStableBitrate: knownStableBitrate };
316
+ chosenRepFromGuessMode.bitrate < currentRepresentationVal.bitrate,
317
+ manual: false, knownStableBitrate: knownStableBitrate };
280
318
  }
281
319
  else if (chosenRepFromBufferSize !== null) {
282
320
  log.debug("ABR: Choosing representation with buffer-based estimation.", chosenRepFromBufferSize.bitrate, chosenRepFromBufferSize.id);
283
321
  prevEstimate.update(chosenRepFromBufferSize, bandwidthEstimate, 0 /* ABRAlgorithmType.BufferBased */);
284
322
  return { bitrate: bandwidthEstimate,
285
323
  representation: chosenRepFromBufferSize,
286
- urgent: networkAnalyzer.isUrgent(chosenRepFromBufferSize.bitrate, currentRepresentationVal, requests, lastPlaybackObservation), knownStableBitrate: knownStableBitrate };
324
+ urgent: networkAnalyzer.isUrgent(chosenRepFromBufferSize.bitrate, currentRepresentationVal, requests, lastPlaybackObservation),
325
+ manual: false, knownStableBitrate: knownStableBitrate };
287
326
  }
288
327
  else {
289
328
  log.debug("ABR: Choosing representation with bandwidth estimation.", chosenRepFromBandwidth.bitrate, chosenRepFromBandwidth.id);
290
329
  prevEstimate.update(chosenRepFromBandwidth, bandwidthEstimate, 1 /* ABRAlgorithmType.BandwidthBased */);
291
330
  return { bitrate: bandwidthEstimate,
292
331
  representation: chosenRepFromBandwidth,
293
- urgent: networkAnalyzer.isUrgent(chosenRepFromBandwidth.bitrate, currentRepresentationVal, requests, lastPlaybackObservation), knownStableBitrate: knownStableBitrate };
332
+ urgent: networkAnalyzer.isUrgent(chosenRepFromBandwidth.bitrate, currentRepresentationVal, requests, lastPlaybackObservation),
333
+ manual: false, knownStableBitrate: knownStableBitrate };
294
334
  }
295
335
  }
296
336
  }
297
337
  /**
298
338
  * Stop previous estimate production (if one) and restart it considering new
299
- * conditions (such as a new list of Representations).
339
+ * conditions (such as a manual bitrate and/or a new list of Representations).
300
340
  */
301
341
  function restartEstimatesProductionFromCurrentConditions() {
302
342
  var representations = representationsRef.getValue();
@@ -20,8 +20,14 @@ import { Representation } from "../../../manifest";
20
20
  * bitrates.
21
21
  * @param {Array.<Representation>} representations - The representations array,
22
22
  * sorted in bitrate ascending order.
23
- * @param {Number} wantedBitrate - The optimal bitrate the Representation
23
+ * @param {Number} optimalBitrate - The optimal bitrate the Representation
24
24
  * should have under the current condition.
25
+ * @param {Number} minBitrate - The minimum bitrate the chosen Representation
26
+ * should have. We will take the Representation with the maximum bitrate if none
27
+ * is found.
28
+ * @param {Number} maxBitrate - The maximum bitrate the chosen Representation
29
+ * should have. We will take the Representation with the minimum bitrate if none
30
+ * is found.
25
31
  * @returns {Representation|undefined}
26
32
  */
27
- export default function selectOptimalRepresentation(representations: Representation[], wantedBitrate: number): Representation;
33
+ export default function selectOptimalRepresentation(representations: Representation[], optimalBitrate: number, minBitrate: number, maxBitrate: number): Representation;
@@ -20,11 +20,20 @@ import arrayFindIndex from "../../../utils/array_find_index";
20
20
  * bitrates.
21
21
  * @param {Array.<Representation>} representations - The representations array,
22
22
  * sorted in bitrate ascending order.
23
- * @param {Number} wantedBitrate - The optimal bitrate the Representation
23
+ * @param {Number} optimalBitrate - The optimal bitrate the Representation
24
24
  * should have under the current condition.
25
+ * @param {Number} minBitrate - The minimum bitrate the chosen Representation
26
+ * should have. We will take the Representation with the maximum bitrate if none
27
+ * is found.
28
+ * @param {Number} maxBitrate - The maximum bitrate the chosen Representation
29
+ * should have. We will take the Representation with the minimum bitrate if none
30
+ * is found.
25
31
  * @returns {Representation|undefined}
26
32
  */
27
- export default function selectOptimalRepresentation(representations, wantedBitrate) {
33
+ export default function selectOptimalRepresentation(representations, optimalBitrate, minBitrate, maxBitrate) {
34
+ var wantedBitrate = optimalBitrate <= minBitrate ? minBitrate :
35
+ optimalBitrate >= maxBitrate ? maxBitrate :
36
+ optimalBitrate;
28
37
  var firstIndexTooHigh = arrayFindIndex(representations, function (representation) { return representation.bitrate > wantedBitrate; });
29
38
  if (firstIndexTooHigh === -1) {
30
39
  return representations[representations.length - 1];
@@ -17,7 +17,7 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
17
17
  representationsElt,
18
18
  ]);
19
19
  function updateGeneralInfo() {
20
- var _a, _b, _c, _d, _e;
20
+ var _a, _b, _c, _d;
21
21
  var videoElement = instance.getVideoElement();
22
22
  if (videoElement === null) {
23
23
  // disposed player. Clean-up everything
@@ -29,7 +29,7 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
29
29
  }
30
30
  else {
31
31
  var currentTime = instance.getPosition();
32
- var bufferGap = instance.getCurrentBufferGap();
32
+ var bufferGap = instance.getVideoBufferGap();
33
33
  var bufferGapStr = bufferGap === Infinity ? "0" : bufferGap.toFixed(2);
34
34
  var valuesLine1 = [
35
35
  ["ct", currentTime.toFixed(2)],
@@ -56,6 +56,30 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
56
56
  if (mba !== Infinity) {
57
57
  valuesLine2.push(["mba", String(mba)]);
58
58
  }
59
+ var mia = instance.getMinAudioBitrate();
60
+ if (mia !== 0) {
61
+ valuesLine2.push(["mia", String(mia)]);
62
+ }
63
+ var miv = instance.getMinVideoBitrate();
64
+ if (miv !== 0) {
65
+ valuesLine2.push(["miv", String(miv)]);
66
+ }
67
+ var maa = instance.getMaxAudioBitrate();
68
+ if (maa !== Infinity) {
69
+ valuesLine2.push(["maa", String(maa)]);
70
+ }
71
+ var mav = instance.getMaxVideoBitrate();
72
+ if (mav !== Infinity) {
73
+ valuesLine2.push(["mav", String(mav)]);
74
+ }
75
+ var fab = instance.getManualAudioBitrate();
76
+ if (fab >= 0) {
77
+ valuesLine2.push(["fab", String(fab)]);
78
+ }
79
+ var fvb = instance.getManualVideoBitrate();
80
+ if (fvb >= 0) {
81
+ valuesLine2.push(["fvb", String(fvb)]);
82
+ }
59
83
  var mbs = instance.getMaxVideoBufferSize();
60
84
  if (mbs !== Infinity) {
61
85
  valuesLine2.push(["mbs", String(mbs)]);
@@ -76,12 +100,12 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
76
100
  valuesLine3.push(["er", "\"".concat(String(error), "\"")]);
77
101
  }
78
102
  generalInfoElt.innerHTML = "";
79
- for (var _i = 0, _f = [valuesLine1, valuesLine2, valuesLine3]; _i < _f.length; _i++) {
80
- var valueSet = _f[_i];
103
+ for (var _i = 0, _e = [valuesLine1, valuesLine2, valuesLine3]; _i < _e.length; _i++) {
104
+ var valueSet = _e[_i];
81
105
  if (valueSet.length > 0) {
82
106
  var lineInfoElt = createElement("div");
83
- for (var _g = 0, valueSet_1 = valueSet; _g < valueSet_1.length; _g++) {
84
- var value = valueSet_1[_g];
107
+ for (var _f = 0, valueSet_1 = valueSet; _f < valueSet_1.length; _f++) {
108
+ var value = valueSet_1[_f];
85
109
  lineInfoElt.appendChild(createMetricTitle(value[0]));
86
110
  lineInfoElt.appendChild(createElement("span", {
87
111
  textContent: value[1] + " ",
@@ -91,7 +115,7 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
91
115
  }
92
116
  }
93
117
  if (isExtendedMode(parentElt)) {
94
- var url = (_a = instance.getContentUrls()) === null || _a === void 0 ? void 0 : _a[0];
118
+ var url = instance.getUrl();
95
119
  if (url !== undefined) {
96
120
  var reducedUrl = url.length > 100 ?
97
121
  url.substring(0, 99) + "…" :
@@ -152,23 +176,28 @@ export default function constructDebugGeneralInfo(instance, parentElt, cancelSig
152
176
  ]);
153
177
  adaptationsElt.appendChild(textAdaps);
154
178
  }
155
- var videoBitrates = (_c = (_b = instance.getVideoTrack()) === null || _b === void 0 ? void 0 : _b.representations.map(function (r) {
156
- return r.bitrate;
157
- }).filter(function (bitrate) { return bitrate !== undefined; })) !== null && _c !== void 0 ? _c : [];
158
- var audioBitrates = (_e = (_d = instance.getAudioTrack()) === null || _d === void 0 ? void 0 : _d.representations.map(function (r) {
159
- return r.bitrate;
160
- }).filter(function (bitrate) { return bitrate !== undefined; })) !== null && _e !== void 0 ? _e : [];
179
+ var adaptations = instance.getCurrentAdaptations();
180
+ var videoBitratesStr = (_b = (_a = adaptations === null || adaptations === void 0 ? void 0 : adaptations.video) === null || _a === void 0 ? void 0 : _a.representations.map(function (r) {
181
+ return String(r.bitrate) +
182
+ (r.isSupported ? "" : " U!") +
183
+ (r.decipherable !== false ? "" : " E!");
184
+ })) !== null && _b !== void 0 ? _b : [];
185
+ var audioBitratesStr = (_d = (_c = adaptations === null || adaptations === void 0 ? void 0 : adaptations.video) === null || _c === void 0 ? void 0 : _c.representations.map(function (r) {
186
+ return String(r.bitrate) +
187
+ (r.isSupported ? "" : " U!") +
188
+ (r.decipherable !== false ? "" : " E!");
189
+ })) !== null && _d !== void 0 ? _d : [];
161
190
  representationsElt.innerHTML = "";
162
- if (videoBitrates.length > 0) {
191
+ if (videoBitratesStr.length > 0) {
163
192
  representationsElt.appendChild(createMetricTitle("vb"));
164
193
  representationsElt.appendChild(createElement("span", {
165
- textContent: videoBitrates.join(" ") + " ",
194
+ textContent: videoBitratesStr.join(" ") + " ",
166
195
  }));
167
196
  }
168
- if (audioBitrates.length > 0) {
197
+ if (audioBitratesStr.length > 0) {
169
198
  representationsElt.appendChild(createMetricTitle("ab"));
170
199
  representationsElt.appendChild(createElement("span", {
171
- textContent: audioBitrates.join(" ") + " ",
200
+ textContent: audioBitratesStr.join(" ") + " ",
172
201
  }));
173
202
  }
174
203
  }
@@ -67,9 +67,9 @@ export default function createSegmentBufferGraph(instance, bufferType, title, pa
67
67
  }
68
68
  }
69
69
  loadingRangeRepInfoElt.innerHTML = "";
70
- var rep = (_c = instance.__priv_getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c[bufferType];
71
- var adap = (_d = instance.__priv_getCurrentAdaptation()) === null || _d === void 0 ? void 0 : _d[bufferType];
72
- var manifest = instance.__priv_getManifest();
70
+ var rep = (_c = instance.getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c[bufferType];
71
+ var adap = (_d = instance.getCurrentAdaptations()) === null || _d === void 0 ? void 0 : _d[bufferType];
72
+ var manifest = instance.getManifest();
73
73
  if (manifest !== null && !isNullOrUndefined(rep) && !isNullOrUndefined(adap)) {
74
74
  var period = manifest.getPeriodForTime(currentTime);
75
75
  if (period !== undefined) {
@@ -22,7 +22,7 @@ export default function createSegmentBufferSizeGraph(instance, parentElt, cancel
22
22
  clearInterval(intervalId);
23
23
  return;
24
24
  }
25
- var bufferGap = instance.getCurrentBufferGap();
25
+ var bufferGap = instance.getVideoBufferGap();
26
26
  if (bufferGap === Infinity) {
27
27
  bufferSizeGraph.pushBufferSize(0);
28
28
  }