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
|
@@ -20,6 +20,7 @@ import EventEmitter from "../../../../utils/event_emitter";
|
|
|
20
20
|
import SharedReference from "../../../../utils/reference";
|
|
21
21
|
import TaskCanceller, { CancellationSignal } from "../../../../utils/task_canceller";
|
|
22
22
|
import { IPlaybackObservation, IReadOnlyPlaybackObserver } from "../../../api";
|
|
23
|
+
import { SeekingState } from "../../../api/playback_observer";
|
|
23
24
|
import refreshScheduledEventsList from "./refresh_scheduled_events_list";
|
|
24
25
|
import {
|
|
25
26
|
INonFiniteStreamEventPayload,
|
|
@@ -127,8 +128,10 @@ export default class StreamEventsEmitter extends EventEmitter<IStreamEventsEmitt
|
|
|
127
128
|
});
|
|
128
129
|
|
|
129
130
|
function constructObservation() {
|
|
130
|
-
const
|
|
131
|
-
|
|
131
|
+
const lastObservation = playbackObserver.getReference().getValue();
|
|
132
|
+
const currentTime = mediaElement.currentTime;
|
|
133
|
+
const isSeeking = lastObservation.seeking !== SeekingState.None;
|
|
134
|
+
return { currentTime,
|
|
132
135
|
isSeeking };
|
|
133
136
|
}
|
|
134
137
|
}, { emitCurrentValue: true, clearSignal: cancelSignal });
|
|
@@ -54,7 +54,7 @@ export default function BufferGarbageCollector(
|
|
|
54
54
|
) : void {
|
|
55
55
|
let lastPosition : number;
|
|
56
56
|
playbackObserver.listen((o) => {
|
|
57
|
-
lastPosition = o.position.
|
|
57
|
+
lastPosition = o.position.getWanted();
|
|
58
58
|
clean();
|
|
59
59
|
}, { includeLastObservation: true, clearSignal: cancellationSignal });
|
|
60
60
|
function clean() {
|
|
@@ -376,7 +376,15 @@ export default class AudioVideoSegmentBuffer extends SegmentBuffer {
|
|
|
376
376
|
err :
|
|
377
377
|
new Error("An unknown error occured when doing operations " +
|
|
378
378
|
"on the SourceBuffer");
|
|
379
|
-
this._pendingTask
|
|
379
|
+
const task = this._pendingTask;
|
|
380
|
+
if (task.type === SegmentBufferOperation.Push &&
|
|
381
|
+
task.data.length === 0 &&
|
|
382
|
+
task.inventoryData !== null)
|
|
383
|
+
{
|
|
384
|
+
this._segmentInventory.insertChunk(task.inventoryData, false);
|
|
385
|
+
}
|
|
386
|
+
this._pendingTask = null;
|
|
387
|
+
task.reject(error);
|
|
380
388
|
}
|
|
381
389
|
}
|
|
382
390
|
|
|
@@ -429,7 +437,7 @@ export default class AudioVideoSegmentBuffer extends SegmentBuffer {
|
|
|
429
437
|
switch (task.type) {
|
|
430
438
|
case SegmentBufferOperation.Push:
|
|
431
439
|
if (task.inventoryData !== null) {
|
|
432
|
-
this._segmentInventory.insertChunk(task.inventoryData);
|
|
440
|
+
this._segmentInventory.insertChunk(task.inventoryData, true);
|
|
433
441
|
}
|
|
434
442
|
break;
|
|
435
443
|
case SegmentBufferOperation.EndOfSegment:
|
|
@@ -302,7 +302,7 @@ export default class HTMLTextSegmentBuffer extends SegmentBuffer {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
if (infos.inventoryInfos !== null) {
|
|
305
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
305
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
306
306
|
}
|
|
307
307
|
this._buffer.insert(cues, start, end);
|
|
308
308
|
this._buffered.insert(start, end);
|
|
@@ -182,7 +182,7 @@ export default class NativeTextSegmentBuffer extends SegmentBuffer {
|
|
|
182
182
|
}
|
|
183
183
|
this._buffered.insert(start, end);
|
|
184
184
|
if (infos.inventoryInfos !== null) {
|
|
185
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
185
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
186
186
|
}
|
|
187
187
|
} catch (err) {
|
|
188
188
|
return Promise.reject(err);
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
SegmentBufferOperation,
|
|
29
29
|
} from "./implementations";
|
|
30
30
|
import {
|
|
31
|
+
ChunkStatus,
|
|
31
32
|
IBufferedChunk,
|
|
32
33
|
IChunkContext,
|
|
33
34
|
IInsertedChunkInfos,
|
|
@@ -42,6 +43,7 @@ import SegmentBuffersStore, {
|
|
|
42
43
|
export default SegmentBuffersStore;
|
|
43
44
|
export {
|
|
44
45
|
BufferGarbageCollector,
|
|
46
|
+
ChunkStatus,
|
|
45
47
|
|
|
46
48
|
ISegmentBufferOptions,
|
|
47
49
|
ITextTrackSegmentBufferOptions,
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import SegmentInventory, {
|
|
18
|
+
ChunkStatus,
|
|
18
19
|
IBufferedChunk,
|
|
19
20
|
IInsertedChunkInfos,
|
|
20
21
|
} from "./segment_inventory";
|
|
21
22
|
|
|
22
23
|
export default SegmentInventory;
|
|
23
24
|
export {
|
|
25
|
+
ChunkStatus,
|
|
24
26
|
IBufferedChunk,
|
|
25
27
|
IInsertedChunkInfos,
|
|
26
28
|
};
|
|
@@ -28,6 +28,27 @@ import BufferedHistory, {
|
|
|
28
28
|
} from "./buffered_history";
|
|
29
29
|
import { IChunkContext } from "./types";
|
|
30
30
|
|
|
31
|
+
/** Categorization of a given chunk in the `SegmentInventory`. */
|
|
32
|
+
export const enum ChunkStatus {
|
|
33
|
+
/**
|
|
34
|
+
* This chunk is only a part of a partially-pushed segment for now, meaning
|
|
35
|
+
* that it is only a sub-part of a requested segment that was not yet
|
|
36
|
+
* fully-loaded and pushed.
|
|
37
|
+
*
|
|
38
|
+
* Once and if the corresponding segment is fully-pushed, its `ChunkStatus`
|
|
39
|
+
* switches to `Complete`.
|
|
40
|
+
*/
|
|
41
|
+
PartiallyPushed = 0,
|
|
42
|
+
/** This chunk corresponds to a fully-loaded segment. */
|
|
43
|
+
Complete = 1,
|
|
44
|
+
/**
|
|
45
|
+
* This chunk's push operation failed, in this scenario there is no certitude
|
|
46
|
+
* about the presence of that chunk in the buffer: it may not be present,
|
|
47
|
+
* partially-present, or fully-present depending on why that push operation
|
|
48
|
+
* failed, which is generally only known by the lower-level code.
|
|
49
|
+
*/
|
|
50
|
+
Failed = 2,
|
|
51
|
+
}
|
|
31
52
|
|
|
32
53
|
/** Information stored on a single chunk by the SegmentInventory. */
|
|
33
54
|
export interface IBufferedChunk {
|
|
@@ -82,14 +103,10 @@ export interface IBufferedChunk {
|
|
|
82
103
|
/** Information on what that chunk actually contains. */
|
|
83
104
|
infos : IChunkContext;
|
|
84
105
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* Inversely, if `false`, this chunk is a whole segment whose inner chunks
|
|
88
|
-
* have all been fully pushed.
|
|
89
|
-
* In that condition, the `start` and `end` properties refer to that fully
|
|
90
|
-
* pushed segment.
|
|
106
|
+
* Status of this chunk.
|
|
107
|
+
* @see ChunkStatus
|
|
91
108
|
*/
|
|
92
|
-
|
|
109
|
+
status : ChunkStatus;
|
|
93
110
|
/**
|
|
94
111
|
* If `true`, the segment as a whole is divided into multiple parts in the
|
|
95
112
|
* buffer, with other segment(s) between them.
|
|
@@ -244,7 +261,11 @@ export default class SegmentInventory {
|
|
|
244
261
|
log.debug(`SI: ${numberOfSegmentToDelete} segments GCed.`, bufferType);
|
|
245
262
|
const removed = inventory.splice(indexBefore, numberOfSegmentToDelete);
|
|
246
263
|
for (const seg of removed) {
|
|
247
|
-
if (
|
|
264
|
+
if (
|
|
265
|
+
seg.bufferedStart === undefined &&
|
|
266
|
+
seg.bufferedEnd === undefined &&
|
|
267
|
+
seg.status !== ChunkStatus.Failed
|
|
268
|
+
) {
|
|
248
269
|
this._bufferedHistory.addBufferedSegment(seg.infos, null);
|
|
249
270
|
}
|
|
250
271
|
}
|
|
@@ -318,7 +339,11 @@ export default class SegmentInventory {
|
|
|
318
339
|
bufferType, inventoryIndex, inventory.length);
|
|
319
340
|
const removed = inventory.splice(inventoryIndex, inventory.length - inventoryIndex);
|
|
320
341
|
for (const seg of removed) {
|
|
321
|
-
if (
|
|
342
|
+
if (
|
|
343
|
+
seg.bufferedStart === undefined &&
|
|
344
|
+
seg.bufferedEnd === undefined &&
|
|
345
|
+
seg.status !== ChunkStatus.Failed
|
|
346
|
+
) {
|
|
322
347
|
this._bufferedHistory.addBufferedSegment(seg.infos, null);
|
|
323
348
|
}
|
|
324
349
|
}
|
|
@@ -343,7 +368,8 @@ export default class SegmentInventory {
|
|
|
343
368
|
segment,
|
|
344
369
|
chunkSize,
|
|
345
370
|
start,
|
|
346
|
-
end } : IInsertedChunkInfos
|
|
371
|
+
end } : IInsertedChunkInfos,
|
|
372
|
+
succeed: boolean
|
|
347
373
|
) : void {
|
|
348
374
|
if (segment.isInit) {
|
|
349
375
|
return;
|
|
@@ -357,7 +383,8 @@ export default class SegmentInventory {
|
|
|
357
383
|
}
|
|
358
384
|
|
|
359
385
|
const inventory = this._inventory;
|
|
360
|
-
const newSegment = {
|
|
386
|
+
const newSegment = { status: succeed ? ChunkStatus.PartiallyPushed :
|
|
387
|
+
ChunkStatus.Failed,
|
|
361
388
|
chunkSize,
|
|
362
389
|
splitted: false,
|
|
363
390
|
start,
|
|
@@ -565,7 +592,7 @@ export default class SegmentInventory {
|
|
|
565
592
|
// ===> : |--|====|-|
|
|
566
593
|
log.warn("SI: Segment pushed is contained in a previous one",
|
|
567
594
|
bufferType, start, end, segmentI.start, segmentI.end);
|
|
568
|
-
const nextSegment = {
|
|
595
|
+
const nextSegment = { status: segmentI.status,
|
|
569
596
|
/**
|
|
570
597
|
* Note: this sadly means we're doing as if
|
|
571
598
|
* that chunk is present two times.
|
|
@@ -743,7 +770,9 @@ export default class SegmentInventory {
|
|
|
743
770
|
this._inventory.splice(firstI + 1, length);
|
|
744
771
|
i -= length;
|
|
745
772
|
}
|
|
746
|
-
this._inventory[firstI].
|
|
773
|
+
if (this._inventory[firstI].status === ChunkStatus.PartiallyPushed) {
|
|
774
|
+
this._inventory[firstI].status = ChunkStatus.Complete;
|
|
775
|
+
}
|
|
747
776
|
this._inventory[firstI].chunkSize = segmentSize;
|
|
748
777
|
this._inventory[firstI].end = lastEnd;
|
|
749
778
|
this._inventory[firstI].bufferedEnd = lastBufferedEnd;
|
|
@@ -760,8 +789,11 @@ export default class SegmentInventory {
|
|
|
760
789
|
this.synchronizeBuffered(newBuffered);
|
|
761
790
|
for (const seg of resSegments) {
|
|
762
791
|
if (seg.bufferedStart !== undefined && seg.bufferedEnd !== undefined) {
|
|
763
|
-
|
|
764
|
-
|
|
792
|
+
if (seg.status !== ChunkStatus.Failed) {
|
|
793
|
+
this._bufferedHistory.addBufferedSegment(seg.infos,
|
|
794
|
+
{ start: seg.bufferedStart,
|
|
795
|
+
end: seg.bufferedEnd });
|
|
796
|
+
}
|
|
765
797
|
} else {
|
|
766
798
|
log.debug("SI: buffered range not known after sync. Skipping history.",
|
|
767
799
|
seg.start,
|
|
@@ -810,7 +842,7 @@ function bufferedStartLooksCoherent(
|
|
|
810
842
|
thisSegment : IBufferedChunk
|
|
811
843
|
) : boolean {
|
|
812
844
|
if (thisSegment.bufferedStart === undefined ||
|
|
813
|
-
thisSegment.
|
|
845
|
+
thisSegment.status !== ChunkStatus.Complete)
|
|
814
846
|
{
|
|
815
847
|
return false;
|
|
816
848
|
}
|
|
@@ -837,7 +869,7 @@ function bufferedEndLooksCoherent(
|
|
|
837
869
|
thisSegment : IBufferedChunk
|
|
838
870
|
) : boolean {
|
|
839
871
|
if (thisSegment.bufferedEnd === undefined ||
|
|
840
|
-
thisSegment.
|
|
872
|
+
thisSegment.status !== ChunkStatus.Complete)
|
|
841
873
|
{
|
|
842
874
|
return false;
|
|
843
875
|
}
|
|
@@ -35,14 +35,17 @@ import {
|
|
|
35
35
|
IBufferedChunk,
|
|
36
36
|
SegmentBuffer,
|
|
37
37
|
} from "../../segment_buffers";
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
IRepresentationStreamPlaybackObservation,
|
|
40
|
+
IRepresentationsChoice,
|
|
41
|
+
} from "../representation";
|
|
39
42
|
|
|
40
43
|
export default function getRepresentationsSwitchingStrategy(
|
|
41
44
|
period : Period,
|
|
42
45
|
adaptation : Adaptation,
|
|
43
46
|
settings : IRepresentationsChoice,
|
|
44
47
|
segmentBuffer : SegmentBuffer,
|
|
45
|
-
playbackObserver : IReadOnlyPlaybackObserver<
|
|
48
|
+
playbackObserver : IReadOnlyPlaybackObserver<IRepresentationStreamPlaybackObservation>
|
|
46
49
|
) : IRepresentationSwitchStrategy {
|
|
47
50
|
if (settings.switchingMode === "lazy") {
|
|
48
51
|
return { type: "continue", value: undefined };
|
|
@@ -81,17 +84,22 @@ export default function getRepresentationsSwitchingStrategy(
|
|
|
81
84
|
return { type: "continue", value: undefined };
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
const currentTime = playbackObserver.getCurrentTime();
|
|
85
87
|
const readyState = playbackObserver.getReadyState();
|
|
86
|
-
if (settings.switchingMode === "reload" &&
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
if (settings.switchingMode === "reload" && readyState > 1) {
|
|
89
|
+
const lastObservation = playbackObserver.getReference().getValue();
|
|
90
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
91
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
92
|
+
// seek-back...), just reload as checks here would be too complex
|
|
93
|
+
return { type: "needs-reload", value: undefined };
|
|
94
|
+
} else {
|
|
95
|
+
const currentTime = playbackObserver.getCurrentTime();
|
|
96
|
+
if (isTimeInRange({ start, end }, currentTime) &&
|
|
97
|
+
// We're not playing the current wanted video Adaptation
|
|
98
|
+
!isTimeInRanges(rangesWithReps, currentTime))
|
|
99
|
+
{
|
|
100
|
+
return { type: "needs-reload", value: undefined };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
// From here, clean-up data from the previous Adaptation, if one
|
|
@@ -128,6 +136,7 @@ export default function getRepresentationsSwitchingStrategy(
|
|
|
128
136
|
if (paddingAfter == null) {
|
|
129
137
|
paddingAfter = 0;
|
|
130
138
|
}
|
|
139
|
+
const currentTime = playbackObserver.getCurrentTime();
|
|
131
140
|
rangesToExclude.push({ start: currentTime - paddingBefore,
|
|
132
141
|
end: currentTime + paddingAfter });
|
|
133
142
|
}
|
|
@@ -108,7 +108,8 @@ export default function StreamOrchestrator(
|
|
|
108
108
|
wantedBufferAhead,
|
|
109
109
|
maxVideoBufferSize } = options;
|
|
110
110
|
|
|
111
|
-
const {
|
|
111
|
+
const { MINIMUM_MAX_BUFFER_AHEAD,
|
|
112
|
+
MAXIMUM_MAX_BUFFER_AHEAD,
|
|
112
113
|
MAXIMUM_MAX_BUFFER_BEHIND } = config.getCurrent();
|
|
113
114
|
|
|
114
115
|
// Keep track of a unique BufferGarbageCollector created per
|
|
@@ -116,12 +117,8 @@ export default function StreamOrchestrator(
|
|
|
116
117
|
const garbageCollectors =
|
|
117
118
|
new WeakMapMemory((segmentBuffer : SegmentBuffer) => {
|
|
118
119
|
const { bufferType } = segmentBuffer;
|
|
119
|
-
const defaultMaxBehind = MAXIMUM_MAX_BUFFER_BEHIND[bufferType]
|
|
120
|
-
|
|
121
|
-
Infinity;
|
|
122
|
-
const defaultMaxAhead = MAXIMUM_MAX_BUFFER_AHEAD[bufferType] != null ?
|
|
123
|
-
MAXIMUM_MAX_BUFFER_AHEAD[bufferType] as number :
|
|
124
|
-
Infinity;
|
|
120
|
+
const defaultMaxBehind = MAXIMUM_MAX_BUFFER_BEHIND[bufferType] ?? Infinity;
|
|
121
|
+
const maxAheadHigherBound = MAXIMUM_MAX_BUFFER_AHEAD[bufferType] ?? Infinity;
|
|
125
122
|
return (gcCancelSignal : CancellationSignal) => {
|
|
126
123
|
BufferGarbageCollector(
|
|
127
124
|
{ segmentBuffer,
|
|
@@ -130,10 +127,11 @@ export default function StreamOrchestrator(
|
|
|
130
127
|
(val) =>
|
|
131
128
|
Math.min(val, defaultMaxBehind),
|
|
132
129
|
gcCancelSignal),
|
|
133
|
-
maxBufferAhead: createMappedReference(maxBufferAhead,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
maxBufferAhead: createMappedReference(maxBufferAhead, (val) => {
|
|
131
|
+
const lowerBound = Math.max(val,
|
|
132
|
+
MINIMUM_MAX_BUFFER_AHEAD[bufferType] ?? 0);
|
|
133
|
+
return Math.min(lowerBound, maxAheadHigherBound);
|
|
134
|
+
}, gcCancelSignal) },
|
|
137
135
|
gcCancelSignal
|
|
138
136
|
);
|
|
139
137
|
};
|
|
@@ -173,7 +171,7 @@ export default function StreamOrchestrator(
|
|
|
173
171
|
// Restart the current Stream when the wanted time is in another period
|
|
174
172
|
// than the ones already considered
|
|
175
173
|
playbackObserver.listen(({ position }) => {
|
|
176
|
-
const time = position.
|
|
174
|
+
const time = position.getWanted();
|
|
177
175
|
if (!enableOutOfBoundsCheck || !isOutOfPeriodList(time)) {
|
|
178
176
|
return ;
|
|
179
177
|
}
|
|
@@ -370,8 +368,7 @@ export default function StreamOrchestrator(
|
|
|
370
368
|
}
|
|
371
369
|
}
|
|
372
370
|
|
|
373
|
-
const lastPosition = observation.position.
|
|
374
|
-
observation.position.last;
|
|
371
|
+
const lastPosition = observation.position.getWanted();
|
|
375
372
|
const newInitialPeriod = manifest.getPeriodForTime(lastPosition);
|
|
376
373
|
if (newInitialPeriod == null) {
|
|
377
374
|
callbacks.error(
|
|
@@ -444,13 +441,11 @@ export default function StreamOrchestrator(
|
|
|
444
441
|
// Stop current PeriodStream when the current position goes over the end of
|
|
445
442
|
// that Period.
|
|
446
443
|
playbackObserver.listen(({ position }, stopListeningObservations) => {
|
|
447
|
-
if (basePeriod.end !== undefined &&
|
|
448
|
-
(position.pending ?? position.last) >= basePeriod.end)
|
|
449
|
-
{
|
|
444
|
+
if (basePeriod.end !== undefined && position.getWanted() >= basePeriod.end) {
|
|
450
445
|
log.info("Stream: Destroying PeriodStream as the current playhead moved above it",
|
|
451
446
|
bufferType,
|
|
452
447
|
basePeriod.start,
|
|
453
|
-
position.
|
|
448
|
+
position.getWanted(),
|
|
454
449
|
basePeriod.end);
|
|
455
450
|
stopListeningObservations();
|
|
456
451
|
consecutivePeriodStreamCb.periodStreamCleared({ type: bufferType,
|
|
@@ -719,7 +714,7 @@ function needsFlushingAfterClean(
|
|
|
719
714
|
if (cleanedRanges.length === 0) {
|
|
720
715
|
return false;
|
|
721
716
|
}
|
|
722
|
-
const curPos = observation.position.
|
|
717
|
+
const curPos = observation.position.getPolled();
|
|
723
718
|
|
|
724
719
|
// Based on the playback direction, we just check whether we may encounter
|
|
725
720
|
// the corresponding ranges, without seeking or re-switching playback
|
|
@@ -221,18 +221,15 @@ export default function PeriodStream(
|
|
|
221
221
|
return; // Previous call has provoken cancellation by side-effect
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const readyState = playbackObserver.getReadyState();
|
|
225
224
|
const segmentBuffer = createOrReuseSegmentBuffer(segmentBuffersStore,
|
|
226
225
|
bufferType,
|
|
227
226
|
adaptation,
|
|
228
227
|
options);
|
|
229
|
-
const playbackInfos = { currentTime: playbackObserver.getCurrentTime(),
|
|
230
|
-
readyState };
|
|
231
228
|
const strategy = getAdaptationSwitchStrategy(segmentBuffer,
|
|
232
229
|
period,
|
|
233
230
|
adaptation,
|
|
234
231
|
choice.switchingMode,
|
|
235
|
-
|
|
232
|
+
playbackObserver,
|
|
236
233
|
options);
|
|
237
234
|
if (strategy.type === "needs-reload") {
|
|
238
235
|
return askForMediaSourceReload(relativePosAfterSwitch,
|
|
@@ -444,8 +441,10 @@ function createAdaptationStreamPlaybackObserver(
|
|
|
444
441
|
) : IAdaptationStreamPlaybackObservation {
|
|
445
442
|
const baseObservation = observationRef.getValue();
|
|
446
443
|
const buffered = segmentBuffer.getBufferedRanges();
|
|
447
|
-
const bufferGap = getLeftSizeOfBufferedTimeRange(
|
|
448
|
-
|
|
444
|
+
const bufferGap = getLeftSizeOfBufferedTimeRange(
|
|
445
|
+
buffered,
|
|
446
|
+
baseObservation.position.getWanted()
|
|
447
|
+
);
|
|
449
448
|
return objectAssign({}, baseObservation, { bufferGap });
|
|
450
449
|
}
|
|
451
450
|
|
|
@@ -486,15 +485,15 @@ function createEmptyAdaptationStream(
|
|
|
486
485
|
function sendStatus() : void {
|
|
487
486
|
const observation = playbackObserver.getReference().getValue();
|
|
488
487
|
const wba = wantedBufferAhead.getValue();
|
|
489
|
-
const position = observation.position.
|
|
488
|
+
const position = observation.position.getWanted();
|
|
490
489
|
if (period.end !== undefined && position + wba >= period.end) {
|
|
491
490
|
log.debug("Stream: full \"empty\" AdaptationStream", bufferType);
|
|
492
491
|
hasFinishedLoading = true;
|
|
493
492
|
}
|
|
494
493
|
callbacks.streamStatusUpdate({ period,
|
|
495
494
|
bufferType,
|
|
496
|
-
position,
|
|
497
495
|
imminentDiscontinuity: null,
|
|
496
|
+
position,
|
|
498
497
|
isEmptyStream: true,
|
|
499
498
|
hasFinishedLoading,
|
|
500
499
|
neededSegments: [] });
|
|
@@ -8,7 +8,7 @@ import SharedReference, {
|
|
|
8
8
|
import { CancellationSignal } from "../../../utils/task_canceller";
|
|
9
9
|
import WeakMapMemory from "../../../utils/weak_map_memory";
|
|
10
10
|
import { IRepresentationEstimator } from "../../adaptive";
|
|
11
|
-
import { IReadOnlyPlaybackObserver } from "../../api";
|
|
11
|
+
import { IObservationPosition, IReadOnlyPlaybackObserver } from "../../api";
|
|
12
12
|
import { SegmentFetcherCreator } from "../../fetchers";
|
|
13
13
|
import SegmentBuffersStore, {
|
|
14
14
|
IBufferType,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
IAdaptationStreamOptions,
|
|
22
22
|
IPausedPlaybackObservation,
|
|
23
23
|
} from "../adaptation";
|
|
24
|
-
import { IPositionPlaybackObservation } from "../representation";
|
|
25
24
|
|
|
26
25
|
/** Callbacks called by the `AdaptationStream` on various events. */
|
|
27
26
|
export interface IPeriodStreamCallbacks extends
|
|
@@ -86,7 +85,7 @@ export interface IPeriodStreamPlaybackObservation {
|
|
|
86
85
|
* Information on the current media position in seconds at the time of the
|
|
87
86
|
* Observation.
|
|
88
87
|
*/
|
|
89
|
-
position :
|
|
88
|
+
position : IObservationPosition;
|
|
90
89
|
/** `duration` property of the HTMLMediaElement. */
|
|
91
90
|
duration : number;
|
|
92
91
|
/** `readyState` property of the HTMLMediaElement. */
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
isTimeInRanges,
|
|
29
29
|
keepRangeIntersection,
|
|
30
30
|
} from "../../../../utils/ranges";
|
|
31
|
+
import { IReadOnlyPlaybackObserver } from "../../../api";
|
|
31
32
|
import {
|
|
32
33
|
getFirstSegmentAfterPeriod,
|
|
33
34
|
getLastSegmentBeforePeriod,
|
|
@@ -35,6 +36,7 @@ import {
|
|
|
35
36
|
SegmentBuffer,
|
|
36
37
|
} from "../../../segment_buffers";
|
|
37
38
|
import { ITrackSwitchingMode } from "../../adaptation";
|
|
39
|
+
import { IPeriodStreamPlaybackObservation } from "../types";
|
|
38
40
|
|
|
39
41
|
export type IAdaptationSwitchStrategy =
|
|
40
42
|
/** Do nothing special. */
|
|
@@ -63,7 +65,7 @@ export interface IAdaptationSwitchOptions {
|
|
|
63
65
|
* @param {Object} segmentBuffer
|
|
64
66
|
* @param {Object} period
|
|
65
67
|
* @param {Object} adaptation
|
|
66
|
-
* @param {Object}
|
|
68
|
+
* @param {Object} playbackObserver
|
|
67
69
|
* @returns {Object}
|
|
68
70
|
*/
|
|
69
71
|
export default function getAdaptationSwitchStrategy(
|
|
@@ -71,7 +73,9 @@ export default function getAdaptationSwitchStrategy(
|
|
|
71
73
|
period : Period,
|
|
72
74
|
adaptation : Adaptation,
|
|
73
75
|
switchingMode : ITrackSwitchingMode,
|
|
74
|
-
|
|
76
|
+
playbackObserver : IReadOnlyPlaybackObserver<
|
|
77
|
+
IPeriodStreamPlaybackObservation
|
|
78
|
+
>,
|
|
75
79
|
options : IAdaptationSwitchOptions
|
|
76
80
|
) : IAdaptationSwitchStrategy {
|
|
77
81
|
if (segmentBuffer.codec !== undefined &&
|
|
@@ -119,18 +123,20 @@ export default function getAdaptationSwitchStrategy(
|
|
|
119
123
|
return { type: "continue", value: undefined };
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
const currentTime = playbackObserver.getCurrentTime();
|
|
127
|
+
const readyState = playbackObserver.getReadyState();
|
|
128
|
+
if (switchingMode === "reload" && readyState > 1) {
|
|
129
|
+
const lastObservation = playbackObserver.getReference().getValue();
|
|
130
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
131
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
132
|
+
// seek-back...), just reload as checks here would be too complex
|
|
133
|
+
return { type: "needs-reload", value: undefined };
|
|
134
|
+
} else if (isTimeInRange({ start, end }, currentTime) &&
|
|
135
|
+
// We're not playing the current wanted video Adaptation
|
|
136
|
+
!isTimeInRanges(adaptationInBuffer, currentTime))
|
|
137
|
+
{
|
|
138
|
+
return { type: "needs-reload", value: undefined };
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
// From here, clean-up data from the previous Adaptation, if one
|
|
@@ -216,7 +222,7 @@ function hasCompatibleCodec(
|
|
|
216
222
|
/**
|
|
217
223
|
* Returns buffered ranges of what we know correspond to the given `adaptation`
|
|
218
224
|
* in the SegmentBuffer.
|
|
219
|
-
* @param {Object}
|
|
225
|
+
* @param {Array.<Object>} inventory
|
|
220
226
|
* @param {Object} period
|
|
221
227
|
* @param {Object} adaptation
|
|
222
228
|
* @returns {Array.<Object>}
|
|
@@ -230,8 +230,7 @@ export default function RepresentationStream<TSegmentDataType>(
|
|
|
230
230
|
return ; // Stop all buffer status checking if load operations are stopped
|
|
231
231
|
}
|
|
232
232
|
const observation = playbackObserver.getReference().getValue();
|
|
233
|
-
const initialWantedTime = observation.position.
|
|
234
|
-
observation.position.last;
|
|
233
|
+
const initialWantedTime = observation.position.getWanted();
|
|
235
234
|
const status = getBufferStatus(content,
|
|
236
235
|
initialWantedTime,
|
|
237
236
|
playbackObserver,
|
|
@@ -251,8 +250,7 @@ export default function RepresentationStream<TSegmentDataType>(
|
|
|
251
250
|
log.warn("Stream: Uninitialized index with an already loaded " +
|
|
252
251
|
"initialization segment");
|
|
253
252
|
} else {
|
|
254
|
-
const wantedStart = observation.position.
|
|
255
|
-
observation.position.last;
|
|
253
|
+
const wantedStart = observation.position.getWanted();
|
|
256
254
|
neededInitSegment = { segment: initSegmentState.segment,
|
|
257
255
|
priority: getSegmentPriority(period.start,
|
|
258
256
|
wantedStart) };
|
|
@@ -307,7 +305,7 @@ export default function RepresentationStream<TSegmentDataType>(
|
|
|
307
305
|
}
|
|
308
306
|
|
|
309
307
|
callbacks.streamStatusUpdate({ period,
|
|
310
|
-
position: observation.position.
|
|
308
|
+
position: observation.position.getWanted(),
|
|
311
309
|
bufferType,
|
|
312
310
|
imminentDiscontinuity: status.imminentDiscontinuity,
|
|
313
311
|
isEmptyStream: false,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
IVideoRepresentationsSwitchingMode,
|
|
12
12
|
} from "../../../public_types";
|
|
13
13
|
import { IReadOnlySharedReference } from "../../../utils/reference";
|
|
14
|
-
import { IReadOnlyPlaybackObserver } from "../../api";
|
|
14
|
+
import { IObservationPosition, IReadOnlyPlaybackObserver } from "../../api";
|
|
15
15
|
import { IContentProtection } from "../../decrypt";
|
|
16
16
|
import { IPrioritizedSegmentFetcher } from "../../fetchers";
|
|
17
17
|
import {
|
|
@@ -180,7 +180,7 @@ export interface IRepresentationStreamPlaybackObservation {
|
|
|
180
180
|
* Information on the current media position in seconds at the time of a
|
|
181
181
|
* Playback Observation.
|
|
182
182
|
*/
|
|
183
|
-
position :
|
|
183
|
+
position : IObservationPosition;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/** Position-related information linked to an emitted Playback observation. */
|
|
@@ -61,7 +61,7 @@ export default async function appendSegmentToBuffer<T>(
|
|
|
61
61
|
{ adaptations: [dataInfos.inventoryInfos.adaptation] });
|
|
62
62
|
}
|
|
63
63
|
const { position } = playbackObserver.getReference().getValue();
|
|
64
|
-
const currentPos = position.
|
|
64
|
+
const currentPos = position.getWanted();
|
|
65
65
|
try {
|
|
66
66
|
await forceGarbageCollection(currentPos, segmentBuffer, cancellationSignal);
|
|
67
67
|
await segmentBuffer.pushChunk(dataInfos, cancellationSignal);
|
|
@@ -23,6 +23,7 @@ import Manifest, {
|
|
|
23
23
|
import isNullOrUndefined from "../../../../utils/is_null_or_undefined";
|
|
24
24
|
import { IReadOnlyPlaybackObserver } from "../../../api";
|
|
25
25
|
import SegmentBuffersStore, {
|
|
26
|
+
ChunkStatus,
|
|
26
27
|
IBufferedChunk,
|
|
27
28
|
IEndOfSegmentOperation,
|
|
28
29
|
SegmentBuffer,
|
|
@@ -153,7 +154,7 @@ export default function getBufferStatus(
|
|
|
153
154
|
* needed segments for this Representation until the end of the Period.
|
|
154
155
|
*/
|
|
155
156
|
const hasFinishedLoading = representation.index.isInitialized() &&
|
|
156
|
-
representation.index.
|
|
157
|
+
!representation.index.isStillAwaitingFutureSegments() &&
|
|
157
158
|
neededRange.hasReachedPeriodEnd &&
|
|
158
159
|
prioritizedNeededSegments.length === 0 &&
|
|
159
160
|
segmentsOnHold.length === 0;
|
|
@@ -221,7 +222,7 @@ function getRangeOfNeededSegments(
|
|
|
221
222
|
SegmentBuffersStore.isNative(content.adaptation.type) &&
|
|
222
223
|
initialWantedTime >= lastIndexPosition &&
|
|
223
224
|
representationIndex.isInitialized() &&
|
|
224
|
-
representationIndex.
|
|
225
|
+
!representationIndex.isStillAwaitingFutureSegments() &&
|
|
225
226
|
isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime))
|
|
226
227
|
{
|
|
227
228
|
wantedStartPosition = lastIndexPosition - 1;
|
|
@@ -233,7 +234,7 @@ function getRangeOfNeededSegments(
|
|
|
233
234
|
|
|
234
235
|
let hasReachedPeriodEnd;
|
|
235
236
|
if (!representation.index.isInitialized() ||
|
|
236
|
-
|
|
237
|
+
representation.index.isStillAwaitingFutureSegments() ||
|
|
237
238
|
period.end === undefined)
|
|
238
239
|
{
|
|
239
240
|
hasReachedPeriodEnd = false;
|
|
@@ -299,7 +300,7 @@ function getPlayableBufferedSegments(
|
|
|
299
300
|
const eltInventory = segmentInventory[i];
|
|
300
301
|
|
|
301
302
|
const { representation } = eltInventory.infos;
|
|
302
|
-
if (
|
|
303
|
+
if (eltInventory.status === ChunkStatus.Complete &&
|
|
303
304
|
representation.decipherable !== false &&
|
|
304
305
|
representation.isSupported)
|
|
305
306
|
{
|