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
|
@@ -134,7 +134,7 @@ function PeriodStream(_a, callbacks, parentCancelSignal) {
|
|
|
134
134
|
adaptationRef.onUpdate(function (choice) {
|
|
135
135
|
// As an IIFE to profit from async/await while respecting onUpdate's signature
|
|
136
136
|
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
137
|
-
var streamCanceller, segmentBufferStatus, periodEnd, DELTA_POSITION_AFTER_RELOAD, relativePosAfterSwitch, adaptation, representations,
|
|
137
|
+
var streamCanceller, segmentBufferStatus, periodEnd, DELTA_POSITION_AFTER_RELOAD, relativePosAfterSwitch, adaptation, representations, segmentBuffer, strategy, _a, _b, _c, start, end, e_1_1;
|
|
138
138
|
var e_1, _d;
|
|
139
139
|
var _e;
|
|
140
140
|
return __generator(this, function (_f) {
|
|
@@ -235,10 +235,8 @@ function PeriodStream(_a, callbacks, parentCancelSignal) {
|
|
|
235
235
|
if (streamCanceller.isUsed()) {
|
|
236
236
|
return [2 /*return*/]; // Previous call has provoken cancellation by side-effect
|
|
237
237
|
}
|
|
238
|
-
readyState = playbackObserver.getReadyState();
|
|
239
238
|
segmentBuffer = createOrReuseSegmentBuffer(segmentBuffersStore, bufferType, adaptation, options);
|
|
240
|
-
|
|
241
|
-
strategy = (0, get_adaptation_switch_strategy_1.default)(segmentBuffer, period, adaptation, choice.switchingMode, playbackInfos, options);
|
|
239
|
+
strategy = (0, get_adaptation_switch_strategy_1.default)(segmentBuffer, period, adaptation, choice.switchingMode, playbackObserver, options);
|
|
242
240
|
if (strategy.type === "needs-reload") {
|
|
243
241
|
return [2 /*return*/, askForMediaSourceReload(relativePosAfterSwitch, true, streamCanceller.signal)];
|
|
244
242
|
}
|
|
@@ -415,7 +413,7 @@ function createAdaptationStreamPlaybackObserver(initialPlaybackObserver, segment
|
|
|
415
413
|
function constructAdaptationStreamPlaybackObservation() {
|
|
416
414
|
var baseObservation = observationRef.getValue();
|
|
417
415
|
var buffered = segmentBuffer.getBufferedRanges();
|
|
418
|
-
var bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(buffered, baseObservation.position.
|
|
416
|
+
var bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(buffered, baseObservation.position.getWanted());
|
|
419
417
|
return (0, object_assign_1.default)({}, baseObservation, { bufferGap: bufferGap });
|
|
420
418
|
}
|
|
421
419
|
function emitAdaptationStreamPlaybackObservation() {
|
|
@@ -443,12 +441,11 @@ function createEmptyAdaptationStream(playbackObserver, wantedBufferAhead, buffer
|
|
|
443
441
|
function sendStatus() {
|
|
444
442
|
var observation = playbackObserver.getReference().getValue();
|
|
445
443
|
var wba = wantedBufferAhead.getValue();
|
|
446
|
-
var position = observation.position.
|
|
444
|
+
var position = observation.position.getWanted();
|
|
447
445
|
if (period.end !== undefined && position + wba >= period.end) {
|
|
448
446
|
log_1.default.debug("Stream: full \"empty\" AdaptationStream", bufferType);
|
|
449
447
|
hasFinishedLoading = true;
|
|
450
448
|
}
|
|
451
|
-
callbacks.streamStatusUpdate({ period: period, bufferType: bufferType, position: position,
|
|
452
|
-
isEmptyStream: true, hasFinishedLoading: hasFinishedLoading, neededSegments: [] });
|
|
449
|
+
callbacks.streamStatusUpdate({ period: period, bufferType: bufferType, imminentDiscontinuity: null, position: position, isEmptyStream: true, hasFinishedLoading: hasFinishedLoading, neededSegments: [] });
|
|
453
450
|
}
|
|
454
451
|
}
|
|
@@ -3,11 +3,10 @@ import SharedReference, { IReadOnlySharedReference } from "../../../utils/refere
|
|
|
3
3
|
import { CancellationSignal } from "../../../utils/task_canceller";
|
|
4
4
|
import WeakMapMemory from "../../../utils/weak_map_memory";
|
|
5
5
|
import { IRepresentationEstimator } from "../../adaptive";
|
|
6
|
-
import { IReadOnlyPlaybackObserver } from "../../api";
|
|
6
|
+
import { IObservationPosition, IReadOnlyPlaybackObserver } from "../../api";
|
|
7
7
|
import { SegmentFetcherCreator } from "../../fetchers";
|
|
8
8
|
import SegmentBuffersStore, { IBufferType, ITextTrackSegmentBufferOptions, SegmentBuffer } from "../../segment_buffers";
|
|
9
9
|
import { IAdaptationChoice, IAdaptationStreamCallbacks, IAdaptationStreamOptions, IPausedPlaybackObservation } from "../adaptation";
|
|
10
|
-
import { IPositionPlaybackObservation } from "../representation";
|
|
11
10
|
/** Callbacks called by the `AdaptationStream` on various events. */
|
|
12
11
|
export interface IPeriodStreamCallbacks extends IAdaptationStreamCallbacks {
|
|
13
12
|
/**
|
|
@@ -65,7 +64,7 @@ export interface IPeriodStreamPlaybackObservation {
|
|
|
65
64
|
* Information on the current media position in seconds at the time of the
|
|
66
65
|
* Observation.
|
|
67
66
|
*/
|
|
68
|
-
position:
|
|
67
|
+
position: IObservationPosition;
|
|
69
68
|
/** `duration` property of the HTMLMediaElement. */
|
|
70
69
|
duration: number;
|
|
71
70
|
/** `readyState` property of the HTMLMediaElement. */
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Adaptation, Period } from "../../../../manifest";
|
|
17
|
+
import { IReadOnlyPlaybackObserver } from "../../../api";
|
|
17
18
|
import { SegmentBuffer } from "../../../segment_buffers";
|
|
18
19
|
import { ITrackSwitchingMode } from "../../adaptation";
|
|
20
|
+
import { IPeriodStreamPlaybackObservation } from "../types";
|
|
19
21
|
export type IAdaptationSwitchStrategy =
|
|
20
22
|
/** Do nothing special. */
|
|
21
23
|
{
|
|
@@ -59,10 +61,7 @@ export interface IAdaptationSwitchOptions {
|
|
|
59
61
|
* @param {Object} segmentBuffer
|
|
60
62
|
* @param {Object} period
|
|
61
63
|
* @param {Object} adaptation
|
|
62
|
-
* @param {Object}
|
|
64
|
+
* @param {Object} playbackObserver
|
|
63
65
|
* @returns {Object}
|
|
64
66
|
*/
|
|
65
|
-
export default function getAdaptationSwitchStrategy(segmentBuffer: SegmentBuffer, period: Period, adaptation: Adaptation, switchingMode: ITrackSwitchingMode,
|
|
66
|
-
currentTime: number;
|
|
67
|
-
readyState: number;
|
|
68
|
-
}, options: IAdaptationSwitchOptions): IAdaptationSwitchStrategy;
|
|
67
|
+
export default function getAdaptationSwitchStrategy(segmentBuffer: SegmentBuffer, period: Period, adaptation: Adaptation, switchingMode: ITrackSwitchingMode, playbackObserver: IReadOnlyPlaybackObserver<IPeriodStreamPlaybackObservation>, options: IAdaptationSwitchOptions): IAdaptationSwitchStrategy;
|
|
@@ -25,10 +25,10 @@ var segment_buffers_1 = require("../../../segment_buffers");
|
|
|
25
25
|
* @param {Object} segmentBuffer
|
|
26
26
|
* @param {Object} period
|
|
27
27
|
* @param {Object} adaptation
|
|
28
|
-
* @param {Object}
|
|
28
|
+
* @param {Object} playbackObserver
|
|
29
29
|
* @returns {Object}
|
|
30
30
|
*/
|
|
31
|
-
function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchingMode,
|
|
31
|
+
function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchingMode, playbackObserver, options) {
|
|
32
32
|
if (segmentBuffer.codec !== undefined &&
|
|
33
33
|
options.onCodecSwitch === "reload" &&
|
|
34
34
|
!hasCompatibleCodec(adaptation, segmentBuffer.codec)) {
|
|
@@ -64,16 +64,20 @@ function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchin
|
|
|
64
64
|
if (unwantedRange.length === 0) {
|
|
65
65
|
return { type: "continue", value: undefined };
|
|
66
66
|
}
|
|
67
|
-
var currentTime =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
var currentTime = playbackObserver.getCurrentTime();
|
|
68
|
+
var readyState = playbackObserver.getReadyState();
|
|
69
|
+
if (switchingMode === "reload" && readyState > 1) {
|
|
70
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
71
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
72
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
73
|
+
// seek-back...), just reload as checks here would be too complex
|
|
74
|
+
return { type: "needs-reload", value: undefined };
|
|
75
|
+
}
|
|
76
|
+
else if ((0, ranges_1.isTimeInRange)({ start: start, end: end }, currentTime) &&
|
|
77
|
+
// We're not playing the current wanted video Adaptation
|
|
78
|
+
!(0, ranges_1.isTimeInRanges)(adaptationInBuffer, currentTime)) {
|
|
79
|
+
return { type: "needs-reload", value: undefined };
|
|
80
|
+
}
|
|
77
81
|
}
|
|
78
82
|
// From here, clean-up data from the previous Adaptation, if one
|
|
79
83
|
var shouldCleanAll = switchingMode === "direct";
|
|
@@ -144,7 +148,7 @@ function hasCompatibleCodec(adaptation, segmentBufferCodec) {
|
|
|
144
148
|
/**
|
|
145
149
|
* Returns buffered ranges of what we know correspond to the given `adaptation`
|
|
146
150
|
* in the SegmentBuffer.
|
|
147
|
-
* @param {Object}
|
|
151
|
+
* @param {Array.<Object>} inventory
|
|
148
152
|
* @param {Object} period
|
|
149
153
|
* @param {Object} adaptation
|
|
150
154
|
* @returns {Array.<Object>}
|
|
@@ -197,12 +197,11 @@ function RepresentationStream(_a, callbacks, parentCancelSignal) {
|
|
|
197
197
|
* issues at the current time, calling the right callbacks if necessary.
|
|
198
198
|
*/
|
|
199
199
|
function checkStatus() {
|
|
200
|
-
var _a, _b;
|
|
201
200
|
if (segmentsLoadingCanceller.isUsed()) {
|
|
202
201
|
return; // Stop all buffer status checking if load operations are stopped
|
|
203
202
|
}
|
|
204
203
|
var observation = playbackObserver.getReference().getValue();
|
|
205
|
-
var initialWantedTime =
|
|
204
|
+
var initialWantedTime = observation.position.getWanted();
|
|
206
205
|
var status = (0, get_buffer_status_1.default)(content, initialWantedTime, playbackObserver, fastSwitchThreshold.getValue(), bufferGoal.getValue(), maxBufferSize.getValue(), segmentBuffer);
|
|
207
206
|
var neededSegments = status.neededSegments;
|
|
208
207
|
var neededInitSegment = null;
|
|
@@ -216,7 +215,7 @@ function RepresentationStream(_a, callbacks, parentCancelSignal) {
|
|
|
216
215
|
"initialization segment");
|
|
217
216
|
}
|
|
218
217
|
else {
|
|
219
|
-
var wantedStart =
|
|
218
|
+
var wantedStart = observation.position.getWanted();
|
|
220
219
|
neededInitSegment = { segment: initSegmentState.segment,
|
|
221
220
|
priority: (0, get_segment_priority_1.default)(period.start, wantedStart) };
|
|
222
221
|
}
|
|
@@ -266,7 +265,7 @@ function RepresentationStream(_a, callbacks, parentCancelSignal) {
|
|
|
266
265
|
return;
|
|
267
266
|
}
|
|
268
267
|
}
|
|
269
|
-
callbacks.streamStatusUpdate({ period: period, position: observation.position.
|
|
268
|
+
callbacks.streamStatusUpdate({ period: period, position: observation.position.getWanted(), bufferType: bufferType, imminentDiscontinuity: status.imminentDiscontinuity,
|
|
270
269
|
isEmptyStream: false,
|
|
271
270
|
hasFinishedLoading: status.hasFinishedLoading,
|
|
272
271
|
neededSegments: status.neededSegments });
|
|
@@ -2,7 +2,7 @@ import Manifest, { Adaptation, ISegment, Period, Representation } from "../../..
|
|
|
2
2
|
import { IEMSG } from "../../../parsers/containers/isobmff";
|
|
3
3
|
import { IAudioRepresentationsSwitchingMode, IPlayerError, IVideoRepresentationsSwitchingMode } from "../../../public_types";
|
|
4
4
|
import { IReadOnlySharedReference } from "../../../utils/reference";
|
|
5
|
-
import { IReadOnlyPlaybackObserver } from "../../api";
|
|
5
|
+
import { IObservationPosition, IReadOnlyPlaybackObserver } from "../../api";
|
|
6
6
|
import { IContentProtection } from "../../decrypt";
|
|
7
7
|
import { IPrioritizedSegmentFetcher } from "../../fetchers";
|
|
8
8
|
import { IBufferType, SegmentBuffer } from "../../segment_buffers";
|
|
@@ -163,7 +163,7 @@ export interface IRepresentationStreamPlaybackObservation {
|
|
|
163
163
|
* Information on the current media position in seconds at the time of a
|
|
164
164
|
* Playback Observation.
|
|
165
165
|
*/
|
|
166
|
-
position:
|
|
166
|
+
position: IObservationPosition;
|
|
167
167
|
}
|
|
168
168
|
/** Position-related information linked to an emitted Playback observation. */
|
|
169
169
|
export interface IPositionPlaybackObservation {
|
|
@@ -68,19 +68,18 @@ var force_garbage_collection_1 = require("./force_garbage_collection");
|
|
|
68
68
|
* @returns {Promise}
|
|
69
69
|
*/
|
|
70
70
|
function appendSegmentToBuffer(playbackObserver, segmentBuffer, dataInfos, cancellationSignal) {
|
|
71
|
-
var _a;
|
|
72
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
72
|
var appendError_1, reason, position, currentPos, err2_1, reason;
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
76
75
|
case 0:
|
|
77
|
-
|
|
76
|
+
_a.trys.push([0, 2, , 8]);
|
|
78
77
|
return [4 /*yield*/, segmentBuffer.pushChunk(dataInfos, cancellationSignal)];
|
|
79
78
|
case 1:
|
|
80
|
-
|
|
79
|
+
_a.sent();
|
|
81
80
|
return [3 /*break*/, 8];
|
|
82
81
|
case 2:
|
|
83
|
-
appendError_1 =
|
|
82
|
+
appendError_1 = _a.sent();
|
|
84
83
|
if (cancellationSignal.isCancelled() && appendError_1 instanceof task_canceller_1.CancellationError) {
|
|
85
84
|
throw appendError_1;
|
|
86
85
|
}
|
|
@@ -92,19 +91,19 @@ function appendSegmentToBuffer(playbackObserver, segmentBuffer, dataInfos, cance
|
|
|
92
91
|
throw new errors_1.MediaError("BUFFER_APPEND_ERROR", reason, { adaptations: [dataInfos.inventoryInfos.adaptation] });
|
|
93
92
|
}
|
|
94
93
|
position = playbackObserver.getReference().getValue().position;
|
|
95
|
-
currentPos =
|
|
96
|
-
|
|
94
|
+
currentPos = position.getWanted();
|
|
95
|
+
_a.label = 3;
|
|
97
96
|
case 3:
|
|
98
|
-
|
|
97
|
+
_a.trys.push([3, 6, , 7]);
|
|
99
98
|
return [4 /*yield*/, (0, force_garbage_collection_1.default)(currentPos, segmentBuffer, cancellationSignal)];
|
|
100
99
|
case 4:
|
|
101
|
-
|
|
100
|
+
_a.sent();
|
|
102
101
|
return [4 /*yield*/, segmentBuffer.pushChunk(dataInfos, cancellationSignal)];
|
|
103
102
|
case 5:
|
|
104
|
-
|
|
103
|
+
_a.sent();
|
|
105
104
|
return [3 /*break*/, 7];
|
|
106
105
|
case 6:
|
|
107
|
-
err2_1 =
|
|
106
|
+
err2_1 = _a.sent();
|
|
108
107
|
reason = err2_1 instanceof Error ? err2_1.toString() :
|
|
109
108
|
"Could not clean the buffer";
|
|
110
109
|
throw new errors_1.MediaError("BUFFER_FULL_ERROR", reason, { adaptations: [dataInfos.inventoryInfos.adaptation] });
|
|
@@ -96,7 +96,7 @@ function getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitc
|
|
|
96
96
|
* needed segments for this Representation until the end of the Period.
|
|
97
97
|
*/
|
|
98
98
|
var hasFinishedLoading = representation.index.isInitialized() &&
|
|
99
|
-
representation.index.
|
|
99
|
+
!representation.index.isStillAwaitingFutureSegments() &&
|
|
100
100
|
neededRange.hasReachedPeriodEnd &&
|
|
101
101
|
prioritizedNeededSegments.length === 0 &&
|
|
102
102
|
segmentsOnHold.length === 0;
|
|
@@ -147,7 +147,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
147
147
|
segment_buffers_1.default.isNative(content.adaptation.type) &&
|
|
148
148
|
initialWantedTime >= lastIndexPosition &&
|
|
149
149
|
representationIndex.isInitialized() &&
|
|
150
|
-
representationIndex.
|
|
150
|
+
!representationIndex.isStillAwaitingFutureSegments() &&
|
|
151
151
|
isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime)) {
|
|
152
152
|
wantedStartPosition = lastIndexPosition - 1;
|
|
153
153
|
}
|
|
@@ -157,7 +157,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
157
157
|
var wantedEndPosition = wantedStartPosition + bufferGoal;
|
|
158
158
|
var hasReachedPeriodEnd;
|
|
159
159
|
if (!representation.index.isInitialized() ||
|
|
160
|
-
|
|
160
|
+
representation.index.isStillAwaitingFutureSegments() ||
|
|
161
161
|
period.end === undefined) {
|
|
162
162
|
hasReachedPeriodEnd = false;
|
|
163
163
|
}
|
|
@@ -212,7 +212,7 @@ function getPlayableBufferedSegments(neededRange, segmentInventory) {
|
|
|
212
212
|
for (var i = segmentInventory.length - 1; i >= 0; i--) {
|
|
213
213
|
var eltInventory = segmentInventory[i];
|
|
214
214
|
var representation = eltInventory.infos.representation;
|
|
215
|
-
if (
|
|
215
|
+
if (eltInventory.status === 1 /* ChunkStatus.Complete */ &&
|
|
216
216
|
representation.decipherable !== false &&
|
|
217
217
|
representation.isSupported) {
|
|
218
218
|
var inventorySegment = eltInventory.infos.segment;
|
|
@@ -324,7 +324,7 @@ function doesEndSeemGarbageCollected(currentSeg, nextSeg, minimumEndTime) {
|
|
|
324
324
|
}
|
|
325
325
|
if (minimumEndTime > currentSeg.bufferedEnd &&
|
|
326
326
|
currentSeg.end - currentSeg.bufferedEnd > MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT) {
|
|
327
|
-
log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.
|
|
327
|
+
log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.end, currentSeg.bufferedEnd);
|
|
328
328
|
return true;
|
|
329
329
|
}
|
|
330
330
|
return false;
|
|
@@ -21,6 +21,11 @@ declare const DEFAULT_CONFIG: {
|
|
|
21
21
|
* @type {Number}
|
|
22
22
|
*/
|
|
23
23
|
DEFAULT_REQUEST_TIMEOUT: number;
|
|
24
|
+
/**
|
|
25
|
+
* Default connection time after which a request will timeout, in ms.
|
|
26
|
+
* @type {Number}
|
|
27
|
+
*/
|
|
28
|
+
DEFAULT_CONNECTION_TIMEOUT: number;
|
|
24
29
|
/**
|
|
25
30
|
* Can be either:
|
|
26
31
|
* - "native": Subtitles are all displayed in a <track> element
|
|
@@ -141,6 +146,13 @@ declare const DEFAULT_CONFIG: {
|
|
|
141
146
|
* @type {Object}
|
|
142
147
|
*/
|
|
143
148
|
MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "text", number>>;
|
|
149
|
+
/**
|
|
150
|
+
* Minimum possible buffer ahead for each type of buffer, to avoid Garbage
|
|
151
|
+
* Collecting too much data when it would have adverse effects.
|
|
152
|
+
* Equal to `0` if not defined here.
|
|
153
|
+
* @type {Object}
|
|
154
|
+
*/
|
|
155
|
+
MINIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "image" | "text", number>>;
|
|
144
156
|
/**
|
|
145
157
|
* Maximum possible buffer behind for each type of buffer, to avoid too much
|
|
146
158
|
* memory usage when playing for a long time.
|
|
@@ -203,22 +215,6 @@ declare const DEFAULT_CONFIG: {
|
|
|
203
215
|
* @type {Number}
|
|
204
216
|
*/
|
|
205
217
|
BUFFER_DISCONTINUITY_THRESHOLD: number;
|
|
206
|
-
/**
|
|
207
|
-
* When encountering small discontinuities, the RxPlayer may want, in specific
|
|
208
|
-
* conditions, ignore those and let the browser seek over them iself (this
|
|
209
|
-
* allows for example to avoid conflicts when both the browser and the
|
|
210
|
-
* RxPlayer want to seek at a different position, sometimes leading to a
|
|
211
|
-
* seeking loop).
|
|
212
|
-
* In this case, we however still want to seek it ourselves if the browser
|
|
213
|
-
* doesn't take the opportunity soon enough.
|
|
214
|
-
*
|
|
215
|
-
* This value specifies a delay after which a discontinuity ignored by the
|
|
216
|
-
* RxPlayer is finally considered.
|
|
217
|
-
* We want to maintain high enough to be sure the browser will not seek yet
|
|
218
|
-
* small enough so this (arguably rare) situation won't lead to too much
|
|
219
|
-
* waiting time.
|
|
220
|
-
*/
|
|
221
|
-
FORCE_DISCONTINUITY_SEEK_DELAY: number;
|
|
222
218
|
/**
|
|
223
219
|
* Ratio used to know if an already loaded segment should be re-buffered.
|
|
224
220
|
* We re-load the given segment if the current one times that ratio is
|
|
@@ -23,6 +23,11 @@ var DEFAULT_CONFIG = {
|
|
|
23
23
|
* @type {Number}
|
|
24
24
|
*/
|
|
25
25
|
DEFAULT_REQUEST_TIMEOUT: 30 * 1000,
|
|
26
|
+
/**
|
|
27
|
+
* Default connection time after which a request will timeout, in ms.
|
|
28
|
+
* @type {Number}
|
|
29
|
+
*/
|
|
30
|
+
DEFAULT_CONNECTION_TIMEOUT: 15 * 1000,
|
|
26
31
|
/**
|
|
27
32
|
* Can be either:
|
|
28
33
|
* - "native": Subtitles are all displayed in a <track> element
|
|
@@ -146,6 +151,22 @@ var DEFAULT_CONFIG = {
|
|
|
146
151
|
},
|
|
147
152
|
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
148
153
|
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
154
|
+
/**
|
|
155
|
+
* Minimum possible buffer ahead for each type of buffer, to avoid Garbage
|
|
156
|
+
* Collecting too much data when it would have adverse effects.
|
|
157
|
+
* Equal to `0` if not defined here.
|
|
158
|
+
* @type {Object}
|
|
159
|
+
*/
|
|
160
|
+
MINIMUM_MAX_BUFFER_AHEAD: {
|
|
161
|
+
// Text segments are both much lighter on resources and might
|
|
162
|
+
// actually be much larger than other types of segments in terms
|
|
163
|
+
// of duration. Let's make an exception here by authorizing a
|
|
164
|
+
// larger text buffer ahead, to avoid unnecesarily reloading the
|
|
165
|
+
// same text track.
|
|
166
|
+
text: 2 * 60,
|
|
167
|
+
},
|
|
168
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
169
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
149
170
|
/**
|
|
150
171
|
* Maximum possible buffer behind for each type of buffer, to avoid too much
|
|
151
172
|
* memory usage when playing for a long time.
|
|
@@ -211,22 +232,6 @@ var DEFAULT_CONFIG = {
|
|
|
211
232
|
* @type {Number}
|
|
212
233
|
*/
|
|
213
234
|
BUFFER_DISCONTINUITY_THRESHOLD: 0.2,
|
|
214
|
-
/**
|
|
215
|
-
* When encountering small discontinuities, the RxPlayer may want, in specific
|
|
216
|
-
* conditions, ignore those and let the browser seek over them iself (this
|
|
217
|
-
* allows for example to avoid conflicts when both the browser and the
|
|
218
|
-
* RxPlayer want to seek at a different position, sometimes leading to a
|
|
219
|
-
* seeking loop).
|
|
220
|
-
* In this case, we however still want to seek it ourselves if the browser
|
|
221
|
-
* doesn't take the opportunity soon enough.
|
|
222
|
-
*
|
|
223
|
-
* This value specifies a delay after which a discontinuity ignored by the
|
|
224
|
-
* RxPlayer is finally considered.
|
|
225
|
-
* We want to maintain high enough to be sure the browser will not seek yet
|
|
226
|
-
* small enough so this (arguably rare) situation won't lead to too much
|
|
227
|
-
* waiting time.
|
|
228
|
-
*/
|
|
229
|
-
FORCE_DISCONTINUITY_SEEK_DELAY: 5000,
|
|
230
235
|
/**
|
|
231
236
|
* Ratio used to know if an already loaded segment should be re-buffered.
|
|
232
237
|
* We re-load the given segment if the current one times that ratio is
|
|
@@ -181,7 +181,9 @@ var VideoThumbnailLoader = /** @class */ (function () {
|
|
|
181
181
|
{}, { baseDelay: 0,
|
|
182
182
|
maxDelay: 0,
|
|
183
183
|
maxRetry: 0,
|
|
184
|
-
requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT
|
|
184
|
+
requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
185
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
186
|
+
});
|
|
185
187
|
var initSegment_1 = content.representation.index.getInitSegment();
|
|
186
188
|
var initSegmentUniqueId_1 = initSegment_1 !== null ?
|
|
187
189
|
content.representation.uniqueId :
|
|
@@ -112,6 +112,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
112
112
|
url: url,
|
|
113
113
|
responseType: "document",
|
|
114
114
|
timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
115
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
115
116
|
// We won't cancel
|
|
116
117
|
cancelSignal: new task_canceller_1.default().signal,
|
|
117
118
|
})];
|
|
@@ -148,6 +149,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
148
149
|
url: url,
|
|
149
150
|
responseType: "text",
|
|
150
151
|
timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
152
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
151
153
|
// We won't cancel
|
|
152
154
|
cancelSignal: new task_canceller_1.default().signal,
|
|
153
155
|
})];
|
|
@@ -82,7 +82,8 @@ var Adaptation = /** @class */ (function () {
|
|
|
82
82
|
var reprObject = {
|
|
83
83
|
id: representation.id,
|
|
84
84
|
bitrate: representation.bitrate,
|
|
85
|
-
|
|
85
|
+
codecs: representation.codec === undefined ? [] :
|
|
86
|
+
[representation.codec],
|
|
86
87
|
height: representation.height,
|
|
87
88
|
width: representation.width,
|
|
88
89
|
frameRate: representation.frameRate,
|
|
@@ -117,8 +117,8 @@ var StaticRepresentationIndex = /** @class */ (function () {
|
|
|
117
117
|
/**
|
|
118
118
|
* @returns {Boolean}
|
|
119
119
|
*/
|
|
120
|
-
StaticRepresentationIndex.prototype.
|
|
121
|
-
return
|
|
120
|
+
StaticRepresentationIndex.prototype.isStillAwaitingFutureSegments = function () {
|
|
121
|
+
return false;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* @returns {Boolean}
|
|
@@ -304,7 +304,7 @@ export interface IRepresentationIndex {
|
|
|
304
304
|
getLastAvailablePosition(): number | null | undefined;
|
|
305
305
|
/**
|
|
306
306
|
* Returns the ending time, in seconds, of the Representation once it is
|
|
307
|
-
* "finished" (@see
|
|
307
|
+
* "finished" (@see isStillAwaitingFutureSegments).
|
|
308
308
|
* Should thus be equivalent to `getLastAvailablePosition` once finished.
|
|
309
309
|
*
|
|
310
310
|
* Returns `null` if nothing is in the index
|
|
@@ -352,13 +352,13 @@ export interface IRepresentationIndex {
|
|
|
352
352
|
*/
|
|
353
353
|
checkDiscontinuity(time: number): number | null;
|
|
354
354
|
/**
|
|
355
|
-
* Returns `
|
|
355
|
+
* Returns `false` if the last segments in this index have already been
|
|
356
356
|
* generated so that we can freely go to the next period.
|
|
357
|
-
* Returns `
|
|
357
|
+
* Returns `true` if the index is still waiting on future segments to be
|
|
358
358
|
* generated.
|
|
359
359
|
* @returns {boolean}
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
isStillAwaitingFutureSegments(): boolean;
|
|
362
362
|
/**
|
|
363
363
|
* Returns `true` if this index has all the data it needs to give the list
|
|
364
364
|
* of available segments.
|
|
@@ -17,6 +17,7 @@ import { IRepresentationIndex, ISegment } from "../../../../../manifest";
|
|
|
17
17
|
import { ISegmentInformation } from "../../../../../transports";
|
|
18
18
|
import { IEMSG } from "../../../../containers/isobmff";
|
|
19
19
|
import { IIndexSegment } from "../../../utils/index_helpers";
|
|
20
|
+
import ManifestBoundsCalculator from "../manifest_bounds_calculator";
|
|
20
21
|
/**
|
|
21
22
|
* Index property defined for a SegmentBase RepresentationIndex
|
|
22
23
|
* This object contains every property needed to generate an ISegment for a
|
|
@@ -108,6 +109,8 @@ export interface IBaseIndexContextArgument {
|
|
|
108
109
|
representationId?: string | undefined;
|
|
109
110
|
/** Bitrate of the Representation concerned. */
|
|
110
111
|
representationBitrate?: number | undefined;
|
|
112
|
+
/** Allows to obtain the minimum and maximum positions of a content. */
|
|
113
|
+
manifestBoundsCalculator: ManifestBoundsCalculator;
|
|
111
114
|
isEMSGWhitelisted: (inbandEvent: IEMSG) => boolean;
|
|
112
115
|
}
|
|
113
116
|
export default class BaseRepresentationIndex implements IRepresentationIndex {
|
|
@@ -124,6 +127,8 @@ export default class BaseRepresentationIndex implements IRepresentationIndex {
|
|
|
124
127
|
private _scaledPeriodStart;
|
|
125
128
|
/** Absolute end of the period, timescaled and converted to index time. */
|
|
126
129
|
private _scaledPeriodEnd;
|
|
130
|
+
/** Allows to obtain the minimum and maximum positions of a content. */
|
|
131
|
+
private _manifestBoundsCalculator;
|
|
127
132
|
private _isEMSGWhitelisted;
|
|
128
133
|
/**
|
|
129
134
|
* @param {Object} index
|
|
@@ -205,7 +210,7 @@ export default class BaseRepresentationIndex implements IRepresentationIndex {
|
|
|
205
210
|
* should become available in the future.
|
|
206
211
|
* @returns {Boolean}
|
|
207
212
|
*/
|
|
208
|
-
|
|
213
|
+
isStillAwaitingFutureSegments(): false;
|
|
209
214
|
/**
|
|
210
215
|
* No segment in a `BaseRepresentationIndex` are known initially.
|
|
211
216
|
* It is only defined generally in an "index segment" that will thus need to
|
|
@@ -80,6 +80,7 @@ var BaseRepresentationIndex = /** @class */ (function () {
|
|
|
80
80
|
this._index = { indexRange: index.indexRange, indexTimeOffset: indexTimeOffset, initialization: { url: initializationUrl, range: range }, segmentUrlTemplate: segmentUrlTemplate, startNumber: index.startNumber,
|
|
81
81
|
endNumber: index.endNumber,
|
|
82
82
|
timeline: (_c = index.timeline) !== null && _c !== void 0 ? _c : [], timescale: timescale };
|
|
83
|
+
this._manifestBoundsCalculator = context.manifestBoundsCalculator;
|
|
83
84
|
this._scaledPeriodStart = (0, index_helpers_1.toIndexTime)(periodStart, this._index);
|
|
84
85
|
this._scaledPeriodEnd = periodEnd == null ? undefined :
|
|
85
86
|
(0, index_helpers_1.toIndexTime)(periodEnd, this._index);
|
|
@@ -108,7 +109,7 @@ var BaseRepresentationIndex = /** @class */ (function () {
|
|
|
108
109
|
* @returns {Array.<Object>}
|
|
109
110
|
*/
|
|
110
111
|
BaseRepresentationIndex.prototype.getSegments = function (from, dur) {
|
|
111
|
-
return (0, get_segments_from_timeline_1.default)(this._index, from, dur, this.
|
|
112
|
+
return (0, get_segments_from_timeline_1.default)(this._index, from, dur, this._manifestBoundsCalculator, this._scaledPeriodEnd, this._isEMSGWhitelisted);
|
|
112
113
|
};
|
|
113
114
|
/**
|
|
114
115
|
* Returns false as no Segment-Base based index should need to be refreshed.
|
|
@@ -192,8 +193,8 @@ var BaseRepresentationIndex = /** @class */ (function () {
|
|
|
192
193
|
* should become available in the future.
|
|
193
194
|
* @returns {Boolean}
|
|
194
195
|
*/
|
|
195
|
-
BaseRepresentationIndex.prototype.
|
|
196
|
-
return
|
|
196
|
+
BaseRepresentationIndex.prototype.isStillAwaitingFutureSegments = function () {
|
|
197
|
+
return false;
|
|
197
198
|
};
|
|
198
199
|
/**
|
|
199
200
|
* No segment in a `BaseRepresentationIndex` are known initially.
|
|
@@ -16,21 +16,24 @@
|
|
|
16
16
|
import { ISegment } from "../../../../../manifest";
|
|
17
17
|
import { IEMSG } from "../../../../containers/isobmff";
|
|
18
18
|
import { IIndexSegment } from "../../../utils/index_helpers";
|
|
19
|
+
import ManifestBoundsCalculator from "../manifest_bounds_calculator";
|
|
19
20
|
/**
|
|
20
21
|
* Get a list of Segments for the time range wanted.
|
|
21
22
|
* @param {Object} index - index object, constructed by parsing the manifest.
|
|
22
23
|
* @param {number} from - starting timestamp wanted, in seconds
|
|
23
24
|
* @param {number} durationWanted - duration wanted, in seconds
|
|
25
|
+
* @param {Object} manifestBoundsCalculator
|
|
26
|
+
* @param {number|undefined} scaledPeriodEnd
|
|
24
27
|
* @param {function} isEMSGWhitelisted
|
|
25
|
-
* @param {number|undefined} maximumTime
|
|
26
28
|
* @returns {Array.<Object>}
|
|
27
29
|
*/
|
|
28
30
|
export default function getSegmentsFromTimeline(index: {
|
|
29
31
|
availabilityTimeComplete?: boolean | undefined;
|
|
32
|
+
availabilityTimeOffset?: number | undefined;
|
|
30
33
|
segmentUrlTemplate: string | null;
|
|
31
34
|
startNumber?: number | undefined;
|
|
32
35
|
endNumber?: number | undefined;
|
|
33
36
|
timeline: IIndexSegment[];
|
|
34
37
|
timescale: number;
|
|
35
38
|
indexTimeOffset: number;
|
|
36
|
-
}, from: number, durationWanted: number, isEMSGWhitelisted: (inbandEvent: IEMSG) => boolean
|
|
39
|
+
}, from: number, durationWanted: number, manifestBoundsCalculator: ManifestBoundsCalculator, scaledPeriodEnd: number | undefined, isEMSGWhitelisted: (inbandEvent: IEMSG) => boolean): ISegment[];
|
|
@@ -36,13 +36,17 @@ function getWantedRepeatIndex(segmentStartTime, segmentDuration, wantedTime) {
|
|
|
36
36
|
* @param {Object} index - index object, constructed by parsing the manifest.
|
|
37
37
|
* @param {number} from - starting timestamp wanted, in seconds
|
|
38
38
|
* @param {number} durationWanted - duration wanted, in seconds
|
|
39
|
+
* @param {Object} manifestBoundsCalculator
|
|
40
|
+
* @param {number|undefined} scaledPeriodEnd
|
|
39
41
|
* @param {function} isEMSGWhitelisted
|
|
40
|
-
* @param {number|undefined} maximumTime
|
|
41
42
|
* @returns {Array.<Object>}
|
|
42
43
|
*/
|
|
43
|
-
function getSegmentsFromTimeline(index, from, durationWanted,
|
|
44
|
+
function getSegmentsFromTimeline(index, from, durationWanted, manifestBoundsCalculator, scaledPeriodEnd, isEMSGWhitelisted) {
|
|
45
|
+
var _a;
|
|
46
|
+
var maximumTime = manifestBoundsCalculator.getEstimatedMaximumPosition((_a = index.availabilityTimeOffset) !== null && _a !== void 0 ? _a : 0);
|
|
47
|
+
var wantedMaximum = Math.min(from + durationWanted, maximumTime !== null && maximumTime !== void 0 ? maximumTime : Infinity);
|
|
44
48
|
var scaledUp = (0, index_helpers_1.toIndexTime)(from, index);
|
|
45
|
-
var scaledTo = (0, index_helpers_1.toIndexTime)(
|
|
49
|
+
var scaledTo = (0, index_helpers_1.toIndexTime)(wantedMaximum, index);
|
|
46
50
|
var timeline = index.timeline, timescale = index.timescale, segmentUrlTemplate = index.segmentUrlTemplate, startNumber = index.startNumber, endNumber = index.endNumber;
|
|
47
51
|
var currentNumber = startNumber !== null && startNumber !== void 0 ? startNumber : 1;
|
|
48
52
|
var segments = [];
|
|
@@ -50,7 +54,14 @@ function getSegmentsFromTimeline(index, from, durationWanted, isEMSGWhitelisted,
|
|
|
50
54
|
for (var i = 0; i < timelineLength; i++) {
|
|
51
55
|
var timelineItem = timeline[i];
|
|
52
56
|
var duration = timelineItem.duration, start = timelineItem.start, range = timelineItem.range;
|
|
53
|
-
var
|
|
57
|
+
var maxRepeatTime = void 0;
|
|
58
|
+
if (maximumTime === undefined) {
|
|
59
|
+
maxRepeatTime = scaledPeriodEnd;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
maxRepeatTime = Math.min(maximumTime * timescale, scaledPeriodEnd !== null && scaledPeriodEnd !== void 0 ? scaledPeriodEnd : Infinity);
|
|
63
|
+
}
|
|
64
|
+
var repeat = (0, index_helpers_1.calculateRepeat)(timelineItem, timeline[i + 1], maxRepeatTime);
|
|
54
65
|
var complete = index.availabilityTimeComplete !== false ||
|
|
55
66
|
i !== timelineLength - 1 &&
|
|
56
67
|
repeat !== 0;
|