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
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import isSeekingApproximate from "../../compat/is_seeking_approximate";
|
|
16
17
|
import config from "../../config";
|
|
17
18
|
import log from "../../log";
|
|
18
19
|
import getMonotonicTimeStamp from "../../utils/monotonic_timestamp";
|
|
@@ -65,6 +66,19 @@ export default class PlaybackObserver {
|
|
|
65
66
|
this._lowLatencyMode = options.lowLatencyMode;
|
|
66
67
|
this._canceller = new TaskCanceller();
|
|
67
68
|
this._observationRef = this._createSharedReference();
|
|
69
|
+
this._expectedSeekingPosition = null;
|
|
70
|
+
this._pendingSeek = null;
|
|
71
|
+
const onLoadedMetadata = () => {
|
|
72
|
+
if (this._pendingSeek !== null) {
|
|
73
|
+
const positionToSeekTo = this._pendingSeek;
|
|
74
|
+
this._pendingSeek = null;
|
|
75
|
+
this._actuallySetCurrentTime(positionToSeekTo);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
mediaElement.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
79
|
+
this._canceller.signal.register(() => {
|
|
80
|
+
mediaElement.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
81
|
+
});
|
|
68
82
|
}
|
|
69
83
|
/**
|
|
70
84
|
* Stop the `PlaybackObserver` from emitting playback observations and free all
|
|
@@ -114,9 +128,14 @@ export default class PlaybackObserver {
|
|
|
114
128
|
* @param {number} time
|
|
115
129
|
*/
|
|
116
130
|
setCurrentTime(time) {
|
|
117
|
-
this.
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
if (this._mediaElement.readyState >= 1) {
|
|
132
|
+
this._actuallySetCurrentTime(time);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this._internalSeeksIncoming = [];
|
|
136
|
+
this._pendingSeek = time;
|
|
137
|
+
this._generateObservationForEvent("manual");
|
|
138
|
+
}
|
|
120
139
|
}
|
|
121
140
|
/**
|
|
122
141
|
* Update the playback rate of the `HTMLMediaElement`.
|
|
@@ -181,6 +200,11 @@ export default class PlaybackObserver {
|
|
|
181
200
|
deriveReadOnlyObserver(transform) {
|
|
182
201
|
return generateReadOnlyObserver(this, transform, this._canceller.signal);
|
|
183
202
|
}
|
|
203
|
+
_actuallySetCurrentTime(time) {
|
|
204
|
+
log.info("API: Seeking internally", time);
|
|
205
|
+
this._internalSeeksIncoming.push(time);
|
|
206
|
+
this._mediaElement.currentTime = time;
|
|
207
|
+
}
|
|
184
208
|
/**
|
|
185
209
|
* Creates the `IReadOnlySharedReference` that will generate playback
|
|
186
210
|
* observations.
|
|
@@ -190,57 +214,21 @@ export default class PlaybackObserver {
|
|
|
190
214
|
if (this._observationRef !== undefined) {
|
|
191
215
|
return this._observationRef;
|
|
192
216
|
}
|
|
193
|
-
let lastObservation;
|
|
194
217
|
const { SAMPLING_INTERVAL_MEDIASOURCE, SAMPLING_INTERVAL_LOW_LATENCY, SAMPLING_INTERVAL_NO_MEDIASOURCE } = config.getCurrent();
|
|
195
|
-
const
|
|
196
|
-
let tmpEvt = event;
|
|
197
|
-
let startedInternalSeekTime;
|
|
198
|
-
if (tmpEvt === "seeking" && this._internalSeeksIncoming.length > 0) {
|
|
199
|
-
tmpEvt = "internal-seeking";
|
|
200
|
-
startedInternalSeekTime = this._internalSeeksIncoming.shift();
|
|
201
|
-
}
|
|
202
|
-
const _lastObservation = lastObservation !== null && lastObservation !== void 0 ? lastObservation : this._generateInitialObservation();
|
|
203
|
-
const mediaTimings = getMediaInfos(this._mediaElement, tmpEvt, this._withMediaSource);
|
|
204
|
-
let pendingInternalSeek = null;
|
|
205
|
-
if (mediaTimings.seeking) {
|
|
206
|
-
if (typeof startedInternalSeekTime === "number") {
|
|
207
|
-
pendingInternalSeek = startedInternalSeekTime;
|
|
208
|
-
}
|
|
209
|
-
else if (_lastObservation.pendingInternalSeek !== null && event !== "seeking") {
|
|
210
|
-
pendingInternalSeek = _lastObservation.pendingInternalSeek;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const rebufferingStatus = getRebufferingStatus(_lastObservation, mediaTimings, { lowLatencyMode: this._lowLatencyMode,
|
|
214
|
-
withMediaSource: this._withMediaSource });
|
|
215
|
-
const freezingStatus = getFreezingStatus(_lastObservation, mediaTimings);
|
|
216
|
-
const timings = objectAssign({}, { rebuffering: rebufferingStatus,
|
|
217
|
-
freezing: freezingStatus,
|
|
218
|
-
pendingInternalSeek }, mediaTimings);
|
|
219
|
-
if (log.hasLevel("DEBUG")) {
|
|
220
|
-
log.debug("API: current media element state tick", "event", timings.event, "position", timings.position, "seeking", timings.seeking, "internalSeek", timings.pendingInternalSeek, "rebuffering", timings.rebuffering !== null, "freezing", timings.freezing !== null, "ended", timings.ended, "paused", timings.paused, "playbackRate", timings.playbackRate, "readyState", timings.readyState);
|
|
221
|
-
}
|
|
222
|
-
return timings;
|
|
223
|
-
};
|
|
224
|
-
const returnedSharedReference = new SharedReference(getCurrentObservation("init"), this._canceller.signal);
|
|
225
|
-
const generateObservationForEvent = (event) => {
|
|
226
|
-
const newObservation = getCurrentObservation(event);
|
|
227
|
-
if (log.hasLevel("DEBUG")) {
|
|
228
|
-
log.debug("API: current playback timeline:\n" +
|
|
229
|
-
prettyPrintBuffered(newObservation.buffered, newObservation.position), `\n${event}`);
|
|
230
|
-
}
|
|
231
|
-
lastObservation = newObservation;
|
|
232
|
-
returnedSharedReference.setValue(newObservation);
|
|
233
|
-
};
|
|
218
|
+
const returnedSharedReference = new SharedReference(this._getCurrentObservation("init"), this._canceller.signal);
|
|
234
219
|
const interval = this._lowLatencyMode ? SAMPLING_INTERVAL_LOW_LATENCY :
|
|
235
220
|
this._withMediaSource ? SAMPLING_INTERVAL_MEDIASOURCE :
|
|
236
221
|
SAMPLING_INTERVAL_NO_MEDIASOURCE;
|
|
222
|
+
const onInterval = () => {
|
|
223
|
+
this._generateObservationForEvent("timeupdate");
|
|
224
|
+
};
|
|
237
225
|
let intervalId = setInterval(onInterval, interval);
|
|
238
226
|
const removeEventListeners = SCANNED_MEDIA_ELEMENTS_EVENTS.map((eventName) => {
|
|
239
|
-
|
|
240
|
-
function onMediaEvent() {
|
|
227
|
+
const onMediaEvent = () => {
|
|
241
228
|
restartInterval();
|
|
242
|
-
|
|
243
|
-
}
|
|
229
|
+
this._generateObservationForEvent(eventName);
|
|
230
|
+
};
|
|
231
|
+
this._mediaElement.addEventListener(eventName, onMediaEvent);
|
|
244
232
|
return () => {
|
|
245
233
|
this._mediaElement.removeEventListener(eventName, onMediaEvent);
|
|
246
234
|
};
|
|
@@ -251,18 +239,165 @@ export default class PlaybackObserver {
|
|
|
251
239
|
returnedSharedReference.finish();
|
|
252
240
|
});
|
|
253
241
|
return returnedSharedReference;
|
|
254
|
-
function onInterval() {
|
|
255
|
-
generateObservationForEvent("timeupdate");
|
|
256
|
-
}
|
|
257
242
|
function restartInterval() {
|
|
258
243
|
clearInterval(intervalId);
|
|
259
244
|
intervalId = setInterval(onInterval, interval);
|
|
260
245
|
}
|
|
261
246
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
247
|
+
_getCurrentObservation(event) {
|
|
248
|
+
var _a;
|
|
249
|
+
/** Actual event emitted through an observation. */
|
|
250
|
+
let tmpEvt = event;
|
|
251
|
+
// NOTE: `this._observationRef` may be `undefined` because we might here be
|
|
252
|
+
// called in the constructor when that property is not yet set.
|
|
253
|
+
const previousObservation = this._observationRef === undefined ?
|
|
254
|
+
getInitialObservation(this._mediaElement, this._withMediaSource) :
|
|
255
|
+
this._observationRef.getValue();
|
|
256
|
+
/**
|
|
257
|
+
* If `true`, there is a seek operation ongoing but it was done from the
|
|
258
|
+
* `PlaybackObserver`'s `setCurrentTime` method, not from external code.
|
|
259
|
+
*/
|
|
260
|
+
let isInternalSeeking = false;
|
|
261
|
+
/** If set, the position for which we plan to seek to as soon as possible. */
|
|
262
|
+
let pendingPosition = this._pendingSeek;
|
|
263
|
+
/** Initially-polled playback observation, before adjustments. */
|
|
264
|
+
const mediaTimings = getMediaInfos(this._mediaElement, this._withMediaSource);
|
|
265
|
+
if (tmpEvt === "seeking") {
|
|
266
|
+
// We just began seeking.
|
|
267
|
+
// Let's find out if the seek is internal or external and handle approximate
|
|
268
|
+
// seeking
|
|
269
|
+
if (this._internalSeeksIncoming.length > 0) {
|
|
270
|
+
isInternalSeeking = true;
|
|
271
|
+
tmpEvt = "internal-seeking";
|
|
272
|
+
const startedInternalSeekTime = this._internalSeeksIncoming.shift();
|
|
273
|
+
this._expectedSeekingPosition = isSeekingApproximate ?
|
|
274
|
+
Math.max(mediaTimings.position, startedInternalSeekTime !== null && startedInternalSeekTime !== void 0 ? startedInternalSeekTime : 0) :
|
|
275
|
+
mediaTimings.position;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this._expectedSeekingPosition = mediaTimings.position;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
else if (mediaTimings.seeking) {
|
|
282
|
+
// we're still seeking, this time without a "seeking" event so it's an
|
|
283
|
+
// already handled one, keep track of the last wanted position we wanted
|
|
284
|
+
// to seek to, to work-around devices re-seeking silently.
|
|
285
|
+
this._expectedSeekingPosition = Math.max(mediaTimings.position, (_a = this._expectedSeekingPosition) !== null && _a !== void 0 ? _a : 0);
|
|
286
|
+
}
|
|
287
|
+
else if (isSeekingApproximate &&
|
|
288
|
+
this._expectedSeekingPosition !== null &&
|
|
289
|
+
mediaTimings.position < this._expectedSeekingPosition) {
|
|
290
|
+
// We're on a target with aproximate seeking, we're not seeking anymore, but
|
|
291
|
+
// we're not yet at the expected seeking position.
|
|
292
|
+
// Signal to the rest of the application that the intented position is not
|
|
293
|
+
// the current position but the one contained in `this._expectedSeekingPosition`
|
|
294
|
+
pendingPosition = this._expectedSeekingPosition;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this._expectedSeekingPosition = null;
|
|
298
|
+
}
|
|
299
|
+
if (mediaTimings.seeking &&
|
|
300
|
+
previousObservation.seeking === 1 /* SeekingState.Internal */ &&
|
|
301
|
+
event !== "seeking") {
|
|
302
|
+
isInternalSeeking = true;
|
|
303
|
+
}
|
|
304
|
+
const rebufferingStatus = getRebufferingStatus(previousObservation, mediaTimings, tmpEvt, { lowLatencyMode: this._lowLatencyMode,
|
|
305
|
+
withMediaSource: this._withMediaSource });
|
|
306
|
+
const freezingStatus = getFreezingStatus(previousObservation, mediaTimings, tmpEvt);
|
|
307
|
+
const seeking = isInternalSeeking ? 1 /* SeekingState.Internal */ :
|
|
308
|
+
mediaTimings.seeking ? 2 /* SeekingState.External */ :
|
|
309
|
+
0 /* SeekingState.None */;
|
|
310
|
+
const timings = objectAssign({}, mediaTimings, { position: new ObservationPosition(mediaTimings.position, pendingPosition),
|
|
311
|
+
event: tmpEvt,
|
|
312
|
+
seeking,
|
|
313
|
+
rebuffering: rebufferingStatus,
|
|
314
|
+
freezing: freezingStatus });
|
|
315
|
+
if (log.hasLevel("DEBUG")) {
|
|
316
|
+
log.debug("API: current media element state tick", "event", timings.event, "position", timings.position.getPolled(), "seeking", timings.seeking, "internalSeek", isInternalSeeking, "rebuffering", timings.rebuffering !== null, "freezing", timings.freezing !== null, "ended", timings.ended, "paused", timings.paused, "playbackRate", timings.playbackRate, "readyState", timings.readyState);
|
|
317
|
+
}
|
|
318
|
+
return timings;
|
|
319
|
+
}
|
|
320
|
+
_generateObservationForEvent(event) {
|
|
321
|
+
const newObservation = this._getCurrentObservation(event);
|
|
322
|
+
if (log.hasLevel("DEBUG")) {
|
|
323
|
+
log.debug("API: current playback timeline:\n" +
|
|
324
|
+
prettyPrintBuffered(newObservation.buffered, newObservation.position.getPolled()), `\n${event}`);
|
|
325
|
+
}
|
|
326
|
+
this._observationRef.setValue(newObservation);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
class ObservationPosition {
|
|
330
|
+
constructor(last, wanted) {
|
|
331
|
+
this._last = last;
|
|
332
|
+
this._wanted = wanted;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Returns the playback position actually observed on the media element at
|
|
336
|
+
* the time the playback observation was made.
|
|
337
|
+
*
|
|
338
|
+
* Note that it may be different than the position for which media data is
|
|
339
|
+
* wanted in rare scenarios where the goal position is not yet set on the
|
|
340
|
+
* media element.
|
|
341
|
+
*
|
|
342
|
+
* You should use this value when you want to obtain the actual position set
|
|
343
|
+
* on the media element for browser compatibility purposes. Note that this
|
|
344
|
+
* position was calculated at observation time, it might thus not be
|
|
345
|
+
* up-to-date if what you want is milliseconds-accuracy.
|
|
346
|
+
*
|
|
347
|
+
* If what you want is the actual position which the player is intended to
|
|
348
|
+
* play, you should rely on `getWanted` instead`.
|
|
349
|
+
* @returns {number}
|
|
350
|
+
*/
|
|
351
|
+
getPolled() {
|
|
352
|
+
return this._last;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Returns the position which the player should consider to load media data
|
|
356
|
+
* at the time the observation was made.
|
|
357
|
+
*
|
|
358
|
+
* It can be different than the value returned by `getPolled` in rare
|
|
359
|
+
* scenarios:
|
|
360
|
+
*
|
|
361
|
+
* - When the initial position has not been set yet.
|
|
362
|
+
*
|
|
363
|
+
* - When the current device do not let the RxPlayer peform precize seeks,
|
|
364
|
+
* usually for perfomance reasons by seeking to a previous IDR frame
|
|
365
|
+
* instead (for now only Tizen may be like this), in which case we
|
|
366
|
+
* prefer to generally rely on the position wanted by the player (this
|
|
367
|
+
* e.g. prevents issues where the RxPlayer logic and the device are
|
|
368
|
+
* seeking back and forth in a loop).
|
|
369
|
+
*
|
|
370
|
+
* - When a wanted position has been "forced" (@see forceWantedPosition).
|
|
371
|
+
* @returns {number}
|
|
372
|
+
*/
|
|
373
|
+
getWanted() {
|
|
374
|
+
var _a;
|
|
375
|
+
return (_a = this._wanted) !== null && _a !== void 0 ? _a : this._last;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Method to call if you want to overwrite the currently wanted position.
|
|
379
|
+
* @param {number} pos
|
|
380
|
+
*/
|
|
381
|
+
forceWantedPosition(pos) {
|
|
382
|
+
this._wanted = pos;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Returns `true` when the position wanted returned by `getWanted` and the
|
|
386
|
+
* actual position returned by `getPolled` may be different, meaning that
|
|
387
|
+
* we're currently not at the position we want to reach.
|
|
388
|
+
*
|
|
389
|
+
* This is a relatively rare situation which only happens when either the
|
|
390
|
+
* initial seek has not yet been performed. on specific targets where the
|
|
391
|
+
* seeking behavior is a little broken (@see getWanted) or when the wanted
|
|
392
|
+
* position has been forced (@see forceWantedPosition).
|
|
393
|
+
*
|
|
394
|
+
* In those situations, you might temporarily refrain from acting upon the
|
|
395
|
+
* actual current media position, as it may change soon.
|
|
396
|
+
*
|
|
397
|
+
* @returns {boolean}
|
|
398
|
+
*/
|
|
399
|
+
isAwaitingFuturePosition() {
|
|
400
|
+
return this._wanted !== null;
|
|
266
401
|
}
|
|
267
402
|
}
|
|
268
403
|
/**
|
|
@@ -311,10 +446,9 @@ function hasLoadedUntilTheEnd(currentTime, currentRange, ended, duration, lowLat
|
|
|
311
446
|
/**
|
|
312
447
|
* Get basic playback information.
|
|
313
448
|
* @param {HTMLMediaElement} mediaElement
|
|
314
|
-
* @param {string} event
|
|
315
449
|
* @returns {Object}
|
|
316
450
|
*/
|
|
317
|
-
function getMediaInfos(mediaElement,
|
|
451
|
+
function getMediaInfos(mediaElement, withMediaSource) {
|
|
318
452
|
const { buffered, currentTime, duration, ended, paused, playbackRate, readyState, seeking } = mediaElement;
|
|
319
453
|
let currentRange;
|
|
320
454
|
let bufferGap;
|
|
@@ -342,8 +476,7 @@ function getMediaInfos(mediaElement, event, withMediaSource) {
|
|
|
342
476
|
paused,
|
|
343
477
|
playbackRate,
|
|
344
478
|
readyState,
|
|
345
|
-
seeking
|
|
346
|
-
event };
|
|
479
|
+
seeking };
|
|
347
480
|
}
|
|
348
481
|
/**
|
|
349
482
|
* Infer rebuffering status of the media based on:
|
|
@@ -354,12 +487,13 @@ function getMediaInfos(mediaElement, event, withMediaSource) {
|
|
|
354
487
|
* @param {Object} currentInfo - Current set of basic information on the
|
|
355
488
|
* `HTMLMediaElement`. This does not need every single property from a regular
|
|
356
489
|
* playback observation.
|
|
490
|
+
* @param {string} currentEvt
|
|
357
491
|
* @param {Object} options
|
|
358
492
|
* @returns {Object|null}
|
|
359
493
|
*/
|
|
360
|
-
function getRebufferingStatus(prevObservation, currentInfo, { withMediaSource, lowLatencyMode }) {
|
|
494
|
+
function getRebufferingStatus(prevObservation, currentInfo, currentEvt, { withMediaSource, lowLatencyMode }) {
|
|
361
495
|
const { REBUFFERING_GAP } = config.getCurrent();
|
|
362
|
-
const {
|
|
496
|
+
const { position: currentTime, bufferGap, currentRange, duration, paused, readyState, ended } = currentInfo;
|
|
363
497
|
const { rebuffering: prevRebuffering, event: prevEvt, position: prevTime } = prevObservation;
|
|
364
498
|
const fullyLoaded = hasLoadedUntilTheEnd(currentTime, currentRange, ended, duration, lowLatencyMode);
|
|
365
499
|
const canSwitchToRebuffering = (readyState >= 1 &&
|
|
@@ -414,12 +548,12 @@ function getRebufferingStatus(prevObservation, currentInfo, { withMediaSource, l
|
|
|
414
548
|
if (canSwitchToRebuffering &&
|
|
415
549
|
((!paused &&
|
|
416
550
|
currentEvt === "timeupdate" && prevEvt === "timeupdate" &&
|
|
417
|
-
currentTime === prevTime) ||
|
|
551
|
+
currentTime === prevTime.getPolled()) ||
|
|
418
552
|
(currentEvt === "seeking" && (bufferGap === Infinity || (bufferGap === undefined && readyState < 3))))) {
|
|
419
553
|
shouldRebuffer = true;
|
|
420
554
|
}
|
|
421
555
|
else if (prevRebuffering !== null &&
|
|
422
|
-
((currentEvt !== "seeking" && currentTime !== prevTime) ||
|
|
556
|
+
((currentEvt !== "seeking" && currentTime !== prevTime.getPolled()) ||
|
|
423
557
|
currentEvt === "canplay" ||
|
|
424
558
|
(bufferGap === undefined && readyState >= 3) ||
|
|
425
559
|
(bufferGap !== undefined && bufferGap < Infinity &&
|
|
@@ -465,28 +599,29 @@ function getRebufferingStatus(prevObservation, currentInfo, { withMediaSource, l
|
|
|
465
599
|
* `null` if not.
|
|
466
600
|
* @param {Object} prevObservation
|
|
467
601
|
* @param {Object} currentInfo
|
|
602
|
+
* @param {string} currentEvt
|
|
468
603
|
* @returns {Object|null}
|
|
469
604
|
*/
|
|
470
|
-
function getFreezingStatus(prevObservation, currentInfo) {
|
|
605
|
+
function getFreezingStatus(prevObservation, currentInfo, currentEvt) {
|
|
471
606
|
const { MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING } = config.getCurrent();
|
|
472
607
|
if (prevObservation.freezing) {
|
|
473
608
|
if (currentInfo.ended ||
|
|
474
609
|
currentInfo.paused ||
|
|
475
610
|
currentInfo.readyState === 0 ||
|
|
476
611
|
currentInfo.playbackRate === 0 ||
|
|
477
|
-
prevObservation.position !== currentInfo.position) {
|
|
612
|
+
prevObservation.position.getPolled() !== currentInfo.position) {
|
|
478
613
|
return null; // Quit freezing status
|
|
479
614
|
}
|
|
480
615
|
return prevObservation.freezing; // Stay in it
|
|
481
616
|
}
|
|
482
|
-
return
|
|
617
|
+
return currentEvt === "timeupdate" &&
|
|
483
618
|
currentInfo.bufferGap !== undefined &&
|
|
484
619
|
currentInfo.bufferGap > MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING &&
|
|
485
620
|
!currentInfo.ended &&
|
|
486
621
|
!currentInfo.paused &&
|
|
487
622
|
currentInfo.readyState >= 1 &&
|
|
488
623
|
currentInfo.playbackRate !== 0 &&
|
|
489
|
-
currentInfo.position === prevObservation.position ?
|
|
624
|
+
currentInfo.position === prevObservation.position.getPolled() ?
|
|
490
625
|
{ timestamp: getMonotonicTimeStamp() } :
|
|
491
626
|
null;
|
|
492
627
|
}
|
|
@@ -589,3 +724,19 @@ function generateReadOnlyObserver(src, transform, cancellationSignal) {
|
|
|
589
724
|
},
|
|
590
725
|
};
|
|
591
726
|
}
|
|
727
|
+
/**
|
|
728
|
+
* Generate the initial playback observation for when no event has yet been
|
|
729
|
+
* emitted to lead to one.
|
|
730
|
+
* @param {HTMLMediaElement} mediaElement
|
|
731
|
+
* @param {boolean} withMediaSource
|
|
732
|
+
* @returns {Object}
|
|
733
|
+
*/
|
|
734
|
+
function getInitialObservation(mediaElement, withMediaSource) {
|
|
735
|
+
const mediaTimings = getMediaInfos(mediaElement, withMediaSource);
|
|
736
|
+
return objectAssign(mediaTimings, { rebuffering: null,
|
|
737
|
+
event: "init",
|
|
738
|
+
seeking: 0 /* SeekingState.None */,
|
|
739
|
+
position: { last: mediaTimings.position,
|
|
740
|
+
pending: undefined },
|
|
741
|
+
freezing: null });
|
|
742
|
+
}
|
|
@@ -557,6 +557,15 @@ declare class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
557
557
|
* @returns {number}
|
|
558
558
|
*/
|
|
559
559
|
getMinimumPosition(): number | null;
|
|
560
|
+
/**
|
|
561
|
+
* Returns the current position for live contents.
|
|
562
|
+
*
|
|
563
|
+
* Returns `null` if no content is loaded or if the current loaded content is
|
|
564
|
+
* not considered as a live content.
|
|
565
|
+
* Returns `undefined` if that live position is currently unknown.
|
|
566
|
+
* @returns {number}
|
|
567
|
+
*/
|
|
568
|
+
getLivePosition(): number | undefined | null;
|
|
560
569
|
/**
|
|
561
570
|
* Get maximum seek-able position.
|
|
562
571
|
* @returns {number}
|
|
@@ -91,7 +91,7 @@ class Player extends EventEmitter {
|
|
|
91
91
|
// Workaround to support Firefox autoplay on FF 42.
|
|
92
92
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
93
93
|
videoElement.preload = "auto";
|
|
94
|
-
this.version = /* PLAYER_VERSION */ "4.0.0-dev.
|
|
94
|
+
this.version = /* PLAYER_VERSION */ "4.0.0-dev.2023121900";
|
|
95
95
|
this.log = log;
|
|
96
96
|
this.state = "STOPPED";
|
|
97
97
|
this.videoElement = videoElement;
|
|
@@ -250,7 +250,7 @@ class Player extends EventEmitter {
|
|
|
250
250
|
* @param {Object} options
|
|
251
251
|
*/
|
|
252
252
|
_priv_initializeContentPlayback(options) {
|
|
253
|
-
var _a, _b, _c, _d;
|
|
253
|
+
var _a, _b, _c, _d, _e, _f;
|
|
254
254
|
const { autoPlay, defaultAudioTrackSwitchingMode, enableFastSwitching, initialManifest, keySystems, lowLatencyMode, minimumManifestUpdateInterval, requestConfig, onCodecSwitch, startAt, transport, checkMediaSegmentIntegrity, manifestLoader, referenceDateTime, representationFilter, segmentLoader, serverSyncInfos, __priv_manifestUpdateUrl, __priv_patchLastSegmentInSidx, url } = options;
|
|
255
255
|
// Perform multiple checks on the given options
|
|
256
256
|
if (this.videoElement === null) {
|
|
@@ -286,6 +286,7 @@ class Player extends EventEmitter {
|
|
|
286
286
|
const manifestRequestSettings = { lowLatencyMode,
|
|
287
287
|
maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
|
|
288
288
|
requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout,
|
|
289
|
+
connectionTimeout: (_c = requestConfig.manifest) === null || _c === void 0 ? void 0 : _c.connectionTimeout,
|
|
289
290
|
minimumManifestUpdateInterval,
|
|
290
291
|
initialManifest };
|
|
291
292
|
const relyOnVideoVisibilityAndSize = canRelyOnVideoVisibilityAndSize();
|
|
@@ -332,8 +333,9 @@ class Player extends EventEmitter {
|
|
|
332
333
|
const bufferOptions = objectAssign({ enableFastSwitching,
|
|
333
334
|
onCodecSwitch }, this._priv_bufferOptions);
|
|
334
335
|
const segmentRequestOptions = { lowLatencyMode,
|
|
335
|
-
maxRetry: (
|
|
336
|
-
requestTimeout: (
|
|
336
|
+
maxRetry: (_d = requestConfig.segment) === null || _d === void 0 ? void 0 : _d.maxRetry,
|
|
337
|
+
requestTimeout: (_e = requestConfig.segment) === null || _e === void 0 ? void 0 : _e.timeout,
|
|
338
|
+
connectionTimeout: (_f = requestConfig.segment) === null || _f === void 0 ? void 0 : _f.connectionTimeout };
|
|
337
339
|
initializer = new features.mediaSourceInit({
|
|
338
340
|
adaptiveOptions,
|
|
339
341
|
autoPlay,
|
|
@@ -457,12 +459,12 @@ class Player extends EventEmitter {
|
|
|
457
459
|
case "ENDED":
|
|
458
460
|
this._priv_reloadingMetadata.reloadInPause = true;
|
|
459
461
|
this._priv_reloadingMetadata.reloadPosition =
|
|
460
|
-
playbackObserver.getReference().getValue().position;
|
|
462
|
+
playbackObserver.getReference().getValue().position.getPolled();
|
|
461
463
|
break;
|
|
462
464
|
default:
|
|
463
465
|
const o = playbackObserver.getReference().getValue();
|
|
464
466
|
this._priv_reloadingMetadata.reloadInPause = o.paused;
|
|
465
|
-
this._priv_reloadingMetadata.reloadPosition = o.position;
|
|
467
|
+
this._priv_reloadingMetadata.reloadPosition = o.position.getWanted();
|
|
466
468
|
break;
|
|
467
469
|
}
|
|
468
470
|
};
|
|
@@ -1462,6 +1464,27 @@ class Player extends EventEmitter {
|
|
|
1462
1464
|
}
|
|
1463
1465
|
return null;
|
|
1464
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Returns the current position for live contents.
|
|
1469
|
+
*
|
|
1470
|
+
* Returns `null` if no content is loaded or if the current loaded content is
|
|
1471
|
+
* not considered as a live content.
|
|
1472
|
+
* Returns `undefined` if that live position is currently unknown.
|
|
1473
|
+
* @returns {number}
|
|
1474
|
+
*/
|
|
1475
|
+
getLivePosition() {
|
|
1476
|
+
if (this._priv_contentInfos === null) {
|
|
1477
|
+
return null;
|
|
1478
|
+
}
|
|
1479
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
1480
|
+
if (isDirectFile) {
|
|
1481
|
+
return undefined;
|
|
1482
|
+
}
|
|
1483
|
+
if ((manifest === null || manifest === void 0 ? void 0 : manifest.isLive) !== true) {
|
|
1484
|
+
return null;
|
|
1485
|
+
}
|
|
1486
|
+
return manifest.getLivePosition();
|
|
1487
|
+
}
|
|
1465
1488
|
/**
|
|
1466
1489
|
* Get maximum seek-able position.
|
|
1467
1490
|
* @returns {number}
|
|
@@ -1506,9 +1529,11 @@ class Player extends EventEmitter {
|
|
|
1506
1529
|
}
|
|
1507
1530
|
const segmentBufferStatus = this._priv_contentInfos
|
|
1508
1531
|
.segmentBuffersStore.getStatus(bufferType);
|
|
1509
|
-
|
|
1510
|
-
segmentBufferStatus.value.
|
|
1511
|
-
|
|
1532
|
+
if (segmentBufferStatus.type === "initialized") {
|
|
1533
|
+
segmentBufferStatus.value.synchronizeInventory();
|
|
1534
|
+
return segmentBufferStatus.value.getInventory();
|
|
1535
|
+
}
|
|
1536
|
+
return null;
|
|
1512
1537
|
}
|
|
1513
1538
|
/**
|
|
1514
1539
|
* /!\ For tools use only! Do not touch!
|
|
@@ -1950,7 +1975,7 @@ class Player extends EventEmitter {
|
|
|
1950
1975
|
const maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() :
|
|
1951
1976
|
undefined;
|
|
1952
1977
|
const positionData = {
|
|
1953
|
-
position: observation.position,
|
|
1978
|
+
position: observation.position.getPolled(),
|
|
1954
1979
|
duration: observation.duration,
|
|
1955
1980
|
playbackRate: observation.playbackRate,
|
|
1956
1981
|
maximumPosition,
|
|
@@ -1962,18 +1987,18 @@ class Player extends EventEmitter {
|
|
|
1962
1987
|
};
|
|
1963
1988
|
if (manifest !== null &&
|
|
1964
1989
|
manifest.isLive &&
|
|
1965
|
-
observation.position > 0) {
|
|
1990
|
+
observation.position.getPolled() > 0) {
|
|
1966
1991
|
const ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
|
|
1967
|
-
positionData.wallClockTime = observation.position + ast;
|
|
1992
|
+
positionData.wallClockTime = observation.position.getPolled() + ast;
|
|
1968
1993
|
const livePosition = manifest.getLivePosition();
|
|
1969
1994
|
if (livePosition !== undefined) {
|
|
1970
|
-
positionData.liveGap = livePosition - observation.position;
|
|
1995
|
+
positionData.liveGap = livePosition - observation.position.getPolled();
|
|
1971
1996
|
}
|
|
1972
1997
|
}
|
|
1973
1998
|
else if (isDirectFile && this.videoElement !== null) {
|
|
1974
1999
|
const startDate = getStartDate(this.videoElement);
|
|
1975
2000
|
if (startDate !== undefined) {
|
|
1976
|
-
positionData.wallClockTime = startDate + observation.position;
|
|
2001
|
+
positionData.wallClockTime = startDate + observation.position.getPolled();
|
|
1977
2002
|
}
|
|
1978
2003
|
}
|
|
1979
2004
|
this.trigger("positionUpdate", positionData);
|
|
@@ -2107,5 +2132,5 @@ class Player extends EventEmitter {
|
|
|
2107
2132
|
}
|
|
2108
2133
|
}
|
|
2109
2134
|
}
|
|
2110
|
-
Player.version = /* PLAYER_VERSION */ "4.0.0-dev.
|
|
2135
|
+
Player.version = /* PLAYER_VERSION */ "4.0.0-dev.2023121900";
|
|
2111
2136
|
export default Player;
|
|
@@ -31,7 +31,7 @@ export function emitSeekEvents(mediaElement, playbackObserver, onSeeking, onSeek
|
|
|
31
31
|
if (cancelSignal.isCancelled() || mediaElement === null) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
let wasSeeking = playbackObserver.getReference().getValue().seeking
|
|
34
|
+
let wasSeeking = playbackObserver.getReference().getValue().seeking === 2 /* SeekingState.External */;
|
|
35
35
|
if (wasSeeking) {
|
|
36
36
|
onSeeking();
|
|
37
37
|
if (cancelSignal.isCancelled()) {
|
|
@@ -28,13 +28,9 @@ import ServerCertificateStore from "./utils/server_certificate_store";
|
|
|
28
28
|
* @returns {Object|null}
|
|
29
29
|
*/
|
|
30
30
|
function createPersistentSessionsStorage(keySystemOptions) {
|
|
31
|
-
if (isNullOrUndefined(keySystemOptions.persistentLicenseConfig)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
31
|
const { persistentLicenseConfig } = keySystemOptions;
|
|
35
|
-
if (persistentLicenseConfig
|
|
36
|
-
|
|
37
|
-
"persistent license.");
|
|
32
|
+
if (isNullOrUndefined(persistentLicenseConfig)) {
|
|
33
|
+
return null;
|
|
38
34
|
}
|
|
39
35
|
log.debug("DRM: Set the given license storage");
|
|
40
36
|
return new PersistentSessionsStore(persistentLicenseConfig);
|
|
@@ -171,6 +171,12 @@ export interface IManifestFetcherSettings {
|
|
|
171
171
|
* `undefined` will lead to a default, large, timeout being used.
|
|
172
172
|
*/
|
|
173
173
|
requestTimeout: number | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Connection timeout, in milliseconds, after which the request is canceled
|
|
176
|
+
* if the responses headers has not being received.
|
|
177
|
+
* Do not set or set to "undefined" to disable it.
|
|
178
|
+
*/
|
|
179
|
+
connectionTimeout: number | undefined;
|
|
174
180
|
/** Limit the frequency of Manifest updates. */
|
|
175
181
|
minimumManifestUpdateInterval: number;
|
|
176
182
|
/**
|
|
@@ -18,7 +18,6 @@ import { formatError } from "../../../errors";
|
|
|
18
18
|
import log from "../../../log";
|
|
19
19
|
import Manifest from "../../../manifest";
|
|
20
20
|
import EventEmitter from "../../../utils/event_emitter";
|
|
21
|
-
import isNullOrUndefined from "../../../utils/is_null_or_undefined";
|
|
22
21
|
import getMonotonicTimeStamp from "../../../utils/monotonic_timestamp";
|
|
23
22
|
import noop from "../../../utils/noop";
|
|
24
23
|
import TaskCanceller from "../../../utils/task_canceller";
|
|
@@ -157,13 +156,22 @@ export default class ManifestFetcher extends EventEmitter {
|
|
|
157
156
|
*/
|
|
158
157
|
function callLoaderWithRetries(manifestUrl) {
|
|
159
158
|
const { loadManifest } = pipelines;
|
|
160
|
-
let requestTimeout =
|
|
159
|
+
let requestTimeout = (settings.requestTimeout === undefined) ?
|
|
161
160
|
config.getCurrent().DEFAULT_REQUEST_TIMEOUT :
|
|
162
161
|
settings.requestTimeout;
|
|
162
|
+
let connectionTimeout = (settings.connectionTimeout === undefined) ?
|
|
163
|
+
config.getCurrent().DEFAULT_CONNECTION_TIMEOUT :
|
|
164
|
+
settings.connectionTimeout;
|
|
163
165
|
if (requestTimeout < 0) {
|
|
164
166
|
requestTimeout = undefined;
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
if (connectionTimeout < 0) {
|
|
169
|
+
connectionTimeout = undefined;
|
|
170
|
+
}
|
|
171
|
+
const callLoader = () => loadManifest(manifestUrl, {
|
|
172
|
+
timeout: requestTimeout,
|
|
173
|
+
connectionTimeout,
|
|
174
|
+
}, cancelSignal);
|
|
167
175
|
return scheduleRequestPromise(callLoader, backoffSettings, cancelSignal);
|
|
168
176
|
}
|
|
169
177
|
}
|
|
@@ -135,14 +135,21 @@ export interface ISegmentFetcherOptions {
|
|
|
135
135
|
* To set to `-1` for no timeout.
|
|
136
136
|
*/
|
|
137
137
|
requestTimeout: number;
|
|
138
|
+
/**
|
|
139
|
+
* Connection timeout, in milliseconds, after which the request is canceled
|
|
140
|
+
* if the responses headers has not being received.
|
|
141
|
+
* Do not set or set to "undefined" to disable it.
|
|
142
|
+
*/
|
|
143
|
+
connectionTimeout: number | undefined;
|
|
138
144
|
}
|
|
139
145
|
/**
|
|
140
146
|
* @param {string} bufferType
|
|
141
147
|
* @param {Object}
|
|
142
148
|
* @returns {Object}
|
|
143
149
|
*/
|
|
144
|
-
export declare function getSegmentFetcherOptions({ maxRetry, lowLatencyMode, requestTimeout }: {
|
|
150
|
+
export declare function getSegmentFetcherOptions({ maxRetry, lowLatencyMode, requestTimeout, connectionTimeout }: {
|
|
145
151
|
maxRetry?: number | undefined;
|
|
146
152
|
requestTimeout?: number | undefined;
|
|
153
|
+
connectionTimeout?: number | undefined;
|
|
147
154
|
lowLatencyMode: boolean;
|
|
148
155
|
}): ISegmentFetcherOptions;
|