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.
- package/CHANGELOG.md +20 -60
- package/FILES.md +1 -1
- package/README.md +2 -33
- package/VERSION +1 -1
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +20 -10
- package/dist/_esm5.processed/core/api/option_utils.d.ts +0 -2
- package/dist/_esm5.processed/core/api/option_utils.js +0 -6
- package/dist/_esm5.processed/core/api/public_api.d.ts +1 -2
- package/dist/_esm5.processed/core/api/public_api.js +9 -17
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +3 -14
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +19 -10
- package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
- package/dist/_esm5.processed/public_types.d.ts +2 -0
- package/dist/commonjs/compat/is_codec_supported.js +22 -1
- package/dist/commonjs/config.d.ts +2 -1
- package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +2 -19
- package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +2 -2
- package/dist/commonjs/core/adaptive/network_analyzer.js +3 -3
- package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
- package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
- package/dist/commonjs/core/api/index.d.ts +1 -1
- package/dist/commonjs/core/api/option_utils.d.ts +2 -0
- package/dist/commonjs/core/api/option_utils.js +2 -3
- package/dist/commonjs/core/api/playback_observer.d.ts +128 -8
- package/dist/commonjs/core/api/playback_observer.js +217 -64
- package/dist/commonjs/core/api/public_api.d.ts +9 -0
- package/dist/commonjs/core/api/public_api.js +41 -16
- package/dist/commonjs/core/api/utils.js +1 -1
- package/dist/commonjs/core/decrypt/get_media_keys.js +2 -6
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/commonjs/core/init/directfile_content_initializer.js +29 -8
- package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/commonjs/core/init/media_source_content_initializer.js +32 -20
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +17 -19
- package/dist/commonjs/core/init/utils/create_stream_playback_observer.d.ts +1 -5
- package/dist/commonjs/core/init/utils/create_stream_playback_observer.js +16 -14
- package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
- package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +9 -11
- package/dist/commonjs/core/init/utils/initial_seek_and_play.js +121 -91
- package/dist/commonjs/core/init/utils/rebuffering_controller.js +27 -70
- package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
- package/dist/commonjs/core/segment_buffers/garbage_collector.js +1 -2
- package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
- package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
- package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
- package/dist/commonjs/core/segment_buffers/index.d.ts +2 -2
- package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +2 -2
- package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
- package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +19 -10
- package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
- package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +14 -18
- package/dist/commonjs/core/stream/period/period_stream.js +5 -8
- package/dist/commonjs/core/stream/period/types.d.ts +2 -3
- package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
- package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
- package/dist/commonjs/core/stream/representation/representation_stream.js +3 -4
- package/dist/commonjs/core/stream/representation/types.d.ts +2 -2
- package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +11 -12
- package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +4 -4
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/commonjs/default_config.d.ts +12 -16
- package/dist/commonjs/default_config.js +21 -16
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/commonjs/manifest/adaptation.js +2 -1
- package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
- package/dist/commonjs/manifest/representation_index/static.js +2 -2
- package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
- package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +7 -3
- package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/commonjs/public_types.d.ts +107 -36
- package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
- package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
- package/dist/commonjs/transports/dash/segment_loader.js +2 -1
- package/dist/commonjs/transports/dash/text_loader.js +2 -0
- package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
- package/dist/commonjs/transports/smooth/pipelines.js +4 -2
- package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
- package/dist/commonjs/transports/types.d.ts +12 -0
- package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
- package/dist/commonjs/utils/request/fetch.d.ts +6 -0
- package/dist/commonjs/utils/request/fetch.js +29 -8
- package/dist/commonjs/utils/request/xhr.d.ts +11 -5
- package/dist/commonjs/utils/request/xhr.js +29 -8
- package/dist/es2017/compat/is_codec_supported.js +22 -1
- package/dist/es2017/config.d.ts +2 -1
- package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +2 -19
- package/dist/es2017/core/adaptive/adaptive_representation_selector.js +2 -2
- package/dist/es2017/core/adaptive/network_analyzer.js +3 -3
- package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
- package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
- package/dist/es2017/core/api/index.d.ts +1 -1
- package/dist/es2017/core/api/option_utils.d.ts +2 -0
- package/dist/es2017/core/api/option_utils.js +2 -3
- package/dist/es2017/core/api/playback_observer.d.ts +128 -8
- package/dist/es2017/core/api/playback_observer.js +217 -66
- package/dist/es2017/core/api/public_api.d.ts +9 -0
- package/dist/es2017/core/api/public_api.js +40 -15
- package/dist/es2017/core/api/utils.js +1 -1
- package/dist/es2017/core/decrypt/get_media_keys.js +2 -6
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/es2017/core/init/directfile_content_initializer.js +31 -8
- package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/es2017/core/init/media_source_content_initializer.js +34 -22
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +17 -17
- package/dist/es2017/core/init/utils/create_stream_playback_observer.d.ts +1 -5
- package/dist/es2017/core/init/utils/create_stream_playback_observer.js +16 -14
- package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
- package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +9 -11
- package/dist/es2017/core/init/utils/initial_seek_and_play.js +120 -91
- package/dist/es2017/core/init/utils/rebuffering_controller.js +27 -70
- package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
- package/dist/es2017/core/segment_buffers/garbage_collector.js +1 -2
- package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
- package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
- package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
- package/dist/es2017/core/segment_buffers/index.d.ts +2 -2
- package/dist/es2017/core/segment_buffers/inventory/index.d.ts +2 -2
- package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
- package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +19 -10
- package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
- package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +16 -18
- package/dist/es2017/core/stream/period/period_stream.js +4 -7
- package/dist/es2017/core/stream/period/types.d.ts +2 -3
- package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
- package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
- package/dist/es2017/core/stream/representation/representation_stream.js +3 -4
- package/dist/es2017/core/stream/representation/types.d.ts +2 -2
- package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +1 -2
- package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +4 -4
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/es2017/default_config.d.ts +12 -16
- package/dist/es2017/default_config.js +21 -16
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/es2017/manifest/adaptation.js +2 -1
- package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
- package/dist/es2017/manifest/representation_index/static.js +2 -2
- package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +7 -3
- package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/es2017/public_types.d.ts +107 -36
- package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
- package/dist/es2017/transports/dash/manifest_parser.js +3 -0
- package/dist/es2017/transports/dash/segment_loader.js +1 -0
- package/dist/es2017/transports/dash/text_loader.js +2 -0
- package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
- package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
- package/dist/es2017/transports/smooth/pipelines.js +2 -0
- package/dist/es2017/transports/smooth/segment_loader.js +1 -0
- package/dist/es2017/transports/types.d.ts +12 -0
- package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
- package/dist/es2017/utils/request/fetch.d.ts +6 -0
- package/dist/es2017/utils/request/fetch.js +29 -8
- package/dist/es2017/utils/request/xhr.d.ts +11 -5
- package/dist/es2017/utils/request/xhr.js +30 -9
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +1335 -812
- package/dist/rx-player.min.js +1 -1
- package/package.json +7 -4
- package/scripts/canal-release.patch +78 -0
- package/scripts/make-dev-releases +65 -0
- package/scripts/update-version +7 -0
- package/sonar-project.properties +1 -1
- package/src/compat/is_codec_supported.ts +23 -1
- package/src/core/adaptive/adaptive_representation_selector.ts +4 -21
- package/src/core/adaptive/network_analyzer.ts +3 -3
- package/src/core/api/debug/buffer_graph.ts +2 -5
- package/src/core/api/debug/modules/general_info.ts +15 -10
- package/src/core/api/index.ts +1 -0
- package/src/core/api/option_utils.ts +3 -3
- package/src/core/api/playback_observer.ts +327 -107
- package/src/core/api/public_api.ts +42 -14
- package/src/core/api/utils.ts +3 -1
- package/src/core/decrypt/get_media_keys.ts +2 -8
- package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
- package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
- package/src/core/fetchers/utils/schedule_request.ts +1 -1
- package/src/core/init/directfile_content_initializer.ts +31 -15
- package/src/core/init/media_source_content_initializer.ts +40 -27
- package/src/core/init/utils/content_time_boundaries_observer.ts +24 -23
- package/src/core/init/utils/create_stream_playback_observer.ts +19 -20
- package/src/core/init/utils/get_initial_time.ts +25 -12
- package/src/core/init/utils/initial_seek_and_play.ts +140 -108
- package/src/core/init/utils/rebuffering_controller.ts +32 -77
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +5 -2
- package/src/core/segment_buffers/garbage_collector.ts +1 -1
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +1 -1
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +1 -1
- package/src/core/segment_buffers/index.ts +2 -0
- package/src/core/segment_buffers/inventory/index.ts +2 -0
- package/src/core/segment_buffers/inventory/segment_inventory.ts +49 -17
- package/src/core/stream/adaptation/get_representations_switch_strategy.ts +21 -12
- package/src/core/stream/orchestrator/stream_orchestrator.ts +14 -19
- package/src/core/stream/period/period_stream.ts +7 -8
- package/src/core/stream/period/types.ts +2 -3
- package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +21 -15
- package/src/core/stream/representation/representation_stream.ts +3 -5
- package/src/core/stream/representation/types.ts +2 -2
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
- package/src/core/stream/representation/utils/get_buffer_status.ts +5 -4
- package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
- package/src/default_config.ts +22 -17
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
- package/src/manifest/adaptation.ts +2 -1
- package/src/manifest/representation_index/static.ts +2 -2
- package/src/manifest/representation_index/types.ts +4 -4
- package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
- package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
- package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
- package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
- package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
- package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
- package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
- package/src/parsers/manifest/dash/common/parse_representations.ts +9 -3
- package/src/parsers/manifest/local/representation_index.ts +3 -3
- package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
- package/src/parsers/manifest/smooth/representation_index.ts +23 -9
- package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
- package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
- package/src/parsers/manifest/utils/index_helpers.ts +1 -1
- package/src/parsers/texttracks/ttml/html/apply_line_height.ts +3 -1
- package/src/public_types.ts +108 -36
- package/src/transports/dash/init_segment_loader.ts +5 -0
- package/src/transports/dash/manifest_parser.ts +6 -0
- package/src/transports/dash/segment_loader.ts +1 -0
- package/src/transports/dash/text_loader.ts +2 -0
- package/src/transports/metaplaylist/manifest_loader.ts +1 -0
- package/src/transports/metaplaylist/pipelines.ts +4 -1
- package/src/transports/smooth/pipelines.ts +2 -0
- package/src/transports/smooth/segment_loader.ts +1 -0
- package/src/transports/types.ts +12 -0
- package/src/transports/utils/generate_manifest_loader.ts +3 -0
- package/src/utils/request/fetch.ts +35 -8
- package/src/utils/request/xhr.ts +45 -14
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
- package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
- package/src/typings/object-assign.d.ts +0 -48
|
@@ -346,7 +346,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
346
346
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
347
347
|
videoElement.preload = "auto";
|
|
348
348
|
|
|
349
|
-
this.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
349
|
+
this.version = /* PLAYER_VERSION */"4.0.0-dev.2023121900";
|
|
350
350
|
this.log = log;
|
|
351
351
|
this.state = "STOPPED";
|
|
352
352
|
this.videoElement = videoElement;
|
|
@@ -610,6 +610,8 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
610
610
|
const manifestRequestSettings = { lowLatencyMode,
|
|
611
611
|
maxRetry : requestConfig.manifest?.maxRetry,
|
|
612
612
|
requestTimeout: requestConfig.manifest?.timeout,
|
|
613
|
+
connectionTimeout:
|
|
614
|
+
requestConfig.manifest?.connectionTimeout,
|
|
613
615
|
minimumManifestUpdateInterval,
|
|
614
616
|
initialManifest };
|
|
615
617
|
|
|
@@ -667,8 +669,9 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
667
669
|
|
|
668
670
|
const segmentRequestOptions = { lowLatencyMode,
|
|
669
671
|
maxRetry: requestConfig.segment?.maxRetry,
|
|
670
|
-
requestTimeout: requestConfig.segment?.timeout
|
|
671
|
-
|
|
672
|
+
requestTimeout: requestConfig.segment?.timeout,
|
|
673
|
+
connectionTimeout:
|
|
674
|
+
requestConfig.segment?.connectionTimeout };
|
|
672
675
|
initializer = new features.mediaSourceInit({
|
|
673
676
|
adaptiveOptions,
|
|
674
677
|
autoPlay,
|
|
@@ -811,12 +814,12 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
811
814
|
case "ENDED":
|
|
812
815
|
this._priv_reloadingMetadata.reloadInPause = true;
|
|
813
816
|
this._priv_reloadingMetadata.reloadPosition =
|
|
814
|
-
playbackObserver.getReference().getValue().position;
|
|
817
|
+
playbackObserver.getReference().getValue().position.getPolled();
|
|
815
818
|
break;
|
|
816
819
|
default:
|
|
817
820
|
const o = playbackObserver.getReference().getValue();
|
|
818
821
|
this._priv_reloadingMetadata.reloadInPause = o.paused;
|
|
819
|
-
this._priv_reloadingMetadata.reloadPosition = o.position;
|
|
822
|
+
this._priv_reloadingMetadata.reloadPosition = o.position.getWanted();
|
|
820
823
|
break;
|
|
821
824
|
}
|
|
822
825
|
};
|
|
@@ -1958,6 +1961,29 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
1958
1961
|
return null;
|
|
1959
1962
|
}
|
|
1960
1963
|
|
|
1964
|
+
/**
|
|
1965
|
+
* Returns the current position for live contents.
|
|
1966
|
+
*
|
|
1967
|
+
* Returns `null` if no content is loaded or if the current loaded content is
|
|
1968
|
+
* not considered as a live content.
|
|
1969
|
+
* Returns `undefined` if that live position is currently unknown.
|
|
1970
|
+
* @returns {number}
|
|
1971
|
+
*/
|
|
1972
|
+
getLivePosition() : number | undefined |null {
|
|
1973
|
+
if (this._priv_contentInfos === null) {
|
|
1974
|
+
return null;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
1978
|
+
if (isDirectFile) {
|
|
1979
|
+
return undefined;
|
|
1980
|
+
}
|
|
1981
|
+
if (manifest?.isLive !== true) {
|
|
1982
|
+
return null;
|
|
1983
|
+
}
|
|
1984
|
+
return manifest.getLivePosition();
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1961
1987
|
/**
|
|
1962
1988
|
* Get maximum seek-able position.
|
|
1963
1989
|
* @returns {number}
|
|
@@ -2008,9 +2034,11 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2008
2034
|
}
|
|
2009
2035
|
const segmentBufferStatus = this._priv_contentInfos
|
|
2010
2036
|
.segmentBuffersStore.getStatus(bufferType);
|
|
2011
|
-
|
|
2012
|
-
segmentBufferStatus.value.
|
|
2013
|
-
|
|
2037
|
+
if (segmentBufferStatus.type === "initialized") {
|
|
2038
|
+
segmentBufferStatus.value.synchronizeInventory();
|
|
2039
|
+
return segmentBufferStatus.value.getInventory();
|
|
2040
|
+
}
|
|
2041
|
+
return null;
|
|
2014
2042
|
}
|
|
2015
2043
|
|
|
2016
2044
|
/**
|
|
@@ -2562,7 +2590,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2562
2590
|
const maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() :
|
|
2563
2591
|
undefined;
|
|
2564
2592
|
const positionData : IPositionUpdate = {
|
|
2565
|
-
position: observation.position,
|
|
2593
|
+
position: observation.position.getPolled(),
|
|
2566
2594
|
duration: observation.duration,
|
|
2567
2595
|
playbackRate: observation.playbackRate,
|
|
2568
2596
|
maximumPosition,
|
|
@@ -2576,18 +2604,18 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2576
2604
|
|
|
2577
2605
|
if (manifest !== null &&
|
|
2578
2606
|
manifest.isLive &&
|
|
2579
|
-
observation.position > 0
|
|
2607
|
+
observation.position.getPolled() > 0
|
|
2580
2608
|
) {
|
|
2581
2609
|
const ast = manifest.availabilityStartTime ?? 0;
|
|
2582
|
-
positionData.wallClockTime = observation.position + ast;
|
|
2610
|
+
positionData.wallClockTime = observation.position.getPolled() + ast;
|
|
2583
2611
|
const livePosition = manifest.getLivePosition();
|
|
2584
2612
|
if (livePosition !== undefined) {
|
|
2585
|
-
positionData.liveGap = livePosition - observation.position;
|
|
2613
|
+
positionData.liveGap = livePosition - observation.position.getPolled();
|
|
2586
2614
|
}
|
|
2587
2615
|
} else if (isDirectFile && this.videoElement !== null) {
|
|
2588
2616
|
const startDate = getStartDate(this.videoElement);
|
|
2589
2617
|
if (startDate !== undefined) {
|
|
2590
|
-
positionData.wallClockTime = startDate + observation.position;
|
|
2618
|
+
positionData.wallClockTime = startDate + observation.position.getPolled();
|
|
2591
2619
|
}
|
|
2592
2620
|
}
|
|
2593
2621
|
this.trigger("positionUpdate", positionData);
|
|
@@ -2784,7 +2812,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2784
2812
|
}
|
|
2785
2813
|
}
|
|
2786
2814
|
}
|
|
2787
|
-
Player.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
2815
|
+
Player.version = /* PLAYER_VERSION */"4.0.0-dev.2023121900";
|
|
2788
2816
|
|
|
2789
2817
|
/** Every events sent by the RxPlayer's public API. */
|
|
2790
2818
|
interface IPublicAPIEvent {
|
package/src/core/api/utils.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
IPlaybackObservation,
|
|
30
30
|
IReadOnlyPlaybackObserver,
|
|
31
|
+
SeekingState,
|
|
31
32
|
} from "./playback_observer";
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -52,7 +53,8 @@ export function emitSeekEvents(
|
|
|
52
53
|
return ;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
let wasSeeking =
|
|
56
|
+
let wasSeeking =
|
|
57
|
+
playbackObserver.getReference().getValue().seeking === SeekingState.External;
|
|
56
58
|
if (wasSeeking) {
|
|
57
59
|
onSeeking();
|
|
58
60
|
if (cancelSignal.isCancelled()) {
|
|
@@ -39,15 +39,9 @@ import ServerCertificateStore from "./utils/server_certificate_store";
|
|
|
39
39
|
function createPersistentSessionsStorage(
|
|
40
40
|
keySystemOptions : IKeySystemOption
|
|
41
41
|
) : PersistentSessionsStore|null {
|
|
42
|
-
if (isNullOrUndefined(keySystemOptions.persistentLicenseConfig)) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
const { persistentLicenseConfig } = keySystemOptions;
|
|
47
|
-
if (persistentLicenseConfig
|
|
48
|
-
|
|
49
|
-
"No `persistentLicenseConfig` found for " +
|
|
50
|
-
"persistent license.");
|
|
43
|
+
if (isNullOrUndefined(persistentLicenseConfig)) {
|
|
44
|
+
return null;
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
log.debug("DRM: Set the given license storage");
|
|
@@ -29,7 +29,6 @@ import {
|
|
|
29
29
|
ITransportPipelines,
|
|
30
30
|
} from "../../../transports";
|
|
31
31
|
import EventEmitter from "../../../utils/event_emitter";
|
|
32
|
-
import isNullOrUndefined from "../../../utils/is_null_or_undefined";
|
|
33
32
|
import getMonotonicTimeStamp from "../../../utils/monotonic_timestamp";
|
|
34
33
|
import noop from "../../../utils/noop";
|
|
35
34
|
import TaskCanceller from "../../../utils/task_canceller";
|
|
@@ -231,14 +230,27 @@ export default class ManifestFetcher extends EventEmitter<IManifestFetcherEvent>
|
|
|
231
230
|
) : Promise<IRequestedData<ILoadedManifestFormat>> {
|
|
232
231
|
const { loadManifest } = pipelines;
|
|
233
232
|
let requestTimeout : number | undefined =
|
|
234
|
-
|
|
233
|
+
(settings.requestTimeout === undefined) ?
|
|
235
234
|
config.getCurrent().DEFAULT_REQUEST_TIMEOUT :
|
|
236
235
|
settings.requestTimeout;
|
|
236
|
+
|
|
237
|
+
let connectionTimeout: number | undefined =
|
|
238
|
+
(settings.connectionTimeout === undefined) ?
|
|
239
|
+
config.getCurrent().DEFAULT_CONNECTION_TIMEOUT :
|
|
240
|
+
settings.connectionTimeout;
|
|
241
|
+
|
|
237
242
|
if (requestTimeout < 0) {
|
|
238
243
|
requestTimeout = undefined;
|
|
239
244
|
}
|
|
245
|
+
|
|
246
|
+
if (connectionTimeout < 0) {
|
|
247
|
+
connectionTimeout = undefined;
|
|
248
|
+
}
|
|
240
249
|
const callLoader = () => loadManifest(manifestUrl,
|
|
241
|
-
{
|
|
250
|
+
{
|
|
251
|
+
timeout: requestTimeout,
|
|
252
|
+
connectionTimeout,
|
|
253
|
+
},
|
|
242
254
|
cancelSignal);
|
|
243
255
|
return scheduleRequestPromise(callLoader, backoffSettings, cancelSignal);
|
|
244
256
|
}
|
|
@@ -722,6 +734,12 @@ export interface IManifestFetcherSettings {
|
|
|
722
734
|
* `undefined` will lead to a default, large, timeout being used.
|
|
723
735
|
*/
|
|
724
736
|
requestTimeout : number | undefined;
|
|
737
|
+
/**
|
|
738
|
+
* Connection timeout, in milliseconds, after which the request is canceled
|
|
739
|
+
* if the responses headers has not being received.
|
|
740
|
+
* Do not set or set to "undefined" to disable it.
|
|
741
|
+
*/
|
|
742
|
+
connectionTimeout: number | undefined;
|
|
725
743
|
/** Limit the frequency of Manifest updates. */
|
|
726
744
|
minimumManifestUpdateInterval : number;
|
|
727
745
|
/**
|
|
@@ -93,6 +93,8 @@ export default function createSegmentFetcher<TLoadedFormat, TSegmentDataType>(
|
|
|
93
93
|
const requestOptions = {
|
|
94
94
|
timeout: options.requestTimeout < 0 ? undefined :
|
|
95
95
|
options.requestTimeout,
|
|
96
|
+
connectionTimeout: options.connectionTimeout === undefined ? undefined :
|
|
97
|
+
options.connectionTimeout < 0 ? undefined : options.connectionTimeout,
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
/**
|
|
@@ -457,6 +459,12 @@ export interface ISegmentFetcherOptions {
|
|
|
457
459
|
* To set to `-1` for no timeout.
|
|
458
460
|
*/
|
|
459
461
|
requestTimeout : number;
|
|
462
|
+
/**
|
|
463
|
+
* Connection timeout, in milliseconds, after which the request is canceled
|
|
464
|
+
* if the responses headers has not being received.
|
|
465
|
+
* Do not set or set to "undefined" to disable it.
|
|
466
|
+
*/
|
|
467
|
+
connectionTimeout: number | undefined;
|
|
460
468
|
}
|
|
461
469
|
|
|
462
470
|
/**
|
|
@@ -467,12 +475,15 @@ export interface ISegmentFetcherOptions {
|
|
|
467
475
|
export function getSegmentFetcherOptions(
|
|
468
476
|
{ maxRetry,
|
|
469
477
|
lowLatencyMode,
|
|
470
|
-
requestTimeout
|
|
471
|
-
|
|
472
|
-
|
|
478
|
+
requestTimeout,
|
|
479
|
+
connectionTimeout } : { maxRetry? : number | undefined;
|
|
480
|
+
requestTimeout? : number | undefined;
|
|
481
|
+
connectionTimeout? : number | undefined;
|
|
482
|
+
lowLatencyMode : boolean; }
|
|
473
483
|
) : ISegmentFetcherOptions {
|
|
474
484
|
const { DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,
|
|
475
485
|
DEFAULT_REQUEST_TIMEOUT,
|
|
486
|
+
DEFAULT_CONNECTION_TIMEOUT,
|
|
476
487
|
INITIAL_BACKOFF_DELAY_BASE,
|
|
477
488
|
MAX_BACKOFF_DELAY_BASE } = config.getCurrent();
|
|
478
489
|
return { maxRetry: maxRetry ?? DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,
|
|
@@ -480,6 +491,9 @@ export function getSegmentFetcherOptions(
|
|
|
480
491
|
INITIAL_BACKOFF_DELAY_BASE.REGULAR,
|
|
481
492
|
maxDelay: lowLatencyMode ? MAX_BACKOFF_DELAY_BASE.LOW_LATENCY :
|
|
482
493
|
MAX_BACKOFF_DELAY_BASE.REGULAR,
|
|
483
|
-
requestTimeout:
|
|
484
|
-
|
|
494
|
+
requestTimeout: (requestTimeout === undefined) ? DEFAULT_REQUEST_TIMEOUT :
|
|
495
|
+
requestTimeout,
|
|
496
|
+
connectionTimeout: (connectionTimeout === undefined) ?
|
|
497
|
+
DEFAULT_CONNECTION_TIMEOUT : connectionTimeout,
|
|
498
|
+
};
|
|
485
499
|
}
|
|
@@ -352,7 +352,7 @@ export async function scheduleRequestWithCdns<T>(
|
|
|
352
352
|
* attempts already done for that resource.
|
|
353
353
|
*
|
|
354
354
|
* Returns `undefined` if there's no Cdn left to request the resource.
|
|
355
|
-
* @param {Array.<Object>}
|
|
355
|
+
* @param {Array.<Object>} sortedCdns
|
|
356
356
|
* @returns {Object|undefined}
|
|
357
357
|
*/
|
|
358
358
|
function getPrioritaryRequestableCdnFromSortedList(
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
IPlayerError,
|
|
28
28
|
} from "../../public_types";
|
|
29
29
|
import assert from "../../utils/assert";
|
|
30
|
+
import isNullOrUndefined from "../../utils/is_null_or_undefined";
|
|
30
31
|
import SharedReference, {
|
|
31
32
|
IReadOnlySharedReference,
|
|
32
33
|
} from "../../utils/reference";
|
|
@@ -207,14 +208,14 @@ export default class DirectFileContentInitializer extends ContentInitializer {
|
|
|
207
208
|
log.debug("Init: Initial time calculated:", initTime);
|
|
208
209
|
return initTime;
|
|
209
210
|
};
|
|
210
|
-
performInitialSeekAndPlay(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
211
|
+
performInitialSeekAndPlay({ mediaElement,
|
|
212
|
+
playbackObserver,
|
|
213
|
+
startTime: initialTime,
|
|
214
|
+
mustAutoPlay: autoPlay,
|
|
215
|
+
onWarning: (err) => this.trigger("warning", err),
|
|
216
|
+
isDirectfile: true },
|
|
217
|
+
cancelSignal)
|
|
218
|
+
.autoPlayResult
|
|
218
219
|
.then(() =>
|
|
219
220
|
getLoadedReference(playbackObserver, mediaElement, true, cancelSignal)
|
|
220
221
|
.onUpdate((isLoaded, stopListening) => {
|
|
@@ -241,11 +242,11 @@ function getDirectFileInitialTime(
|
|
|
241
242
|
mediaElement : HTMLMediaElement,
|
|
242
243
|
startAt? : IInitialTimeOptions
|
|
243
244
|
) : number {
|
|
244
|
-
if (startAt
|
|
245
|
+
if (isNullOrUndefined(startAt)) {
|
|
245
246
|
return 0;
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
if (startAt.position
|
|
249
|
+
if (!isNullOrUndefined(startAt.position)) {
|
|
249
250
|
return startAt.position;
|
|
250
251
|
} else if (startAt.wallClockTime != null) {
|
|
251
252
|
return startAt.wallClockTime;
|
|
@@ -254,15 +255,30 @@ function getDirectFileInitialTime(
|
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
const duration = mediaElement.duration;
|
|
257
|
-
if (duration == null || !isFinite(duration)) {
|
|
258
|
-
log.warn("startAt.fromLastPosition set but no known duration, " +
|
|
259
|
-
"beginning at 0.");
|
|
260
|
-
return 0;
|
|
261
|
-
}
|
|
262
258
|
|
|
263
259
|
if (typeof startAt.fromLastPosition === "number") {
|
|
260
|
+
if (isNullOrUndefined(duration) || !isFinite(duration)) {
|
|
261
|
+
log.warn("startAt.fromLastPosition set but no known duration, " +
|
|
262
|
+
"beginning at 0.");
|
|
263
|
+
return 0;
|
|
264
|
+
}
|
|
264
265
|
return Math.max(0, duration + startAt.fromLastPosition);
|
|
266
|
+
} else if (typeof startAt.fromLivePosition === "number") {
|
|
267
|
+
const livePosition = mediaElement.seekable.length > 0 ?
|
|
268
|
+
mediaElement.seekable.end(0) :
|
|
269
|
+
duration;
|
|
270
|
+
if (isNullOrUndefined(livePosition)) {
|
|
271
|
+
log.warn("startAt.fromLivePosition set but no known live position, " +
|
|
272
|
+
"beginning at 0.");
|
|
273
|
+
return 0;
|
|
274
|
+
}
|
|
275
|
+
return Math.max(0, livePosition + startAt.fromLivePosition);
|
|
265
276
|
} else if (startAt.percentage != null) {
|
|
277
|
+
if (isNullOrUndefined(duration) || !isFinite(duration)) {
|
|
278
|
+
log.warn("startAt.percentage set but no known duration, " +
|
|
279
|
+
"beginning at 0.");
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
266
282
|
const { percentage } = startAt;
|
|
267
283
|
if (percentage >= 100) {
|
|
268
284
|
return duration;
|
|
@@ -416,12 +416,13 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
416
416
|
segmentBuffersStore.disposeAll();
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
-
const { autoPlayResult, initialPlayPerformed
|
|
420
|
-
performInitialSeekAndPlay(mediaElement,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
419
|
+
const { autoPlayResult, initialPlayPerformed } =
|
|
420
|
+
performInitialSeekAndPlay({ mediaElement,
|
|
421
|
+
playbackObserver,
|
|
422
|
+
startTime: initialTime,
|
|
423
|
+
mustAutoPlay: autoPlay,
|
|
424
|
+
onWarning: (err) => { this.trigger("warning", err); },
|
|
425
|
+
isDirectfile: false },
|
|
425
426
|
cancelSignal);
|
|
426
427
|
|
|
427
428
|
if (cancelSignal.isCancelled()) {
|
|
@@ -451,9 +452,7 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
451
452
|
{ autoPlay,
|
|
452
453
|
manifest,
|
|
453
454
|
initialPlayPerformed,
|
|
454
|
-
|
|
455
|
-
speed,
|
|
456
|
-
startTime: initialTime },
|
|
455
|
+
speed },
|
|
457
456
|
cancelSignal);
|
|
458
457
|
|
|
459
458
|
const rebufferingController = this._createRebufferingController(playbackObserver,
|
|
@@ -462,11 +461,16 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
462
461
|
speed,
|
|
463
462
|
cancelSignal);
|
|
464
463
|
rebufferingController.addEventListener("needsReload", () => {
|
|
464
|
+
let position: number;
|
|
465
|
+
const lastObservation = playbackObserver.getReference().getValue();
|
|
466
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
467
|
+
position = lastObservation.position.getWanted();
|
|
468
|
+
} else {
|
|
469
|
+
position = playbackObserver.getCurrentTime();
|
|
470
|
+
}
|
|
471
|
+
|
|
465
472
|
// NOTE couldn't both be always calculated at event destination?
|
|
466
473
|
// Maybe there are exceptions?
|
|
467
|
-
const position = initialSeekPerformed.getValue() ?
|
|
468
|
-
playbackObserver.getCurrentTime() :
|
|
469
|
-
initialTime;
|
|
470
474
|
const autoplay = initialPlayPerformed.getValue() ?
|
|
471
475
|
!playbackObserver.getIsPaused() :
|
|
472
476
|
autoPlay;
|
|
@@ -541,11 +545,11 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
541
545
|
if (
|
|
542
546
|
// Data is buffered around the current position
|
|
543
547
|
obs.currentRange !== null ||
|
|
544
|
-
// Or, for whatever reason,
|
|
545
|
-
obs.position > seekedTime + 0.1
|
|
548
|
+
// Or, for whatever reason, we have no buffer but we're already advancing
|
|
549
|
+
obs.position.getPolled() > seekedTime + 0.1
|
|
546
550
|
) {
|
|
547
551
|
stopListening();
|
|
548
|
-
playbackObserver.setCurrentTime(obs.position + 0.001);
|
|
552
|
+
playbackObserver.setCurrentTime(obs.position.getWanted() + 0.001);
|
|
549
553
|
}
|
|
550
554
|
}, { includeLastObservation: false, clearSignal: cancelSignal });
|
|
551
555
|
},
|
|
@@ -635,8 +639,9 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
635
639
|
|
|
636
640
|
needsMediaSourceReload: (payload) => {
|
|
637
641
|
const lastObservation = streamObserver.getReference().getValue();
|
|
638
|
-
const currentPosition = lastObservation.position.
|
|
639
|
-
|
|
642
|
+
const currentPosition = lastObservation.position.isAwaitingFuturePosition() ?
|
|
643
|
+
lastObservation.position.getWanted() :
|
|
644
|
+
streamObserver.getCurrentTime();
|
|
640
645
|
const isPaused = lastObservation.paused.pending ??
|
|
641
646
|
streamObserver.getIsPaused();
|
|
642
647
|
let position = currentPosition + payload.timeOffset;
|
|
@@ -653,15 +658,17 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
653
658
|
const keySystem = getKeySystemConfiguration(mediaElement);
|
|
654
659
|
if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem?.[0])) {
|
|
655
660
|
const lastObservation = streamObserver.getReference().getValue();
|
|
656
|
-
const position = lastObservation.position.
|
|
657
|
-
|
|
661
|
+
const position = lastObservation.position.isAwaitingFuturePosition() ?
|
|
662
|
+
lastObservation.position.getWanted() :
|
|
663
|
+
streamObserver.getCurrentTime();
|
|
658
664
|
const isPaused = lastObservation.paused.pending ??
|
|
659
665
|
streamObserver.getIsPaused();
|
|
660
666
|
onReloadOrder({ position, autoPlay: !isPaused });
|
|
661
667
|
} else {
|
|
662
668
|
const lastObservation = streamObserver.getReference().getValue();
|
|
663
|
-
const position = lastObservation.position.
|
|
664
|
-
|
|
669
|
+
const position = lastObservation.position.isAwaitingFuturePosition() ?
|
|
670
|
+
lastObservation.position.getWanted() :
|
|
671
|
+
streamObserver.getCurrentTime();
|
|
665
672
|
// simple seek close to the current position
|
|
666
673
|
// to flush the buffers
|
|
667
674
|
if (position + 0.001 < lastObservation.duration) {
|
|
@@ -728,9 +735,10 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
728
735
|
contentTimeBoundariesObserver.addEventListener("periodChange", (period) => {
|
|
729
736
|
this.trigger("activePeriodChanged", { period });
|
|
730
737
|
});
|
|
731
|
-
contentTimeBoundariesObserver.addEventListener(
|
|
732
|
-
|
|
733
|
-
|
|
738
|
+
contentTimeBoundariesObserver.addEventListener(
|
|
739
|
+
"endingPositionChange",
|
|
740
|
+
(x) => mediaSourceDurationUpdater.updateDuration(x.endingPosition, x.isEnd)
|
|
741
|
+
);
|
|
734
742
|
contentTimeBoundariesObserver.addEventListener("endOfStream", () => {
|
|
735
743
|
if (endOfStreamCanceller === null) {
|
|
736
744
|
endOfStreamCanceller = new TaskCanceller();
|
|
@@ -746,9 +754,8 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
746
754
|
endOfStreamCanceller = null;
|
|
747
755
|
}
|
|
748
756
|
});
|
|
749
|
-
const
|
|
750
|
-
mediaSourceDurationUpdater.updateDuration(
|
|
751
|
-
currentDuration.isEnd);
|
|
757
|
+
const endInfo = contentTimeBoundariesObserver.getCurrentEndingTime();
|
|
758
|
+
mediaSourceDurationUpdater.updateDuration(endInfo.endingPosition, endInfo.isEnd);
|
|
752
759
|
return contentTimeBoundariesObserver;
|
|
753
760
|
}
|
|
754
761
|
|
|
@@ -835,6 +842,12 @@ export interface IInitializeArguments {
|
|
|
835
842
|
* `-1` indicates no timeout.
|
|
836
843
|
*/
|
|
837
844
|
requestTimeout : number | undefined;
|
|
845
|
+
/**
|
|
846
|
+
* Amount of time, in milliseconds, after which a request that hasn't receive
|
|
847
|
+
* the headers and status code should be aborted and optionnaly retried,
|
|
848
|
+
* depending on the maxRetry configuration.
|
|
849
|
+
*/
|
|
850
|
+
connectionTimeout : number | undefined;
|
|
838
851
|
/** Maximum number of time a request on error will be retried. */
|
|
839
852
|
maxRetry : number | undefined;
|
|
840
853
|
};
|
|
@@ -32,8 +32,8 @@ import { IStreamOrchestratorPlaybackObservation } from "../../stream";
|
|
|
32
32
|
/**
|
|
33
33
|
* Observes what's being played and take care of media events relating to time
|
|
34
34
|
* boundaries:
|
|
35
|
-
* - Emits a `
|
|
36
|
-
* known and every time it changes.
|
|
35
|
+
* - Emits a `endingPositionChange` when the known maximum playable position
|
|
36
|
+
* of the current content is known and every time it changes.
|
|
37
37
|
* - Emits `endOfStream` API once segments have been pushed until the end and
|
|
38
38
|
* `resumeStream` if downloads starts back.
|
|
39
39
|
* - Emits a `periodChange` event when the currently-playing Period seemed to
|
|
@@ -94,7 +94,7 @@ export default class ContentTimeBoundariesObserver
|
|
|
94
94
|
|
|
95
95
|
const cancelSignal = this._canceller.signal;
|
|
96
96
|
playbackObserver.listen(({ position }) => {
|
|
97
|
-
const wantedPosition = position.
|
|
97
|
+
const wantedPosition = position.getWanted();
|
|
98
98
|
if (wantedPosition < manifest.getMinimumSafePosition()) {
|
|
99
99
|
const warning = new MediaError("MEDIA_TIME_BEFORE_MANIFEST",
|
|
100
100
|
"The current position is behind the " +
|
|
@@ -111,7 +111,7 @@ export default class ContentTimeBoundariesObserver
|
|
|
111
111
|
}, { includeLastObservation: true, clearSignal: cancelSignal });
|
|
112
112
|
|
|
113
113
|
manifest.addEventListener("manifestUpdate", () => {
|
|
114
|
-
this.trigger("
|
|
114
|
+
this.trigger("endingPositionChange", this._getManifestEndTime());
|
|
115
115
|
if (cancelSignal.isCancelled()) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
@@ -120,11 +120,12 @@ export default class ContentTimeBoundariesObserver
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* Returns an estimate of the current
|
|
123
|
+
* Returns an estimate of the current last position which may be played in
|
|
124
|
+
* the content at the moment.
|
|
124
125
|
* @returns {Object}
|
|
125
126
|
*/
|
|
126
|
-
public
|
|
127
|
-
return this.
|
|
127
|
+
public getCurrentEndingTime() : IEndingPositionInformation {
|
|
128
|
+
return this._getManifestEndTime();
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/**
|
|
@@ -157,12 +158,13 @@ export default class ContentTimeBoundariesObserver
|
|
|
157
158
|
.updateLastVideoAdaptation(adaptation);
|
|
158
159
|
}
|
|
159
160
|
const endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
160
|
-
const
|
|
161
|
+
const newEndingPosition = endingPosition !== undefined ?
|
|
161
162
|
{ isEnd: true,
|
|
162
|
-
|
|
163
|
+
endingPosition } :
|
|
163
164
|
{ isEnd: false,
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
endingPosition: this._maximumPositionCalculator
|
|
166
|
+
.getMaximumAvailablePosition() };
|
|
167
|
+
this.trigger("endingPositionChange", newEndingPosition);
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
}
|
|
@@ -311,13 +313,13 @@ export default class ContentTimeBoundariesObserver
|
|
|
311
313
|
}
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
private
|
|
316
|
+
private _getManifestEndTime() : IEndingPositionInformation {
|
|
315
317
|
const endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
316
318
|
return endingPosition !== undefined ?
|
|
317
319
|
{ isEnd: true,
|
|
318
|
-
|
|
320
|
+
endingPosition } :
|
|
319
321
|
{ isEnd: false,
|
|
320
|
-
|
|
322
|
+
endingPosition: this._maximumPositionCalculator.getMaximumAvailablePosition() };
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
private _lazilyCreateActiveStreamInfo(bufferType : IBufferType) : IActiveStreamsInfo {
|
|
@@ -348,16 +350,16 @@ export default class ContentTimeBoundariesObserver
|
|
|
348
350
|
}
|
|
349
351
|
}
|
|
350
352
|
|
|
351
|
-
export interface
|
|
353
|
+
export interface IEndingPositionInformation {
|
|
352
354
|
/**
|
|
353
355
|
* The new maximum known position (note that this is the ending position
|
|
354
356
|
* currently known of the current content, it might be superior to the last
|
|
355
357
|
* position at which segments are available and it might also evolve over
|
|
356
358
|
* time), in seconds.
|
|
357
359
|
*/
|
|
358
|
-
|
|
360
|
+
endingPosition : number;
|
|
359
361
|
/**
|
|
360
|
-
* If `true`, the communicated `
|
|
362
|
+
* If `true`, the communicated `endingPosition` is the actual end of the content.
|
|
361
363
|
* It may still be updated due to a track change or to add precision, but it
|
|
362
364
|
* is still a (rough) estimate of the maximum position that content should
|
|
363
365
|
* have.
|
|
@@ -365,7 +367,7 @@ export interface IDurationItem {
|
|
|
365
367
|
* If `false`, this is the currently known maximum position associated to
|
|
366
368
|
* the content, but the content is still evolving (typically, new media
|
|
367
369
|
* segments are still being generated) and as such it can still have a
|
|
368
|
-
* longer
|
|
370
|
+
* longer `endingPosition` in the future.
|
|
369
371
|
*/
|
|
370
372
|
isEnd : boolean;
|
|
371
373
|
}
|
|
@@ -380,10 +382,10 @@ export interface IContentTimeBoundariesObserverEvent {
|
|
|
380
382
|
/** Triggered when a new `Period` is currently playing. */
|
|
381
383
|
periodChange : Period;
|
|
382
384
|
/**
|
|
383
|
-
* Triggered when the
|
|
384
|
-
* or changed.
|
|
385
|
+
* Triggered when the ending position of the currently-playing content became
|
|
386
|
+
* known or changed.
|
|
385
387
|
*/
|
|
386
|
-
|
|
388
|
+
endingPositionChange : IEndingPositionInformation;
|
|
387
389
|
/**
|
|
388
390
|
* Triggered when the last possible chronological segment for all types of
|
|
389
391
|
* buffers has either been pushed or is being pushed to the corresponding
|
|
@@ -460,8 +462,7 @@ class MaximumPositionCalculator {
|
|
|
460
462
|
*/
|
|
461
463
|
public getMaximumAvailablePosition() : number {
|
|
462
464
|
if (this._manifest.isDynamic) {
|
|
463
|
-
return this._manifest.
|
|
464
|
-
this._manifest.getMaximumSafePosition();
|
|
465
|
+
return this._manifest.getMaximumSafePosition();
|
|
465
466
|
}
|
|
466
467
|
if (this._lastVideoAdaptation === undefined ||
|
|
467
468
|
this._lastAudioAdaptation === undefined)
|