rx-player 4.2.0-dev.2024082600 → 4.2.0-dev.2024090500
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.
- package/CHANGELOG.md +12 -3
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/add_class_name.d.ts.map +1 -1
- package/dist/commonjs/compat/add_class_name.js +1 -2
- package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.js +4 -1
- package/dist/commonjs/compat/browser_detection.d.ts +3 -1
- package/dist/commonjs/compat/browser_detection.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_detection.js +8 -1
- package/dist/commonjs/compat/can_reuse_media_keys.d.ts +2 -0
- package/dist/commonjs/compat/can_reuse_media_keys.d.ts.map +1 -1
- package/dist/commonjs/compat/can_reuse_media_keys.js +3 -1
- package/dist/commonjs/compat/clear_element_src.js +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/moz_media_keys_constructor.js +2 -4
- package/dist/commonjs/compat/eme/custom_media_keys/ms_media_keys_constructor.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/ms_media_keys_constructor.js +2 -4
- package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.js +3 -6
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.js +2 -17
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +1 -2
- package/dist/commonjs/compat/eme/eme-api-implementation.js +0 -2
- package/dist/commonjs/compat/event_listeners.d.ts.map +1 -1
- package/dist/commonjs/compat/event_listeners.js +2 -6
- package/dist/commonjs/compat/has_mse_in_worker.js +1 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/commonjs/compat/is_codec_supported.js +0 -2
- package/dist/commonjs/compat/is_vtt_cue.d.ts.map +1 -1
- package/dist/commonjs/compat/is_vtt_cue.js +1 -2
- package/dist/commonjs/compat/on_height_width_change.d.ts.map +1 -1
- package/dist/commonjs/compat/patch_webkit_source_buffer.d.ts.map +1 -1
- package/dist/commonjs/compat/patch_webkit_source_buffer.js +8 -18
- package/dist/commonjs/compat/remove_cue.js +2 -2
- package/dist/commonjs/core/cmcd/cmcd_data_builder.js +1 -1
- package/dist/commonjs/core/fetchers/index.d.ts +4 -4
- package/dist/commonjs/core/fetchers/index.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/index.js +2 -2
- package/dist/commonjs/core/fetchers/segment/index.d.ts +6 -5
- package/dist/commonjs/core/fetchers/segment/index.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/segment/index.js +2 -2
- package/dist/commonjs/core/{stream/representation/utils/downloading_queue.d.ts → fetchers/segment/segment_queue.d.ts} +63 -80
- package/dist/commonjs/core/fetchers/segment/segment_queue.d.ts.map +1 -0
- package/dist/commonjs/core/{stream/representation/utils/downloading_queue.js → fetchers/segment/segment_queue.js} +132 -111
- package/dist/{es2017/core/fetchers/segment/segment_fetcher_creator.d.ts → commonjs/core/fetchers/segment/segment_queue_creator.d.ts} +25 -12
- package/dist/commonjs/core/fetchers/segment/segment_queue_creator.d.ts.map +1 -0
- package/dist/commonjs/core/fetchers/segment/{segment_fetcher_creator.js → segment_queue_creator.js} +15 -9
- package/dist/commonjs/core/fetchers/segment/task_prioritizer.d.ts +9 -0
- package/dist/commonjs/core/fetchers/segment/task_prioritizer.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/segment/task_prioritizer.js +38 -8
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/commonjs/core/main/common/content_time_boundaries_observer.js +21 -10
- package/dist/commonjs/core/main/worker/content_preparer.d.ts +3 -3
- package/dist/commonjs/core/main/worker/content_preparer.d.ts.map +1 -1
- package/dist/commonjs/core/main/worker/content_preparer.js +2 -2
- package/dist/commonjs/core/main/worker/send_message.js +1 -1
- package/dist/commonjs/core/main/worker/worker_main.js +3 -2
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_buffer.js +1 -5
- package/dist/commonjs/core/segment_sinks/inventory/segment_inventory.js +39 -30
- package/dist/commonjs/core/segment_sinks/segment_buffers_store.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/segment_buffers_store.js +3 -2
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts +1 -1
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +3 -3
- package/dist/commonjs/core/stream/adaptation/types.d.ts +2 -2
- package/dist/commonjs/core/stream/adaptation/types.d.ts.map +1 -1
- package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.d.ts.map +1 -1
- package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.js +27 -6
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts +3 -3
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/commonjs/core/stream/period/period_stream.d.ts +1 -1
- package/dist/commonjs/core/stream/period/period_stream.d.ts.map +1 -1
- package/dist/commonjs/core/stream/period/period_stream.js +2 -2
- package/dist/commonjs/core/stream/period/types.d.ts +2 -2
- package/dist/commonjs/core/stream/period/types.d.ts.map +1 -1
- package/dist/commonjs/core/stream/representation/representation_stream.d.ts +1 -1
- package/dist/commonjs/core/stream/representation/representation_stream.d.ts.map +1 -1
- package/dist/commonjs/core/stream/representation/representation_stream.js +19 -28
- package/dist/commonjs/core/stream/representation/types.d.ts +2 -2
- package/dist/commonjs/core/stream/representation/types.d.ts.map +1 -1
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.d.ts.map +1 -1
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +39 -18
- package/dist/commonjs/core/types.d.ts +2 -2
- package/dist/commonjs/core/types.d.ts.map +1 -1
- package/dist/commonjs/default_config.d.ts.map +1 -1
- package/dist/commonjs/default_config.js +0 -8
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +0 -13
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +0 -4
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +2 -13
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
- package/dist/commonjs/features/add_features.d.ts.map +1 -1
- package/dist/commonjs/features/add_features.js +31 -10
- package/dist/commonjs/main_thread/api/option_utils.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/option_utils.js +2 -6
- package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +33 -27
- package/dist/commonjs/main_thread/decrypt/utils/persistent_sessions_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/utils/persistent_sessions_store.js +4 -3
- package/dist/commonjs/main_thread/init/media_source_content_initializer.js +6 -6
- package/dist/commonjs/main_thread/init/multi_thread_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/multi_thread_content_initializer.js +32 -37
- package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.js +1 -5
- package/dist/commonjs/main_thread/text_displayer/native/native_text_displayer.js +3 -7
- package/dist/commonjs/main_thread/tracks_store/track_dispatcher.js +1 -1
- package/dist/commonjs/main_thread/types.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/adaptation.d.ts +13 -13
- package/dist/commonjs/manifest/classes/manifest.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/manifest.js +0 -6
- package/dist/commonjs/manifest/classes/representation.d.ts +20 -12
- package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +72 -62
- package/dist/commonjs/mse/main_media_source_interface.js +1 -1
- package/dist/commonjs/multithread_types.d.ts +2 -2
- package/dist/commonjs/multithread_types.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +12 -6
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +14 -7
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +8 -4
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +10 -5
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +10 -5
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.js +14 -7
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/EventStream.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/EventStream.js +2 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/MPD.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/MPD.js +8 -4
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Period.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Period.js +10 -5
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Representation.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Representation.js +10 -5
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +2 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +2 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +4 -2
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +10 -5
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +2 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.js +2 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.js +29 -8
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +31 -10
- package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/smooth/create_parser.js +2 -1
- package/dist/commonjs/parsers/manifest/smooth/shared_smooth_segment_timeline.js +26 -4
- package/dist/commonjs/parsers/manifest/utils/get_first_time_from_adaptation.js +29 -7
- package/dist/commonjs/parsers/manifest/utils/get_last_time_from_adaptation.js +29 -7
- package/dist/commonjs/parsers/texttracks/srt/html.js +28 -6
- package/dist/commonjs/parsers/texttracks/ttml/html/create_element.js +1 -1
- package/dist/commonjs/parsers/texttracks/ttml/html/parse_ttml_to_div.js +29 -7
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts.map +1 -1
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +26 -5
- package/dist/commonjs/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts.map +1 -1
- package/dist/commonjs/parsers/texttracks/ttml/resolve_styles_inheritance.js +25 -4
- package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.d.ts +9 -3
- package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.d.ts.map +1 -1
- package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.js +9 -3
- package/dist/commonjs/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +30 -8
- package/dist/commonjs/public_types.d.ts +5 -7
- package/dist/commonjs/public_types.d.ts.map +1 -1
- package/dist/commonjs/transports/smooth/extract_timings_infos.js +30 -8
- package/dist/commonjs/utils/array_find.d.ts +1 -1
- package/dist/commonjs/utils/array_find.d.ts.map +1 -1
- package/dist/commonjs/utils/array_find.js +3 -1
- package/dist/commonjs/utils/array_find_index.d.ts +1 -1
- package/dist/commonjs/utils/array_find_index.d.ts.map +1 -1
- package/dist/commonjs/utils/array_find_index.js +3 -1
- package/dist/commonjs/utils/array_includes.d.ts.map +1 -1
- package/dist/commonjs/utils/array_includes.js +1 -3
- package/dist/commonjs/utils/assert.d.ts.map +1 -1
- package/dist/commonjs/utils/assert.js +0 -2
- package/dist/commonjs/utils/base64.d.ts +1 -1
- package/dist/commonjs/utils/base64.d.ts.map +1 -1
- package/dist/commonjs/utils/base64.js +3 -2
- package/dist/commonjs/utils/event_emitter.js +1 -1
- package/dist/commonjs/utils/flat_map.d.ts.map +1 -1
- package/dist/commonjs/utils/flat_map.js +1 -2
- package/dist/commonjs/utils/id_generator.d.ts.map +1 -1
- package/dist/commonjs/utils/id_generator.js +0 -1
- package/dist/commonjs/utils/logger.js +1 -1
- package/dist/commonjs/utils/monotonic_timestamp.js +2 -2
- package/dist/commonjs/utils/noop.js +1 -2
- package/dist/commonjs/utils/object_assign.d.ts.map +1 -1
- package/dist/commonjs/utils/object_assign.js +27 -6
- package/dist/commonjs/utils/object_values.d.ts.map +1 -1
- package/dist/commonjs/utils/object_values.js +1 -1
- package/dist/commonjs/utils/reference.js +1 -1
- package/dist/commonjs/utils/request/xhr.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/add_class_name.d.ts.map +1 -1
- package/dist/es2017/compat/add_class_name.js +1 -2
- package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/es2017/compat/browser_compatibility_types.js +4 -1
- package/dist/es2017/compat/browser_detection.d.ts +3 -1
- package/dist/es2017/compat/browser_detection.d.ts.map +1 -1
- package/dist/es2017/compat/browser_detection.js +7 -1
- package/dist/es2017/compat/can_reuse_media_keys.d.ts +2 -0
- package/dist/es2017/compat/can_reuse_media_keys.d.ts.map +1 -1
- package/dist/es2017/compat/can_reuse_media_keys.js +4 -2
- package/dist/es2017/compat/clear_element_src.js +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/moz_media_keys_constructor.js +2 -4
- package/dist/es2017/compat/eme/custom_media_keys/ms_media_keys_constructor.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/ms_media_keys_constructor.js +2 -4
- package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.js +3 -6
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.js +2 -17
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +1 -2
- package/dist/es2017/compat/eme/eme-api-implementation.js +0 -2
- package/dist/es2017/compat/event_listeners.d.ts.map +1 -1
- package/dist/es2017/compat/event_listeners.js +2 -6
- package/dist/es2017/compat/has_mse_in_worker.js +1 -1
- package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/es2017/compat/is_codec_supported.js +0 -2
- package/dist/es2017/compat/is_vtt_cue.d.ts.map +1 -1
- package/dist/es2017/compat/is_vtt_cue.js +1 -2
- package/dist/es2017/compat/on_height_width_change.d.ts.map +1 -1
- package/dist/es2017/compat/patch_webkit_source_buffer.d.ts.map +1 -1
- package/dist/es2017/compat/patch_webkit_source_buffer.js +8 -18
- package/dist/es2017/compat/remove_cue.js +2 -2
- package/dist/es2017/core/cmcd/cmcd_data_builder.js +1 -1
- package/dist/es2017/core/fetchers/index.d.ts +4 -4
- package/dist/es2017/core/fetchers/index.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/index.js +2 -2
- package/dist/es2017/core/fetchers/segment/index.d.ts +6 -5
- package/dist/es2017/core/fetchers/segment/index.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/segment/index.js +2 -2
- package/dist/es2017/core/{stream/representation/utils/downloading_queue.d.ts → fetchers/segment/segment_queue.d.ts} +63 -80
- package/dist/es2017/core/fetchers/segment/segment_queue.d.ts.map +1 -0
- package/dist/es2017/core/{stream/representation/utils/downloading_queue.js → fetchers/segment/segment_queue.js} +126 -105
- package/dist/{commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts → es2017/core/fetchers/segment/segment_queue_creator.d.ts} +25 -12
- package/dist/es2017/core/fetchers/segment/segment_queue_creator.d.ts.map +1 -0
- package/dist/es2017/core/fetchers/segment/{segment_fetcher_creator.js → segment_queue_creator.js} +12 -6
- package/dist/es2017/core/fetchers/segment/task_prioritizer.d.ts +9 -0
- package/dist/es2017/core/fetchers/segment/task_prioritizer.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/segment/task_prioritizer.js +10 -2
- package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/es2017/core/main/common/content_time_boundaries_observer.js +4 -4
- package/dist/es2017/core/main/worker/content_preparer.d.ts +3 -3
- package/dist/es2017/core/main/worker/content_preparer.d.ts.map +1 -1
- package/dist/es2017/core/main/worker/content_preparer.js +3 -3
- package/dist/es2017/core/main/worker/send_message.js +1 -1
- package/dist/es2017/core/main/worker/worker_main.js +3 -2
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_buffer.js +1 -5
- package/dist/es2017/core/segment_sinks/inventory/segment_inventory.js +1 -2
- package/dist/es2017/core/segment_sinks/segment_buffers_store.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/segment_buffers_store.js +3 -2
- package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts +1 -1
- package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +3 -3
- package/dist/es2017/core/stream/adaptation/types.d.ts +2 -2
- package/dist/es2017/core/stream/adaptation/types.d.ts.map +1 -1
- package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.d.ts.map +1 -1
- package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.js +1 -2
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts +3 -3
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/es2017/core/stream/period/period_stream.d.ts +1 -1
- package/dist/es2017/core/stream/period/period_stream.d.ts.map +1 -1
- package/dist/es2017/core/stream/period/period_stream.js +2 -2
- package/dist/es2017/core/stream/period/types.d.ts +2 -2
- package/dist/es2017/core/stream/period/types.d.ts.map +1 -1
- package/dist/es2017/core/stream/representation/representation_stream.d.ts +1 -1
- package/dist/es2017/core/stream/representation/representation_stream.d.ts.map +1 -1
- package/dist/es2017/core/stream/representation/representation_stream.js +19 -28
- package/dist/es2017/core/stream/representation/types.d.ts +2 -2
- package/dist/es2017/core/stream/representation/types.d.ts.map +1 -1
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.d.ts.map +1 -1
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -2
- package/dist/es2017/core/types.d.ts +2 -2
- package/dist/es2017/core/types.d.ts.map +1 -1
- package/dist/es2017/default_config.d.ts.map +1 -1
- package/dist/es2017/default_config.js +0 -8
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +0 -13
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +0 -4
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +2 -13
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
- package/dist/es2017/features/add_features.d.ts.map +1 -1
- package/dist/es2017/features/add_features.js +1 -2
- package/dist/es2017/main_thread/api/option_utils.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/option_utils.js +2 -6
- package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +29 -23
- package/dist/es2017/main_thread/decrypt/utils/persistent_sessions_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/utils/persistent_sessions_store.js +2 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.js +6 -6
- package/dist/es2017/main_thread/init/multi_thread_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/multi_thread_content_initializer.js +7 -12
- package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.js +1 -5
- package/dist/es2017/main_thread/text_displayer/native/native_text_displayer.js +3 -7
- package/dist/es2017/main_thread/tracks_store/track_dispatcher.js +1 -1
- package/dist/es2017/main_thread/types.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/adaptation.d.ts +13 -13
- package/dist/es2017/manifest/classes/manifest.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/manifest.js +0 -6
- package/dist/es2017/manifest/classes/representation.d.ts +20 -12
- package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +1 -2
- package/dist/es2017/mse/main_media_source_interface.js +1 -1
- package/dist/es2017/multithread_types.d.ts +2 -2
- package/dist/es2017/multithread_types.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +12 -6
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +14 -7
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +8 -4
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +10 -5
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +10 -5
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.js +14 -7
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/EventStream.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/EventStream.js +2 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/MPD.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/MPD.js +8 -4
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Period.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Period.js +10 -5
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Representation.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Representation.js +10 -5
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -2
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +2 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +2 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +4 -2
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +10 -5
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +2 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.js +2 -1
- package/dist/es2017/parsers/manifest/local/representation_index.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/local/representation_index.js +1 -2
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +2 -3
- package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/smooth/create_parser.js +2 -1
- package/dist/es2017/parsers/manifest/smooth/shared_smooth_segment_timeline.js +2 -2
- package/dist/es2017/parsers/manifest/utils/get_first_time_from_adaptation.js +2 -2
- package/dist/es2017/parsers/manifest/utils/get_last_time_from_adaptation.js +2 -2
- package/dist/es2017/parsers/texttracks/srt/html.js +2 -2
- package/dist/es2017/parsers/texttracks/ttml/html/create_element.js +1 -1
- package/dist/es2017/parsers/texttracks/ttml/html/parse_ttml_to_div.js +3 -3
- package/dist/es2017/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts.map +1 -1
- package/dist/es2017/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +1 -2
- package/dist/es2017/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts.map +1 -1
- package/dist/es2017/parsers/texttracks/ttml/resolve_styles_inheritance.js +1 -2
- package/dist/es2017/parsers/texttracks/webvtt/html/to_html.d.ts +9 -3
- package/dist/es2017/parsers/texttracks/webvtt/html/to_html.d.ts.map +1 -1
- package/dist/es2017/parsers/texttracks/webvtt/html/to_html.js +9 -3
- package/dist/es2017/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +2 -2
- package/dist/es2017/public_types.d.ts +5 -7
- package/dist/es2017/public_types.d.ts.map +1 -1
- package/dist/es2017/transports/smooth/extract_timings_infos.js +3 -3
- package/dist/es2017/utils/array_find.d.ts +1 -1
- package/dist/es2017/utils/array_find.d.ts.map +1 -1
- package/dist/es2017/utils/array_find.js +3 -1
- package/dist/es2017/utils/array_find_index.d.ts +1 -1
- package/dist/es2017/utils/array_find_index.d.ts.map +1 -1
- package/dist/es2017/utils/array_find_index.js +3 -1
- package/dist/es2017/utils/array_includes.d.ts.map +1 -1
- package/dist/es2017/utils/array_includes.js +1 -3
- package/dist/es2017/utils/assert.d.ts.map +1 -1
- package/dist/es2017/utils/assert.js +0 -2
- package/dist/es2017/utils/base64.d.ts +1 -1
- package/dist/es2017/utils/base64.d.ts.map +1 -1
- package/dist/es2017/utils/base64.js +3 -2
- package/dist/es2017/utils/event_emitter.js +1 -1
- package/dist/es2017/utils/flat_map.d.ts.map +1 -1
- package/dist/es2017/utils/flat_map.js +1 -2
- package/dist/es2017/utils/id_generator.d.ts.map +1 -1
- package/dist/es2017/utils/id_generator.js +0 -1
- package/dist/es2017/utils/logger.js +1 -1
- package/dist/es2017/utils/monotonic_timestamp.js +2 -2
- package/dist/es2017/utils/noop.js +1 -2
- package/dist/es2017/utils/object_assign.d.ts.map +1 -1
- package/dist/es2017/utils/object_assign.js +1 -2
- package/dist/es2017/utils/object_values.d.ts.map +1 -1
- package/dist/es2017/utils/object_values.js +1 -2
- package/dist/es2017/utils/reference.js +1 -1
- package/dist/es2017/utils/request/xhr.js +1 -1
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +39336 -18
- package/dist/rx-player.min.js +18 -0
- package/dist/worker.js +5 -5
- package/package.json +16 -9
- package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/add_text_track.test.ts +8 -12
- package/src/compat/__tests__/browser_compatibility_types.test.ts +0 -7
- package/src/compat/__tests__/browser_version.test.ts +20 -19
- package/src/compat/__tests__/can_patch_isobmff.test.ts +7 -10
- package/src/compat/__tests__/can_rely_on_video_visibility_and_size.test.ts +17 -21
- package/src/compat/__tests__/can_reuse_media_keys.test.ts +38 -15
- package/src/compat/__tests__/clear_element_src.test.ts +37 -34
- package/src/compat/__tests__/enable_audio_track.test.ts +22 -21
- package/src/compat/__tests__/is_codec_supported.test.ts +17 -18
- package/src/compat/__tests__/is_seeking_approximate.test.ts +8 -14
- package/src/compat/__tests__/is_vtt_cue.test.ts +8 -13
- package/src/compat/__tests__/make_vtt_cue.test.ts +7 -12
- package/src/compat/__tests__/patch_webkit_source_buffer.test.ts +44 -32
- package/src/compat/__tests__/remove_cue.test.ts +30 -31
- package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +21 -26
- package/src/compat/__tests__/should_renew_media_key_system_access.test.ts +9 -17
- package/src/compat/__tests__/should_unset_media_keys.test.ts +7 -14
- package/src/compat/__tests__/should_validate_metadata.test.ts +7 -17
- package/src/compat/__tests__/should_wait_for_data_before_loaded.test.ts +17 -26
- package/src/compat/__tests__/should_wait_for_have_enough_data.test.ts +10 -15
- package/src/compat/add_class_name.ts +1 -2
- package/src/compat/browser_compatibility_types.ts +4 -2
- package/src/compat/browser_detection.ts +9 -0
- package/src/compat/can_reuse_media_keys.ts +4 -2
- package/src/compat/clear_element_src.ts +1 -1
- package/src/compat/eme/custom_media_keys/moz_media_keys_constructor.ts +1 -2
- package/src/compat/eme/custom_media_keys/ms_media_keys_constructor.ts +1 -2
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +3 -6
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +2 -17
- package/src/compat/eme/custom_media_keys/webkit_media_keys_constructor.ts +1 -4
- package/src/compat/eme/eme-api-implementation.ts +0 -2
- package/src/compat/event_listeners.ts +2 -6
- package/src/compat/has_mse_in_worker.ts +1 -1
- package/src/compat/is_codec_supported.ts +0 -2
- package/src/compat/is_debug_mode_enabled.ts +1 -1
- package/src/compat/is_vtt_cue.ts +1 -2
- package/src/compat/on_height_width_change.ts +1 -2
- package/src/compat/patch_webkit_source_buffer.ts +48 -29
- package/src/compat/remove_cue.ts +2 -2
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +21 -26
- package/src/core/cmcd/cmcd_data_builder.ts +1 -1
- package/src/core/fetchers/README.md +13 -12
- package/src/core/fetchers/index.ts +5 -8
- package/src/core/fetchers/segment/__tests__/task_prioritizer.test.ts +17 -23
- package/src/core/fetchers/segment/index.ts +6 -5
- package/src/core/{stream/representation/utils/downloading_queue.ts → fetchers/segment/segment_queue.ts} +204 -166
- package/src/core/fetchers/segment/{segment_fetcher_creator.ts → segment_queue_creator.ts} +31 -14
- package/src/core/fetchers/segment/task_prioritizer.ts +10 -2
- package/src/core/fetchers/utils/schedule_request.ts +1 -1
- package/src/core/main/common/content_time_boundaries_observer.ts +4 -4
- package/src/core/main/worker/content_preparer.ts +5 -5
- package/src/core/main/worker/send_message.ts +1 -1
- package/src/core/main/worker/worker_main.ts +3 -2
- package/src/core/segment_sinks/implementations/text/text_segment_buffer.ts +1 -5
- package/src/core/segment_sinks/inventory/segment_inventory.ts +1 -2
- package/src/core/segment_sinks/segment_buffers_store.ts +3 -2
- package/src/core/stream/adaptation/adaptation_stream.ts +3 -3
- package/src/core/stream/adaptation/types.ts +2 -2
- package/src/core/stream/orchestrator/get_time_ranges_for_content.ts +1 -2
- package/src/core/stream/orchestrator/stream_orchestrator.ts +4 -4
- package/src/core/stream/period/period_stream.ts +2 -2
- package/src/core/stream/period/types.ts +2 -2
- package/src/core/stream/representation/representation_stream.ts +59 -56
- package/src/core/stream/representation/types.ts +3 -4
- package/src/core/stream/representation/utils/get_needed_segments.ts +1 -2
- package/src/core/types.ts +2 -4
- package/src/default_config.ts +0 -8
- package/src/errors/__tests__/format_error.test.ts +18 -18
- package/src/experimental/features/__tests__/multi_thread.test.ts +5 -5
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/capabilities.test.ts +11 -11
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +18 -26
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +13 -21
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/decodingInfos.test.ts +24 -20
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/defaultCodecFinder.test.ts +28 -30
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaContentType.test.ts +32 -38
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +64 -51
- package/src/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.ts +4 -17
- package/src/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.ts +0 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +16 -14
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +1 -2
- package/src/features/__tests__/add_features.test.ts +12 -11
- package/src/features/add_features.ts +1 -2
- package/src/features/list/__tests__/dash_wasm.test.ts +4 -4
- package/src/main_thread/api/__tests__/option_utils.test.ts +114 -70
- package/src/main_thread/api/__tests__/public_api.test.ts +85 -48
- package/src/main_thread/api/option_utils.ts +2 -6
- package/src/main_thread/api/public_api.ts +24 -18
- package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +12 -18
- package/src/main_thread/decrypt/__tests__/__global__/init_data.test.ts +128 -101
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +26 -33
- package/src/main_thread/decrypt/__tests__/__global__/media_keys.test.ts +46 -48
- package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +33 -34
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +13 -17
- package/src/main_thread/decrypt/session_events_listener.ts +1 -1
- package/src/main_thread/decrypt/utils/__tests__/clean_old_loaded_sessions.test.ts +0 -5
- package/src/main_thread/decrypt/utils/__tests__/clean_old_stored_persistent_info.test.ts +14 -17
- package/src/main_thread/decrypt/utils/persistent_sessions_store.ts +2 -1
- package/src/main_thread/init/media_source_content_initializer.ts +7 -7
- package/src/main_thread/init/multi_thread_content_initializer.ts +7 -12
- package/src/main_thread/init/utils/__tests__/are_same_stream_events.test.ts +11 -16
- package/src/main_thread/init/utils/__tests__/refresh_scheduled_events_list.test.ts +48 -18
- package/src/main_thread/text_displayer/html/__tests__/text_track_cues_store.test.ts +32 -17
- package/src/main_thread/text_displayer/html/html_text_displayer.ts +1 -5
- package/src/main_thread/text_displayer/native/native_text_displayer.ts +3 -7
- package/src/main_thread/tracks_store/__tests__/media_element_tracks_store.test.ts +33 -28
- package/src/main_thread/tracks_store/track_dispatcher.ts +1 -1
- package/src/main_thread/types.ts +0 -1
- package/src/manifest/classes/__tests__/adaptation.test.ts +167 -62
- package/src/manifest/classes/__tests__/manifest.test.ts +130 -74
- package/src/manifest/classes/__tests__/period.test.ts +293 -211
- package/src/manifest/classes/__tests__/update_period_in_place.test.ts +0 -2
- package/src/manifest/classes/__tests__/update_periods.test.ts +57 -57
- package/src/manifest/classes/adaptation.ts +13 -13
- package/src/manifest/classes/manifest.ts +0 -6
- package/src/manifest/classes/representation.ts +20 -12
- package/src/manifest/utils.ts +1 -2
- package/src/mse/main_media_source_interface.ts +1 -1
- package/src/mse/types.ts +1 -1
- package/src/multithread_types.ts +2 -2
- package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +5 -10
- package/src/parsers/manifest/dash/common/__tests__/get_http_utc-timing_url.test.ts +38 -30
- package/src/parsers/manifest/dash/common/__tests__/get_periods_time_infos.test.ts +0 -3
- package/src/parsers/manifest/dash/common/indexes/timeline/parse_s_element.ts +12 -6
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.ts +14 -7
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.ts +8 -4
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/Period.ts +10 -5
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.ts +10 -5
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/__tests__/ContentProtection.test.ts +15 -27
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/__tests__/Initialization.test.ts +13 -17
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/__tests__/SegmentURL.test.ts +18 -15
- package/src/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.ts +14 -7
- package/src/parsers/manifest/dash/native-parser/node_parsers/EventStream.ts +2 -1
- package/src/parsers/manifest/dash/native-parser/node_parsers/MPD.ts +8 -4
- package/src/parsers/manifest/dash/native-parser/node_parsers/Period.ts +10 -5
- package/src/parsers/manifest/dash/native-parser/node_parsers/Representation.ts +10 -5
- package/src/parsers/manifest/dash/native-parser/node_parsers/__tests__/ContentProtection.test.ts +15 -27
- package/src/parsers/manifest/dash/native-parser/node_parsers/__tests__/Initialization.test.ts +13 -17
- package/src/parsers/manifest/dash/native-parser/node_parsers/__tests__/SegmentTimeline.test.ts +9 -14
- package/src/parsers/manifest/dash/native-parser/node_parsers/__tests__/SegmentURL.test.ts +18 -15
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -2
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +2 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.ts +2 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.ts +4 -2
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/MPD.ts +10 -5
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Period.ts +2 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/root.ts +2 -1
- package/src/parsers/manifest/local/representation_index.ts +1 -2
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +2 -3
- package/src/parsers/manifest/smooth/create_parser.ts +2 -1
- package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +2 -2
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +3 -8
- package/src/parsers/manifest/utils/get_first_time_from_adaptation.ts +2 -2
- package/src/parsers/manifest/utils/get_last_time_from_adaptation.ts +2 -2
- package/src/parsers/texttracks/srt/html.ts +2 -2
- package/src/parsers/texttracks/ttml/__tests__/resolve_styles_inheritance.test.ts +3 -7
- package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts +4 -4
- package/src/parsers/texttracks/ttml/html/create_element.ts +1 -1
- package/src/parsers/texttracks/ttml/html/parse_ttml_to_div.ts +3 -3
- package/src/parsers/texttracks/ttml/native/parse_ttml_to_vtt.ts +1 -2
- package/src/parsers/texttracks/ttml/resolve_styles_inheritance.ts +1 -2
- package/src/parsers/texttracks/webvtt/__tests__/parse_cue_block.test.ts +11 -11
- package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +5 -18
- package/src/parsers/texttracks/webvtt/html/__tests__/parse_style_block.test.ts +23 -28
- package/src/parsers/texttracks/webvtt/html/__tests__/parse_webvtt_to_div.test.ts +9 -14
- package/src/parsers/texttracks/webvtt/html/__tests__/to_html.test.ts +11 -11
- package/src/parsers/texttracks/webvtt/html/to_html.ts +9 -3
- package/src/parsers/texttracks/webvtt/native/parse_vtt_to_cues.ts +2 -2
- package/src/public_types.ts +7 -8
- package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
- package/src/transports/smooth/extract_timings_infos.ts +3 -3
- package/src/transports/smooth/isobmff/__tests__/create_boxes.test.ts +30 -28
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +38 -44
- package/src/utils/__tests__/array_find.test.ts +12 -12
- package/src/utils/__tests__/array_find_index.test.ts +13 -12
- package/src/utils/__tests__/array_includes.test.ts +7 -7
- package/src/utils/__tests__/assert.test.ts +19 -25
- package/src/utils/__tests__/base64.test.ts +18 -13
- package/src/utils/__tests__/event_emitter.test.ts +225 -50
- package/src/utils/__tests__/flat_map.test.ts +2 -6
- package/src/utils/__tests__/starts_with.test.ts +7 -8
- package/src/utils/array_find.ts +3 -7
- package/src/utils/array_find_index.ts +3 -7
- package/src/utils/array_includes.ts +1 -3
- package/src/utils/assert.ts +0 -2
- package/src/utils/base64.ts +3 -2
- package/src/utils/event_emitter.ts +1 -1
- package/src/utils/flat_map.ts +1 -2
- package/src/utils/id_generator.ts +0 -2
- package/src/utils/is_worker.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/monotonic_timestamp.ts +2 -2
- package/src/utils/noop.ts +1 -2
- package/src/utils/object_assign.ts +1 -2
- package/src/utils/object_values.ts +1 -2
- package/src/utils/reference.ts +1 -1
- package/src/utils/request/xhr.ts +1 -1
- package/.vscode/settings.json +0 -7
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts.map +0 -1
- package/dist/commonjs/core/stream/representation/utils/downloading_queue.d.ts.map +0 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts.map +0 -1
- package/dist/es2017/core/stream/representation/utils/downloading_queue.d.ts.map +0 -1
|
@@ -14,117 +14,58 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import log from "
|
|
17
|
+
import log from "../../../log";
|
|
18
18
|
import type {
|
|
19
19
|
IManifest,
|
|
20
20
|
IAdaptation,
|
|
21
21
|
ISegment,
|
|
22
22
|
IPeriod,
|
|
23
23
|
IRepresentation,
|
|
24
|
-
} from "
|
|
25
|
-
import type { IPlayerError } from "
|
|
24
|
+
} from "../../../manifest";
|
|
25
|
+
import type { IPlayerError } from "../../../public_types";
|
|
26
26
|
import type {
|
|
27
27
|
ISegmentParserParsedInitChunk,
|
|
28
28
|
ISegmentParserParsedMediaChunk,
|
|
29
|
-
} from "
|
|
30
|
-
import assert from "
|
|
31
|
-
import EventEmitter from "
|
|
32
|
-
import noop from "
|
|
33
|
-
import objectAssign from "
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
} from "../../../transports";
|
|
30
|
+
import assert from "../../../utils/assert";
|
|
31
|
+
import EventEmitter from "../../../utils/event_emitter";
|
|
32
|
+
import noop from "../../../utils/noop";
|
|
33
|
+
import objectAssign from "../../../utils/object_assign";
|
|
34
|
+
import SharedReference from "../../../utils/reference";
|
|
35
|
+
import TaskCanceller from "../../../utils/task_canceller";
|
|
36
|
+
import type { IPrioritizedSegmentFetcher } from "./prioritized_segment_fetcher";
|
|
37
|
+
|
|
38
|
+
/** Information about a Segment waiting to be loaded by the SegmentQueue. */
|
|
39
|
+
export interface IQueuedSegment {
|
|
40
|
+
/** Priority of the segment request (lower number = higher priority). */
|
|
41
|
+
priority: number;
|
|
42
|
+
/** Segment wanted. */
|
|
43
|
+
segment: ISegment;
|
|
44
|
+
}
|
|
39
45
|
|
|
40
46
|
/**
|
|
41
|
-
* Class scheduling segment downloads
|
|
42
|
-
*
|
|
43
|
-
* TODO The request scheduling abstractions might be simplified by integrating
|
|
44
|
-
* the `DownloadingQueue` in the segment fetchers code, instead of having it as
|
|
45
|
-
* an utilis of the `RepresentationStream` like here.
|
|
46
|
-
* @class DownloadingQueue
|
|
47
|
+
* Class scheduling segment downloads as a FIFO queue.
|
|
47
48
|
*/
|
|
48
|
-
export default class
|
|
49
|
-
/** Context of the Representation that will be loaded through this DownloadingQueue. */
|
|
50
|
-
private _content: IDownloadingQueueContext;
|
|
51
|
-
/**
|
|
52
|
-
* Current queue of segments scheduled for download.
|
|
53
|
-
*
|
|
54
|
-
* Segments whose request are still pending are still in that queue. Segments
|
|
55
|
-
* are only removed from it once their request has succeeded.
|
|
56
|
-
*/
|
|
57
|
-
private _downloadQueue: IReadOnlySharedReference<IDownloadQueueItem>;
|
|
58
|
-
/**
|
|
59
|
-
* Allows to stop listening to queue updates and stop performing requests.
|
|
60
|
-
* Set to `null` if the DownloadingQueue is not started right now.
|
|
61
|
-
*/
|
|
62
|
-
private _currentCanceller: TaskCanceller | null;
|
|
63
|
-
/**
|
|
64
|
-
* Pending request for the initialization segment.
|
|
65
|
-
* `null` if no request is pending for it.
|
|
66
|
-
*/
|
|
67
|
-
private _initSegmentRequest: ISegmentRequestObject | null;
|
|
68
|
-
/**
|
|
69
|
-
* Pending request for a media (i.e. non-initialization) segment.
|
|
70
|
-
* `null` if no request is pending for it.
|
|
71
|
-
*/
|
|
72
|
-
private _mediaSegmentRequest: ISegmentRequestObject | null;
|
|
49
|
+
export default class SegmentQueue<T> extends EventEmitter<ISegmentQueueEvent<T>> {
|
|
73
50
|
/** Interface used to load segments. */
|
|
74
51
|
private _segmentFetcher: IPrioritizedSegmentFetcher<T>;
|
|
52
|
+
|
|
75
53
|
/**
|
|
76
|
-
*
|
|
77
|
-
* `
|
|
78
|
-
* `null` when no initialization segment or timescale exists.
|
|
79
|
-
*/
|
|
80
|
-
private _initSegmentInfoRef: SharedReference<number | undefined | null>;
|
|
81
|
-
/**
|
|
82
|
-
* Some media segment might have been loaded and are only awaiting for the
|
|
83
|
-
* initialization segment to be parsed before being parsed themselves.
|
|
84
|
-
* This string will contain the `id` property of that segment if one exist or
|
|
85
|
-
* `null` if no segment is awaiting an init segment.
|
|
54
|
+
* Metadata on the content for which segments are currently loaded.
|
|
55
|
+
* `null` if no queue is active.
|
|
86
56
|
*/
|
|
87
|
-
private
|
|
57
|
+
private _currentContentInfo: ISegmentQueueContentInfo | null;
|
|
88
58
|
|
|
89
59
|
/**
|
|
90
|
-
* Create a new `
|
|
60
|
+
* Create a new `SegmentQueue`.
|
|
91
61
|
*
|
|
92
|
-
* @param {Object} content - The context of the Representation you want to
|
|
93
|
-
* load segments for.
|
|
94
|
-
* @param {Object} downloadQueue - Queue of segments you want to load.
|
|
95
62
|
* @param {Object} segmentFetcher - Interface to facilitate the download of
|
|
96
63
|
* segments.
|
|
97
|
-
* @param {boolean} hasInitSegment - Declare that an initialization segment
|
|
98
|
-
* will need to be downloaded.
|
|
99
|
-
*
|
|
100
|
-
* A `DownloadingQueue` ALWAYS wait for the initialization segment to be
|
|
101
|
-
* loaded and parsed before parsing a media segment.
|
|
102
|
-
*
|
|
103
|
-
* In cases where no initialization segment exist, this would lead to the
|
|
104
|
-
* `DownloadingQueue` waiting indefinitely for it.
|
|
105
|
-
*
|
|
106
|
-
* By setting that value to `false`, you anounce to the `DownloadingQueue`
|
|
107
|
-
* that it should not wait for an initialization segment before parsing a
|
|
108
|
-
* media segment.
|
|
109
64
|
*/
|
|
110
|
-
constructor(
|
|
111
|
-
content: IDownloadingQueueContext,
|
|
112
|
-
downloadQueue: IReadOnlySharedReference<IDownloadQueueItem>,
|
|
113
|
-
segmentFetcher: IPrioritizedSegmentFetcher<T>,
|
|
114
|
-
hasInitSegment: boolean,
|
|
115
|
-
) {
|
|
65
|
+
constructor(segmentFetcher: IPrioritizedSegmentFetcher<T>) {
|
|
116
66
|
super();
|
|
117
|
-
this._content = content;
|
|
118
|
-
this._currentCanceller = null;
|
|
119
|
-
this._downloadQueue = downloadQueue;
|
|
120
|
-
this._initSegmentRequest = null;
|
|
121
|
-
this._mediaSegmentRequest = null;
|
|
122
67
|
this._segmentFetcher = segmentFetcher;
|
|
123
|
-
this.
|
|
124
|
-
this._mediaSegmentAwaitingInitMetadata = null;
|
|
125
|
-
if (!hasInitSegment) {
|
|
126
|
-
this._initSegmentInfoRef.setValue(null);
|
|
127
|
-
}
|
|
68
|
+
this._currentContentInfo = null;
|
|
128
69
|
}
|
|
129
70
|
|
|
130
71
|
/**
|
|
@@ -133,7 +74,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
133
74
|
* @returns {Object | null}
|
|
134
75
|
*/
|
|
135
76
|
public getRequestedInitSegment(): ISegment | null {
|
|
136
|
-
return this.
|
|
77
|
+
return this._currentContentInfo?.initSegmentRequest?.segment ?? null;
|
|
137
78
|
}
|
|
138
79
|
|
|
139
80
|
/**
|
|
@@ -142,70 +83,114 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
142
83
|
* @returns {Object | null}
|
|
143
84
|
*/
|
|
144
85
|
public getRequestedMediaSegment(): ISegment | null {
|
|
145
|
-
return this.
|
|
86
|
+
return this._currentContentInfo?.mediaSegmentRequest?.segment ?? null;
|
|
146
87
|
}
|
|
147
88
|
|
|
148
89
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
90
|
+
* Return an object allowing to schedule segment requests linked to the given
|
|
91
|
+
* content.
|
|
92
|
+
* The `SegmentQueue` will emit events as it loads and parses initialization
|
|
93
|
+
* and media segments.
|
|
94
|
+
*
|
|
95
|
+
* Calling this method resets all previous queues that were previously started
|
|
96
|
+
* on the same instance.
|
|
97
|
+
*
|
|
98
|
+
* @param {Object} content - The context of the Representation you want to
|
|
99
|
+
* load segments for.
|
|
100
|
+
* @param {boolean} hasInitSegment - Declare that an initialization segment
|
|
101
|
+
* will need to be downloaded.
|
|
102
|
+
*
|
|
103
|
+
* A `SegmentQueue` ALWAYS wait for the initialization segment to be
|
|
104
|
+
* loaded and parsed before parsing a media segment.
|
|
105
|
+
*
|
|
106
|
+
* In cases where no initialization segment exist, this would lead to the
|
|
107
|
+
* `SegmentQueue` waiting indefinitely for it.
|
|
108
|
+
*
|
|
109
|
+
* By setting that value to `false`, you anounce to the `SegmentQueue`
|
|
110
|
+
* that it should not wait for an initialization segment before parsing a
|
|
111
|
+
* media segment.
|
|
112
|
+
* @returns {Object} - `SharedReference` on which the queue of segment for
|
|
113
|
+
* that content can be communicated and updated. See type for more
|
|
114
|
+
* information.
|
|
151
115
|
*/
|
|
152
|
-
public
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.
|
|
116
|
+
public resetForContent(
|
|
117
|
+
content: ISegmentQueueContext,
|
|
118
|
+
hasInitSegment: boolean,
|
|
119
|
+
): SharedReference<ISegmentQueueItem> {
|
|
120
|
+
this._currentContentInfo?.currentCanceller.cancel();
|
|
121
|
+
const downloadQueue = new SharedReference<ISegmentQueueItem>({
|
|
122
|
+
initSegment: null,
|
|
123
|
+
segmentQueue: [],
|
|
124
|
+
});
|
|
125
|
+
const currentCanceller = new TaskCanceller();
|
|
126
|
+
currentCanceller.signal.register(() => {
|
|
127
|
+
downloadQueue.finish();
|
|
128
|
+
});
|
|
129
|
+
const currentContentInfo: ISegmentQueueContentInfo = {
|
|
130
|
+
content,
|
|
131
|
+
downloadQueue,
|
|
132
|
+
initSegmentInfoRef: hasInitSegment
|
|
133
|
+
? new SharedReference<number | undefined | null>(undefined)
|
|
134
|
+
: new SharedReference<number | undefined | null>(null),
|
|
135
|
+
currentCanceller,
|
|
136
|
+
initSegmentRequest: null,
|
|
137
|
+
mediaSegmentRequest: null,
|
|
138
|
+
mediaSegmentAwaitingInitMetadata: null,
|
|
139
|
+
};
|
|
140
|
+
this._currentContentInfo = currentContentInfo;
|
|
157
141
|
|
|
158
142
|
// Listen for asked media segments
|
|
159
|
-
|
|
143
|
+
downloadQueue.onUpdate(
|
|
160
144
|
(queue) => {
|
|
161
145
|
const { segmentQueue } = queue;
|
|
162
146
|
|
|
163
147
|
if (
|
|
164
148
|
segmentQueue.length > 0 &&
|
|
165
|
-
segmentQueue[0].segment.id ===
|
|
149
|
+
segmentQueue[0].segment.id ===
|
|
150
|
+
currentContentInfo.mediaSegmentAwaitingInitMetadata
|
|
166
151
|
) {
|
|
167
152
|
// The most needed segment is still the same one, and there's no need to
|
|
168
153
|
// update its priority as the request already ended, just quit.
|
|
169
154
|
return;
|
|
170
155
|
}
|
|
171
156
|
|
|
172
|
-
const currentSegmentRequest =
|
|
157
|
+
const currentSegmentRequest = currentContentInfo.mediaSegmentRequest;
|
|
173
158
|
if (segmentQueue.length === 0) {
|
|
174
159
|
if (currentSegmentRequest === null) {
|
|
175
160
|
// There's nothing to load but there's already no request pending.
|
|
176
161
|
return;
|
|
177
162
|
}
|
|
178
163
|
log.debug(
|
|
179
|
-
"
|
|
180
|
-
|
|
164
|
+
"SQ: no more media segment to request. Cancelling queue.",
|
|
165
|
+
content.adaptation.type,
|
|
181
166
|
);
|
|
182
|
-
this._restartMediaSegmentDownloadingQueue();
|
|
167
|
+
this._restartMediaSegmentDownloadingQueue(currentContentInfo);
|
|
183
168
|
return;
|
|
184
169
|
} else if (currentSegmentRequest === null) {
|
|
185
170
|
// There's no request although there are needed segments: start requests
|
|
186
171
|
log.debug(
|
|
187
|
-
"
|
|
188
|
-
|
|
172
|
+
"SQ: Media segments now need to be requested. Starting queue.",
|
|
173
|
+
content.adaptation.type,
|
|
189
174
|
segmentQueue.length,
|
|
190
175
|
);
|
|
191
|
-
this._restartMediaSegmentDownloadingQueue();
|
|
176
|
+
this._restartMediaSegmentDownloadingQueue(currentContentInfo);
|
|
192
177
|
return;
|
|
193
178
|
} else {
|
|
194
179
|
const nextItem = segmentQueue[0];
|
|
195
180
|
if (currentSegmentRequest.segment.id !== nextItem.segment.id) {
|
|
196
181
|
// The most important request if for another segment, request it
|
|
197
182
|
log.debug(
|
|
198
|
-
"
|
|
199
|
-
|
|
183
|
+
"SQ: Next media segment changed, cancelling previous",
|
|
184
|
+
content.adaptation.type,
|
|
200
185
|
);
|
|
201
|
-
this._restartMediaSegmentDownloadingQueue();
|
|
186
|
+
this._restartMediaSegmentDownloadingQueue(currentContentInfo);
|
|
202
187
|
return;
|
|
203
188
|
}
|
|
204
189
|
if (currentSegmentRequest.priority !== nextItem.priority) {
|
|
205
190
|
// The priority of the most important request has changed, update it
|
|
206
191
|
log.debug(
|
|
207
|
-
"
|
|
208
|
-
|
|
192
|
+
"SQ: Priority of next media segment changed, updating",
|
|
193
|
+
content.adaptation.type,
|
|
209
194
|
currentSegmentRequest.priority,
|
|
210
195
|
nextItem.priority,
|
|
211
196
|
);
|
|
@@ -217,13 +202,13 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
217
202
|
return;
|
|
218
203
|
}
|
|
219
204
|
},
|
|
220
|
-
{ emitCurrentValue: true, clearSignal:
|
|
205
|
+
{ emitCurrentValue: true, clearSignal: currentCanceller.signal },
|
|
221
206
|
);
|
|
222
207
|
|
|
223
208
|
// Listen for asked init segment
|
|
224
|
-
|
|
209
|
+
downloadQueue.onUpdate(
|
|
225
210
|
(next) => {
|
|
226
|
-
const initSegmentRequest =
|
|
211
|
+
const initSegmentRequest = currentContentInfo.initSegmentRequest;
|
|
227
212
|
if (next.initSegment !== null && initSegmentRequest !== null) {
|
|
228
213
|
if (next.initSegment.priority !== initSegmentRequest.priority) {
|
|
229
214
|
this._segmentFetcher.updatePriority(
|
|
@@ -237,50 +222,61 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
237
222
|
}
|
|
238
223
|
if (next.initSegment === null) {
|
|
239
224
|
log.debug(
|
|
240
|
-
"
|
|
241
|
-
|
|
225
|
+
"SQ: no more init segment to request. Cancelling queue.",
|
|
226
|
+
content.adaptation.type,
|
|
242
227
|
);
|
|
243
228
|
}
|
|
244
|
-
this._restartInitSegmentDownloadingQueue(next.initSegment);
|
|
229
|
+
this._restartInitSegmentDownloadingQueue(currentContentInfo, next.initSegment);
|
|
245
230
|
},
|
|
246
|
-
{ emitCurrentValue: true, clearSignal:
|
|
231
|
+
{ emitCurrentValue: true, clearSignal: currentCanceller.signal },
|
|
247
232
|
);
|
|
233
|
+
|
|
234
|
+
return downloadQueue;
|
|
248
235
|
}
|
|
249
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Stop the currently-active `SegmentQueue`.
|
|
239
|
+
*
|
|
240
|
+
* Do nothing if no queue is active.
|
|
241
|
+
*/
|
|
250
242
|
public stop() {
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
243
|
+
this._currentContentInfo?.currentCanceller.cancel();
|
|
244
|
+
this._currentContentInfo = null;
|
|
253
245
|
}
|
|
254
246
|
|
|
255
247
|
/**
|
|
256
248
|
* Internal logic performing media segment requests.
|
|
257
249
|
*/
|
|
258
|
-
private _restartMediaSegmentDownloadingQueue(
|
|
259
|
-
|
|
260
|
-
|
|
250
|
+
private _restartMediaSegmentDownloadingQueue(
|
|
251
|
+
contentInfo: ISegmentQueueContentInfo,
|
|
252
|
+
): void {
|
|
253
|
+
if (contentInfo.mediaSegmentRequest !== null) {
|
|
254
|
+
contentInfo.mediaSegmentRequest.canceller.cancel();
|
|
261
255
|
}
|
|
262
|
-
|
|
256
|
+
|
|
257
|
+
const { downloadQueue, content, initSegmentInfoRef, currentCanceller } = contentInfo;
|
|
258
|
+
const { segmentQueue } = downloadQueue.getValue();
|
|
263
259
|
const currentNeededSegment = segmentQueue[0];
|
|
264
260
|
const recursivelyRequestSegments = (
|
|
265
261
|
startingSegment: IQueuedSegment | undefined,
|
|
266
262
|
): void => {
|
|
267
|
-
if (
|
|
268
|
-
|
|
263
|
+
if (currentCanceller !== null && currentCanceller.isUsed()) {
|
|
264
|
+
contentInfo.mediaSegmentRequest = null;
|
|
269
265
|
return;
|
|
270
266
|
}
|
|
271
267
|
if (startingSegment === undefined) {
|
|
272
|
-
|
|
268
|
+
contentInfo.mediaSegmentRequest = null;
|
|
273
269
|
this.trigger("emptyQueue", null);
|
|
274
270
|
return;
|
|
275
271
|
}
|
|
276
272
|
const canceller = new TaskCanceller();
|
|
277
273
|
const unlinkCanceller =
|
|
278
|
-
|
|
274
|
+
currentCanceller === null
|
|
279
275
|
? noop
|
|
280
|
-
: canceller.linkToSignal(
|
|
276
|
+
: canceller.linkToSignal(currentCanceller.signal);
|
|
281
277
|
|
|
282
278
|
const { segment, priority } = startingSegment;
|
|
283
|
-
const context = objectAssign({ segment },
|
|
279
|
+
const context = objectAssign({ segment }, content);
|
|
284
280
|
|
|
285
281
|
/**
|
|
286
282
|
* If `true` , the current task has either errored, finished, or was
|
|
@@ -295,12 +291,12 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
295
291
|
let isWaitingOnInitSegment = false;
|
|
296
292
|
|
|
297
293
|
canceller.signal.register(() => {
|
|
298
|
-
|
|
294
|
+
contentInfo.mediaSegmentRequest = null;
|
|
299
295
|
if (isComplete) {
|
|
300
296
|
return;
|
|
301
297
|
}
|
|
302
|
-
if (
|
|
303
|
-
|
|
298
|
+
if (contentInfo.mediaSegmentAwaitingInitMetadata === segment.id) {
|
|
299
|
+
contentInfo.mediaSegmentAwaitingInitMetadata = null;
|
|
304
300
|
}
|
|
305
301
|
isComplete = true;
|
|
306
302
|
isWaitingOnInitSegment = false;
|
|
@@ -313,7 +309,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
313
309
|
};
|
|
314
310
|
|
|
315
311
|
const continueToNextSegment = (): void => {
|
|
316
|
-
const lastQueue =
|
|
312
|
+
const lastQueue = downloadQueue.getValue().segmentQueue;
|
|
317
313
|
if (lastQueue.length === 0) {
|
|
318
314
|
isComplete = true;
|
|
319
315
|
this.trigger("emptyQueue", null);
|
|
@@ -344,7 +340,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
344
340
|
*/
|
|
345
341
|
beforeInterrupted() {
|
|
346
342
|
log.info(
|
|
347
|
-
"
|
|
343
|
+
"SQ: segment request interrupted temporarly.",
|
|
348
344
|
segment.id,
|
|
349
345
|
segment.time,
|
|
350
346
|
);
|
|
@@ -359,7 +355,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
359
355
|
initTimescale: number | undefined,
|
|
360
356
|
) => ISegmentParserParsedInitChunk<T> | ISegmentParserParsedMediaChunk<T>,
|
|
361
357
|
): void => {
|
|
362
|
-
const initTimescale =
|
|
358
|
+
const initTimescale = initSegmentInfoRef.getValue();
|
|
363
359
|
if (initTimescale !== undefined) {
|
|
364
360
|
emitChunk(parse(initTimescale ?? undefined));
|
|
365
361
|
} else {
|
|
@@ -369,7 +365,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
369
365
|
// but I found it globally clearer to segregate the two cases,
|
|
370
366
|
// especially to always have a meaningful `isWaitingOnInitSegment`
|
|
371
367
|
// boolean which is a very important variable.
|
|
372
|
-
|
|
368
|
+
initSegmentInfoRef.waitUntilDefined(
|
|
373
369
|
(actualTimescale) => {
|
|
374
370
|
emitChunk(parse(actualTimescale ?? undefined));
|
|
375
371
|
},
|
|
@@ -383,10 +379,10 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
383
379
|
if (!isWaitingOnInitSegment) {
|
|
384
380
|
this.trigger("fullyLoadedSegment", segment);
|
|
385
381
|
} else {
|
|
386
|
-
|
|
387
|
-
|
|
382
|
+
contentInfo.mediaSegmentAwaitingInitMetadata = segment.id;
|
|
383
|
+
initSegmentInfoRef.waitUntilDefined(
|
|
388
384
|
() => {
|
|
389
|
-
|
|
385
|
+
contentInfo.mediaSegmentAwaitingInitMetadata = null;
|
|
390
386
|
isWaitingOnInitSegment = false;
|
|
391
387
|
this.trigger("fullyLoadedSegment", segment);
|
|
392
388
|
},
|
|
@@ -401,10 +397,10 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
401
397
|
*/
|
|
402
398
|
beforeEnded: (): void => {
|
|
403
399
|
unlinkCanceller();
|
|
404
|
-
|
|
400
|
+
contentInfo.mediaSegmentRequest = null;
|
|
405
401
|
|
|
406
402
|
if (isWaitingOnInitSegment) {
|
|
407
|
-
|
|
403
|
+
initSegmentInfoRef.waitUntilDefined(continueToNextSegment, {
|
|
408
404
|
clearSignal: canceller.signal,
|
|
409
405
|
});
|
|
410
406
|
} else {
|
|
@@ -424,23 +420,24 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
424
420
|
}
|
|
425
421
|
});
|
|
426
422
|
|
|
427
|
-
|
|
423
|
+
contentInfo.mediaSegmentRequest = { segment, priority, request, canceller };
|
|
428
424
|
};
|
|
429
425
|
recursivelyRequestSegments(currentNeededSegment);
|
|
430
426
|
}
|
|
431
427
|
|
|
432
428
|
/**
|
|
433
429
|
* Internal logic performing initialization segment requests.
|
|
430
|
+
* @param {Object} contentInfo
|
|
434
431
|
* @param {Object} queuedInitSegment
|
|
435
432
|
*/
|
|
436
433
|
private _restartInitSegmentDownloadingQueue(
|
|
434
|
+
contentInfo: ISegmentQueueContentInfo,
|
|
437
435
|
queuedInitSegment: IQueuedSegment | null,
|
|
438
436
|
): void {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
this._initSegmentRequest.canceller.cancel();
|
|
437
|
+
const { content, initSegmentInfoRef } = contentInfo;
|
|
438
|
+
|
|
439
|
+
if (contentInfo.initSegmentRequest !== null) {
|
|
440
|
+
contentInfo.initSegmentRequest.canceller.cancel();
|
|
444
441
|
}
|
|
445
442
|
if (queuedInitSegment === null) {
|
|
446
443
|
return;
|
|
@@ -448,11 +445,11 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
448
445
|
|
|
449
446
|
const canceller = new TaskCanceller();
|
|
450
447
|
const unlinkCanceller =
|
|
451
|
-
|
|
448
|
+
contentInfo.currentCanceller === null
|
|
452
449
|
? noop
|
|
453
|
-
: canceller.linkToSignal(
|
|
450
|
+
: canceller.linkToSignal(contentInfo.currentCanceller.signal);
|
|
454
451
|
const { segment, priority } = queuedInitSegment;
|
|
455
|
-
const context = objectAssign({ segment },
|
|
452
|
+
const context = objectAssign({ segment }, content);
|
|
456
453
|
|
|
457
454
|
/**
|
|
458
455
|
* If `true` , the current task has either errored, finished, or was
|
|
@@ -468,11 +465,11 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
468
465
|
this.trigger("requestRetry", { segment, error: err });
|
|
469
466
|
},
|
|
470
467
|
beforeInterrupted: () => {
|
|
471
|
-
log.info("
|
|
468
|
+
log.info("SQ: init segment request interrupted temporarly.", segment.id);
|
|
472
469
|
},
|
|
473
470
|
beforeEnded: () => {
|
|
474
471
|
unlinkCanceller();
|
|
475
|
-
|
|
472
|
+
contentInfo.initSegmentRequest = null;
|
|
476
473
|
isComplete = true;
|
|
477
474
|
},
|
|
478
475
|
onChunk: (
|
|
@@ -484,7 +481,7 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
484
481
|
assert(parsed.segmentType === "init", "Should have loaded an init segment.");
|
|
485
482
|
this.trigger("parsedInitSegment", objectAssign({}, parsed, { segment }));
|
|
486
483
|
if (parsed.segmentType === "init") {
|
|
487
|
-
|
|
484
|
+
initSegmentInfoRef.setValue(parsed.initTimescale ?? null);
|
|
488
485
|
}
|
|
489
486
|
},
|
|
490
487
|
onAllChunksReceived: (): void => {
|
|
@@ -504,31 +501,31 @@ export default class DownloadingQueue<T> extends EventEmitter<IDownloadingQueueE
|
|
|
504
501
|
});
|
|
505
502
|
|
|
506
503
|
canceller.signal.register(() => {
|
|
507
|
-
|
|
504
|
+
contentInfo.initSegmentRequest = null;
|
|
508
505
|
if (isComplete) {
|
|
509
506
|
return;
|
|
510
507
|
}
|
|
511
508
|
isComplete = true;
|
|
512
509
|
});
|
|
513
510
|
|
|
514
|
-
|
|
511
|
+
contentInfo.initSegmentRequest = { segment, priority, request, canceller };
|
|
515
512
|
}
|
|
516
513
|
}
|
|
517
514
|
|
|
518
515
|
/**
|
|
519
|
-
* Events sent by the `
|
|
516
|
+
* Events sent by the `SegmentQueue`.
|
|
520
517
|
*
|
|
521
518
|
* The key is the event's name and the value the format of the corresponding
|
|
522
519
|
* event's payload.
|
|
523
520
|
*/
|
|
524
|
-
export interface
|
|
521
|
+
export interface ISegmentQueueEvent<T> {
|
|
525
522
|
/**
|
|
526
523
|
* Notify that the initialization segment has been fully loaded and parsed.
|
|
527
524
|
*
|
|
528
525
|
* You can now push that segment to its corresponding buffer and use its parsed
|
|
529
526
|
* metadata.
|
|
530
527
|
*
|
|
531
|
-
* Only sent if an initialization segment exists (when the `
|
|
528
|
+
* Only sent if an initialization segment exists (when the `SegmentQueue`'s
|
|
532
529
|
* `hasInitSegment` constructor option has been set to `true`).
|
|
533
530
|
* In that case, an `IParsedInitSegmentEvent` will always be sent before any
|
|
534
531
|
* `IParsedSegmentEvent` event is sent.
|
|
@@ -538,7 +535,7 @@ export interface IDownloadingQueueEvent<T> {
|
|
|
538
535
|
* Notify that a media chunk (decodable sub-part of a media segment) has been
|
|
539
536
|
* loaded and parsed.
|
|
540
537
|
*
|
|
541
|
-
* If an initialization segment exists (when the `
|
|
538
|
+
* If an initialization segment exists (when the `SegmentQueue`'s
|
|
542
539
|
* `hasInitSegment` constructor option has been set to `true`), an
|
|
543
540
|
* `IParsedSegmentEvent` will always be sent AFTER the `IParsedInitSegmentEvent`
|
|
544
541
|
* event.
|
|
@@ -586,10 +583,10 @@ export interface IRequestRetryPayload {
|
|
|
586
583
|
}
|
|
587
584
|
|
|
588
585
|
/**
|
|
589
|
-
* Structure of the object that has to be emitted through the `
|
|
586
|
+
* Structure of the object that has to be emitted through the `SegmentQueue`
|
|
590
587
|
* shared reference, to signal which segments are currently needed.
|
|
591
588
|
*/
|
|
592
|
-
export interface
|
|
589
|
+
export interface ISegmentQueueItem {
|
|
593
590
|
/**
|
|
594
591
|
* A potential initialization segment that needs to be loaded and parsed.
|
|
595
592
|
* It will generally be requested in parralel of the first media segments.
|
|
@@ -597,7 +594,7 @@ export interface IDownloadQueueItem {
|
|
|
597
594
|
* Can be set to `null` if you don't need to load the initialization segment
|
|
598
595
|
* for now.
|
|
599
596
|
*
|
|
600
|
-
* If the `
|
|
597
|
+
* If the `SegmentQueue`'s `hasInitSegment` constructor option has been
|
|
601
598
|
* set to `true`, no media segment will be parsed before the initialization
|
|
602
599
|
* segment has been loaded and parsed.
|
|
603
600
|
*/
|
|
@@ -612,8 +609,8 @@ export interface IDownloadQueueItem {
|
|
|
612
609
|
* Note that any media segments in the segment queue will only be parsed once
|
|
613
610
|
* either of these is true:
|
|
614
611
|
* - An initialization segment has been loaded and parsed by this
|
|
615
|
-
* `
|
|
616
|
-
* - The `
|
|
612
|
+
* `SegmentQueue` instance.
|
|
613
|
+
* - The `SegmentQueue`'s `hasInitSegment` constructor option has been
|
|
617
614
|
* set to `false`.
|
|
618
615
|
*/
|
|
619
616
|
segmentQueue: IQueuedSegment[];
|
|
@@ -631,8 +628,8 @@ interface ISegmentRequestObject {
|
|
|
631
628
|
canceller: TaskCanceller;
|
|
632
629
|
}
|
|
633
630
|
|
|
634
|
-
/** Context for segments downloaded through the
|
|
635
|
-
export interface
|
|
631
|
+
/** Context for segments downloaded through the SegmentQueue. */
|
|
632
|
+
export interface ISegmentQueueContext {
|
|
636
633
|
/** Adaptation linked to the segments you want to load. */
|
|
637
634
|
adaptation: IAdaptation;
|
|
638
635
|
/** Manifest linked to the segments you want to load. */
|
|
@@ -642,3 +639,44 @@ export interface IDownloadingQueueContext {
|
|
|
642
639
|
/** Representation linked to the segments you want to load. */
|
|
643
640
|
representation: IRepresentation;
|
|
644
641
|
}
|
|
642
|
+
|
|
643
|
+
interface ISegmentQueueContentInfo {
|
|
644
|
+
/** Context of the Representation that will be loaded through this SegmentQueue. */
|
|
645
|
+
content: ISegmentQueueContext;
|
|
646
|
+
/**
|
|
647
|
+
* Current queue of segments scheduled for download.
|
|
648
|
+
*
|
|
649
|
+
* Segments whose request are still pending are still in that queue. Segments
|
|
650
|
+
* are only removed from it once their request has succeeded.
|
|
651
|
+
*/
|
|
652
|
+
downloadQueue: SharedReference<ISegmentQueueItem>;
|
|
653
|
+
/**
|
|
654
|
+
* Allows to stop listening to queue updates and stop performing requests.
|
|
655
|
+
* Set to `null` if the SegmentQueue is not started right now.
|
|
656
|
+
*/
|
|
657
|
+
currentCanceller: TaskCanceller;
|
|
658
|
+
/**
|
|
659
|
+
* Pending request for the initialization segment.
|
|
660
|
+
* `null` if no request is pending for it.
|
|
661
|
+
*/
|
|
662
|
+
initSegmentRequest: ISegmentRequestObject | null;
|
|
663
|
+
/**
|
|
664
|
+
* Pending request for a media (i.e. non-initialization) segment.
|
|
665
|
+
* `null` if no request is pending for it.
|
|
666
|
+
*/
|
|
667
|
+
mediaSegmentRequest: ISegmentRequestObject | null;
|
|
668
|
+
/**
|
|
669
|
+
* Emit the timescale anounced in the initialization segment once parsed.
|
|
670
|
+
* Emit `undefined` when this is not yet known.
|
|
671
|
+
* Emit `null` when no initialization segment or timescale exists.
|
|
672
|
+
*/
|
|
673
|
+
initSegmentInfoRef: SharedReference<number | undefined | null>;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Some media segment might have been loaded and are only awaiting for the
|
|
677
|
+
* initialization segment to be parsed before being parsed themselves.
|
|
678
|
+
* This string will contain the `id` property of that segment if one exist or
|
|
679
|
+
* `null` if no segment is awaiting an init segment.
|
|
680
|
+
*/
|
|
681
|
+
mediaSegmentAwaitingInitMetadata: string | null;
|
|
682
|
+
}
|