rx-player 4.0.0-dev.2023111400 → 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 (336) hide show
  1. package/CHANGELOG.md +20 -60
  2. package/FILES.md +1 -1
  3. package/README.md +2 -33
  4. package/VERSION +1 -1
  5. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
  6. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +20 -10
  7. package/dist/_esm5.processed/core/api/option_utils.d.ts +0 -2
  8. package/dist/_esm5.processed/core/api/option_utils.js +0 -6
  9. package/dist/_esm5.processed/core/api/public_api.d.ts +1 -2
  10. package/dist/_esm5.processed/core/api/public_api.js +9 -17
  11. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
  12. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +3 -14
  13. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
  14. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
  15. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  16. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +1 -1
  17. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  18. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  19. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  20. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +2 -2
  21. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  22. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +19 -10
  23. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -1
  24. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +1 -1
  25. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
  26. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  27. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
  28. package/dist/_esm5.processed/public_types.d.ts +2 -0
  29. package/dist/commonjs/compat/is_codec_supported.js +22 -1
  30. package/dist/commonjs/config.d.ts +2 -1
  31. package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  32. package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +2 -2
  33. package/dist/commonjs/core/adaptive/network_analyzer.js +3 -3
  34. package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
  35. package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
  36. package/dist/commonjs/core/api/index.d.ts +1 -1
  37. package/dist/commonjs/core/api/option_utils.d.ts +2 -0
  38. package/dist/commonjs/core/api/option_utils.js +2 -3
  39. package/dist/commonjs/core/api/playback_observer.d.ts +128 -8
  40. package/dist/commonjs/core/api/playback_observer.js +217 -64
  41. package/dist/commonjs/core/api/public_api.d.ts +9 -0
  42. package/dist/commonjs/core/api/public_api.js +41 -16
  43. package/dist/commonjs/core/api/utils.js +1 -1
  44. package/dist/commonjs/core/decrypt/get_media_keys.js +2 -6
  45. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  46. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
  47. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  48. package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
  49. package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  50. package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
  51. package/dist/commonjs/core/init/directfile_content_initializer.js +29 -8
  52. package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
  53. package/dist/commonjs/core/init/media_source_content_initializer.js +32 -20
  54. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  55. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +17 -19
  56. package/dist/commonjs/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  57. package/dist/commonjs/core/init/utils/create_stream_playback_observer.js +16 -14
  58. package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
  59. package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
  60. package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +9 -11
  61. package/dist/commonjs/core/init/utils/initial_seek_and_play.js +121 -91
  62. package/dist/commonjs/core/init/utils/rebuffering_controller.js +27 -70
  63. package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  64. package/dist/commonjs/core/segment_buffers/garbage_collector.js +1 -2
  65. package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  66. package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  67. package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  68. package/dist/commonjs/core/segment_buffers/index.d.ts +2 -2
  69. package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +2 -2
  70. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  71. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +19 -10
  72. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  73. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  74. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +14 -18
  75. package/dist/commonjs/core/stream/period/period_stream.js +5 -8
  76. package/dist/commonjs/core/stream/period/types.d.ts +2 -3
  77. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  78. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  79. package/dist/commonjs/core/stream/representation/representation_stream.js +3 -4
  80. package/dist/commonjs/core/stream/representation/types.d.ts +2 -2
  81. package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +11 -12
  82. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +4 -4
  83. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
  84. package/dist/commonjs/default_config.d.ts +12 -16
  85. package/dist/commonjs/default_config.js +21 -16
  86. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  87. package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  88. package/dist/commonjs/manifest/adaptation.js +2 -1
  89. package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
  90. package/dist/commonjs/manifest/representation_index/static.js +2 -2
  91. package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
  92. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  93. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
  94. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  95. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  96. package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  97. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  98. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
  99. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  100. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
  101. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  102. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  103. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
  104. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  105. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  106. package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
  107. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
  108. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  109. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
  110. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  111. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
  112. package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +7 -3
  113. package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
  114. package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
  115. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  116. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
  117. package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
  118. package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
  119. package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
  120. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  121. package/dist/commonjs/public_types.d.ts +107 -36
  122. package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
  123. package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
  124. package/dist/commonjs/transports/dash/segment_loader.js +2 -1
  125. package/dist/commonjs/transports/dash/text_loader.js +2 -0
  126. package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
  127. package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
  128. package/dist/commonjs/transports/smooth/pipelines.js +4 -2
  129. package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
  130. package/dist/commonjs/transports/types.d.ts +12 -0
  131. package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
  132. package/dist/commonjs/utils/request/fetch.d.ts +6 -0
  133. package/dist/commonjs/utils/request/fetch.js +29 -8
  134. package/dist/commonjs/utils/request/xhr.d.ts +11 -5
  135. package/dist/commonjs/utils/request/xhr.js +29 -8
  136. package/dist/es2017/compat/is_codec_supported.js +22 -1
  137. package/dist/es2017/config.d.ts +2 -1
  138. package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  139. package/dist/es2017/core/adaptive/adaptive_representation_selector.js +2 -2
  140. package/dist/es2017/core/adaptive/network_analyzer.js +3 -3
  141. package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
  142. package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
  143. package/dist/es2017/core/api/index.d.ts +1 -1
  144. package/dist/es2017/core/api/option_utils.d.ts +2 -0
  145. package/dist/es2017/core/api/option_utils.js +2 -3
  146. package/dist/es2017/core/api/playback_observer.d.ts +128 -8
  147. package/dist/es2017/core/api/playback_observer.js +217 -66
  148. package/dist/es2017/core/api/public_api.d.ts +9 -0
  149. package/dist/es2017/core/api/public_api.js +40 -15
  150. package/dist/es2017/core/api/utils.js +1 -1
  151. package/dist/es2017/core/decrypt/get_media_keys.js +2 -6
  152. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  153. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
  154. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  155. package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
  156. package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  157. package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
  158. package/dist/es2017/core/init/directfile_content_initializer.js +31 -8
  159. package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
  160. package/dist/es2017/core/init/media_source_content_initializer.js +34 -22
  161. package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  162. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +17 -17
  163. package/dist/es2017/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  164. package/dist/es2017/core/init/utils/create_stream_playback_observer.js +16 -14
  165. package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
  166. package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
  167. package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +9 -11
  168. package/dist/es2017/core/init/utils/initial_seek_and_play.js +120 -91
  169. package/dist/es2017/core/init/utils/rebuffering_controller.js +27 -70
  170. package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  171. package/dist/es2017/core/segment_buffers/garbage_collector.js +1 -2
  172. package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  173. package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  174. package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  175. package/dist/es2017/core/segment_buffers/index.d.ts +2 -2
  176. package/dist/es2017/core/segment_buffers/inventory/index.d.ts +2 -2
  177. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  178. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +19 -10
  179. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  180. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  181. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +16 -18
  182. package/dist/es2017/core/stream/period/period_stream.js +4 -7
  183. package/dist/es2017/core/stream/period/types.d.ts +2 -3
  184. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  185. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  186. package/dist/es2017/core/stream/representation/representation_stream.js +3 -4
  187. package/dist/es2017/core/stream/representation/types.d.ts +2 -2
  188. package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +1 -2
  189. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +4 -4
  190. package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
  191. package/dist/es2017/default_config.d.ts +12 -16
  192. package/dist/es2017/default_config.js +21 -16
  193. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  194. package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  195. package/dist/es2017/manifest/adaptation.js +2 -1
  196. package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
  197. package/dist/es2017/manifest/representation_index/static.js +2 -2
  198. package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
  199. package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  200. package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
  201. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  202. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  203. package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  204. package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  205. package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
  206. package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  207. package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
  208. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  209. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  210. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
  211. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  212. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  213. package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
  214. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
  215. package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  216. package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
  217. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  218. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
  219. package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +7 -3
  220. package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
  221. package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
  222. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  223. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
  224. package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
  225. package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
  226. package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
  227. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  228. package/dist/es2017/public_types.d.ts +107 -36
  229. package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
  230. package/dist/es2017/transports/dash/manifest_parser.js +3 -0
  231. package/dist/es2017/transports/dash/segment_loader.js +1 -0
  232. package/dist/es2017/transports/dash/text_loader.js +2 -0
  233. package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
  234. package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
  235. package/dist/es2017/transports/smooth/pipelines.js +2 -0
  236. package/dist/es2017/transports/smooth/segment_loader.js +1 -0
  237. package/dist/es2017/transports/types.d.ts +12 -0
  238. package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
  239. package/dist/es2017/utils/request/fetch.d.ts +6 -0
  240. package/dist/es2017/utils/request/fetch.js +29 -8
  241. package/dist/es2017/utils/request/xhr.d.ts +11 -5
  242. package/dist/es2017/utils/request/xhr.js +30 -9
  243. package/dist/mpd-parser.wasm +0 -0
  244. package/dist/rx-player.js +1335 -812
  245. package/dist/rx-player.min.js +1 -1
  246. package/package.json +7 -4
  247. package/scripts/canal-release.patch +78 -0
  248. package/scripts/make-dev-releases +65 -0
  249. package/scripts/update-version +7 -0
  250. package/sonar-project.properties +1 -1
  251. package/src/compat/is_codec_supported.ts +23 -1
  252. package/src/core/adaptive/adaptive_representation_selector.ts +4 -21
  253. package/src/core/adaptive/network_analyzer.ts +3 -3
  254. package/src/core/api/debug/buffer_graph.ts +2 -5
  255. package/src/core/api/debug/modules/general_info.ts +15 -10
  256. package/src/core/api/index.ts +1 -0
  257. package/src/core/api/option_utils.ts +3 -3
  258. package/src/core/api/playback_observer.ts +327 -107
  259. package/src/core/api/public_api.ts +42 -14
  260. package/src/core/api/utils.ts +3 -1
  261. package/src/core/decrypt/get_media_keys.ts +2 -8
  262. package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
  263. package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
  264. package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
  265. package/src/core/fetchers/utils/schedule_request.ts +1 -1
  266. package/src/core/init/directfile_content_initializer.ts +31 -15
  267. package/src/core/init/media_source_content_initializer.ts +40 -27
  268. package/src/core/init/utils/content_time_boundaries_observer.ts +24 -23
  269. package/src/core/init/utils/create_stream_playback_observer.ts +19 -20
  270. package/src/core/init/utils/get_initial_time.ts +25 -12
  271. package/src/core/init/utils/initial_seek_and_play.ts +140 -108
  272. package/src/core/init/utils/rebuffering_controller.ts +32 -77
  273. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +5 -2
  274. package/src/core/segment_buffers/garbage_collector.ts +1 -1
  275. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
  276. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +1 -1
  277. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +1 -1
  278. package/src/core/segment_buffers/index.ts +2 -0
  279. package/src/core/segment_buffers/inventory/index.ts +2 -0
  280. package/src/core/segment_buffers/inventory/segment_inventory.ts +49 -17
  281. package/src/core/stream/adaptation/get_representations_switch_strategy.ts +21 -12
  282. package/src/core/stream/orchestrator/stream_orchestrator.ts +14 -19
  283. package/src/core/stream/period/period_stream.ts +7 -8
  284. package/src/core/stream/period/types.ts +2 -3
  285. package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +21 -15
  286. package/src/core/stream/representation/representation_stream.ts +3 -5
  287. package/src/core/stream/representation/types.ts +2 -2
  288. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
  289. package/src/core/stream/representation/utils/get_buffer_status.ts +5 -4
  290. package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
  291. package/src/default_config.ts +22 -17
  292. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
  293. package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
  294. package/src/manifest/adaptation.ts +2 -1
  295. package/src/manifest/representation_index/static.ts +2 -2
  296. package/src/manifest/representation_index/types.ts +4 -4
  297. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
  298. package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
  299. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
  300. package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
  301. package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
  302. package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
  303. package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
  304. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
  305. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
  306. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
  307. package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
  308. package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
  309. package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
  310. package/src/parsers/manifest/dash/common/parse_representations.ts +9 -3
  311. package/src/parsers/manifest/local/representation_index.ts +3 -3
  312. package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
  313. package/src/parsers/manifest/smooth/representation_index.ts +23 -9
  314. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
  315. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
  316. package/src/parsers/manifest/utils/index_helpers.ts +1 -1
  317. package/src/parsers/texttracks/ttml/html/apply_line_height.ts +3 -1
  318. package/src/public_types.ts +108 -36
  319. package/src/transports/dash/init_segment_loader.ts +5 -0
  320. package/src/transports/dash/manifest_parser.ts +6 -0
  321. package/src/transports/dash/segment_loader.ts +1 -0
  322. package/src/transports/dash/text_loader.ts +2 -0
  323. package/src/transports/metaplaylist/manifest_loader.ts +1 -0
  324. package/src/transports/metaplaylist/pipelines.ts +4 -1
  325. package/src/transports/smooth/pipelines.ts +2 -0
  326. package/src/transports/smooth/segment_loader.ts +1 -0
  327. package/src/transports/types.ts +12 -0
  328. package/src/transports/utils/generate_manifest_loader.ts +3 -0
  329. package/src/utils/request/fetch.ts +35 -8
  330. package/src/utils/request/xhr.ts +45 -14
  331. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  332. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
  333. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  334. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
  335. package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
  336. package/src/typings/object-assign.d.ts +0 -48
