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
|
@@ -41,7 +41,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
41
41
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
var is_seeking_approximate_1 = require("../../../compat/is_seeking_approximate");
|
|
45
44
|
var config_1 = require("../../../config");
|
|
46
45
|
var errors_1 = require("../../../errors");
|
|
47
46
|
var log_1 = require("../../../log");
|
|
@@ -87,52 +86,15 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
87
86
|
return;
|
|
88
87
|
}
|
|
89
88
|
this._isStarted = true;
|
|
90
|
-
/**
|
|
91
|
-
* On some devices (right now only seen on Tizen), seeking through the
|
|
92
|
-
* `currentTime` property can lead to the browser re-seeking once the
|
|
93
|
-
* segments have been loaded to improve seeking performances (for
|
|
94
|
-
* example, by seeking right to an intra video frame).
|
|
95
|
-
* In that case, we risk being in a conflict with that behavior: if for
|
|
96
|
-
* example we encounter a small discontinuity at the position the browser
|
|
97
|
-
* seeks to, we will seek over it, the browser would seek back and so on.
|
|
98
|
-
*
|
|
99
|
-
* This variable allows to store the last known position we were seeking to
|
|
100
|
-
* so we can detect when the browser seeked back (to avoid performing another
|
|
101
|
-
* seek after that). When browsers seek back to a position behind a
|
|
102
|
-
* discontinuity, they are usually able to skip them without our help.
|
|
103
|
-
*/
|
|
104
|
-
var lastSeekingPosition;
|
|
105
|
-
/**
|
|
106
|
-
* In some conditions (see `lastSeekingPosition`), we might want to not
|
|
107
|
-
* automatically seek over discontinuities because the browser might do it
|
|
108
|
-
* itself instead.
|
|
109
|
-
* In that case, we still want to perform the seek ourselves if the browser
|
|
110
|
-
* doesn't do it after sufficient time.
|
|
111
|
-
* This variable allows to store the timestamp at which a discontinuity began
|
|
112
|
-
* to be ignored.
|
|
113
|
-
*/
|
|
114
|
-
var ignoredStallTimeStamp = null;
|
|
115
89
|
var playbackRateUpdater = new PlaybackRateUpdater(this._playbackObserver, this._speed);
|
|
116
90
|
this._canceller.signal.register(function () {
|
|
117
91
|
playbackRateUpdater.dispose();
|
|
118
92
|
});
|
|
119
93
|
var prevFreezingState = null;
|
|
120
94
|
this._playbackObserver.listen(function (observation) {
|
|
121
|
-
var _a;
|
|
122
95
|
var discontinuitiesStore = _this._discontinuitiesStore;
|
|
123
96
|
var buffered = observation.buffered, position = observation.position, readyState = observation.readyState, rebuffering = observation.rebuffering, freezing = observation.freezing;
|
|
124
|
-
var
|
|
125
|
-
if (!observation.seeking &&
|
|
126
|
-
is_seeking_approximate_1.default &&
|
|
127
|
-
ignoredStallTimeStamp === null &&
|
|
128
|
-
lastSeekingPosition !== null && observation.position < lastSeekingPosition) {
|
|
129
|
-
log_1.default.debug("Init: the device appeared to have seeked back by itself.");
|
|
130
|
-
var now = (0, monotonic_timestamp_1.default)();
|
|
131
|
-
ignoredStallTimeStamp = now;
|
|
132
|
-
}
|
|
133
|
-
lastSeekingPosition = observation.seeking ?
|
|
134
|
-
Math.max((_a = observation.pendingInternalSeek) !== null && _a !== void 0 ? _a : 0, observation.position) :
|
|
135
|
-
null;
|
|
97
|
+
var _a = config_1.default.getCurrent(), BUFFER_DISCONTINUITY_THRESHOLD = _a.BUFFER_DISCONTINUITY_THRESHOLD, FREEZING_STALLED_DELAY = _a.FREEZING_STALLED_DELAY, UNFREEZING_SEEK_DELAY = _a.UNFREEZING_SEEK_DELAY, UNFREEZING_DELTA_POSITION = _a.UNFREEZING_DELTA_POSITION;
|
|
136
98
|
if (_this._checkDecipherabilityFreeze(observation)) {
|
|
137
99
|
return;
|
|
138
100
|
}
|
|
@@ -141,13 +103,14 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
141
103
|
var referenceTimestamp = prevFreezingState === null ?
|
|
142
104
|
freezing.timestamp :
|
|
143
105
|
prevFreezingState.attemptTimestamp;
|
|
144
|
-
if (
|
|
106
|
+
if (!position.isAwaitingFuturePosition() &&
|
|
107
|
+
now - referenceTimestamp > UNFREEZING_SEEK_DELAY) {
|
|
145
108
|
log_1.default.warn("Init: trying to seek to un-freeze player");
|
|
146
109
|
_this._playbackObserver.setCurrentTime(_this._playbackObserver.getCurrentTime() + UNFREEZING_DELTA_POSITION);
|
|
147
110
|
prevFreezingState = { attemptTimestamp: now };
|
|
148
111
|
}
|
|
149
112
|
if (now - freezing.timestamp > FREEZING_STALLED_DELAY) {
|
|
150
|
-
if (rebuffering === null
|
|
113
|
+
if (rebuffering === null) {
|
|
151
114
|
playbackRateUpdater.stopRebuffering();
|
|
152
115
|
}
|
|
153
116
|
else {
|
|
@@ -166,8 +129,9 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
166
129
|
// With a readyState set to 1, we should still not be able to play:
|
|
167
130
|
// Return that we're stalled
|
|
168
131
|
var reason = void 0;
|
|
169
|
-
if (observation.seeking) {
|
|
170
|
-
reason = observation.
|
|
132
|
+
if (observation.seeking !== 0 /* SeekingState.None */) {
|
|
133
|
+
reason = observation.seeking === 1 /* SeekingState.Internal */ ?
|
|
134
|
+
"internal-seek" :
|
|
171
135
|
"seeking";
|
|
172
136
|
}
|
|
173
137
|
else {
|
|
@@ -182,22 +146,15 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
182
146
|
// We want to separate a stall situation when a seek is due to a seek done
|
|
183
147
|
// internally by the player to when its due to a regular user seek.
|
|
184
148
|
var stalledReason = rebuffering.reason === "seeking" &&
|
|
185
|
-
observation.
|
|
149
|
+
observation.seeking === 1 /* SeekingState.Internal */ ?
|
|
186
150
|
"internal-seek" :
|
|
187
151
|
rebuffering.reason;
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
_this.trigger("stalled", stalledReason);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
log_1.default.warn("Init: ignored stall for too long, considering it", now - ignoredStallTimeStamp);
|
|
198
|
-
}
|
|
152
|
+
if (position.isAwaitingFuturePosition()) {
|
|
153
|
+
playbackRateUpdater.stopRebuffering();
|
|
154
|
+
log_1.default.debug("Init: let rebuffering happen as we're awaiting a future position");
|
|
155
|
+
_this.trigger("stalled", stalledReason);
|
|
156
|
+
return;
|
|
199
157
|
}
|
|
200
|
-
ignoredStallTimeStamp = null;
|
|
201
158
|
playbackRateUpdater.startRebuffering();
|
|
202
159
|
if (_this._manifest === null) {
|
|
203
160
|
_this.trigger("stalled", stalledReason);
|
|
@@ -215,14 +172,14 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
215
172
|
log_1.default.info("Init: position to seek already reached, no seeking", _this._playbackObserver.getCurrentTime(), realSeekTime);
|
|
216
173
|
}
|
|
217
174
|
else {
|
|
218
|
-
log_1.default.warn("SA: skippable discontinuity found in the stream", position, realSeekTime);
|
|
175
|
+
log_1.default.warn("SA: skippable discontinuity found in the stream", position.getPolled(), realSeekTime);
|
|
219
176
|
_this._playbackObserver.setCurrentTime(realSeekTime);
|
|
220
177
|
_this.trigger("warning", generateDiscontinuityError(stalledPosition, realSeekTime));
|
|
221
178
|
return;
|
|
222
179
|
}
|
|
223
180
|
}
|
|
224
181
|
}
|
|
225
|
-
var
|
|
182
|
+
var positionBlockedAt = stalledPosition !== null && stalledPosition !== void 0 ? stalledPosition : position.getPolled();
|
|
226
183
|
// Is it a very short discontinuity in buffer ? -> Seek at the beginning of the
|
|
227
184
|
// next range
|
|
228
185
|
//
|
|
@@ -230,14 +187,14 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
230
187
|
// calculate a stalled state. This is useful for some
|
|
231
188
|
// implementation that might drop an injected segment, or in
|
|
232
189
|
// case of small discontinuity in the content.
|
|
233
|
-
var nextBufferRangeGap = (0, ranges_1.getNextBufferedTimeRangeGap)(buffered,
|
|
190
|
+
var nextBufferRangeGap = (0, ranges_1.getNextBufferedTimeRangeGap)(buffered, positionBlockedAt);
|
|
234
191
|
if (_this._speed.getValue() > 0 &&
|
|
235
192
|
nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD) {
|
|
236
|
-
var seekTo = (
|
|
193
|
+
var seekTo = (positionBlockedAt + nextBufferRangeGap + EPSILON);
|
|
237
194
|
if (_this._playbackObserver.getCurrentTime() < seekTo) {
|
|
238
|
-
log_1.default.warn("Init: discontinuity encountered inferior to the threshold",
|
|
195
|
+
log_1.default.warn("Init: discontinuity encountered inferior to the threshold", positionBlockedAt, seekTo, BUFFER_DISCONTINUITY_THRESHOLD);
|
|
239
196
|
_this._playbackObserver.setCurrentTime(seekTo);
|
|
240
|
-
_this.trigger("warning", generateDiscontinuityError(
|
|
197
|
+
_this.trigger("warning", generateDiscontinuityError(positionBlockedAt, seekTo));
|
|
241
198
|
return;
|
|
242
199
|
}
|
|
243
200
|
}
|
|
@@ -245,13 +202,13 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
245
202
|
// next period
|
|
246
203
|
for (var i = _this._manifest.periods.length - 2; i >= 0; i--) {
|
|
247
204
|
var period = _this._manifest.periods[i];
|
|
248
|
-
if (period.end !== undefined && period.end <=
|
|
249
|
-
if (_this._manifest.periods[i + 1].start >
|
|
205
|
+
if (period.end !== undefined && period.end <= positionBlockedAt) {
|
|
206
|
+
if (_this._manifest.periods[i + 1].start > positionBlockedAt &&
|
|
250
207
|
_this._manifest.periods[i + 1].start >
|
|
251
208
|
_this._playbackObserver.getCurrentTime()) {
|
|
252
209
|
var nextPeriod = _this._manifest.periods[i + 1];
|
|
253
210
|
_this._playbackObserver.setCurrentTime(nextPeriod.start);
|
|
254
|
-
_this.trigger("warning", generateDiscontinuityError(
|
|
211
|
+
_this.trigger("warning", generateDiscontinuityError(positionBlockedAt, nextPeriod.start));
|
|
255
212
|
return;
|
|
256
213
|
}
|
|
257
214
|
break;
|
|
@@ -293,10 +250,10 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
293
250
|
bufferType !== "video")) {
|
|
294
251
|
return;
|
|
295
252
|
}
|
|
296
|
-
var
|
|
297
|
-
var rebufferingPos = (_a = observation.rebuffering.position) !== null && _a !== void 0 ? _a :
|
|
253
|
+
var loadedPos = observation.position.getWanted();
|
|
254
|
+
var rebufferingPos = (_a = observation.rebuffering.position) !== null && _a !== void 0 ? _a : loadedPos;
|
|
298
255
|
var lockedPeriodStart = period.start;
|
|
299
|
-
if (
|
|
256
|
+
if (loadedPos < lockedPeriodStart &&
|
|
300
257
|
Math.abs(rebufferingPos - lockedPeriodStart) < 1) {
|
|
301
258
|
log_1.default.warn("Init: rebuffering because of a future locked stream.\n" +
|
|
302
259
|
"Trying to unlock by seeking to the next Period");
|
|
@@ -331,7 +288,6 @@ var RebufferingController = /** @class */ (function (_super) {
|
|
|
331
288
|
* right handling steps.
|
|
332
289
|
*/
|
|
333
290
|
RebufferingController.prototype._checkDecipherabilityFreeze = function (observation) {
|
|
334
|
-
// XXX TODO allow this in in-worker configuration
|
|
335
291
|
var e_1, _a, e_2, _b;
|
|
336
292
|
var readyState = observation.readyState, rebuffering = observation.rebuffering, freezing = observation.freezing;
|
|
337
293
|
var bufferGap = observation.bufferGap !== undefined &&
|
|
@@ -478,10 +434,11 @@ function eventContainsDiscontinuity(evt) {
|
|
|
478
434
|
* @returns {Array.<Object>}
|
|
479
435
|
*/
|
|
480
436
|
function updateDiscontinuitiesStore(discontinuitiesStore, evt, observation) {
|
|
437
|
+
var gcTime = Math.min(observation.position.getPolled(), observation.position.getWanted());
|
|
481
438
|
// First, perform clean-up of old discontinuities
|
|
482
439
|
while (discontinuitiesStore.length > 0 &&
|
|
483
440
|
discontinuitiesStore[0].period.end !== undefined &&
|
|
484
|
-
discontinuitiesStore[0].period.end + 10 <
|
|
441
|
+
discontinuitiesStore[0].period.end + 10 < gcTime) {
|
|
485
442
|
discontinuitiesStore.shift();
|
|
486
443
|
}
|
|
487
444
|
var period = evt.period, bufferType = evt.bufferType;
|
|
@@ -113,8 +113,10 @@ var StreamEventsEmitter = /** @class */ (function (_super) {
|
|
|
113
113
|
clearInterval(intervalId);
|
|
114
114
|
});
|
|
115
115
|
function constructObservation() {
|
|
116
|
-
var
|
|
117
|
-
|
|
116
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
117
|
+
var currentTime = mediaElement.currentTime;
|
|
118
|
+
var isSeeking = lastObservation.seeking !== 0 /* SeekingState.None */;
|
|
119
|
+
return { currentTime: currentTime, isSeeking: isSeeking };
|
|
118
120
|
}
|
|
119
121
|
}, { emitCurrentValue: true, clearSignal: cancelSignal });
|
|
120
122
|
};
|
|
@@ -78,8 +78,7 @@ function BufferGarbageCollector(_a, cancellationSignal) {
|
|
|
78
78
|
var segmentBuffer = _a.segmentBuffer, playbackObserver = _a.playbackObserver, maxBufferBehind = _a.maxBufferBehind, maxBufferAhead = _a.maxBufferAhead;
|
|
79
79
|
var lastPosition;
|
|
80
80
|
playbackObserver.listen(function (o) {
|
|
81
|
-
|
|
82
|
-
lastPosition = (_a = o.position.pending) !== null && _a !== void 0 ? _a : o.position.last;
|
|
81
|
+
lastPosition = o.position.getWanted();
|
|
83
82
|
clean();
|
|
84
83
|
}, { includeLastObservation: true, clearSignal: cancellationSignal });
|
|
85
84
|
function clean() {
|
package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js
CHANGED
|
@@ -226,7 +226,14 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
226
226
|
err :
|
|
227
227
|
new Error("An unknown error occured when doing operations " +
|
|
228
228
|
"on the SourceBuffer");
|
|
229
|
-
this._pendingTask
|
|
229
|
+
var task = this._pendingTask;
|
|
230
|
+
if (task.type === types_1.SegmentBufferOperation.Push &&
|
|
231
|
+
task.data.length === 0 &&
|
|
232
|
+
task.inventoryData !== null) {
|
|
233
|
+
this._segmentInventory.insertChunk(task.inventoryData, false);
|
|
234
|
+
}
|
|
235
|
+
this._pendingTask = null;
|
|
236
|
+
task.reject(error);
|
|
230
237
|
}
|
|
231
238
|
};
|
|
232
239
|
/**
|
|
@@ -274,7 +281,7 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
274
281
|
switch (task.type) {
|
|
275
282
|
case types_1.SegmentBufferOperation.Push:
|
|
276
283
|
if (task.inventoryData !== null) {
|
|
277
|
-
this._segmentInventory.insertChunk(task.inventoryData);
|
|
284
|
+
this._segmentInventory.insertChunk(task.inventoryData, true);
|
|
278
285
|
}
|
|
279
286
|
break;
|
|
280
287
|
case types_1.SegmentBufferOperation.EndOfSegment:
|
package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js
CHANGED
|
@@ -233,7 +233,7 @@ var HTMLTextSegmentBuffer = /** @class */ (function (_super) {
|
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
if (infos.inventoryInfos !== null) {
|
|
236
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
236
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
237
237
|
}
|
|
238
238
|
this._buffer.insert(cues, start, end);
|
|
239
239
|
this._buffered.insert(start, end);
|
package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js
CHANGED
|
@@ -158,7 +158,7 @@ var NativeTextSegmentBuffer = /** @class */ (function (_super) {
|
|
|
158
158
|
}
|
|
159
159
|
this._buffered.insert(start, end);
|
|
160
160
|
if (infos.inventoryInfos !== null) {
|
|
161
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
161
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
catch (err) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import BufferGarbageCollector from "./garbage_collector";
|
|
17
17
|
import { IBufferType, IEndOfSegmentInfos, IEndOfSegmentOperation, IPushChunkInfos, IPushedChunkData, IPushOperation, IRemoveOperation, ISBOperation, SegmentBuffer, SegmentBufferOperation } from "./implementations";
|
|
18
|
-
import { IBufferedChunk, IChunkContext, IInsertedChunkInfos, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod } from "./inventory";
|
|
18
|
+
import { ChunkStatus, IBufferedChunk, IChunkContext, IInsertedChunkInfos, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod } from "./inventory";
|
|
19
19
|
import SegmentBuffersStore, { ISegmentBufferOptions, ITextTrackSegmentBufferOptions } from "./segment_buffers_store";
|
|
20
20
|
export default SegmentBuffersStore;
|
|
21
|
-
export { BufferGarbageCollector, ISegmentBufferOptions, ITextTrackSegmentBufferOptions, SegmentBuffer, IBufferType, IBufferedChunk, IChunkContext, IInsertedChunkInfos, IPushChunkInfos, IPushedChunkData, IEndOfSegmentInfos, SegmentBufferOperation, ISBOperation, IEndOfSegmentOperation, IPushOperation, IRemoveOperation, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, };
|
|
21
|
+
export { BufferGarbageCollector, ChunkStatus, ISegmentBufferOptions, ITextTrackSegmentBufferOptions, SegmentBuffer, IBufferType, IBufferedChunk, IChunkContext, IInsertedChunkInfos, IPushChunkInfos, IPushedChunkData, IEndOfSegmentInfos, SegmentBufferOperation, ISBOperation, IEndOfSegmentOperation, IPushOperation, IRemoveOperation, getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, };
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import SegmentInventory, { IBufferedChunk, IInsertedChunkInfos } from "./segment_inventory";
|
|
16
|
+
import SegmentInventory, { ChunkStatus, IBufferedChunk, IInsertedChunkInfos } from "./segment_inventory";
|
|
17
17
|
export default SegmentInventory;
|
|
18
|
-
export { IBufferedChunk, IInsertedChunkInfos, };
|
|
18
|
+
export { ChunkStatus, IBufferedChunk, IInsertedChunkInfos, };
|
|
19
19
|
export { IBufferedHistoryEntry } from "./buffered_history";
|
|
20
20
|
export { IChunkContext } from "./types";
|
|
21
21
|
export { getFirstSegmentAfterPeriod, getLastSegmentBeforePeriod, } from "./utils";
|
|
@@ -16,6 +16,27 @@
|
|
|
16
16
|
import { Adaptation, ISegment, Period, Representation } from "../../../manifest";
|
|
17
17
|
import { IBufferedHistoryEntry } from "./buffered_history";
|
|
18
18
|
import { IChunkContext } from "./types";
|
|
19
|
+
/** Categorization of a given chunk in the `SegmentInventory`. */
|
|
20
|
+
export declare const enum ChunkStatus {
|
|
21
|
+
/**
|
|
22
|
+
* This chunk is only a part of a partially-pushed segment for now, meaning
|
|
23
|
+
* that it is only a sub-part of a requested segment that was not yet
|
|
24
|
+
* fully-loaded and pushed.
|
|
25
|
+
*
|
|
26
|
+
* Once and if the corresponding segment is fully-pushed, its `ChunkStatus`
|
|
27
|
+
* switches to `Complete`.
|
|
28
|
+
*/
|
|
29
|
+
PartiallyPushed = 0,
|
|
30
|
+
/** This chunk corresponds to a fully-loaded segment. */
|
|
31
|
+
Complete = 1,
|
|
32
|
+
/**
|
|
33
|
+
* This chunk's push operation failed, in this scenario there is no certitude
|
|
34
|
+
* about the presence of that chunk in the buffer: it may not be present,
|
|
35
|
+
* partially-present, or fully-present depending on why that push operation
|
|
36
|
+
* failed, which is generally only known by the lower-level code.
|
|
37
|
+
*/
|
|
38
|
+
Failed = 2
|
|
39
|
+
}
|
|
19
40
|
/** Information stored on a single chunk by the SegmentInventory. */
|
|
20
41
|
export interface IBufferedChunk {
|
|
21
42
|
/**
|
|
@@ -69,14 +90,10 @@ export interface IBufferedChunk {
|
|
|
69
90
|
/** Information on what that chunk actually contains. */
|
|
70
91
|
infos: IChunkContext;
|
|
71
92
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* Inversely, if `false`, this chunk is a whole segment whose inner chunks
|
|
75
|
-
* have all been fully pushed.
|
|
76
|
-
* In that condition, the `start` and `end` properties refer to that fully
|
|
77
|
-
* pushed segment.
|
|
93
|
+
* Status of this chunk.
|
|
94
|
+
* @see ChunkStatus
|
|
78
95
|
*/
|
|
79
|
-
|
|
96
|
+
status: ChunkStatus;
|
|
80
97
|
/**
|
|
81
98
|
* If `true`, the segment as a whole is divided into multiple parts in the
|
|
82
99
|
* buffer, with other segment(s) between them.
|
|
@@ -169,7 +186,7 @@ export default class SegmentInventory {
|
|
|
169
186
|
* segment have been inserted, you should call the `completeSegment` method.
|
|
170
187
|
* @param {Object} chunkInformation
|
|
171
188
|
*/
|
|
172
|
-
insertChunk({ period, adaptation, representation, segment, chunkSize, start, end }: IInsertedChunkInfos): void;
|
|
189
|
+
insertChunk({ period, adaptation, representation, segment, chunkSize, start, end }: IInsertedChunkInfos, succeed: boolean): void;
|
|
173
190
|
/**
|
|
174
191
|
* Indicate that inserted chunks can now be considered as a complete segment.
|
|
175
192
|
* Take in argument the same content than what was given to `insertChunk` for
|
|
@@ -112,7 +112,9 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
112
112
|
try {
|
|
113
113
|
for (var removed_1 = (e_1 = void 0, __values(removed)), removed_1_1 = removed_1.next(); !removed_1_1.done; removed_1_1 = removed_1.next()) {
|
|
114
114
|
var seg = removed_1_1.value;
|
|
115
|
-
if (seg.bufferedStart === undefined &&
|
|
115
|
+
if (seg.bufferedStart === undefined &&
|
|
116
|
+
seg.bufferedEnd === undefined &&
|
|
117
|
+
seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
116
118
|
this._bufferedHistory.addBufferedSegment(seg.infos, null);
|
|
117
119
|
}
|
|
118
120
|
}
|
|
@@ -180,7 +182,9 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
180
182
|
try {
|
|
181
183
|
for (var removed_2 = __values(removed), removed_2_1 = removed_2.next(); !removed_2_1.done; removed_2_1 = removed_2.next()) {
|
|
182
184
|
var seg = removed_2_1.value;
|
|
183
|
-
if (seg.bufferedStart === undefined &&
|
|
185
|
+
if (seg.bufferedStart === undefined &&
|
|
186
|
+
seg.bufferedEnd === undefined &&
|
|
187
|
+
seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
184
188
|
this._bufferedHistory.addBufferedSegment(seg.infos, null);
|
|
185
189
|
}
|
|
186
190
|
}
|
|
@@ -205,7 +209,7 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
205
209
|
* segment have been inserted, you should call the `completeSegment` method.
|
|
206
210
|
* @param {Object} chunkInformation
|
|
207
211
|
*/
|
|
208
|
-
SegmentInventory.prototype.insertChunk = function (_a) {
|
|
212
|
+
SegmentInventory.prototype.insertChunk = function (_a, succeed) {
|
|
209
213
|
var period = _a.period, adaptation = _a.adaptation, representation = _a.representation, segment = _a.segment, chunkSize = _a.chunkSize, start = _a.start, end = _a.end;
|
|
210
214
|
if (segment.isInit) {
|
|
211
215
|
return;
|
|
@@ -216,7 +220,8 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
216
220
|
return;
|
|
217
221
|
}
|
|
218
222
|
var inventory = this._inventory;
|
|
219
|
-
var newSegment = {
|
|
223
|
+
var newSegment = { status: succeed ? 0 /* ChunkStatus.PartiallyPushed */ :
|
|
224
|
+
2 /* ChunkStatus.Failed */, chunkSize: chunkSize, splitted: false, start: start, end: end, precizeStart: false,
|
|
220
225
|
precizeEnd: false,
|
|
221
226
|
bufferedStart: undefined,
|
|
222
227
|
bufferedEnd: undefined,
|
|
@@ -409,7 +414,7 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
409
414
|
// newSegment : |====|
|
|
410
415
|
// ===> : |--|====|-|
|
|
411
416
|
log_1.default.warn("SI: Segment pushed is contained in a previous one", bufferType, start, end, segmentI.start, segmentI.end);
|
|
412
|
-
var nextSegment = {
|
|
417
|
+
var nextSegment = { status: segmentI.status,
|
|
413
418
|
/**
|
|
414
419
|
* Note: this sadly means we're doing as if
|
|
415
420
|
* that chunk is present two times.
|
|
@@ -568,7 +573,9 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
568
573
|
this._inventory.splice(firstI + 1, length_1);
|
|
569
574
|
i -= length_1;
|
|
570
575
|
}
|
|
571
|
-
this._inventory[firstI].
|
|
576
|
+
if (this._inventory[firstI].status === 0 /* ChunkStatus.PartiallyPushed */) {
|
|
577
|
+
this._inventory[firstI].status = 1 /* ChunkStatus.Complete */;
|
|
578
|
+
}
|
|
572
579
|
this._inventory[firstI].chunkSize = segmentSize;
|
|
573
580
|
this._inventory[firstI].end = lastEnd;
|
|
574
581
|
this._inventory[firstI].bufferedEnd = lastBufferedEnd;
|
|
@@ -585,8 +592,10 @@ var SegmentInventory = /** @class */ (function () {
|
|
|
585
592
|
for (var resSegments_1 = __values(resSegments), resSegments_1_1 = resSegments_1.next(); !resSegments_1_1.done; resSegments_1_1 = resSegments_1.next()) {
|
|
586
593
|
var seg = resSegments_1_1.value;
|
|
587
594
|
if (seg.bufferedStart !== undefined && seg.bufferedEnd !== undefined) {
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
if (seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
596
|
+
this._bufferedHistory.addBufferedSegment(seg.infos, { start: seg.bufferedStart,
|
|
597
|
+
end: seg.bufferedEnd });
|
|
598
|
+
}
|
|
590
599
|
}
|
|
591
600
|
else {
|
|
592
601
|
log_1.default.debug("SI: buffered range not known after sync. Skipping history.", seg.start, seg.end);
|
|
@@ -639,7 +648,7 @@ exports.default = SegmentInventory;
|
|
|
639
648
|
*/
|
|
640
649
|
function bufferedStartLooksCoherent(thisSegment) {
|
|
641
650
|
if (thisSegment.bufferedStart === undefined ||
|
|
642
|
-
thisSegment.
|
|
651
|
+
thisSegment.status !== 1 /* ChunkStatus.Complete */) {
|
|
643
652
|
return false;
|
|
644
653
|
}
|
|
645
654
|
var start = thisSegment.start, end = thisSegment.end;
|
|
@@ -660,7 +669,7 @@ function bufferedStartLooksCoherent(thisSegment) {
|
|
|
660
669
|
*/
|
|
661
670
|
function bufferedEndLooksCoherent(thisSegment) {
|
|
662
671
|
if (thisSegment.bufferedEnd === undefined ||
|
|
663
|
-
thisSegment.
|
|
672
|
+
thisSegment.status !== 1 /* ChunkStatus.Complete */) {
|
|
664
673
|
return false;
|
|
665
674
|
}
|
|
666
675
|
var start = thisSegment.start, end = thisSegment.end;
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
import { Adaptation, Period } from "../../../manifest";
|
|
17
17
|
import { IReadOnlyPlaybackObserver } from "../../api";
|
|
18
18
|
import { SegmentBuffer } from "../../segment_buffers";
|
|
19
|
-
import { IRepresentationsChoice } from "../representation";
|
|
20
|
-
export default function getRepresentationsSwitchingStrategy(period: Period, adaptation: Adaptation, settings: IRepresentationsChoice, segmentBuffer: SegmentBuffer, playbackObserver: IReadOnlyPlaybackObserver<
|
|
19
|
+
import { IRepresentationStreamPlaybackObservation, IRepresentationsChoice } from "../representation";
|
|
20
|
+
export default function getRepresentationsSwitchingStrategy(period: Period, adaptation: Adaptation, settings: IRepresentationsChoice, segmentBuffer: SegmentBuffer, playbackObserver: IReadOnlyPlaybackObserver<IRepresentationStreamPlaybackObservation>): IRepresentationSwitchStrategy;
|
|
21
21
|
export type IRepresentationSwitchStrategy = {
|
|
22
22
|
type: "continue";
|
|
23
23
|
value: undefined;
|
|
@@ -47,16 +47,22 @@ function getRepresentationsSwitchingStrategy(period, adaptation, settings, segme
|
|
|
47
47
|
if (unwantedRange.length === 0) {
|
|
48
48
|
return { type: "continue", value: undefined };
|
|
49
49
|
}
|
|
50
|
-
var currentTime = playbackObserver.getCurrentTime();
|
|
51
50
|
var readyState = playbackObserver.getReadyState();
|
|
52
|
-
if (settings.switchingMode === "reload" &&
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
if (settings.switchingMode === "reload" && readyState > 1) {
|
|
52
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
53
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
54
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
55
|
+
// seek-back...), just reload as checks here would be too complex
|
|
56
|
+
return { type: "needs-reload", value: undefined };
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
var currentTime = playbackObserver.getCurrentTime();
|
|
60
|
+
if ((0, ranges_1.isTimeInRange)({ start: start, end: end }, currentTime) &&
|
|
61
|
+
// We're not playing the current wanted video Adaptation
|
|
62
|
+
!(0, ranges_1.isTimeInRanges)(rangesWithReps, currentTime)) {
|
|
63
|
+
return { type: "needs-reload", value: undefined };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
60
66
|
}
|
|
61
67
|
// From here, clean-up data from the previous Adaptation, if one
|
|
62
68
|
var shouldFlush = settings.switchingMode === "direct";
|
|
@@ -87,6 +93,7 @@ function getRepresentationsSwitchingStrategy(period, adaptation, settings, segme
|
|
|
87
93
|
if (paddingAfter == null) {
|
|
88
94
|
paddingAfter = 0;
|
|
89
95
|
}
|
|
96
|
+
var currentTime = playbackObserver.getCurrentTime();
|
|
90
97
|
rangesToExclude.push({ start: currentTime - paddingBefore,
|
|
91
98
|
end: currentTime + paddingAfter });
|
|
92
99
|
}
|
|
@@ -155,23 +155,22 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
155
155
|
var e_1, _a;
|
|
156
156
|
var manifest = content.manifest, initialPeriod = content.initialPeriod;
|
|
157
157
|
var maxBufferAhead = options.maxBufferAhead, maxBufferBehind = options.maxBufferBehind, wantedBufferAhead = options.wantedBufferAhead, maxVideoBufferSize = options.maxVideoBufferSize;
|
|
158
|
-
var _b = config_1.default.getCurrent(), MAXIMUM_MAX_BUFFER_AHEAD = _b.MAXIMUM_MAX_BUFFER_AHEAD, MAXIMUM_MAX_BUFFER_BEHIND = _b.MAXIMUM_MAX_BUFFER_BEHIND;
|
|
158
|
+
var _b = config_1.default.getCurrent(), MINIMUM_MAX_BUFFER_AHEAD = _b.MINIMUM_MAX_BUFFER_AHEAD, MAXIMUM_MAX_BUFFER_AHEAD = _b.MAXIMUM_MAX_BUFFER_AHEAD, MAXIMUM_MAX_BUFFER_BEHIND = _b.MAXIMUM_MAX_BUFFER_BEHIND;
|
|
159
159
|
// Keep track of a unique BufferGarbageCollector created per
|
|
160
160
|
// SegmentBuffer.
|
|
161
161
|
var garbageCollectors = new weak_map_memory_1.default(function (segmentBuffer) {
|
|
162
|
+
var _a, _b;
|
|
162
163
|
var bufferType = segmentBuffer.bufferType;
|
|
163
|
-
var defaultMaxBehind = MAXIMUM_MAX_BUFFER_BEHIND[bufferType]
|
|
164
|
-
|
|
165
|
-
Infinity;
|
|
166
|
-
var defaultMaxAhead = MAXIMUM_MAX_BUFFER_AHEAD[bufferType] != null ?
|
|
167
|
-
MAXIMUM_MAX_BUFFER_AHEAD[bufferType] :
|
|
168
|
-
Infinity;
|
|
164
|
+
var defaultMaxBehind = (_a = MAXIMUM_MAX_BUFFER_BEHIND[bufferType]) !== null && _a !== void 0 ? _a : Infinity;
|
|
165
|
+
var maxAheadHigherBound = (_b = MAXIMUM_MAX_BUFFER_AHEAD[bufferType]) !== null && _b !== void 0 ? _b : Infinity;
|
|
169
166
|
return function (gcCancelSignal) {
|
|
170
167
|
(0, segment_buffers_1.BufferGarbageCollector)({ segmentBuffer: segmentBuffer, playbackObserver: playbackObserver, maxBufferBehind: (0, reference_1.createMappedReference)(maxBufferBehind, function (val) {
|
|
171
168
|
return Math.min(val, defaultMaxBehind);
|
|
172
169
|
}, gcCancelSignal),
|
|
173
170
|
maxBufferAhead: (0, reference_1.createMappedReference)(maxBufferAhead, function (val) {
|
|
174
|
-
|
|
171
|
+
var _a;
|
|
172
|
+
var lowerBound = Math.max(val, (_a = MINIMUM_MAX_BUFFER_AHEAD[bufferType]) !== null && _a !== void 0 ? _a : 0);
|
|
173
|
+
return Math.min(lowerBound, maxAheadHigherBound);
|
|
175
174
|
}, gcCancelSignal) }, gcCancelSignal);
|
|
176
175
|
};
|
|
177
176
|
});
|
|
@@ -215,9 +214,9 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
215
214
|
// Restart the current Stream when the wanted time is in another period
|
|
216
215
|
// than the ones already considered
|
|
217
216
|
playbackObserver.listen(function (_a) {
|
|
218
|
-
var _b
|
|
217
|
+
var _b;
|
|
219
218
|
var position = _a.position;
|
|
220
|
-
var time =
|
|
219
|
+
var time = position.getWanted();
|
|
221
220
|
if (!enableOutOfBoundsCheck || !isOutOfPeriodList(time)) {
|
|
222
221
|
return;
|
|
223
222
|
}
|
|
@@ -231,7 +230,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
231
230
|
currentCanceller.cancel();
|
|
232
231
|
currentCanceller = new task_canceller_1.default();
|
|
233
232
|
currentCanceller.linkToSignal(orchestratorCancelSignal);
|
|
234
|
-
var nextPeriod = (
|
|
233
|
+
var nextPeriod = (_b = manifest.getPeriodForTime(time)) !== null && _b !== void 0 ? _b : manifest.getNextPeriod(time);
|
|
235
234
|
if (nextPeriod === undefined) {
|
|
236
235
|
log_1.default.warn("Stream: The wanted position is not found in the Manifest.");
|
|
237
236
|
return;
|
|
@@ -382,7 +381,6 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
382
381
|
// to reduce the risk of race conditions where the next observation
|
|
383
382
|
// was going to be emitted synchronously.
|
|
384
383
|
(0, queue_microtask_1.default)(function () {
|
|
385
|
-
var _a;
|
|
386
384
|
if (orchestratorCancelSignal.isCancelled()) {
|
|
387
385
|
return;
|
|
388
386
|
}
|
|
@@ -400,7 +398,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
400
398
|
return;
|
|
401
399
|
}
|
|
402
400
|
}
|
|
403
|
-
var lastPosition =
|
|
401
|
+
var lastPosition = observation.position.getWanted();
|
|
404
402
|
var newInitialPeriod = manifest.getPeriodForTime(lastPosition);
|
|
405
403
|
if (newInitialPeriod == null) {
|
|
406
404
|
callbacks.error(new errors_1.MediaError("MEDIA_TIME_NOT_FOUND", "The wanted position is not found in the Manifest."));
|
|
@@ -458,11 +456,9 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
458
456
|
// Stop current PeriodStream when the current position goes over the end of
|
|
459
457
|
// that Period.
|
|
460
458
|
playbackObserver.listen(function (_a, stopListeningObservations) {
|
|
461
|
-
var _b, _c;
|
|
462
459
|
var position = _a.position;
|
|
463
|
-
if (basePeriod.end !== undefined &&
|
|
464
|
-
(
|
|
465
|
-
log_1.default.info("Stream: Destroying PeriodStream as the current playhead moved above it", bufferType, basePeriod.start, (_c = position.pending) !== null && _c !== void 0 ? _c : position.last, basePeriod.end);
|
|
460
|
+
if (basePeriod.end !== undefined && position.getWanted() >= basePeriod.end) {
|
|
461
|
+
log_1.default.info("Stream: Destroying PeriodStream as the current playhead moved above it", bufferType, basePeriod.start, position.getWanted(), basePeriod.end);
|
|
466
462
|
stopListeningObservations();
|
|
467
463
|
consecutivePeriodStreamCb.periodStreamCleared({ type: bufferType, manifest: manifest, period: basePeriod });
|
|
468
464
|
currentStreamCanceller.cancel();
|
|
@@ -591,7 +587,7 @@ function needsFlushingAfterClean(observation, cleanedRanges) {
|
|
|
591
587
|
if (cleanedRanges.length === 0) {
|
|
592
588
|
return false;
|
|
593
589
|
}
|
|
594
|
-
var curPos = observation.position.
|
|
590
|
+
var curPos = observation.position.getPolled();
|
|
595
591
|
// Based on the playback direction, we just check whether we may encounter
|
|
596
592
|
// the corresponding ranges, without seeking or re-switching playback
|
|
597
593
|
// direction which is expected to lead to a low-level flush anyway.
|