@@ -231,7 +231,7 @@ var HTMLTextSegmentBuffer = /** @class */ (function (_super) {
231
231
  return;
232
232
  }
233
233
  if (infos.inventoryInfos !== null) {
234
- this._segmentInventory.insertChunk(infos.inventoryInfos);
234
+ this._segmentInventory.insertChunk(infos.inventoryInfos, true);
235
235
  }
236
236
  this._buffer.insert(cues, start, end);
237
237
  this._buffered.insert(start, end);
@@ -157,7 +157,7 @@ var NativeTextSegmentBuffer = /** @class */ (function (_super) {
157
157
  }
158
158
  this._buffered.insert(start, end);
159
159
  if (infos.inventoryInfos !== null) {
160
- this._segmentInventory.insertChunk(infos.inventoryInfos);
160
+ this._segmentInventory.insertChunk(infos.inventoryInfos, true);
161
161
  }
162
162
  }
163
163
  catch (err) {
@@ -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 { ChunkStatus, IBufferedChunk, IChunkContext, IInsertedChunkInfos } 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, ChunkStatus, ISegmentBufferOptions, ITextTrackSegmentBufferOptions, SegmentBuffer, IBufferType, IBufferedChunk, IChunkContext, IInsertedChunkInfos, IPushChunkInfos, IPushedChunkData, IEndOfSegmentInfos, SegmentBufferOperation, ISBOperation, IEndOfSegmentOperation, IPushOperation, IRemoveOperation, };
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import SegmentInventory, { IBufferedChunk, IInsertedChunkInfos } from "./segment_inventory";
16
+ import SegmentInventory, { ChunkStatus, IBufferedChunk, IInsertedChunkInfos } from "./segment_inventory";
17
17
  export default SegmentInventory;
18
- export { IBufferedChunk, IInsertedChunkInfos, };
18
+ export { ChunkStatus, IBufferedChunk, IInsertedChunkInfos, };
19
19
  export { IBufferedHistoryEntry } from "./buffered_history";
20
20
  export { IChunkContext } from "./types";
@@ -16,6 +16,27 @@
16
16
  import { Adaptation, ISegment, Period, Representation } from "../../../manifest";
17
17
  import { IBufferedHistoryEntry } from "./buffered_history";
18
18
  import { IChunkContext } from "./types";
19
+ /** Categorization of a given chunk in the `SegmentInventory`. */
20
+ export declare const enum ChunkStatus {
21
+ /**
22
+ * This chunk is only a part of a partially-pushed segment for now, meaning
23
+ * that it is only a sub-part of a requested segment that was not yet
24
+ * fully-loaded and pushed.
25
+ *
26
+ * Once and if the corresponding segment is fully-pushed, its `ChunkStatus`
27
+ * switches to `Complete`.
28
+ */
29
+ PartiallyPushed = 0,
30
+ /** This chunk corresponds to a fully-loaded segment. */
31
+ Complete = 1,
32
+ /**
33
+ * This chunk's push operation failed, in this scenario there is no certitude
34
+ * about the presence of that chunk in the buffer: it may not be present,
35
+ * partially-present, or fully-present depending on why that push operation
36
+ * failed, which is generally only known by the lower-level code.
37
+ */
38
+ Failed = 2
39
+ }
19
40
  /** Information stored on a single chunk by the SegmentInventory. */
20
41
  export interface IBufferedChunk {
21
42
  /**
@@ -69,14 +90,10 @@ export interface IBufferedChunk {
69
90
  /** Information on what that chunk actually contains. */
70
91
  infos: IChunkContext;
71
92
  /**
72
- * If `true`, this chunk is only a partial chunk of a whole segment.
73
- *
74
- * Inversely, if `false`, this chunk is a whole segment whose inner chunks
75
- * have all been fully pushed.
76
- * In that condition, the `start` and `end` properties refer to that fully
77
- * pushed segment.
93
+ * Status of this chunk.
94
+ * @see ChunkStatus
78
95
  */
79
- partiallyPushed: boolean;
96
+ status: ChunkStatus;
80
97
  /**
81
98
  * If `true`, the segment as a whole is divided into multiple parts in the
82
99
  * buffer, with other segment(s) between them.
@@ -169,7 +186,7 @@ export default class SegmentInventory {
169
186
  * segment have been inserted, you should call the `completeSegment` method.
170
187
  * @param {Object} chunkInformation
171
188
  */
172
- insertChunk({ period, adaptation, representation, segment, chunkSize, start, end }: IInsertedChunkInfos): void;
189
+ insertChunk({ period, adaptation, representation, segment, chunkSize, start, end }: IInsertedChunkInfos, succeed: boolean): void;
173
190
  /**
174
191
  * Indicate that inserted chunks can now be considered as a complete segment.
175
192
  * Take in argument the same content than what was given to `insertChunk` for
@@ -97,7 +97,9 @@ var SegmentInventory = /** @class */ (function () {
97
97
  var removed = inventory.splice(indexBefore, numberOfSegmentToDelete);
98
98
  for (var _i = 0, removed_1 = removed; _i < removed_1.length; _i++) {
99
99
  var seg = removed_1[_i];
100
- if (seg.bufferedStart === undefined && seg.bufferedEnd === undefined) {
100
+ if (seg.bufferedStart === undefined &&
101
+ seg.bufferedEnd === undefined &&
102
+ seg.status !== 2 /* ChunkStatus.Failed */) {
101
103
  this._bufferedHistory.addBufferedSegment(seg.infos, null);
102
104
  }
103
105
  }
@@ -156,7 +158,9 @@ var SegmentInventory = /** @class */ (function () {
156
158
  var removed = inventory.splice(inventoryIndex, inventory.length - inventoryIndex);
157
159
  for (var _h = 0, removed_2 = removed; _h < removed_2.length; _h++) {
158
160
  var seg = removed_2[_h];
159
- if (seg.bufferedStart === undefined && seg.bufferedEnd === undefined) {
161
+ if (seg.bufferedStart === undefined &&
162
+ seg.bufferedEnd === undefined &&
163
+ seg.status !== 2 /* ChunkStatus.Failed */) {
160
164
  this._bufferedHistory.addBufferedSegment(seg.infos, null);
161
165
  }
162
166
  }
@@ -173,7 +177,7 @@ var SegmentInventory = /** @class */ (function () {
173
177
  * segment have been inserted, you should call the `completeSegment` method.
174
178
  * @param {Object} chunkInformation
175
179
  */
176
- SegmentInventory.prototype.insertChunk = function (_a) {
180
+ SegmentInventory.prototype.insertChunk = function (_a, succeed) {
177
181
  var period = _a.period, adaptation = _a.adaptation, representation = _a.representation, segment = _a.segment, chunkSize = _a.chunkSize, start = _a.start, end = _a.end;
178
182
  if (segment.isInit) {
179
183
  return;
@@ -184,7 +188,8 @@ var SegmentInventory = /** @class */ (function () {
184
188
  return;
185
189
  }
186
190
  var inventory = this._inventory;
187
- var newSegment = { partiallyPushed: true, chunkSize: chunkSize, splitted: false, start: start, end: end, precizeStart: false,
191
+ var newSegment = { status: succeed ? 0 /* ChunkStatus.PartiallyPushed */ :
192
+ 2 /* ChunkStatus.Failed */, chunkSize: chunkSize, splitted: false, start: start, end: end, precizeStart: false,
188
193
  precizeEnd: false,
189
194
  bufferedStart: undefined,
190
195
  bufferedEnd: undefined,
@@ -377,7 +382,7 @@ var SegmentInventory = /** @class */ (function () {
377
382
  // newSegment : |====|
378
383
  // ===> : |--|====|-|
379
384
  log.warn("SI: Segment pushed is contained in a previous one", bufferType, start, end, segmentI.start, segmentI.end);
380
- var nextSegment = { partiallyPushed: segmentI.partiallyPushed,
385
+ var nextSegment = { status: segmentI.status,
381
386
  /**
382
387
  * Note: this sadly means we're doing as if
383
388
  * that chunk is present two times.
@@ -535,7 +540,9 @@ var SegmentInventory = /** @class */ (function () {
535
540
  this._inventory.splice(firstI + 1, length_1);
536
541
  i -= length_1;
537
542
  }
538
- this._inventory[firstI].partiallyPushed = false;
543
+ if (this._inventory[firstI].status === 0 /* ChunkStatus.PartiallyPushed */) {
544
+ this._inventory[firstI].status = 1 /* ChunkStatus.Complete */;
545
+ }
539
546
  this._inventory[firstI].chunkSize = segmentSize;
540
547
  this._inventory[firstI].end = lastEnd;
541
548
  this._inventory[firstI].bufferedEnd = lastBufferedEnd;
@@ -551,8 +558,10 @@ var SegmentInventory = /** @class */ (function () {
551
558
  for (var _i = 0, resSegments_1 = resSegments; _i < resSegments_1.length; _i++) {
552
559
  var seg = resSegments_1[_i];
553
560
  if (seg.bufferedStart !== undefined && seg.bufferedEnd !== undefined) {
554
- this._bufferedHistory.addBufferedSegment(seg.infos, { start: seg.bufferedStart,
555
- end: seg.bufferedEnd });
561
+ if (seg.status !== 2 /* ChunkStatus.Failed */) {
562
+ this._bufferedHistory.addBufferedSegment(seg.infos, { start: seg.bufferedStart,
563
+ end: seg.bufferedEnd });
564
+ }
556
565
  }
557
566
  else {
558
567
  log.debug("SI: buffered range not known after sync. Skipping history.", seg.start, seg.end);
@@ -597,7 +606,7 @@ export default SegmentInventory;
597
606
  */
598
607
  function bufferedStartLooksCoherent(thisSegment) {
599
608
  if (thisSegment.bufferedStart === undefined ||
600
- thisSegment.partiallyPushed) {
609
+ thisSegment.status !== 1 /* ChunkStatus.Complete */) {
601
610
  return false;
602
611
  }
603
612
  var start = thisSegment.start, end = thisSegment.end;
@@ -618,7 +627,7 @@ function bufferedStartLooksCoherent(thisSegment) {
618
627
  */
619
628
  function bufferedEndLooksCoherent(thisSegment) {
620
629
  if (thisSegment.bufferedEnd === undefined ||
621
- thisSegment.partiallyPushed) {
630
+ thisSegment.status !== 1 /* ChunkStatus.Complete */) {
622
631
  return false;
623
632
  }
624
633
  var start = thisSegment.start, end = thisSegment.end;
@@ -184,7 +184,7 @@ function getPlayableBufferedSegments(neededRange, segmentInventory) {
184
184
  for (var i = segmentInventory.length - 1; i >= 0; i--) {
185
185
  var eltInventory = segmentInventory[i];
186
186
  var representation = eltInventory.infos.representation;
187
- if (!eltInventory.partiallyPushed &&
187
+ if (eltInventory.status === 1 /* ChunkStatus.Complete */ &&
188
188
  representation.decipherable !== false &&
189
189
  representation.isSupported) {
190
190
  var inventorySegment = eltInventory.infos.segment;
@@ -321,7 +321,7 @@ function doesEndSeemGarbageCollected(currentSeg, nextSeg, minimumEndTime) {
321
321
  }
322
322
  if (minimumEndTime > currentSeg.bufferedEnd &&
323
323
  currentSeg.end - currentSeg.bufferedEnd > MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT) {
324
- log.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.start, currentSeg.bufferedStart);
324
+ log.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.end, currentSeg.bufferedEnd);
325
325
  return true;
326
326
  }
327
327
  return false;
@@ -48,14 +48,7 @@ export default function applyExtent(element, extent) {
48
48
  if (secondExtent[2] === "px" ||
49
49
  secondExtent[2] === "%" ||
50
50
  secondExtent[2] === "em") {
51
- var toNum = Number(secondExtent[1]);
52
- if (secondExtent[2] === "%" && !isNaN(toNum) &&
53
- (toNum < 0 || toNum > 100)) {
54
- element.style.width = "80%";
55
- }
56
- else {
57
- element.style.height = secondExtent[1] + secondExtent[2];
58
- }
51
+ element.style.height = secondExtent[1] + secondExtent[2];
59
52
  }
60
53
  else if (secondExtent[2] === "c") {
61
54
  addClassName(element, "proportional-style");
@@ -22,10 +22,11 @@ import { REGXP_LENGTH } from "../regexps";
22
22
  */
23
23
  export default function applyLineHeight(element, lineHeight) {
24
24
  var trimmedLineHeight = lineHeight.trim();
25
+ var splittedLineHeight = trimmedLineHeight.split(" ");
25
26
  if (trimmedLineHeight === "auto") {
26
27
  return;
27
28
  }
28
- var firstLineHeight = REGXP_LENGTH.exec(trimmedLineHeight[0]);
29
+ var firstLineHeight = REGXP_LENGTH.exec(splittedLineHeight[0]);
29
30
  if (firstLineHeight === null) {
30
31
  return;
31
32
  }
@@ -47,15 +47,7 @@ export default function applyOrigin(element, origin) {
47
47
  if (secondOrigin[2] === "px" ||
48
48
  secondOrigin[2] === "%" ||
49
49
  secondOrigin[2] === "em") {
50
- var toNum = Number(secondOrigin[1]);
51
- if (secondOrigin[2] === "%" && !isNaN(toNum) &&
52
- (toNum < 0 || toNum > 100)) {
53
- element.style.bottom = "5%";
54
- element.style.left = "10%";
55
- }
56
- else {
57
- element.style.top = secondOrigin[1] + secondOrigin[2];
58
- }
50
+ element.style.top = secondOrigin[1] + secondOrigin[2];
59
51
  }
60
52
  else if (secondOrigin[2] === "c") {
61
53
  addClassName(element, "proportional-style");
@@ -264,6 +264,8 @@ export interface IRepresentation {
264
264
  /** If the track is HDR, gives the HDR characteristics of the content */
265
265
  hdrInfo?: IHDRInformation;
266
266
  index: IRepresentationIndex;
267
+ /** NOTE: not part of the API. */
268
+ isSupported: boolean;
267
269
  }
268
270
  export interface IHDRInformation {
269
271
  /**
@@ -16,6 +16,16 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  var browser_compatibility_types_1 = require("./browser_compatibility_types");
19
+ /**
20
+ * Setting this value limit the number of entries in the support map
21
+ * preventing important memory usage, value is arbitrary
22
+ */
23
+ var MAX_SUPPORT_MAP_ENTRIES = 200;
24
+ /**
25
+ * caching the codec support reduce the amount of call to `isTypeSupported`
26
+ * and help for performance especially on low-end devices.
27
+ */
28
+ var supportMap = new Map();
19
29
  /**
20
30
  * Returns true if the given codec is supported by the browser's MediaSource
21
31
  * implementation.
@@ -32,7 +42,18 @@ function isCodecSupported(mimeType) {
32
42
  /* eslint-disable @typescript-eslint/unbound-method */
33
43
  if (typeof browser_compatibility_types_1.MediaSource_.isTypeSupported === "function") {
34
44
  /* eslint-enable @typescript-eslint/unbound-method */
35
- return browser_compatibility_types_1.MediaSource_.isTypeSupported(mimeType);
45
+ var cachedSupport = supportMap.get(mimeType);
46
+ if (cachedSupport !== undefined) {
47
+ return cachedSupport;
48
+ }
49
+ else {
50
+ var isSupported = browser_compatibility_types_1.MediaSource_.isTypeSupported(mimeType);
51
+ if (supportMap.size >= MAX_SUPPORT_MAP_ENTRIES) {
52
+ supportMap.clear();
53
+ }
54
+ supportMap.set(mimeType, isSupported);
55
+ return isSupported;
56
+ }
36
57
  }
37
58
  return true;
38
59
  }
@@ -18,6 +18,7 @@ declare class ConfigHandler {
18
18
  _config: {
19
19
  DEFAULT_UNMUTED_VOLUME: number;
20
20
  DEFAULT_REQUEST_TIMEOUT: number;
21
+ DEFAULT_CONNECTION_TIMEOUT: number;
21
22
  DEFAULT_TEXT_TRACK_MODE: "native" | "html";
22
23
  DEFAULT_ENABLE_FAST_SWITCHING: boolean;
23
24
  DELTA_POSITION_AFTER_RELOAD: {
@@ -35,6 +36,7 @@ declare class ConfigHandler {
35
36
  DEFAULT_MAX_BUFFER_BEHIND: number;
36
37
  DEFAULT_MAX_VIDEO_BUFFER_SIZE: number;
37
38
  MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "text", number>>;
39
+ MINIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "image" | "text", number>>;
38
40
  MAXIMUM_MAX_BUFFER_BEHIND: Partial<Record<"audio" | "video" | "text", number>>;
39
41
  DEFAULT_BASE_BANDWIDTH: number;
40
42
  INACTIVITY_DELAY: number;
@@ -45,7 +47,6 @@ declare class ConfigHandler {
45
47
  LOW_LATENCY: number;
46
48
  };
47
49
  BUFFER_DISCONTINUITY_THRESHOLD: number;
48
- FORCE_DISCONTINUITY_SEEK_DELAY: number;
49
50
  BITRATE_REBUFFERING_RATIO: number;
50
51
  BUFFER_GC_GAPS: {
51
52
  CALM: number;
@@ -16,7 +16,7 @@
16
16
  import Manifest, { Adaptation, ISegment, Period, Representation } from "../../manifest";
17
17
  import { IReadOnlySharedReference } from "../../utils/reference";
18
18
  import { CancellationSignal } from "../../utils/task_canceller";
19
- import { IReadOnlyPlaybackObserver } from "../api";
19
+ import { IObservationPosition, IReadOnlyPlaybackObserver } from "../api";
20
20
  import { IBufferType } from "../segment_buffers";
21
21
  import BandwidthEstimator from "./utils/bandwidth_estimator";
22
22
  import { IResolutionInfo } from "./utils/filter_by_resolution";
@@ -99,24 +99,7 @@ export interface IRepresentationEstimatorPlaybackObservation {
99
99
  * Information on the current media position in seconds at the time of a
100
100
  * Playback Observation.
101
101
  */
102
- position: {
103
- /**
104
- * Known position at the time the Observation was emitted, in seconds.
105
- *
106
- * Note that it might have changed since. If you want truly precize
107
- * information, you should recuperate it from the HTMLMediaElement directly
108
- * through another mean.
109
- */
110
- last: number;
111
- /**
112
- * Actually wanted position in seconds that is not yet reached.
113
- *
114
- * This might for example be set to the initial position when the content is
115
- * loading (and thus potentially at a `0` position) but which will be seeked
116
- * to a given position once possible.
117
- */
118
- pending: number | undefined;
119
- };
102
+ position: IObservationPosition;
120
103
  /**
121
104
  * Last "playback rate" set by the user. This is the ideal "playback rate" at
122
105
  * which the media should play.
@@ -194,7 +194,7 @@ function getEstimateReference(_a, stopAllEstimates) {
194
194
  }
195
195
  var position = lastPlaybackObservation.position, speed = lastPlaybackObservation.speed;
196
196
  var timeRanges = val.buffered;
197
- var bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(timeRanges, position.last);
197
+ var bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(timeRanges, position.getWanted());
198
198
  var representation = val.content.representation;
199
199
  var currentScore = scoreCalculator.getEstimate(representation);
200
200
  var currentBitrate = representation.bitrate;
@@ -285,7 +285,7 @@ function getEstimateReference(_a, stopAllEstimates) {
285
285
  if (lowLatencyMode &&
286
286
  currentRepresentationVal !== null &&
287
287
  context.manifest.isDynamic &&
288
- maximumPosition - position.last < 40) {
288
+ maximumPosition - position.getWanted() < 40) {
289
289
  chosenRepFromGuessMode = guessBasedChooser
290
290
  .getGuess(sortedRepresentations, lastPlaybackObservation, currentRepresentationVal, currentBestBitrate, requests);
291
291
  }
@@ -124,7 +124,7 @@ function estimateStarvationModeBitrate(pendingRequests, playbackInfo, currentRep
124
124
  var bufferGap = playbackInfo.bufferGap, speed = playbackInfo.speed, position = playbackInfo.position;
125
125
  var realBufferGap = isFinite(bufferGap) ? bufferGap :
126
126
  0;
127
- var nextNeededPosition = position.last + realBufferGap;
127
+ var nextNeededPosition = position.getWanted() + realBufferGap;
128
128
  var concernedRequests = getConcernedRequests(pendingRequests, nextNeededPosition);
129
129
  if (concernedRequests.length !== 1) { // 0 == no request
130
130
  // 2+ == too complicated to calculate
@@ -192,7 +192,7 @@ function shouldDirectlySwitchToLowBitrate(playbackInfo, requests, lowLatencyMode
192
192
  }
193
193
  var realBufferGap = isFinite(playbackInfo.bufferGap) ? playbackInfo.bufferGap :
194
194
  0;
195
- var nextNeededPosition = playbackInfo.position.last + realBufferGap;
195
+ var nextNeededPosition = playbackInfo.position.getWanted() + realBufferGap;
196
196
  var nextRequest = (0, array_find_1.default)(requests, function (_a) {
197
197
  var content = _a.content;
198
198
  return content.segment.duration > 0 &&
@@ -268,7 +268,7 @@ var NetworkAnalyzer = /** @class */ (function () {
268
268
  var ABR_STARVATION_DURATION_DELTA = config_1.default.getCurrent().ABR_STARVATION_DURATION_DELTA;
269
269
  // check if should get in/out of starvation mode
270
270
  if (isNaN(duration) ||
271
- realBufferGap + position.last < duration - ABR_STARVATION_DURATION_DELTA) {
271
+ realBufferGap + position.getWanted() < duration - ABR_STARVATION_DURATION_DELTA) {
272
272
  if (!this._inStarvationMode && realBufferGap <= localConf.starvationGap) {
273
273
  log_1.default.info("ABR: enter starvation mode.");
274
274
  this._inStarvationMode = true;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var BUFFER_WIDTH_IN_SECONDS = 10000;
3
+ var BUFFER_WIDTH_IN_SECONDS = 30 * 60;
4
4
  var COLORS = [
5
5
  "#2ab7ca",
6
6
  "#fed766",
@@ -67,11 +67,7 @@ var SegmentBufferGraph = /** @class */ (function () {
67
67
  var minimumPosition;
68
68
  var maximumPosition;
69
69
  if (maximumPoint - minimumPoint > BUFFER_WIDTH_IN_SECONDS) {
70
- if (currentTime === undefined) {
71
- minimumPosition = minimumPoint;
72
- maximumPosition = maximumPoint;
73
- }
74
- else if (maximumPoint - currentTime < BUFFER_WIDTH_IN_SECONDS / 2) {
70
+ if (maximumPoint - currentTime < BUFFER_WIDTH_IN_SECONDS / 2) {
75
71
  maximumPosition = maximumPoint;
76
72
  minimumPosition = maximumPoint - BUFFER_WIDTH_IN_SECONDS;
77
73
  }
@@ -184,23 +184,30 @@ function constructDebugGeneralInfo(instance, parentElt, cancelSignal) {
184
184
  ]);
185
185
  adaptationsElt.appendChild(textAdaps);
186
186
  }
187
- var videoBitrates = (_e = (_d = instance.getVideoTrack()) === null || _d === void 0 ? void 0 : _d.representations.map(function (r) {
188
- return r.bitrate;
189
- }).filter(function (bitrate) { return bitrate !== undefined; })) !== null && _e !== void 0 ? _e : [];
190
- var audioBitrates = (_g = (_f = instance.getAudioTrack()) === null || _f === void 0 ? void 0 : _f.representations.map(function (r) {
191
- return r.bitrate;
192
- }).filter(function (bitrate) { return bitrate !== undefined; })) !== null && _g !== void 0 ? _g : [];
187
+ var adaptations = instance.__priv_getCurrentAdaptation();
188
+ var videoBitratesStr = (_e = (_d = adaptations === null || adaptations === void 0 ? void 0 : adaptations.video) === null || _d === void 0 ? void 0 : _d.representations.map(function (r) {
189
+ var _a;
190
+ return String((_a = r.bitrate) !== null && _a !== void 0 ? _a : "N/A") +
191
+ (r.isSupported ? "" : " U!") +
192
+ (r.decipherable !== false ? "" : " E!");
193
+ })) !== null && _e !== void 0 ? _e : [];
194
+ var audioBitratesStr = (_g = (_f = adaptations === null || adaptations === void 0 ? void 0 : adaptations.video) === null || _f === void 0 ? void 0 : _f.representations.map(function (r) {
195
+ var _a;
196
+ return String((_a = r.bitrate) !== null && _a !== void 0 ? _a : "N/A") +
197
+ (r.isSupported ? "" : " U!") +
198
+ (r.decipherable !== false ? "" : " E!");
199
+ })) !== null && _g !== void 0 ? _g : [];
193
200
  representationsElt.innerHTML = "";
194
- if (videoBitrates.length > 0) {
201
+ if (videoBitratesStr.length > 0) {
195
202
  representationsElt.appendChild((0, utils_1.createMetricTitle)("vb"));
196
203
  representationsElt.appendChild((0, utils_1.createElement)("span", {
197
- textContent: videoBitrates.join(" ") + " ",
204
+ textContent: videoBitratesStr.join(" ") + " ",
198
205
  }));
199
206
  }
200
- if (audioBitrates.length > 0) {
207
+ if (audioBitratesStr.length > 0) {
201
208
  representationsElt.appendChild((0, utils_1.createMetricTitle)("ab"));
202
209
  representationsElt.appendChild((0, utils_1.createElement)("span", {
203
- textContent: audioBitrates.join(" ") + " ",
210
+ textContent: audioBitratesStr.join(" ") + " ",
204
211
  }));
205
212
  }
206
213
  }
@@ -16,5 +16,5 @@
16
16
  import PlaybackObserver from "./playback_observer";
17
17
  import Player from "./public_api";
18
18
  export { PlaybackObserver };
19
- export { IPlaybackObservation, IPlaybackObserverEventType, IReadOnlyPlaybackObserver, IFreezingStatus, IRebufferingStatus, } from "./playback_observer";
19
+ export { IObservationPosition, IPlaybackObservation, IPlaybackObserverEventType, IReadOnlyPlaybackObserver, IFreezingStatus, IRebufferingStatus, } from "./playback_observer";
20
20
  export default Player;
@@ -23,6 +23,8 @@ export type IParsedStartAtOption = {
23
23
  percentage: number;
24
24
  } | {
25
25
  fromLastPosition: number;
26
+ } | {
27
+ fromLivePosition: number;
26
28
  } | {
27
29
  fromFirstPosition: number;
28
30
  };
@@ -279,9 +279,8 @@ function parseLoadVideoOptions(options) {
279
279
  "an \"html\" textTrackMode. It will be ignored.");
280
280
  }
281
281
  if (!(0, is_null_or_undefined_1.default)(options.startAt)) {
282
- // TODO Better way to express that in TypeScript?
283
- if (options.startAt.wallClockTime
284
- instanceof Date) {
282
+ if ("wallClockTime" in options.startAt
283
+ && options.startAt.wallClockTime instanceof Date) {
285
284
  var wallClockTime = options.startAt
286
285
  .wallClockTime.getTime() / 1000;
287
286
  startAt = (0, object_assign_1.default)({}, options.startAt, { wallClockTime: wallClockTime });