rx-player 4.0.0-dev.2023120600 → 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 +178 -2
- package/README.md +2 -33
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/add_text_track.d.ts +3 -1
- package/dist/_esm5.processed/compat/add_text_track.js +7 -4
- package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +7 -0
- package/dist/_esm5.processed/compat/event_listeners.d.ts +15 -2
- package/dist/_esm5.processed/compat/event_listeners.js +37 -2
- package/dist/_esm5.processed/compat/fullscreen.d.ts +32 -0
- package/dist/_esm5.processed/compat/fullscreen.js +78 -0
- package/dist/_esm5.processed/compat/index.d.ts +3 -1
- package/dist/_esm5.processed/compat/index.js +3 -1
- package/dist/_esm5.processed/compat/is_offline.d.ts +39 -0
- package/dist/_esm5.processed/compat/is_offline.js +43 -0
- package/dist/_esm5.processed/config.d.ts +21 -9
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +58 -0
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +54 -14
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +8 -2
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +11 -2
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +46 -17
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +35 -14
- package/dist/_esm5.processed/core/api/option_utils.js +230 -47
- package/dist/_esm5.processed/core/api/public_api.d.ts +266 -92
- package/dist/_esm5.processed/core/api/public_api.js +802 -444
- package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.d.ts → tracks_management/media_element_track_choice_manager.d.ts} +75 -15
- package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.js → tracks_management/media_element_track_choice_manager.js} +193 -74
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +258 -0
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +989 -0
- package/dist/_esm5.processed/core/api/utils.d.ts +0 -1
- package/dist/_esm5.processed/core/api/utils.js +11 -28
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +71 -83
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +5 -6
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +72 -10
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +4 -6
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +3 -1
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +26 -7
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +9 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +9 -16
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +6 -1
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +41 -4
- package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +8 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -2
- package/dist/_esm5.processed/core/init/types.d.ts +15 -5
- 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.d.ts +75 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +133 -0
- package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.d.ts +2 -3
- package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.js +2 -3
- 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.d.ts +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +4 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.js +1 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +2 -3
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +0 -1
- 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/segment_buffers/segment_buffers_store.d.ts +1 -0
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +16 -2
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +15 -0
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +93 -183
- package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +13 -27
- package/dist/_esm5.processed/core/stream/index.d.ts +3 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +0 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +7 -5
- package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -13
- package/dist/_esm5.processed/core/stream/period/types.d.ts +14 -5
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +46 -10
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +23 -29
- package/dist/_esm5.processed/core/stream/representation/types.d.ts +1 -11
- 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/default_config.d.ts +98 -35
- package/dist/_esm5.processed/default_config.js +113 -36
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -1
- package/dist/_esm5.processed/errors/custom_loader_error.js +3 -1
- package/dist/_esm5.processed/errors/media_error.js +2 -2
- package/dist/_esm5.processed/errors/network_error.d.ts +1 -0
- package/dist/_esm5.processed/errors/network_error.js +1 -0
- package/dist/_esm5.processed/errors/request_error.d.ts +3 -2
- package/dist/_esm5.processed/errors/request_error.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
- package/dist/_esm5.processed/features/features_object.js +2 -0
- package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.js → features/list/bif_parser.d.ts} +6 -7
- package/dist/_esm5.processed/features/list/bif_parser.js +27 -0
- package/dist/_esm5.processed/features/list/directfile.js +5 -2
- package/dist/_esm5.processed/features/list/image_buffer.d.ts +23 -0
- package/dist/_esm5.processed/features/list/image_buffer.js +25 -0
- package/dist/_esm5.processed/features/list/index.d.ts +2 -0
- package/dist/_esm5.processed/features/list/index.js +2 -0
- package/dist/_esm5.processed/features/types.d.ts +27 -3
- package/dist/_esm5.processed/manifest/adaptation.d.ts +11 -9
- package/dist/_esm5.processed/manifest/adaptation.js +30 -41
- package/dist/_esm5.processed/manifest/index.d.ts +4 -3
- package/dist/_esm5.processed/manifest/manifest.d.ts +54 -5
- package/dist/_esm5.processed/manifest/manifest.js +110 -5
- package/dist/_esm5.processed/manifest/period.d.ts +5 -4
- package/dist/_esm5.processed/manifest/representation.d.ts +5 -10
- package/dist/_esm5.processed/manifest/representation.js +5 -15
- package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
- package/dist/_esm5.processed/manifest/representation_index/static.d.ts +0 -2
- package/dist/_esm5.processed/manifest/representation_index/static.js +0 -6
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +21 -42
- package/dist/_esm5.processed/manifest/types.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +31 -17
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +19 -26
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +1 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +6 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +8 -11
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +0 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +6 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +5 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +6 -10
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +1 -10
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +2 -18
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +6 -3
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +0 -6
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +3 -12
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +2 -11
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +1 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +17 -11
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +83 -21
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +125 -53
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +6 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/_esm5.processed/public_types.d.ts +310 -396
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +4 -5
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +4 -5
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +38 -0
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +129 -0
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +3 -2
- package/dist/_esm5.processed/transports/dash/pipelines.js +4 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +20 -26
- package/dist/_esm5.processed/transports/dash/segment_parser.js +24 -19
- package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
- package/dist/_esm5.processed/transports/dash/text_parser.js +33 -28
- package/dist/_esm5.processed/transports/local/pipelines.js +10 -1
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
- package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +52 -34
- package/dist/_esm5.processed/transports/smooth/pipelines.js +190 -33
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +22 -28
- package/dist/_esm5.processed/transports/smooth/utils.d.ts +26 -1
- package/dist/_esm5.processed/transports/smooth/utils.js +55 -1
- package/dist/_esm5.processed/transports/types.d.ts +89 -94
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.js +7 -5
- package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +12 -8
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +21 -19
- package/dist/_esm5.processed/utils/array_includes.d.ts +1 -2
- package/dist/_esm5.processed/utils/array_includes.js +28 -30
- package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.d.ts → utils/list_to_map.d.ts} +5 -5
- package/dist/_esm5.processed/utils/list_to_map.js +28 -0
- package/dist/_esm5.processed/utils/request/xhr.js +5 -5
- package/dist/_esm5.processed/utils/simple_set.d.ts +51 -0
- package/dist/_esm5.processed/utils/simple_set.js +57 -0
- package/dist/_esm5.processed/utils/uniq.d.ts +36 -0
- package/dist/_esm5.processed/utils/uniq.js +43 -0
- package/dist/commonjs/config.d.ts +1 -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/index.d.ts +1 -1
- 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.js +9 -9
- package/dist/commonjs/core/api/utils.js +1 -1
- package/dist/commonjs/core/decrypt/get_media_keys.js +2 -6
- package/dist/commonjs/core/init/directfile_content_initializer.js +5 -1
- package/dist/commonjs/core/init/media_source_content_initializer.js +28 -14
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +1 -2
- 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/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 +1 -1
- package/dist/commonjs/default_config.d.ts +7 -16
- package/dist/commonjs/default_config.js +16 -16
- package/dist/commonjs/manifest/adaptation.js +2 -1
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/commonjs/public_types.d.ts +29 -2
- package/dist/es2017/config.d.ts +1 -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/index.d.ts +1 -1
- 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.js +9 -9
- package/dist/es2017/core/api/utils.js +1 -1
- package/dist/es2017/core/decrypt/get_media_keys.js +2 -6
- package/dist/es2017/core/init/directfile_content_initializer.js +7 -1
- package/dist/es2017/core/init/media_source_content_initializer.js +30 -16
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +1 -2
- 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/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 +1 -1
- package/dist/es2017/default_config.d.ts +7 -16
- package/dist/es2017/default_config.js +16 -16
- package/dist/es2017/manifest/adaptation.js +2 -1
- package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
- package/dist/es2017/public_types.d.ts +29 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +614 -438
- package/dist/rx-player.min.js +1 -1
- package/package.json +5 -1
- package/scripts/canal-release.patch +78 -0
- package/scripts/make-dev-releases +65 -0
- package/scripts/update-version +5 -0
- package/sonar-project.properties +1 -1
- package/src/core/adaptive/adaptive_representation_selector.ts +4 -21
- package/src/core/adaptive/network_analyzer.ts +3 -3
- package/src/core/api/index.ts +1 -0
- package/src/core/api/playback_observer.ts +327 -107
- package/src/core/api/public_api.ts +9 -9
- package/src/core/api/utils.ts +3 -1
- package/src/core/decrypt/get_media_keys.ts +2 -8
- package/src/core/init/directfile_content_initializer.ts +8 -8
- package/src/core/init/media_source_content_initializer.ts +27 -20
- package/src/core/init/utils/content_time_boundaries_observer.ts +1 -1
- package/src/core/init/utils/create_stream_playback_observer.ts +19 -20
- 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 +2 -1
- package/src/default_config.ts +17 -17
- package/src/manifest/adaptation.ts +2 -1
- package/src/parsers/texttracks/ttml/html/apply_line_height.ts +3 -1
- package/src/public_types.ts +29 -2
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +0 -84
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +0 -158
- package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +0 -406
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +0 -932
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +0 -33
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +0 -49
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +0 -39
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +0 -133
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +0 -119
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +0 -159
package/dist/rx-player.js
CHANGED
|
@@ -665,6 +665,22 @@ var DEFAULT_CONFIG = {
|
|
|
665
665
|
},
|
|
666
666
|
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
667
667
|
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
668
|
+
/**
|
|
669
|
+
* Minimum possible buffer ahead for each type of buffer, to avoid Garbage
|
|
670
|
+
* Collecting too much data when it would have adverse effects.
|
|
671
|
+
* Equal to `0` if not defined here.
|
|
672
|
+
* @type {Object}
|
|
673
|
+
*/
|
|
674
|
+
MINIMUM_MAX_BUFFER_AHEAD: {
|
|
675
|
+
// Text segments are both much lighter on resources and might
|
|
676
|
+
// actually be much larger than other types of segments in terms
|
|
677
|
+
// of duration. Let's make an exception here by authorizing a
|
|
678
|
+
// larger text buffer ahead, to avoid unnecesarily reloading the
|
|
679
|
+
// same text track.
|
|
680
|
+
text: 2 * 60
|
|
681
|
+
},
|
|
682
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
683
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
668
684
|
/**
|
|
669
685
|
* Maximum possible buffer behind for each type of buffer, to avoid too much
|
|
670
686
|
* memory usage when playing for a long time.
|
|
@@ -730,22 +746,6 @@ var DEFAULT_CONFIG = {
|
|
|
730
746
|
* @type {Number}
|
|
731
747
|
*/
|
|
732
748
|
BUFFER_DISCONTINUITY_THRESHOLD: 0.2,
|
|
733
|
-
/**
|
|
734
|
-
* When encountering small discontinuities, the RxPlayer may want, in specific
|
|
735
|
-
* conditions, ignore those and let the browser seek over them iself (this
|
|
736
|
-
* allows for example to avoid conflicts when both the browser and the
|
|
737
|
-
* RxPlayer want to seek at a different position, sometimes leading to a
|
|
738
|
-
* seeking loop).
|
|
739
|
-
* In this case, we however still want to seek it ourselves if the browser
|
|
740
|
-
* doesn't take the opportunity soon enough.
|
|
741
|
-
*
|
|
742
|
-
* This value specifies a delay after which a discontinuity ignored by the
|
|
743
|
-
* RxPlayer is finally considered.
|
|
744
|
-
* We want to maintain high enough to be sure the browser will not seek yet
|
|
745
|
-
* small enough so this (arguably rare) situation won't lead to too much
|
|
746
|
-
* waiting time.
|
|
747
|
-
*/
|
|
748
|
-
FORCE_DISCONTINUITY_SEEK_DELAY: 5000,
|
|
749
749
|
/**
|
|
750
750
|
* Ratio used to know if an already loaded segment should be re-buffered.
|
|
751
751
|
* We re-load the given segment if the current one times that ratio is
|
|
@@ -5264,6 +5264,36 @@ function parseLoadVideoOptions(options) {
|
|
|
5264
5264
|
};
|
|
5265
5265
|
}
|
|
5266
5266
|
|
|
5267
|
+
;// CONCATENATED MODULE: ./src/compat/is_seeking_approximate.ts
|
|
5268
|
+
/**
|
|
5269
|
+
* Copyright 2015 CANAL+ Group
|
|
5270
|
+
*
|
|
5271
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5272
|
+
* you may not use this file except in compliance with the License.
|
|
5273
|
+
* You may obtain a copy of the License at
|
|
5274
|
+
*
|
|
5275
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5276
|
+
*
|
|
5277
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5278
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5279
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5280
|
+
* See the License for the specific language governing permissions and
|
|
5281
|
+
* limitations under the License.
|
|
5282
|
+
*/
|
|
5283
|
+
|
|
5284
|
+
/**
|
|
5285
|
+
* On some devices (right now only seen on Tizen), seeking through the
|
|
5286
|
+
* `currentTime` property can lead to the browser re-seeking once the
|
|
5287
|
+
* segments have been loaded to improve seeking performances (for
|
|
5288
|
+
* example, by seeking right to an intra video frame).
|
|
5289
|
+
*
|
|
5290
|
+
* This can lead to conflicts with the RxPlayer code.
|
|
5291
|
+
*
|
|
5292
|
+
* This boolean is only `true` on the devices where this behavior has been
|
|
5293
|
+
* observed.
|
|
5294
|
+
*/
|
|
5295
|
+
var isSeekingApproximate = isTizen;
|
|
5296
|
+
/* harmony default export */ var is_seeking_approximate = (isSeekingApproximate);
|
|
5267
5297
|
;// CONCATENATED MODULE: ./src/utils/monotonic_timestamp.ts
|
|
5268
5298
|
/**
|
|
5269
5299
|
* Returns a monotonically-increasing timestamp in milliseconds that is
|
|
@@ -5301,6 +5331,7 @@ function getMonotonicTimeStamp() {
|
|
|
5301
5331
|
|
|
5302
5332
|
|
|
5303
5333
|
|
|
5334
|
+
|
|
5304
5335
|
/**
|
|
5305
5336
|
* HTMLMediaElement Events for which playback observations are calculated and
|
|
5306
5337
|
* emitted.
|
|
@@ -5332,12 +5363,26 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5332
5363
|
* @param {Object} options
|
|
5333
5364
|
*/
|
|
5334
5365
|
function PlaybackObserver(mediaElement, options) {
|
|
5366
|
+
var _this = this;
|
|
5335
5367
|
this._internalSeeksIncoming = [];
|
|
5336
5368
|
this._mediaElement = mediaElement;
|
|
5337
5369
|
this._withMediaSource = options.withMediaSource;
|
|
5338
5370
|
this._lowLatencyMode = options.lowLatencyMode;
|
|
5339
5371
|
this._canceller = new TaskCanceller();
|
|
5340
5372
|
this._observationRef = this._createSharedReference();
|
|
5373
|
+
this._expectedSeekingPosition = null;
|
|
5374
|
+
this._pendingSeek = null;
|
|
5375
|
+
var onLoadedMetadata = function onLoadedMetadata() {
|
|
5376
|
+
if (_this._pendingSeek !== null) {
|
|
5377
|
+
var positionToSeekTo = _this._pendingSeek;
|
|
5378
|
+
_this._pendingSeek = null;
|
|
5379
|
+
_this._actuallySetCurrentTime(positionToSeekTo);
|
|
5380
|
+
}
|
|
5381
|
+
};
|
|
5382
|
+
mediaElement.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
5383
|
+
this._canceller.signal.register(function () {
|
|
5384
|
+
mediaElement.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
5385
|
+
});
|
|
5341
5386
|
}
|
|
5342
5387
|
/**
|
|
5343
5388
|
* Stop the `PlaybackObserver` from emitting playback observations and free all
|
|
@@ -5388,9 +5433,13 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5388
5433
|
* @param {number} time
|
|
5389
5434
|
*/;
|
|
5390
5435
|
_proto.setCurrentTime = function setCurrentTime(time) {
|
|
5391
|
-
this.
|
|
5392
|
-
|
|
5393
|
-
|
|
5436
|
+
if (this._mediaElement.readyState >= 1) {
|
|
5437
|
+
this._actuallySetCurrentTime(time);
|
|
5438
|
+
} else {
|
|
5439
|
+
this._internalSeeksIncoming = [];
|
|
5440
|
+
this._pendingSeek = time;
|
|
5441
|
+
this._generateObservationForEvent("manual");
|
|
5442
|
+
}
|
|
5394
5443
|
}
|
|
5395
5444
|
/**
|
|
5396
5445
|
* Update the playback rate of the `HTMLMediaElement`.
|
|
@@ -5454,6 +5503,11 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5454
5503
|
*/;
|
|
5455
5504
|
_proto.deriveReadOnlyObserver = function deriveReadOnlyObserver(transform) {
|
|
5456
5505
|
return generateReadOnlyObserver(this, transform, this._canceller.signal);
|
|
5506
|
+
};
|
|
5507
|
+
_proto._actuallySetCurrentTime = function _actuallySetCurrentTime(time) {
|
|
5508
|
+
src_log.info("API: Seeking internally", time);
|
|
5509
|
+
this._internalSeeksIncoming.push(time);
|
|
5510
|
+
this._mediaElement.currentTime = time;
|
|
5457
5511
|
}
|
|
5458
5512
|
/**
|
|
5459
5513
|
* Creates the `IReadOnlySharedReference` that will generate playback
|
|
@@ -5461,66 +5515,28 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5461
5515
|
* @returns {Object}
|
|
5462
5516
|
*/;
|
|
5463
5517
|
_proto._createSharedReference = function _createSharedReference() {
|
|
5464
|
-
var
|
|
5518
|
+
var _this2 = this;
|
|
5465
5519
|
if (this._observationRef !== undefined) {
|
|
5466
5520
|
return this._observationRef;
|
|
5467
5521
|
}
|
|
5468
|
-
var lastObservation;
|
|
5469
5522
|
var _config$getCurrent = config.getCurrent(),
|
|
5470
5523
|
SAMPLING_INTERVAL_MEDIASOURCE = _config$getCurrent.SAMPLING_INTERVAL_MEDIASOURCE,
|
|
5471
5524
|
SAMPLING_INTERVAL_LOW_LATENCY = _config$getCurrent.SAMPLING_INTERVAL_LOW_LATENCY,
|
|
5472
5525
|
SAMPLING_INTERVAL_NO_MEDIASOURCE = _config$getCurrent.SAMPLING_INTERVAL_NO_MEDIASOURCE;
|
|
5473
|
-
var
|
|
5474
|
-
var tmpEvt = event;
|
|
5475
|
-
var startedInternalSeekTime;
|
|
5476
|
-
if (tmpEvt === "seeking" && _this._internalSeeksIncoming.length > 0) {
|
|
5477
|
-
tmpEvt = "internal-seeking";
|
|
5478
|
-
startedInternalSeekTime = _this._internalSeeksIncoming.shift();
|
|
5479
|
-
}
|
|
5480
|
-
var _lastObservation = lastObservation !== null && lastObservation !== void 0 ? lastObservation : _this._generateInitialObservation();
|
|
5481
|
-
var mediaTimings = getMediaInfos(_this._mediaElement, tmpEvt, _this._withMediaSource);
|
|
5482
|
-
var pendingInternalSeek = null;
|
|
5483
|
-
if (mediaTimings.seeking) {
|
|
5484
|
-
if (typeof startedInternalSeekTime === "number") {
|
|
5485
|
-
pendingInternalSeek = startedInternalSeekTime;
|
|
5486
|
-
} else if (_lastObservation.pendingInternalSeek !== null && event !== "seeking") {
|
|
5487
|
-
pendingInternalSeek = _lastObservation.pendingInternalSeek;
|
|
5488
|
-
}
|
|
5489
|
-
}
|
|
5490
|
-
var rebufferingStatus = getRebufferingStatus(_lastObservation, mediaTimings, {
|
|
5491
|
-
lowLatencyMode: _this._lowLatencyMode,
|
|
5492
|
-
withMediaSource: _this._withMediaSource
|
|
5493
|
-
});
|
|
5494
|
-
var freezingStatus = getFreezingStatus(_lastObservation, mediaTimings);
|
|
5495
|
-
var timings = object_assign({}, {
|
|
5496
|
-
rebuffering: rebufferingStatus,
|
|
5497
|
-
freezing: freezingStatus,
|
|
5498
|
-
pendingInternalSeek: pendingInternalSeek
|
|
5499
|
-
}, mediaTimings);
|
|
5500
|
-
if (src_log.hasLevel("DEBUG")) {
|
|
5501
|
-
src_log.debug("API: current media element state tick", "event", timings.event, "position", timings.position, "seeking", timings.seeking, "internalSeek", timings.pendingInternalSeek, "rebuffering", timings.rebuffering !== null, "freezing", timings.freezing !== null, "ended", timings.ended, "paused", timings.paused, "playbackRate", timings.playbackRate, "readyState", timings.readyState);
|
|
5502
|
-
}
|
|
5503
|
-
return timings;
|
|
5504
|
-
};
|
|
5505
|
-
var returnedSharedReference = new utils_reference(getCurrentObservation("init"), this._canceller.signal);
|
|
5506
|
-
var generateObservationForEvent = function generateObservationForEvent(event) {
|
|
5507
|
-
var newObservation = getCurrentObservation(event);
|
|
5508
|
-
if (src_log.hasLevel("DEBUG")) {
|
|
5509
|
-
src_log.debug("API: current playback timeline:\n" + prettyPrintBuffered(newObservation.buffered, newObservation.position), "\n" + event);
|
|
5510
|
-
}
|
|
5511
|
-
lastObservation = newObservation;
|
|
5512
|
-
returnedSharedReference.setValue(newObservation);
|
|
5513
|
-
};
|
|
5526
|
+
var returnedSharedReference = new utils_reference(this._getCurrentObservation("init"), this._canceller.signal);
|
|
5514
5527
|
var interval = this._lowLatencyMode ? SAMPLING_INTERVAL_LOW_LATENCY : this._withMediaSource ? SAMPLING_INTERVAL_MEDIASOURCE : SAMPLING_INTERVAL_NO_MEDIASOURCE;
|
|
5528
|
+
var onInterval = function onInterval() {
|
|
5529
|
+
_this2._generateObservationForEvent("timeupdate");
|
|
5530
|
+
};
|
|
5515
5531
|
var intervalId = setInterval(onInterval, interval);
|
|
5516
5532
|
var removeEventListeners = SCANNED_MEDIA_ELEMENTS_EVENTS.map(function (eventName) {
|
|
5517
|
-
|
|
5518
|
-
function onMediaEvent() {
|
|
5533
|
+
var onMediaEvent = function onMediaEvent() {
|
|
5519
5534
|
restartInterval();
|
|
5520
|
-
|
|
5521
|
-
}
|
|
5535
|
+
_this2._generateObservationForEvent(eventName);
|
|
5536
|
+
};
|
|
5537
|
+
_this2._mediaElement.addEventListener(eventName, onMediaEvent);
|
|
5522
5538
|
return function () {
|
|
5523
|
-
|
|
5539
|
+
_this2._mediaElement.removeEventListener(eventName, onMediaEvent);
|
|
5524
5540
|
};
|
|
5525
5541
|
});
|
|
5526
5542
|
this._canceller.signal.register(function () {
|
|
@@ -5531,23 +5547,160 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5531
5547
|
returnedSharedReference.finish();
|
|
5532
5548
|
});
|
|
5533
5549
|
return returnedSharedReference;
|
|
5534
|
-
function onInterval() {
|
|
5535
|
-
generateObservationForEvent("timeupdate");
|
|
5536
|
-
}
|
|
5537
5550
|
function restartInterval() {
|
|
5538
5551
|
clearInterval(intervalId);
|
|
5539
5552
|
intervalId = setInterval(onInterval, interval);
|
|
5540
5553
|
}
|
|
5541
5554
|
};
|
|
5542
|
-
_proto.
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5555
|
+
_proto._getCurrentObservation = function _getCurrentObservation(event) {
|
|
5556
|
+
var _a;
|
|
5557
|
+
/** Actual event emitted through an observation. */
|
|
5558
|
+
var tmpEvt = event;
|
|
5559
|
+
// NOTE: `this._observationRef` may be `undefined` because we might here be
|
|
5560
|
+
// called in the constructor when that property is not yet set.
|
|
5561
|
+
var previousObservation = this._observationRef === undefined ? getInitialObservation(this._mediaElement, this._withMediaSource) : this._observationRef.getValue();
|
|
5562
|
+
/**
|
|
5563
|
+
* If `true`, there is a seek operation ongoing but it was done from the
|
|
5564
|
+
* `PlaybackObserver`'s `setCurrentTime` method, not from external code.
|
|
5565
|
+
*/
|
|
5566
|
+
var isInternalSeeking = false;
|
|
5567
|
+
/** If set, the position for which we plan to seek to as soon as possible. */
|
|
5568
|
+
var pendingPosition = this._pendingSeek;
|
|
5569
|
+
/** Initially-polled playback observation, before adjustments. */
|
|
5570
|
+
var mediaTimings = getMediaInfos(this._mediaElement, this._withMediaSource);
|
|
5571
|
+
if (tmpEvt === "seeking") {
|
|
5572
|
+
// We just began seeking.
|
|
5573
|
+
// Let's find out if the seek is internal or external and handle approximate
|
|
5574
|
+
// seeking
|
|
5575
|
+
if (this._internalSeeksIncoming.length > 0) {
|
|
5576
|
+
isInternalSeeking = true;
|
|
5577
|
+
tmpEvt = "internal-seeking";
|
|
5578
|
+
var startedInternalSeekTime = this._internalSeeksIncoming.shift();
|
|
5579
|
+
this._expectedSeekingPosition = is_seeking_approximate ? Math.max(mediaTimings.position, startedInternalSeekTime !== null && startedInternalSeekTime !== void 0 ? startedInternalSeekTime : 0) : mediaTimings.position;
|
|
5580
|
+
} else {
|
|
5581
|
+
this._expectedSeekingPosition = mediaTimings.position;
|
|
5582
|
+
}
|
|
5583
|
+
} else if (mediaTimings.seeking) {
|
|
5584
|
+
// we're still seeking, this time without a "seeking" event so it's an
|
|
5585
|
+
// already handled one, keep track of the last wanted position we wanted
|
|
5586
|
+
// to seek to, to work-around devices re-seeking silently.
|
|
5587
|
+
this._expectedSeekingPosition = Math.max(mediaTimings.position, (_a = this._expectedSeekingPosition) !== null && _a !== void 0 ? _a : 0);
|
|
5588
|
+
} else if (is_seeking_approximate && this._expectedSeekingPosition !== null && mediaTimings.position < this._expectedSeekingPosition) {
|
|
5589
|
+
// We're on a target with aproximate seeking, we're not seeking anymore, but
|
|
5590
|
+
// we're not yet at the expected seeking position.
|
|
5591
|
+
// Signal to the rest of the application that the intented position is not
|
|
5592
|
+
// the current position but the one contained in `this._expectedSeekingPosition`
|
|
5593
|
+
pendingPosition = this._expectedSeekingPosition;
|
|
5594
|
+
} else {
|
|
5595
|
+
this._expectedSeekingPosition = null;
|
|
5596
|
+
}
|
|
5597
|
+
if (mediaTimings.seeking && previousObservation.seeking === 1 /* SeekingState.Internal */ && event !== "seeking") {
|
|
5598
|
+
isInternalSeeking = true;
|
|
5599
|
+
}
|
|
5600
|
+
var rebufferingStatus = getRebufferingStatus(previousObservation, mediaTimings, tmpEvt, {
|
|
5601
|
+
lowLatencyMode: this._lowLatencyMode,
|
|
5602
|
+
withMediaSource: this._withMediaSource
|
|
5603
|
+
});
|
|
5604
|
+
var freezingStatus = getFreezingStatus(previousObservation, mediaTimings, tmpEvt);
|
|
5605
|
+
var seeking = isInternalSeeking ? 1 /* SeekingState.Internal */ : mediaTimings.seeking ? 2 /* SeekingState.External */ : 0 /* SeekingState.None */;
|
|
5606
|
+
var timings = object_assign({}, mediaTimings, {
|
|
5607
|
+
position: new ObservationPosition(mediaTimings.position, pendingPosition),
|
|
5608
|
+
event: tmpEvt,
|
|
5609
|
+
seeking: seeking,
|
|
5610
|
+
rebuffering: rebufferingStatus,
|
|
5611
|
+
freezing: freezingStatus
|
|
5547
5612
|
});
|
|
5613
|
+
if (src_log.hasLevel("DEBUG")) {
|
|
5614
|
+
src_log.debug("API: current media element state tick", "event", timings.event, "position", timings.position.getPolled(), "seeking", timings.seeking, "internalSeek", isInternalSeeking, "rebuffering", timings.rebuffering !== null, "freezing", timings.freezing !== null, "ended", timings.ended, "paused", timings.paused, "playbackRate", timings.playbackRate, "readyState", timings.readyState);
|
|
5615
|
+
}
|
|
5616
|
+
return timings;
|
|
5617
|
+
};
|
|
5618
|
+
_proto._generateObservationForEvent = function _generateObservationForEvent(event) {
|
|
5619
|
+
var newObservation = this._getCurrentObservation(event);
|
|
5620
|
+
if (src_log.hasLevel("DEBUG")) {
|
|
5621
|
+
src_log.debug("API: current playback timeline:\n" + prettyPrintBuffered(newObservation.buffered, newObservation.position.getPolled()), "\n" + event);
|
|
5622
|
+
}
|
|
5623
|
+
this._observationRef.setValue(newObservation);
|
|
5548
5624
|
};
|
|
5549
5625
|
return PlaybackObserver;
|
|
5550
5626
|
}();
|
|
5627
|
+
|
|
5628
|
+
var ObservationPosition = /*#__PURE__*/function () {
|
|
5629
|
+
function ObservationPosition(last, wanted) {
|
|
5630
|
+
this._last = last;
|
|
5631
|
+
this._wanted = wanted;
|
|
5632
|
+
}
|
|
5633
|
+
/**
|
|
5634
|
+
* Returns the playback position actually observed on the media element at
|
|
5635
|
+
* the time the playback observation was made.
|
|
5636
|
+
*
|
|
5637
|
+
* Note that it may be different than the position for which media data is
|
|
5638
|
+
* wanted in rare scenarios where the goal position is not yet set on the
|
|
5639
|
+
* media element.
|
|
5640
|
+
*
|
|
5641
|
+
* You should use this value when you want to obtain the actual position set
|
|
5642
|
+
* on the media element for browser compatibility purposes. Note that this
|
|
5643
|
+
* position was calculated at observation time, it might thus not be
|
|
5644
|
+
* up-to-date if what you want is milliseconds-accuracy.
|
|
5645
|
+
*
|
|
5646
|
+
* If what you want is the actual position which the player is intended to
|
|
5647
|
+
* play, you should rely on `getWanted` instead`.
|
|
5648
|
+
* @returns {number}
|
|
5649
|
+
*/
|
|
5650
|
+
var _proto2 = ObservationPosition.prototype;
|
|
5651
|
+
_proto2.getPolled = function getPolled() {
|
|
5652
|
+
return this._last;
|
|
5653
|
+
}
|
|
5654
|
+
/**
|
|
5655
|
+
* Returns the position which the player should consider to load media data
|
|
5656
|
+
* at the time the observation was made.
|
|
5657
|
+
*
|
|
5658
|
+
* It can be different than the value returned by `getPolled` in rare
|
|
5659
|
+
* scenarios:
|
|
5660
|
+
*
|
|
5661
|
+
* - When the initial position has not been set yet.
|
|
5662
|
+
*
|
|
5663
|
+
* - When the current device do not let the RxPlayer peform precize seeks,
|
|
5664
|
+
* usually for perfomance reasons by seeking to a previous IDR frame
|
|
5665
|
+
* instead (for now only Tizen may be like this), in which case we
|
|
5666
|
+
* prefer to generally rely on the position wanted by the player (this
|
|
5667
|
+
* e.g. prevents issues where the RxPlayer logic and the device are
|
|
5668
|
+
* seeking back and forth in a loop).
|
|
5669
|
+
*
|
|
5670
|
+
* - When a wanted position has been "forced" (@see forceWantedPosition).
|
|
5671
|
+
* @returns {number}
|
|
5672
|
+
*/;
|
|
5673
|
+
_proto2.getWanted = function getWanted() {
|
|
5674
|
+
var _a;
|
|
5675
|
+
return (_a = this._wanted) !== null && _a !== void 0 ? _a : this._last;
|
|
5676
|
+
}
|
|
5677
|
+
/**
|
|
5678
|
+
* Method to call if you want to overwrite the currently wanted position.
|
|
5679
|
+
* @param {number} pos
|
|
5680
|
+
*/;
|
|
5681
|
+
_proto2.forceWantedPosition = function forceWantedPosition(pos) {
|
|
5682
|
+
this._wanted = pos;
|
|
5683
|
+
}
|
|
5684
|
+
/**
|
|
5685
|
+
* Returns `true` when the position wanted returned by `getWanted` and the
|
|
5686
|
+
* actual position returned by `getPolled` may be different, meaning that
|
|
5687
|
+
* we're currently not at the position we want to reach.
|
|
5688
|
+
*
|
|
5689
|
+
* This is a relatively rare situation which only happens when either the
|
|
5690
|
+
* initial seek has not yet been performed. on specific targets where the
|
|
5691
|
+
* seeking behavior is a little broken (@see getWanted) or when the wanted
|
|
5692
|
+
* position has been forced (@see forceWantedPosition).
|
|
5693
|
+
*
|
|
5694
|
+
* In those situations, you might temporarily refrain from acting upon the
|
|
5695
|
+
* actual current media position, as it may change soon.
|
|
5696
|
+
*
|
|
5697
|
+
* @returns {boolean}
|
|
5698
|
+
*/;
|
|
5699
|
+
_proto2.isAwaitingFuturePosition = function isAwaitingFuturePosition() {
|
|
5700
|
+
return this._wanted !== null;
|
|
5701
|
+
};
|
|
5702
|
+
return ObservationPosition;
|
|
5703
|
+
}();
|
|
5551
5704
|
/**
|
|
5552
5705
|
* Returns the amount of time in seconds the buffer should have ahead of the
|
|
5553
5706
|
* current position before resuming playback. Based on the infos of the
|
|
@@ -5559,7 +5712,6 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
5559
5712
|
* @param {Boolean} lowLatencyMode
|
|
5560
5713
|
* @returns {Number}
|
|
5561
5714
|
*/
|
|
5562
|
-
|
|
5563
5715
|
function getRebufferingEndGap(rebufferingStatus, lowLatencyMode) {
|
|
5564
5716
|
if (rebufferingStatus === null) {
|
|
5565
5717
|
return 0;
|
|
@@ -5596,10 +5748,9 @@ function hasLoadedUntilTheEnd(currentTime, currentRange, ended, duration, lowLat
|
|
|
5596
5748
|
/**
|
|
5597
5749
|
* Get basic playback information.
|
|
5598
5750
|
* @param {HTMLMediaElement} mediaElement
|
|
5599
|
-
* @param {string} event
|
|
5600
5751
|
* @returns {Object}
|
|
5601
5752
|
*/
|
|
5602
|
-
function getMediaInfos(mediaElement,
|
|
5753
|
+
function getMediaInfos(mediaElement, withMediaSource) {
|
|
5603
5754
|
var buffered = mediaElement.buffered,
|
|
5604
5755
|
currentTime = mediaElement.currentTime,
|
|
5605
5756
|
duration = mediaElement.duration,
|
|
@@ -5634,8 +5785,7 @@ function getMediaInfos(mediaElement, event, withMediaSource) {
|
|
|
5634
5785
|
paused: paused,
|
|
5635
5786
|
playbackRate: playbackRate,
|
|
5636
5787
|
readyState: readyState,
|
|
5637
|
-
seeking: seeking
|
|
5638
|
-
event: event
|
|
5788
|
+
seeking: seeking
|
|
5639
5789
|
};
|
|
5640
5790
|
}
|
|
5641
5791
|
/**
|
|
@@ -5647,16 +5797,16 @@ function getMediaInfos(mediaElement, event, withMediaSource) {
|
|
|
5647
5797
|
* @param {Object} currentInfo - Current set of basic information on the
|
|
5648
5798
|
* `HTMLMediaElement`. This does not need every single property from a regular
|
|
5649
5799
|
* playback observation.
|
|
5800
|
+
* @param {string} currentEvt
|
|
5650
5801
|
* @param {Object} options
|
|
5651
5802
|
* @returns {Object|null}
|
|
5652
5803
|
*/
|
|
5653
|
-
function getRebufferingStatus(prevObservation, currentInfo, _ref) {
|
|
5804
|
+
function getRebufferingStatus(prevObservation, currentInfo, currentEvt, _ref) {
|
|
5654
5805
|
var withMediaSource = _ref.withMediaSource,
|
|
5655
5806
|
lowLatencyMode = _ref.lowLatencyMode;
|
|
5656
5807
|
var _config$getCurrent4 = config.getCurrent(),
|
|
5657
5808
|
REBUFFERING_GAP = _config$getCurrent4.REBUFFERING_GAP;
|
|
5658
|
-
var
|
|
5659
|
-
currentTime = currentInfo.position,
|
|
5809
|
+
var currentTime = currentInfo.position,
|
|
5660
5810
|
bufferGap = currentInfo.bufferGap,
|
|
5661
5811
|
currentRange = currentInfo.currentRange,
|
|
5662
5812
|
duration = currentInfo.duration,
|
|
@@ -5703,9 +5853,9 @@ function getRebufferingStatus(prevObservation, currentInfo, _ref) {
|
|
|
5703
5853
|
// own, so we only try to detect when the media timestamp has not changed
|
|
5704
5854
|
// between two consecutive timeupdates
|
|
5705
5855
|
else {
|
|
5706
|
-
if (canSwitchToRebuffering && (!paused && currentEvt === "timeupdate" && prevEvt === "timeupdate" && currentTime === prevTime || currentEvt === "seeking" && (bufferGap === Infinity || bufferGap === undefined && readyState < 3))) {
|
|
5856
|
+
if (canSwitchToRebuffering && (!paused && currentEvt === "timeupdate" && prevEvt === "timeupdate" && currentTime === prevTime.getPolled() || currentEvt === "seeking" && (bufferGap === Infinity || bufferGap === undefined && readyState < 3))) {
|
|
5707
5857
|
shouldRebuffer = true;
|
|
5708
|
-
} else if (prevRebuffering !== null && (currentEvt !== "seeking" && currentTime !== prevTime || currentEvt === "canplay" || bufferGap === undefined && readyState >= 3 || bufferGap !== undefined && bufferGap < Infinity && (bufferGap > getRebufferingEndGap(prevRebuffering, lowLatencyMode) || fullyLoaded || ended))) {
|
|
5858
|
+
} else if (prevRebuffering !== null && (currentEvt !== "seeking" && currentTime !== prevTime.getPolled() || currentEvt === "canplay" || bufferGap === undefined && readyState >= 3 || bufferGap !== undefined && bufferGap < Infinity && (bufferGap > getRebufferingEndGap(prevRebuffering, lowLatencyMode) || fullyLoaded || ended))) {
|
|
5709
5859
|
shouldStopRebuffer = true;
|
|
5710
5860
|
}
|
|
5711
5861
|
}
|
|
@@ -5745,20 +5895,21 @@ function getRebufferingStatus(prevObservation, currentInfo, _ref) {
|
|
|
5745
5895
|
* `null` if not.
|
|
5746
5896
|
* @param {Object} prevObservation
|
|
5747
5897
|
* @param {Object} currentInfo
|
|
5898
|
+
* @param {string} currentEvt
|
|
5748
5899
|
* @returns {Object|null}
|
|
5749
5900
|
*/
|
|
5750
|
-
function getFreezingStatus(prevObservation, currentInfo) {
|
|
5901
|
+
function getFreezingStatus(prevObservation, currentInfo, currentEvt) {
|
|
5751
5902
|
var _config$getCurrent5 = config.getCurrent(),
|
|
5752
5903
|
MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING = _config$getCurrent5.MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;
|
|
5753
5904
|
if (prevObservation.freezing) {
|
|
5754
|
-
if (currentInfo.ended || currentInfo.paused || currentInfo.readyState === 0 || currentInfo.playbackRate === 0 || prevObservation.position !== currentInfo.position) {
|
|
5905
|
+
if (currentInfo.ended || currentInfo.paused || currentInfo.readyState === 0 || currentInfo.playbackRate === 0 || prevObservation.position.getPolled() !== currentInfo.position) {
|
|
5755
5906
|
return null; // Quit freezing status
|
|
5756
5907
|
}
|
|
5757
5908
|
|
|
5758
5909
|
return prevObservation.freezing; // Stay in it
|
|
5759
5910
|
}
|
|
5760
5911
|
|
|
5761
|
-
return
|
|
5912
|
+
return currentEvt === "timeupdate" && currentInfo.bufferGap !== undefined && currentInfo.bufferGap > MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING && !currentInfo.ended && !currentInfo.paused && currentInfo.readyState >= 1 && currentInfo.playbackRate !== 0 && currentInfo.position === prevObservation.position.getPolled() ? {
|
|
5762
5913
|
timestamp: getMonotonicTimeStamp()
|
|
5763
5914
|
} : null;
|
|
5764
5915
|
}
|
|
@@ -5860,6 +6011,26 @@ function generateReadOnlyObserver(src, transform, cancellationSignal) {
|
|
|
5860
6011
|
}
|
|
5861
6012
|
};
|
|
5862
6013
|
}
|
|
6014
|
+
/**
|
|
6015
|
+
* Generate the initial playback observation for when no event has yet been
|
|
6016
|
+
* emitted to lead to one.
|
|
6017
|
+
* @param {HTMLMediaElement} mediaElement
|
|
6018
|
+
* @param {boolean} withMediaSource
|
|
6019
|
+
* @returns {Object}
|
|
6020
|
+
*/
|
|
6021
|
+
function getInitialObservation(mediaElement, withMediaSource) {
|
|
6022
|
+
var mediaTimings = getMediaInfos(mediaElement, withMediaSource);
|
|
6023
|
+
return object_assign(mediaTimings, {
|
|
6024
|
+
rebuffering: null,
|
|
6025
|
+
event: "init",
|
|
6026
|
+
seeking: 0 /* SeekingState.None */,
|
|
6027
|
+
position: {
|
|
6028
|
+
last: mediaTimings.position,
|
|
6029
|
+
pending: undefined
|
|
6030
|
+
},
|
|
6031
|
+
freezing: null
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
5863
6034
|
;// CONCATENATED MODULE: ./src/core/api/track_management/track_dispatcher.ts
|
|
5864
6035
|
|
|
5865
6036
|
|
|
@@ -7078,7 +7249,7 @@ function emitSeekEvents(mediaElement, playbackObserver, onSeeking, onSeeked, can
|
|
|
7078
7249
|
if (cancelSignal.isCancelled() || mediaElement === null) {
|
|
7079
7250
|
return;
|
|
7080
7251
|
}
|
|
7081
|
-
var wasSeeking = playbackObserver.getReference().getValue().seeking
|
|
7252
|
+
var wasSeeking = playbackObserver.getReference().getValue().seeking === 2 /* SeekingState.External */;
|
|
7082
7253
|
if (wasSeeking) {
|
|
7083
7254
|
onSeeking();
|
|
7084
7255
|
if (cancelSignal.isCancelled()) {
|
|
@@ -7303,7 +7474,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7303
7474
|
// Workaround to support Firefox autoplay on FF 42.
|
|
7304
7475
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
7305
7476
|
videoElement.preload = "auto";
|
|
7306
|
-
_this.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
7477
|
+
_this.version = /* PLAYER_VERSION */"4.0.0-dev.2023121900";
|
|
7307
7478
|
_this.log = src_log;
|
|
7308
7479
|
_this.state = "STOPPED";
|
|
7309
7480
|
_this.videoElement = videoElement;
|
|
@@ -7730,12 +7901,12 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7730
7901
|
// keep previous metadata
|
|
7731
7902
|
case "ENDED":
|
|
7732
7903
|
_this2._priv_reloadingMetadata.reloadInPause = true;
|
|
7733
|
-
_this2._priv_reloadingMetadata.reloadPosition = playbackObserver.getReference().getValue().position;
|
|
7904
|
+
_this2._priv_reloadingMetadata.reloadPosition = playbackObserver.getReference().getValue().position.getPolled();
|
|
7734
7905
|
break;
|
|
7735
7906
|
default:
|
|
7736
7907
|
var o = playbackObserver.getReference().getValue();
|
|
7737
7908
|
_this2._priv_reloadingMetadata.reloadInPause = o.paused;
|
|
7738
|
-
_this2._priv_reloadingMetadata.reloadPosition = o.position;
|
|
7909
|
+
_this2._priv_reloadingMetadata.reloadPosition = o.position.getWanted();
|
|
7739
7910
|
break;
|
|
7740
7911
|
}
|
|
7741
7912
|
};
|
|
@@ -9349,24 +9520,24 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9349
9520
|
}
|
|
9350
9521
|
var maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() : undefined;
|
|
9351
9522
|
var positionData = {
|
|
9352
|
-
position: observation.position,
|
|
9523
|
+
position: observation.position.getPolled(),
|
|
9353
9524
|
duration: observation.duration,
|
|
9354
9525
|
playbackRate: observation.playbackRate,
|
|
9355
9526
|
maximumPosition: maximumPosition,
|
|
9356
9527
|
// TODO bufferGap may be undefined
|
|
9357
9528
|
bufferGap: observation.bufferGap === undefined || !isFinite(observation.bufferGap) ? 0 : observation.bufferGap
|
|
9358
9529
|
};
|
|
9359
|
-
if (manifest !== null && manifest.isLive && observation.position > 0) {
|
|
9530
|
+
if (manifest !== null && manifest.isLive && observation.position.getPolled() > 0) {
|
|
9360
9531
|
var ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
|
|
9361
|
-
positionData.wallClockTime = observation.position + ast;
|
|
9532
|
+
positionData.wallClockTime = observation.position.getPolled() + ast;
|
|
9362
9533
|
var livePosition = manifest.getLivePosition();
|
|
9363
9534
|
if (livePosition !== undefined) {
|
|
9364
|
-
positionData.liveGap = livePosition - observation.position;
|
|
9535
|
+
positionData.liveGap = livePosition - observation.position.getPolled();
|
|
9365
9536
|
}
|
|
9366
9537
|
} else if (isDirectFile && this.videoElement !== null) {
|
|
9367
9538
|
var startDate = getStartDate(this.videoElement);
|
|
9368
9539
|
if (startDate !== undefined) {
|
|
9369
|
-
positionData.wallClockTime = startDate + observation.position;
|
|
9540
|
+
positionData.wallClockTime = startDate + observation.position.getPolled();
|
|
9370
9541
|
}
|
|
9371
9542
|
}
|
|
9372
9543
|
this.trigger("positionUpdate", positionData);
|
|
@@ -9539,7 +9710,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9539
9710
|
}]);
|
|
9540
9711
|
return Player;
|
|
9541
9712
|
}(EventEmitter);
|
|
9542
|
-
Player.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
9713
|
+
Player.version = /* PLAYER_VERSION */"4.0.0-dev.2023121900";
|
|
9543
9714
|
/* harmony default export */ var public_api = (Player);
|
|
9544
9715
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
9545
9716
|
/**
|
|
@@ -10063,7 +10234,7 @@ function estimateStarvationModeBitrate(pendingRequests, playbackInfo, currentRep
|
|
|
10063
10234
|
speed = playbackInfo.speed,
|
|
10064
10235
|
position = playbackInfo.position;
|
|
10065
10236
|
var realBufferGap = isFinite(bufferGap) ? bufferGap : 0;
|
|
10066
|
-
var nextNeededPosition = position.
|
|
10237
|
+
var nextNeededPosition = position.getWanted() + realBufferGap;
|
|
10067
10238
|
var concernedRequests = getConcernedRequests(pendingRequests, nextNeededPosition);
|
|
10068
10239
|
if (concernedRequests.length !== 1) {
|
|
10069
10240
|
// 0 == no request
|
|
@@ -10126,7 +10297,7 @@ function shouldDirectlySwitchToLowBitrate(playbackInfo, requests, lowLatencyMode
|
|
|
10126
10297
|
return true;
|
|
10127
10298
|
}
|
|
10128
10299
|
var realBufferGap = isFinite(playbackInfo.bufferGap) ? playbackInfo.bufferGap : 0;
|
|
10129
|
-
var nextNeededPosition = playbackInfo.position.
|
|
10300
|
+
var nextNeededPosition = playbackInfo.position.getWanted() + realBufferGap;
|
|
10130
10301
|
var nextRequest = arrayFind(requests, function (_ref) {
|
|
10131
10302
|
var content = _ref.content;
|
|
10132
10303
|
return content.segment.duration > 0 && content.segment.time + content.segment.duration > nextNeededPosition;
|
|
@@ -10207,7 +10378,7 @@ var NetworkAnalyzer = /*#__PURE__*/function () {
|
|
|
10207
10378
|
var _config$getCurrent2 = config.getCurrent(),
|
|
10208
10379
|
ABR_STARVATION_DURATION_DELTA = _config$getCurrent2.ABR_STARVATION_DURATION_DELTA;
|
|
10209
10380
|
// check if should get in/out of starvation mode
|
|
10210
|
-
if (isNaN(duration) || realBufferGap + position.
|
|
10381
|
+
if (isNaN(duration) || realBufferGap + position.getWanted() < duration - ABR_STARVATION_DURATION_DELTA) {
|
|
10211
10382
|
if (!this._inStarvationMode && realBufferGap <= localConf.starvationGap) {
|
|
10212
10383
|
src_log.info("ABR: enter starvation mode.");
|
|
10213
10384
|
this._inStarvationMode = true;
|
|
@@ -11213,7 +11384,7 @@ function getEstimateReference(_ref, stopAllEstimates) {
|
|
|
11213
11384
|
position = _lastPlaybackObservat.position,
|
|
11214
11385
|
speed = _lastPlaybackObservat.speed;
|
|
11215
11386
|
var timeRanges = val.buffered;
|
|
11216
|
-
var bufferGap = getLeftSizeOfBufferedTimeRange(timeRanges, position.
|
|
11387
|
+
var bufferGap = getLeftSizeOfBufferedTimeRange(timeRanges, position.getWanted());
|
|
11217
11388
|
var representation = val.content.representation;
|
|
11218
11389
|
var currentScore = scoreCalculator.getEstimate(representation);
|
|
11219
11390
|
var currentBitrate = representation.bitrate;
|
|
@@ -11307,7 +11478,7 @@ function getEstimateReference(_ref, stopAllEstimates) {
|
|
|
11307
11478
|
* `null` if not enabled or if there's currently no guess.
|
|
11308
11479
|
*/
|
|
11309
11480
|
var chosenRepFromGuessMode = null;
|
|
11310
|
-
if (lowLatencyMode && currentRepresentationVal !== null && context.manifest.isDynamic && maximumPosition - position.
|
|
11481
|
+
if (lowLatencyMode && currentRepresentationVal !== null && context.manifest.isDynamic && maximumPosition - position.getWanted() < 40) {
|
|
11311
11482
|
chosenRepFromGuessMode = guessBasedChooser.getGuess(sortedRepresentations, lastPlaybackObservation, currentRepresentationVal, currentBestBitrate, requests);
|
|
11312
11483
|
}
|
|
11313
11484
|
if (chosenRepFromGuessMode !== null && chosenRepFromGuessMode.bitrate > currentBestBitrate) {
|
|
@@ -12393,7 +12564,7 @@ var Adaptation = /*#__PURE__*/function () {
|
|
|
12393
12564
|
var reprObject = {
|
|
12394
12565
|
id: representation.id,
|
|
12395
12566
|
bitrate: representation.bitrate,
|
|
12396
|
-
codec: representation.codec,
|
|
12567
|
+
codecs: representation.codec === undefined ? [] : [representation.codec],
|
|
12397
12568
|
height: representation.height,
|
|
12398
12569
|
width: representation.width,
|
|
12399
12570
|
frameRate: representation.frameRate,
|
|
@@ -15886,7 +16057,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
15886
16057
|
var removed = inventory.splice(indexBefore, numberOfSegmentToDelete);
|
|
15887
16058
|
for (var _iterator = segment_inventory_createForOfIteratorHelperLoose(removed), _step; !(_step = _iterator()).done;) {
|
|
15888
16059
|
var seg = _step.value;
|
|
15889
|
-
if (seg.bufferedStart === undefined && seg.bufferedEnd === undefined) {
|
|
16060
|
+
if (seg.bufferedStart === undefined && seg.bufferedEnd === undefined && seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
15890
16061
|
this._bufferedHistory.addBufferedSegment(seg.infos, null);
|
|
15891
16062
|
}
|
|
15892
16063
|
}
|
|
@@ -15939,7 +16110,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
15939
16110
|
var _removed = inventory.splice(inventoryIndex, inventory.length - inventoryIndex);
|
|
15940
16111
|
for (var _iterator2 = segment_inventory_createForOfIteratorHelperLoose(_removed), _step2; !(_step2 = _iterator2()).done;) {
|
|
15941
16112
|
var _seg = _step2.value;
|
|
15942
|
-
if (_seg.bufferedStart === undefined && _seg.bufferedEnd === undefined) {
|
|
16113
|
+
if (_seg.bufferedStart === undefined && _seg.bufferedEnd === undefined && _seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
15943
16114
|
this._bufferedHistory.addBufferedSegment(_seg.infos, null);
|
|
15944
16115
|
}
|
|
15945
16116
|
}
|
|
@@ -15955,7 +16126,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
15955
16126
|
* segment have been inserted, you should call the `completeSegment` method.
|
|
15956
16127
|
* @param {Object} chunkInformation
|
|
15957
16128
|
*/;
|
|
15958
|
-
_proto.insertChunk = function insertChunk(_ref) {
|
|
16129
|
+
_proto.insertChunk = function insertChunk(_ref, succeed) {
|
|
15959
16130
|
var period = _ref.period,
|
|
15960
16131
|
adaptation = _ref.adaptation,
|
|
15961
16132
|
representation = _ref.representation,
|
|
@@ -15973,7 +16144,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
15973
16144
|
}
|
|
15974
16145
|
var inventory = this._inventory;
|
|
15975
16146
|
var newSegment = {
|
|
15976
|
-
|
|
16147
|
+
status: succeed ? 0 /* ChunkStatus.PartiallyPushed */ : 2 /* ChunkStatus.Failed */,
|
|
15977
16148
|
chunkSize: chunkSize,
|
|
15978
16149
|
splitted: false,
|
|
15979
16150
|
start: start,
|
|
@@ -16169,7 +16340,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
16169
16340
|
// ===> : |--|====|-|
|
|
16170
16341
|
src_log.warn("SI: Segment pushed is contained in a previous one", bufferType, start, end, segmentI.start, segmentI.end);
|
|
16171
16342
|
var nextSegment = {
|
|
16172
|
-
|
|
16343
|
+
status: segmentI.status,
|
|
16173
16344
|
/**
|
|
16174
16345
|
* Note: this sadly means we're doing as if
|
|
16175
16346
|
* that chunk is present two times.
|
|
@@ -16322,7 +16493,10 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
16322
16493
|
this._inventory.splice(firstI + 1, length);
|
|
16323
16494
|
i -= length;
|
|
16324
16495
|
}
|
|
16325
|
-
this._inventory[firstI].
|
|
16496
|
+
if (this._inventory[firstI].status === 0 /* ChunkStatus.PartiallyPushed */) {
|
|
16497
|
+
this._inventory[firstI].status = 1 /* ChunkStatus.Complete */;
|
|
16498
|
+
}
|
|
16499
|
+
|
|
16326
16500
|
this._inventory[firstI].chunkSize = segmentSize;
|
|
16327
16501
|
this._inventory[firstI].end = lastEnd;
|
|
16328
16502
|
this._inventory[firstI].bufferedEnd = lastBufferedEnd;
|
|
@@ -16337,10 +16511,12 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
16337
16511
|
for (var _iterator3 = segment_inventory_createForOfIteratorHelperLoose(resSegments), _step3; !(_step3 = _iterator3()).done;) {
|
|
16338
16512
|
var seg = _step3.value;
|
|
16339
16513
|
if (seg.bufferedStart !== undefined && seg.bufferedEnd !== undefined) {
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16514
|
+
if (seg.status !== 2 /* ChunkStatus.Failed */) {
|
|
16515
|
+
this._bufferedHistory.addBufferedSegment(seg.infos, {
|
|
16516
|
+
start: seg.bufferedStart,
|
|
16517
|
+
end: seg.bufferedEnd
|
|
16518
|
+
});
|
|
16519
|
+
}
|
|
16344
16520
|
} else {
|
|
16345
16521
|
src_log.debug("SI: buffered range not known after sync. Skipping history.", seg.start, seg.end);
|
|
16346
16522
|
}
|
|
@@ -16383,7 +16559,7 @@ var SegmentInventory = /*#__PURE__*/function () {
|
|
|
16383
16559
|
*/
|
|
16384
16560
|
|
|
16385
16561
|
function bufferedStartLooksCoherent(thisSegment) {
|
|
16386
|
-
if (thisSegment.bufferedStart === undefined || thisSegment.
|
|
16562
|
+
if (thisSegment.bufferedStart === undefined || thisSegment.status !== 1 /* ChunkStatus.Complete */) {
|
|
16387
16563
|
return false;
|
|
16388
16564
|
}
|
|
16389
16565
|
var start = thisSegment.start,
|
|
@@ -16401,7 +16577,7 @@ function bufferedStartLooksCoherent(thisSegment) {
|
|
|
16401
16577
|
* @returns {Boolean}
|
|
16402
16578
|
*/
|
|
16403
16579
|
function bufferedEndLooksCoherent(thisSegment) {
|
|
16404
|
-
if (thisSegment.bufferedEnd === undefined || thisSegment.
|
|
16580
|
+
if (thisSegment.bufferedEnd === undefined || thisSegment.status !== 1 /* ChunkStatus.Complete */) {
|
|
16405
16581
|
return false;
|
|
16406
16582
|
}
|
|
16407
16583
|
var start = thisSegment.start,
|
|
@@ -16951,7 +17127,12 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
16951
17127
|
this._lastInitSegmentUniqueId = null; // initialize init segment as a security
|
|
16952
17128
|
if (this._pendingTask !== null) {
|
|
16953
17129
|
var error = err instanceof Error ? err : new Error("An unknown error occured when doing operations " + "on the SourceBuffer");
|
|
16954
|
-
this._pendingTask
|
|
17130
|
+
var task = this._pendingTask;
|
|
17131
|
+
if (task.type === SegmentBufferOperation.Push && task.data.length === 0 && task.inventoryData !== null) {
|
|
17132
|
+
this._segmentInventory.insertChunk(task.inventoryData, false);
|
|
17133
|
+
}
|
|
17134
|
+
this._pendingTask = null;
|
|
17135
|
+
task.reject(error);
|
|
16955
17136
|
}
|
|
16956
17137
|
}
|
|
16957
17138
|
/**
|
|
@@ -17002,7 +17183,7 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
17002
17183
|
switch (task.type) {
|
|
17003
17184
|
case SegmentBufferOperation.Push:
|
|
17004
17185
|
if (task.inventoryData !== null) {
|
|
17005
|
-
this._segmentInventory.insertChunk(task.inventoryData);
|
|
17186
|
+
this._segmentInventory.insertChunk(task.inventoryData, true);
|
|
17006
17187
|
}
|
|
17007
17188
|
break;
|
|
17008
17189
|
case SegmentBufferOperation.EndOfSegment:
|
|
@@ -17834,8 +18015,7 @@ function BufferGarbageCollector(_ref, cancellationSignal) {
|
|
|
17834
18015
|
maxBufferAhead = _ref.maxBufferAhead;
|
|
17835
18016
|
var lastPosition;
|
|
17836
18017
|
playbackObserver.listen(function (o) {
|
|
17837
|
-
|
|
17838
|
-
lastPosition = (_a = o.position.pending) !== null && _a !== void 0 ? _a : o.position.last;
|
|
18018
|
+
lastPosition = o.position.getWanted();
|
|
17839
18019
|
clean();
|
|
17840
18020
|
}, {
|
|
17841
18021
|
includeLastObservation: true,
|
|
@@ -19277,7 +19457,7 @@ function getPlayableBufferedSegments(neededRange, segmentInventory) {
|
|
|
19277
19457
|
for (var i = segmentInventory.length - 1; i >= 0; i--) {
|
|
19278
19458
|
var eltInventory = segmentInventory[i];
|
|
19279
19459
|
var representation = eltInventory.infos.representation;
|
|
19280
|
-
if (
|
|
19460
|
+
if (eltInventory.status === 1 /* ChunkStatus.Complete */ && representation.decipherable !== false && representation.isSupported) {
|
|
19281
19461
|
var inventorySegment = eltInventory.infos.segment;
|
|
19282
19462
|
var eltInventoryStart = inventorySegment.time / inventorySegment.timescale;
|
|
19283
19463
|
var eltInventoryEnd = !inventorySegment.complete ? eltInventory.end : eltInventoryStart + inventorySegment.duration / inventorySegment.timescale;
|
|
@@ -19461,7 +19641,7 @@ function appendSegmentToBuffer(_x, _x2, _x3, _x4) {
|
|
|
19461
19641
|
}
|
|
19462
19642
|
function _appendSegmentToBuffer() {
|
|
19463
19643
|
_appendSegmentToBuffer = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(playbackObserver, segmentBuffer, dataInfos, cancellationSignal) {
|
|
19464
|
-
var
|
|
19644
|
+
var reason, _playbackObserver$get, position, currentPos, _reason;
|
|
19465
19645
|
return regenerator_default().wrap(function _callee$(_context) {
|
|
19466
19646
|
while (1) switch (_context.prev = _context.next) {
|
|
19467
19647
|
case 0:
|
|
@@ -19490,7 +19670,7 @@ function _appendSegmentToBuffer() {
|
|
|
19490
19670
|
});
|
|
19491
19671
|
case 14:
|
|
19492
19672
|
_playbackObserver$get = playbackObserver.getReference().getValue(), position = _playbackObserver$get.position;
|
|
19493
|
-
currentPos =
|
|
19673
|
+
currentPos = position.getWanted();
|
|
19494
19674
|
_context.prev = 16;
|
|
19495
19675
|
_context.next = 19;
|
|
19496
19676
|
return forceGarbageCollection(currentPos, segmentBuffer, cancellationSignal);
|
|
@@ -19896,13 +20076,12 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
19896
20076
|
* issues at the current time, calling the right callbacks if necessary.
|
|
19897
20077
|
*/
|
|
19898
20078
|
function checkStatus() {
|
|
19899
|
-
var _a, _b;
|
|
19900
20079
|
if (segmentsLoadingCanceller.isUsed()) {
|
|
19901
20080
|
return; // Stop all buffer status checking if load operations are stopped
|
|
19902
20081
|
}
|
|
19903
20082
|
|
|
19904
20083
|
var observation = playbackObserver.getReference().getValue();
|
|
19905
|
-
var initialWantedTime =
|
|
20084
|
+
var initialWantedTime = observation.position.getWanted();
|
|
19906
20085
|
var status = getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitchThreshold.getValue(), bufferGoal.getValue(), maxBufferSize.getValue(), segmentBuffer);
|
|
19907
20086
|
var neededSegments = status.neededSegments;
|
|
19908
20087
|
var neededInitSegment = null;
|
|
@@ -19913,7 +20092,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
19913
20092
|
} else if (initSegmentState.isLoaded) {
|
|
19914
20093
|
src_log.warn("Stream: Uninitialized index with an already loaded " + "initialization segment");
|
|
19915
20094
|
} else {
|
|
19916
|
-
var wantedStart =
|
|
20095
|
+
var wantedStart = observation.position.getWanted();
|
|
19917
20096
|
neededInitSegment = {
|
|
19918
20097
|
segment: initSegmentState.segment,
|
|
19919
20098
|
priority: getSegmentPriority(period.start, wantedStart)
|
|
@@ -19966,7 +20145,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
19966
20145
|
}
|
|
19967
20146
|
callbacks.streamStatusUpdate({
|
|
19968
20147
|
period: period,
|
|
19969
|
-
position: observation.position.
|
|
20148
|
+
position: observation.position.getWanted(),
|
|
19970
20149
|
bufferType: bufferType,
|
|
19971
20150
|
imminentDiscontinuity: status.imminentDiscontinuity,
|
|
19972
20151
|
isEmptyStream: false,
|
|
@@ -20234,22 +20413,30 @@ function getRepresentationsSwitchingStrategy(period, adaptation, settings, segme
|
|
|
20234
20413
|
value: undefined
|
|
20235
20414
|
};
|
|
20236
20415
|
}
|
|
20237
|
-
var currentTime = playbackObserver.getCurrentTime();
|
|
20238
20416
|
var readyState = playbackObserver.getReadyState();
|
|
20239
|
-
if (settings.switchingMode === "reload" &&
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20417
|
+
if (settings.switchingMode === "reload" && readyState > 1) {
|
|
20418
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
20419
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
20420
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
20421
|
+
// seek-back...), just reload as checks here would be too complex
|
|
20422
|
+
return {
|
|
20423
|
+
type: "needs-reload",
|
|
20424
|
+
value: undefined
|
|
20425
|
+
};
|
|
20426
|
+
} else {
|
|
20427
|
+
var currentTime = playbackObserver.getCurrentTime();
|
|
20428
|
+
if (isTimeInRange({
|
|
20429
|
+
start: start,
|
|
20430
|
+
end: end
|
|
20431
|
+
}, currentTime) &&
|
|
20432
|
+
// We're not playing the current wanted video Adaptation
|
|
20433
|
+
!isTimeInRanges(rangesWithReps, currentTime)) {
|
|
20434
|
+
return {
|
|
20435
|
+
type: "needs-reload",
|
|
20436
|
+
value: undefined
|
|
20437
|
+
};
|
|
20438
|
+
}
|
|
20439
|
+
}
|
|
20253
20440
|
}
|
|
20254
20441
|
// From here, clean-up data from the previous Adaptation, if one
|
|
20255
20442
|
var shouldFlush = settings.switchingMode === "direct";
|
|
@@ -20282,9 +20469,10 @@ function getRepresentationsSwitchingStrategy(period, adaptation, settings, segme
|
|
|
20282
20469
|
if (paddingAfter == null) {
|
|
20283
20470
|
paddingAfter = 0;
|
|
20284
20471
|
}
|
|
20472
|
+
var _currentTime = playbackObserver.getCurrentTime();
|
|
20285
20473
|
rangesToExclude.push({
|
|
20286
|
-
start:
|
|
20287
|
-
end:
|
|
20474
|
+
start: _currentTime - paddingBefore,
|
|
20475
|
+
end: _currentTime + paddingAfter
|
|
20288
20476
|
});
|
|
20289
20477
|
}
|
|
20290
20478
|
// Now remove possible small range from the end if there is a segment from the
|
|
@@ -20912,10 +21100,10 @@ function areCodecsCompatible(a, b) {
|
|
|
20912
21100
|
* @param {Object} segmentBuffer
|
|
20913
21101
|
* @param {Object} period
|
|
20914
21102
|
* @param {Object} adaptation
|
|
20915
|
-
* @param {Object}
|
|
21103
|
+
* @param {Object} playbackObserver
|
|
20916
21104
|
* @returns {Object}
|
|
20917
21105
|
*/
|
|
20918
|
-
function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchingMode,
|
|
21106
|
+
function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchingMode, playbackObserver, options) {
|
|
20919
21107
|
if (segmentBuffer.codec !== undefined && options.onCodecSwitch === "reload" && !hasCompatibleCodec(adaptation, segmentBuffer.codec)) {
|
|
20920
21108
|
return {
|
|
20921
21109
|
type: "needs-reload",
|
|
@@ -20967,24 +21155,28 @@ function getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, switchin
|
|
|
20967
21155
|
value: undefined
|
|
20968
21156
|
};
|
|
20969
21157
|
}
|
|
20970
|
-
var currentTime =
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
21158
|
+
var currentTime = playbackObserver.getCurrentTime();
|
|
21159
|
+
var readyState = playbackObserver.getReadyState();
|
|
21160
|
+
if (switchingMode === "reload" && readyState > 1) {
|
|
21161
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
21162
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
21163
|
+
// We are not at the position we want to reach (e.g. initial seek, tizen
|
|
21164
|
+
// seek-back...), just reload as checks here would be too complex
|
|
21165
|
+
return {
|
|
21166
|
+
type: "needs-reload",
|
|
21167
|
+
value: undefined
|
|
21168
|
+
};
|
|
21169
|
+
} else if (isTimeInRange({
|
|
21170
|
+
start: start,
|
|
21171
|
+
end: end
|
|
21172
|
+
}, currentTime) &&
|
|
21173
|
+
// We're not playing the current wanted video Adaptation
|
|
21174
|
+
!isTimeInRanges(adaptationInBuffer, currentTime)) {
|
|
21175
|
+
return {
|
|
21176
|
+
type: "needs-reload",
|
|
21177
|
+
value: undefined
|
|
21178
|
+
};
|
|
21179
|
+
}
|
|
20988
21180
|
}
|
|
20989
21181
|
// From here, clean-up data from the previous Adaptation, if one
|
|
20990
21182
|
var shouldCleanAll = switchingMode === "direct";
|
|
@@ -21066,7 +21258,7 @@ function hasCompatibleCodec(adaptation, segmentBufferCodec) {
|
|
|
21066
21258
|
/**
|
|
21067
21259
|
* Returns buffered ranges of what we know correspond to the given `adaptation`
|
|
21068
21260
|
* in the SegmentBuffer.
|
|
21069
|
-
* @param {Object}
|
|
21261
|
+
* @param {Array.<Object>} inventory
|
|
21070
21262
|
* @param {Object} period
|
|
21071
21263
|
* @param {Object} adaptation
|
|
21072
21264
|
* @returns {Array.<Object>}
|
|
@@ -21184,7 +21376,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
21184
21376
|
adaptationRef.onUpdate(function (choice) {
|
|
21185
21377
|
// As an IIFE to profit from async/await while respecting onUpdate's signature
|
|
21186
21378
|
_asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee() {
|
|
21187
|
-
var _a, streamCanceller, segmentBufferStatus, periodEnd, _config$getCurrent, DELTA_POSITION_AFTER_RELOAD, relativePosAfterSwitch, adaptation, representations,
|
|
21379
|
+
var _a, streamCanceller, segmentBufferStatus, periodEnd, _config$getCurrent, DELTA_POSITION_AFTER_RELOAD, relativePosAfterSwitch, adaptation, representations, segmentBuffer, strategy, _iterator3, _step3, _step3$value, start, end;
|
|
21188
21380
|
return regenerator_default().wrap(function _callee$(_context) {
|
|
21189
21381
|
while (1) switch (_context.prev = _context.next) {
|
|
21190
21382
|
case 0:
|
|
@@ -21309,65 +21501,60 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
21309
21501
|
}
|
|
21310
21502
|
return _context.abrupt("return");
|
|
21311
21503
|
case 45:
|
|
21312
|
-
readyState = playbackObserver.getReadyState();
|
|
21313
21504
|
segmentBuffer = createOrReuseSegmentBuffer(segmentBuffersStore, bufferType, adaptation, options);
|
|
21314
|
-
|
|
21315
|
-
currentTime: playbackObserver.getCurrentTime(),
|
|
21316
|
-
readyState: readyState
|
|
21317
|
-
};
|
|
21318
|
-
strategy = getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, choice.switchingMode, playbackInfos, options);
|
|
21505
|
+
strategy = getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, choice.switchingMode, playbackObserver, options);
|
|
21319
21506
|
if (!(strategy.type === "needs-reload")) {
|
|
21320
|
-
_context.next =
|
|
21507
|
+
_context.next = 49;
|
|
21321
21508
|
break;
|
|
21322
21509
|
}
|
|
21323
21510
|
return _context.abrupt("return", askForMediaSourceReload(relativePosAfterSwitch, true, streamCanceller.signal));
|
|
21324
|
-
case
|
|
21325
|
-
_context.next =
|
|
21511
|
+
case 49:
|
|
21512
|
+
_context.next = 51;
|
|
21326
21513
|
return segmentBuffersStore.waitForUsableBuffers(streamCanceller.signal);
|
|
21327
|
-
case
|
|
21514
|
+
case 51:
|
|
21328
21515
|
if (!streamCanceller.isUsed()) {
|
|
21329
|
-
_context.next =
|
|
21516
|
+
_context.next = 53;
|
|
21330
21517
|
break;
|
|
21331
21518
|
}
|
|
21332
21519
|
return _context.abrupt("return");
|
|
21333
|
-
case
|
|
21520
|
+
case 53:
|
|
21334
21521
|
if (!(strategy.type === "flush-buffer" || strategy.type === "clean-buffer")) {
|
|
21335
|
-
_context.next =
|
|
21522
|
+
_context.next = 67;
|
|
21336
21523
|
break;
|
|
21337
21524
|
}
|
|
21338
21525
|
_iterator3 = period_stream_createForOfIteratorHelperLoose(strategy.value);
|
|
21339
|
-
case
|
|
21526
|
+
case 55:
|
|
21340
21527
|
if ((_step3 = _iterator3()).done) {
|
|
21341
|
-
_context.next =
|
|
21528
|
+
_context.next = 63;
|
|
21342
21529
|
break;
|
|
21343
21530
|
}
|
|
21344
21531
|
_step3$value = _step3.value, start = _step3$value.start, end = _step3$value.end;
|
|
21345
|
-
_context.next =
|
|
21532
|
+
_context.next = 59;
|
|
21346
21533
|
return segmentBuffer.removeBuffer(start, end, streamCanceller.signal);
|
|
21347
|
-
case
|
|
21534
|
+
case 59:
|
|
21348
21535
|
if (!streamCanceller.isUsed()) {
|
|
21349
|
-
_context.next =
|
|
21536
|
+
_context.next = 61;
|
|
21350
21537
|
break;
|
|
21351
21538
|
}
|
|
21352
21539
|
return _context.abrupt("return");
|
|
21353
|
-
case
|
|
21354
|
-
_context.next =
|
|
21540
|
+
case 61:
|
|
21541
|
+
_context.next = 55;
|
|
21355
21542
|
break;
|
|
21356
|
-
case
|
|
21543
|
+
case 63:
|
|
21357
21544
|
if (!(strategy.type === "flush-buffer")) {
|
|
21358
|
-
_context.next =
|
|
21545
|
+
_context.next = 67;
|
|
21359
21546
|
break;
|
|
21360
21547
|
}
|
|
21361
21548
|
callbacks.needsBufferFlush();
|
|
21362
21549
|
if (!streamCanceller.isUsed()) {
|
|
21363
|
-
_context.next =
|
|
21550
|
+
_context.next = 67;
|
|
21364
21551
|
break;
|
|
21365
21552
|
}
|
|
21366
21553
|
return _context.abrupt("return");
|
|
21367
|
-
case
|
|
21554
|
+
case 67:
|
|
21368
21555
|
garbageCollectors.get(segmentBuffer)(streamCanceller.signal);
|
|
21369
21556
|
createAdaptationStream(adaptation, representations, segmentBuffer, streamCanceller.signal);
|
|
21370
|
-
case
|
|
21557
|
+
case 69:
|
|
21371
21558
|
case "end":
|
|
21372
21559
|
return _context.stop();
|
|
21373
21560
|
}
|
|
@@ -21525,7 +21712,7 @@ function createAdaptationStreamPlaybackObserver(initialPlaybackObserver, segment
|
|
|
21525
21712
|
function constructAdaptationStreamPlaybackObservation() {
|
|
21526
21713
|
var baseObservation = observationRef.getValue();
|
|
21527
21714
|
var buffered = segmentBuffer.getBufferedRanges();
|
|
21528
|
-
var bufferGap = getLeftSizeOfBufferedTimeRange(buffered, baseObservation.position.
|
|
21715
|
+
var bufferGap = getLeftSizeOfBufferedTimeRange(buffered, baseObservation.position.getWanted());
|
|
21529
21716
|
return object_assign({}, baseObservation, {
|
|
21530
21717
|
bufferGap: bufferGap
|
|
21531
21718
|
});
|
|
@@ -21561,7 +21748,7 @@ function createEmptyAdaptationStream(playbackObserver, wantedBufferAhead, buffer
|
|
|
21561
21748
|
function sendStatus() {
|
|
21562
21749
|
var observation = playbackObserver.getReference().getValue();
|
|
21563
21750
|
var wba = wantedBufferAhead.getValue();
|
|
21564
|
-
var position = observation.position.
|
|
21751
|
+
var position = observation.position.getWanted();
|
|
21565
21752
|
if (period.end !== undefined && position + wba >= period.end) {
|
|
21566
21753
|
src_log.debug("Stream: full \"empty\" AdaptationStream", bufferType);
|
|
21567
21754
|
hasFinishedLoading = true;
|
|
@@ -21569,8 +21756,8 @@ function createEmptyAdaptationStream(playbackObserver, wantedBufferAhead, buffer
|
|
|
21569
21756
|
callbacks.streamStatusUpdate({
|
|
21570
21757
|
period: period,
|
|
21571
21758
|
bufferType: bufferType,
|
|
21572
|
-
position: position,
|
|
21573
21759
|
imminentDiscontinuity: null,
|
|
21760
|
+
position: position,
|
|
21574
21761
|
isEmptyStream: true,
|
|
21575
21762
|
hasFinishedLoading: hasFinishedLoading,
|
|
21576
21763
|
neededSegments: []
|
|
@@ -21744,14 +21931,16 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21744
21931
|
wantedBufferAhead = options.wantedBufferAhead,
|
|
21745
21932
|
maxVideoBufferSize = options.maxVideoBufferSize;
|
|
21746
21933
|
var _config$getCurrent = config.getCurrent(),
|
|
21934
|
+
MINIMUM_MAX_BUFFER_AHEAD = _config$getCurrent.MINIMUM_MAX_BUFFER_AHEAD,
|
|
21747
21935
|
MAXIMUM_MAX_BUFFER_AHEAD = _config$getCurrent.MAXIMUM_MAX_BUFFER_AHEAD,
|
|
21748
21936
|
MAXIMUM_MAX_BUFFER_BEHIND = _config$getCurrent.MAXIMUM_MAX_BUFFER_BEHIND;
|
|
21749
21937
|
// Keep track of a unique BufferGarbageCollector created per
|
|
21750
21938
|
// SegmentBuffer.
|
|
21751
21939
|
var garbageCollectors = new WeakMapMemory(function (segmentBuffer) {
|
|
21940
|
+
var _a, _b;
|
|
21752
21941
|
var bufferType = segmentBuffer.bufferType;
|
|
21753
|
-
var defaultMaxBehind = MAXIMUM_MAX_BUFFER_BEHIND[bufferType]
|
|
21754
|
-
var
|
|
21942
|
+
var defaultMaxBehind = (_a = MAXIMUM_MAX_BUFFER_BEHIND[bufferType]) !== null && _a !== void 0 ? _a : Infinity;
|
|
21943
|
+
var maxAheadHigherBound = (_b = MAXIMUM_MAX_BUFFER_AHEAD[bufferType]) !== null && _b !== void 0 ? _b : Infinity;
|
|
21755
21944
|
return function (gcCancelSignal) {
|
|
21756
21945
|
BufferGarbageCollector({
|
|
21757
21946
|
segmentBuffer: segmentBuffer,
|
|
@@ -21760,7 +21949,9 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21760
21949
|
return Math.min(val, defaultMaxBehind);
|
|
21761
21950
|
}, gcCancelSignal),
|
|
21762
21951
|
maxBufferAhead: createMappedReference(maxBufferAhead, function (val) {
|
|
21763
|
-
|
|
21952
|
+
var _a;
|
|
21953
|
+
var lowerBound = Math.max(val, (_a = MINIMUM_MAX_BUFFER_AHEAD[bufferType]) !== null && _a !== void 0 ? _a : 0);
|
|
21954
|
+
return Math.min(lowerBound, maxAheadHigherBound);
|
|
21764
21955
|
}, gcCancelSignal)
|
|
21765
21956
|
}, gcCancelSignal);
|
|
21766
21957
|
};
|
|
@@ -21799,8 +21990,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21799
21990
|
// than the ones already considered
|
|
21800
21991
|
playbackObserver.listen(function (_ref) {
|
|
21801
21992
|
var position = _ref.position;
|
|
21802
|
-
var _a
|
|
21803
|
-
var time =
|
|
21993
|
+
var _a;
|
|
21994
|
+
var time = position.getWanted();
|
|
21804
21995
|
if (!enableOutOfBoundsCheck || !isOutOfPeriodList(time)) {
|
|
21805
21996
|
return;
|
|
21806
21997
|
}
|
|
@@ -21818,7 +22009,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21818
22009
|
currentCanceller.cancel();
|
|
21819
22010
|
currentCanceller = new TaskCanceller();
|
|
21820
22011
|
currentCanceller.linkToSignal(orchestratorCancelSignal);
|
|
21821
|
-
var nextPeriod = (
|
|
22012
|
+
var nextPeriod = (_a = manifest.getPeriodForTime(time)) !== null && _a !== void 0 ? _a : manifest.getNextPeriod(time);
|
|
21822
22013
|
if (nextPeriod === undefined) {
|
|
21823
22014
|
src_log.warn("Stream: The wanted position is not found in the Manifest.");
|
|
21824
22015
|
return;
|
|
@@ -21990,7 +22181,6 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21990
22181
|
// to reduce the risk of race conditions where the next observation
|
|
21991
22182
|
// was going to be emitted synchronously.
|
|
21992
22183
|
queue_microtask(function () {
|
|
21993
|
-
var _a;
|
|
21994
22184
|
if (orchestratorCancelSignal.isCancelled()) {
|
|
21995
22185
|
return;
|
|
21996
22186
|
}
|
|
@@ -22007,7 +22197,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
22007
22197
|
return;
|
|
22008
22198
|
}
|
|
22009
22199
|
}
|
|
22010
|
-
var lastPosition =
|
|
22200
|
+
var lastPosition = observation.position.getWanted();
|
|
22011
22201
|
var newInitialPeriod = manifest.getPeriodForTime(lastPosition);
|
|
22012
22202
|
if (newInitialPeriod == null) {
|
|
22013
22203
|
callbacks.error(new MediaError("MEDIA_TIME_NOT_FOUND", "The wanted position is not found in the Manifest."));
|
|
@@ -22069,9 +22259,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
22069
22259
|
// that Period.
|
|
22070
22260
|
playbackObserver.listen(function (_ref2, stopListeningObservations) {
|
|
22071
22261
|
var position = _ref2.position;
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
src_log.info("Stream: Destroying PeriodStream as the current playhead moved above it", bufferType, basePeriod.start, (_b = position.pending) !== null && _b !== void 0 ? _b : position.last, basePeriod.end);
|
|
22262
|
+
if (basePeriod.end !== undefined && position.getWanted() >= basePeriod.end) {
|
|
22263
|
+
src_log.info("Stream: Destroying PeriodStream as the current playhead moved above it", bufferType, basePeriod.start, position.getWanted(), basePeriod.end);
|
|
22075
22264
|
stopListeningObservations();
|
|
22076
22265
|
consecutivePeriodStreamCb.periodStreamCleared({
|
|
22077
22266
|
type: bufferType,
|
|
@@ -22223,7 +22412,7 @@ function needsFlushingAfterClean(observation, cleanedRanges) {
|
|
|
22223
22412
|
if (cleanedRanges.length === 0) {
|
|
22224
22413
|
return false;
|
|
22225
22414
|
}
|
|
22226
|
-
var curPos = observation.position.
|
|
22415
|
+
var curPos = observation.position.getPolled();
|
|
22227
22416
|
// Based on the playback direction, we just check whether we may encounter
|
|
22228
22417
|
// the corresponding ranges, without seeking or re-switching playback
|
|
22229
22418
|
// direction which is expected to lead to a low-level flush anyway.
|
|
@@ -22364,8 +22553,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
22364
22553
|
var cancelSignal = _this._canceller.signal;
|
|
22365
22554
|
playbackObserver.listen(function (_ref) {
|
|
22366
22555
|
var position = _ref.position;
|
|
22367
|
-
var
|
|
22368
|
-
var wantedPosition = (_a = position.pending) !== null && _a !== void 0 ? _a : position.last;
|
|
22556
|
+
var wantedPosition = position.getWanted();
|
|
22369
22557
|
if (wantedPosition < manifest.getMinimumSafePosition()) {
|
|
22370
22558
|
var warning = new MediaError("MEDIA_TIME_BEFORE_MANIFEST", "The current position is behind the " + "earliest time announced in the Manifest.");
|
|
22371
22559
|
_this.trigger("warning", warning);
|
|
@@ -22981,10 +23169,8 @@ function openMediaSource(mediaElement, unlinkSignal) {
|
|
|
22981
23169
|
function createStreamPlaybackObserver(srcPlaybackObserver, _ref, fnCancelSignal) {
|
|
22982
23170
|
var autoPlay = _ref.autoPlay,
|
|
22983
23171
|
initialPlayPerformed = _ref.initialPlayPerformed,
|
|
22984
|
-
initialSeekPerformed = _ref.initialSeekPerformed,
|
|
22985
23172
|
manifest = _ref.manifest,
|
|
22986
|
-
speed = _ref.speed
|
|
22987
|
-
startTime = _ref.startTime;
|
|
23173
|
+
speed = _ref.speed;
|
|
22988
23174
|
return srcPlaybackObserver.deriveReadOnlyObserver(function transform(observationRef, parentObserverCancelSignal) {
|
|
22989
23175
|
var canceller = new TaskCanceller();
|
|
22990
23176
|
canceller.linkToSignal(parentObserverCancelSignal);
|
|
@@ -23002,10 +23188,7 @@ function createStreamPlaybackObserver(srcPlaybackObserver, _ref, fnCancelSignal)
|
|
|
23002
23188
|
function constructStreamPlaybackObservation() {
|
|
23003
23189
|
var observation = observationRef.getValue();
|
|
23004
23190
|
var lastSpeed = speed.getValue();
|
|
23005
|
-
|
|
23006
|
-
if (!initialSeekPerformed.getValue()) {
|
|
23007
|
-
pendingPosition = startTime;
|
|
23008
|
-
} else if (!manifest.isDynamic || manifest.isLastPeriodKnown) {
|
|
23191
|
+
if (!manifest.isDynamic || manifest.isLastPeriodKnown) {
|
|
23009
23192
|
// HACK: When the position is actually further than the maximum
|
|
23010
23193
|
// position for a finished content, we actually want to be loading
|
|
23011
23194
|
// the last segment before ending.
|
|
@@ -23013,17 +23196,23 @@ function createStreamPlaybackObserver(srcPlaybackObserver, _ref, fnCancelSignal)
|
|
|
23013
23196
|
// want to seek one second before the period's end (despite never
|
|
23014
23197
|
// doing it).
|
|
23015
23198
|
var lastPeriod = manifest.periods[manifest.periods.length - 1];
|
|
23016
|
-
if (lastPeriod !== undefined && lastPeriod.end !== undefined
|
|
23017
|
-
|
|
23199
|
+
if (lastPeriod !== undefined && lastPeriod.end !== undefined) {
|
|
23200
|
+
var wantedPosition = observation.position.getWanted();
|
|
23201
|
+
if (wantedPosition >= lastPeriod.start && wantedPosition >= lastPeriod.end - 1) {
|
|
23202
|
+
// We're after the end of the last Period, check if `buffered`
|
|
23203
|
+
// indicates that the last segment is probably not loaded, in which
|
|
23204
|
+
// case act as if we want to load one second before the end.
|
|
23205
|
+
var buffered = observation.buffered;
|
|
23206
|
+
if (buffered.length === 0 || buffered.end(buffered.length - 1) < observation.duration - 1) {
|
|
23207
|
+
observation.position.forceWantedPosition(lastPeriod.end - 1);
|
|
23208
|
+
}
|
|
23209
|
+
}
|
|
23018
23210
|
}
|
|
23019
23211
|
}
|
|
23020
23212
|
return {
|
|
23021
23213
|
// TODO more exact according to the current Adaptation chosen?
|
|
23022
23214
|
maximumPosition: manifest.getMaximumSafePosition(),
|
|
23023
|
-
position:
|
|
23024
|
-
last: observation.position,
|
|
23025
|
-
pending: pendingPosition
|
|
23026
|
-
},
|
|
23215
|
+
position: observation.position,
|
|
23027
23216
|
duration: observation.duration,
|
|
23028
23217
|
paused: {
|
|
23029
23218
|
last: observation.paused,
|
|
@@ -23380,116 +23569,156 @@ function getLoadedReference(playbackObserver, mediaElement, isDirectfile, cancel
|
|
|
23380
23569
|
|
|
23381
23570
|
|
|
23382
23571
|
|
|
23383
|
-
|
|
23384
23572
|
/**
|
|
23385
23573
|
* Seek as soon as possible at the initially wanted position and play if
|
|
23386
23574
|
* autoPlay is wanted.
|
|
23387
|
-
* @param {
|
|
23388
|
-
* @param {Object} playbackObserver
|
|
23389
|
-
* @param {number|Function} startTime
|
|
23390
|
-
* @param {boolean} mustAutoPlay
|
|
23391
|
-
* @param {Function} onWarning
|
|
23575
|
+
* @param {Object} args
|
|
23392
23576
|
* @param {Object} cancelSignal
|
|
23393
23577
|
* @returns {Object}
|
|
23394
23578
|
*/
|
|
23395
|
-
function performInitialSeekAndPlay(
|
|
23396
|
-
var
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
var initialSeekPerformed = new utils_reference(false, cancelSignal);
|
|
23579
|
+
function performInitialSeekAndPlay(_ref, cancelSignal) {
|
|
23580
|
+
var mediaElement = _ref.mediaElement,
|
|
23581
|
+
playbackObserver = _ref.playbackObserver,
|
|
23582
|
+
startTime = _ref.startTime,
|
|
23583
|
+
mustAutoPlay = _ref.mustAutoPlay,
|
|
23584
|
+
isDirectfile = _ref.isDirectfile,
|
|
23585
|
+
onWarning = _ref.onWarning;
|
|
23403
23586
|
var initialPlayPerformed = new utils_reference(false, cancelSignal);
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
onWarning(error);
|
|
23427
|
-
}
|
|
23428
|
-
if (cancelSignal.isCancelled()) {
|
|
23429
|
-
return;
|
|
23587
|
+
var autoPlayResult = new Promise(function (resolveAutoPlay, rejectAutoPlay) {
|
|
23588
|
+
// `startTime` defined as a function might depend on metadata to make its
|
|
23589
|
+
// choice, such as the content duration, minimum and/or maximum position.
|
|
23590
|
+
//
|
|
23591
|
+
// The RxPlayer might already know those through the Manifest file for
|
|
23592
|
+
// non-Directfile contents, yet only through the `HTMLMediaElement` once a
|
|
23593
|
+
// a sufficient `readyState` has been reached for directfile contents.
|
|
23594
|
+
// So let's divide the two possibilities here.
|
|
23595
|
+
if (!isDirectfile || typeof startTime === "number") {
|
|
23596
|
+
playbackObserver.setCurrentTime(typeof startTime === "number" ? startTime : startTime());
|
|
23597
|
+
waitForSeekable();
|
|
23598
|
+
} else {
|
|
23599
|
+
playbackObserver.listen(function (obs, stopListening) {
|
|
23600
|
+
if (obs.readyState >= 1) {
|
|
23601
|
+
stopListening();
|
|
23602
|
+
playbackObserver.setCurrentTime(typeof startTime === "number" ? startTime : startTime());
|
|
23603
|
+
waitForSeekable();
|
|
23604
|
+
}
|
|
23605
|
+
}, {
|
|
23606
|
+
includeLastObservation: true,
|
|
23607
|
+
clearSignal: cancelSignal
|
|
23608
|
+
});
|
|
23430
23609
|
}
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
stopListening();
|
|
23434
|
-
onPlayable();
|
|
23435
|
-
}
|
|
23436
|
-
}, {
|
|
23437
|
-
includeLastObservation: true,
|
|
23438
|
-
clearSignal: cancelSignal
|
|
23610
|
+
var deregisterCancellation = cancelSignal.register(function (err) {
|
|
23611
|
+
rejectAutoPlay(err);
|
|
23439
23612
|
});
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23613
|
+
/**
|
|
23614
|
+
* Logic that should be run once the initial seek has been asked to the
|
|
23615
|
+
* PlaybackObserver.
|
|
23616
|
+
*
|
|
23617
|
+
* Actually wait until the seek has been performed, wait for the right moment
|
|
23618
|
+
* to perform autoplay, resolve the promise once everything has been done and
|
|
23619
|
+
* potentially send warning if a minor issue is detected.
|
|
23620
|
+
*/
|
|
23621
|
+
function waitForSeekable() {
|
|
23622
|
+
playbackObserver.listen(function (obs, stopListening) {
|
|
23623
|
+
if (obs.seeking === 0 /* SeekingState.None */ || obs.readyState === 0) {
|
|
23624
|
+
return;
|
|
23625
|
+
}
|
|
23626
|
+
stopListening();
|
|
23627
|
+
if (shouldValidateMetadata() && mediaElement.duration === 0) {
|
|
23628
|
+
var error = new MediaError("MEDIA_ERR_NOT_LOADED_METADATA", "Cannot load automatically: your browser " + "falsely announced having loaded the content.");
|
|
23629
|
+
onWarning(error);
|
|
23630
|
+
}
|
|
23631
|
+
if (cancelSignal.isCancelled()) {
|
|
23632
|
+
return;
|
|
23633
|
+
}
|
|
23634
|
+
waitForPlayable();
|
|
23635
|
+
}, {
|
|
23636
|
+
includeLastObservation: true,
|
|
23637
|
+
clearSignal: cancelSignal
|
|
23453
23638
|
});
|
|
23454
23639
|
}
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23640
|
+
/**
|
|
23641
|
+
* Logic that should be run once the initial seek has been properly performed.
|
|
23642
|
+
*
|
|
23643
|
+
* Wait for the media being playable before performing the autoplay operation
|
|
23644
|
+
* if asked. Potentially send warning if a minor issue has been detected while
|
|
23645
|
+
* doing so.
|
|
23646
|
+
*/
|
|
23647
|
+
function waitForPlayable() {
|
|
23648
|
+
playbackObserver.listen(function (observation, stopListening) {
|
|
23649
|
+
if (observation.seeking === 0 /* SeekingState.None */ && observation.rebuffering === null && observation.readyState >= 1) {
|
|
23650
|
+
stopListening();
|
|
23651
|
+
onPlayable();
|
|
23652
|
+
}
|
|
23653
|
+
}, {
|
|
23654
|
+
includeLastObservation: true,
|
|
23655
|
+
clearSignal: cancelSignal
|
|
23656
|
+
});
|
|
23461
23657
|
}
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23658
|
+
/**
|
|
23659
|
+
* Callback called once the content is considered "playable".
|
|
23660
|
+
*
|
|
23661
|
+
* Perform the autoplay if needed, handling potential issues and resolve the
|
|
23662
|
+
* Promise when done.
|
|
23663
|
+
* Might also send warnings if minor issues arise.
|
|
23664
|
+
*/
|
|
23665
|
+
function onPlayable() {
|
|
23666
|
+
var _a;
|
|
23667
|
+
src_log.info("Init: Can begin to play content");
|
|
23668
|
+
if (!mustAutoPlay) {
|
|
23669
|
+
if (mediaElement.autoplay) {
|
|
23670
|
+
src_log.warn("Init: autoplay is enabled on HTML media element. " + "Media will play as soon as possible.");
|
|
23671
|
+
}
|
|
23672
|
+
initialPlayPerformed.setValue(true);
|
|
23673
|
+
initialPlayPerformed.finish();
|
|
23674
|
+
deregisterCancellation();
|
|
23675
|
+
return resolveAutoPlay({
|
|
23676
|
+
type: "skipped"
|
|
23677
|
+
});
|
|
23465
23678
|
}
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
})["catch"](function (playError) {
|
|
23473
|
-
deregisterCancellation();
|
|
23474
|
-
if (cancelSignal.isCancelled()) {
|
|
23475
|
-
return;
|
|
23679
|
+
var playResult;
|
|
23680
|
+
try {
|
|
23681
|
+
playResult = (_a = mediaElement.play()) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
23682
|
+
} catch (playError) {
|
|
23683
|
+
deregisterCancellation();
|
|
23684
|
+
return rejectAutoPlay(playError);
|
|
23476
23685
|
}
|
|
23477
|
-
|
|
23478
|
-
// auto-play was probably prevented.
|
|
23479
|
-
src_log.warn("Init: Media element can't play." + " It may be due to browser auto-play policies.");
|
|
23480
|
-
var error = new MediaError("MEDIA_ERR_BLOCKED_AUTOPLAY", "Cannot trigger auto-play automatically: " + "your browser does not allow it.");
|
|
23481
|
-
onWarning(error);
|
|
23686
|
+
playResult.then(function () {
|
|
23482
23687
|
if (cancelSignal.isCancelled()) {
|
|
23483
23688
|
return;
|
|
23484
23689
|
}
|
|
23690
|
+
initialPlayPerformed.setValue(true);
|
|
23691
|
+
initialPlayPerformed.finish();
|
|
23692
|
+
deregisterCancellation();
|
|
23485
23693
|
return resolveAutoPlay({
|
|
23486
|
-
type: "autoplay
|
|
23694
|
+
type: "autoplay"
|
|
23487
23695
|
});
|
|
23488
|
-
}
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23696
|
+
})["catch"](function (playError) {
|
|
23697
|
+
deregisterCancellation();
|
|
23698
|
+
if (cancelSignal.isCancelled()) {
|
|
23699
|
+
return;
|
|
23700
|
+
}
|
|
23701
|
+
if (playError instanceof Error && playError.name === "NotAllowedError") {
|
|
23702
|
+
// auto-play was probably prevented.
|
|
23703
|
+
src_log.warn("Init: Media element can't play." + " It may be due to browser auto-play policies.");
|
|
23704
|
+
var error = new MediaError("MEDIA_ERR_BLOCKED_AUTOPLAY", "Cannot trigger auto-play automatically: " + "your browser does not allow it.");
|
|
23705
|
+
onWarning(error);
|
|
23706
|
+
if (cancelSignal.isCancelled()) {
|
|
23707
|
+
return;
|
|
23708
|
+
}
|
|
23709
|
+
return resolveAutoPlay({
|
|
23710
|
+
type: "autoplay-blocked"
|
|
23711
|
+
});
|
|
23712
|
+
} else {
|
|
23713
|
+
rejectAutoPlay(playError);
|
|
23714
|
+
}
|
|
23715
|
+
});
|
|
23716
|
+
}
|
|
23717
|
+
});
|
|
23718
|
+
return {
|
|
23719
|
+
autoPlayResult: autoPlayResult,
|
|
23720
|
+
initialPlayPerformed: initialPlayPerformed
|
|
23721
|
+
};
|
|
23493
23722
|
}
|
|
23494
23723
|
;// CONCATENATED MODULE: ./src/core/decrypt/types.ts
|
|
23495
23724
|
/**
|
|
@@ -23971,36 +24200,6 @@ function getMaximumLiveSeekablePosition(contentLastPosition) {
|
|
|
23971
24200
|
// authorize exceptionally going over it.
|
|
23972
24201
|
return Math.max(Math.pow(2, 32), contentLastPosition + YEAR_IN_SECONDS);
|
|
23973
24202
|
}
|
|
23974
|
-
;// CONCATENATED MODULE: ./src/compat/is_seeking_approximate.ts
|
|
23975
|
-
/**
|
|
23976
|
-
* Copyright 2015 CANAL+ Group
|
|
23977
|
-
*
|
|
23978
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23979
|
-
* you may not use this file except in compliance with the License.
|
|
23980
|
-
* You may obtain a copy of the License at
|
|
23981
|
-
*
|
|
23982
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23983
|
-
*
|
|
23984
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23985
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23986
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23987
|
-
* See the License for the specific language governing permissions and
|
|
23988
|
-
* limitations under the License.
|
|
23989
|
-
*/
|
|
23990
|
-
|
|
23991
|
-
/**
|
|
23992
|
-
* On some devices (right now only seen on Tizen), seeking through the
|
|
23993
|
-
* `currentTime` property can lead to the browser re-seeking once the
|
|
23994
|
-
* segments have been loaded to improve seeking performances (for
|
|
23995
|
-
* example, by seeking right to an intra video frame).
|
|
23996
|
-
*
|
|
23997
|
-
* This can lead to conflicts with the RxPlayer code.
|
|
23998
|
-
*
|
|
23999
|
-
* This boolean is only `true` on the devices where this behavior has been
|
|
24000
|
-
* observed.
|
|
24001
|
-
*/
|
|
24002
|
-
var isSeekingApproximate = isTizen;
|
|
24003
|
-
/* harmony default export */ var is_seeking_approximate = (isSeekingApproximate);
|
|
24004
24203
|
;// CONCATENATED MODULE: ./src/core/init/utils/rebuffering_controller.ts
|
|
24005
24204
|
|
|
24006
24205
|
function rebuffering_controller_createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = rebuffering_controller_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -24028,7 +24227,6 @@ function rebuffering_controller_arrayLikeToArray(arr, len) { if (len == null ||
|
|
|
24028
24227
|
|
|
24029
24228
|
|
|
24030
24229
|
|
|
24031
|
-
|
|
24032
24230
|
/**
|
|
24033
24231
|
* Work-around rounding errors with floating points by setting an acceptable,
|
|
24034
24232
|
* very short, deviation when checking equalities.
|
|
@@ -24069,38 +24267,12 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24069
24267
|
return;
|
|
24070
24268
|
}
|
|
24071
24269
|
this._isStarted = true;
|
|
24072
|
-
/**
|
|
24073
|
-
* On some devices (right now only seen on Tizen), seeking through the
|
|
24074
|
-
* `currentTime` property can lead to the browser re-seeking once the
|
|
24075
|
-
* segments have been loaded to improve seeking performances (for
|
|
24076
|
-
* example, by seeking right to an intra video frame).
|
|
24077
|
-
* In that case, we risk being in a conflict with that behavior: if for
|
|
24078
|
-
* example we encounter a small discontinuity at the position the browser
|
|
24079
|
-
* seeks to, we will seek over it, the browser would seek back and so on.
|
|
24080
|
-
*
|
|
24081
|
-
* This variable allows to store the last known position we were seeking to
|
|
24082
|
-
* so we can detect when the browser seeked back (to avoid performing another
|
|
24083
|
-
* seek after that). When browsers seek back to a position behind a
|
|
24084
|
-
* discontinuity, they are usually able to skip them without our help.
|
|
24085
|
-
*/
|
|
24086
|
-
var lastSeekingPosition;
|
|
24087
|
-
/**
|
|
24088
|
-
* In some conditions (see `lastSeekingPosition`), we might want to not
|
|
24089
|
-
* automatically seek over discontinuities because the browser might do it
|
|
24090
|
-
* itself instead.
|
|
24091
|
-
* In that case, we still want to perform the seek ourselves if the browser
|
|
24092
|
-
* doesn't do it after sufficient time.
|
|
24093
|
-
* This variable allows to store the timestamp at which a discontinuity began
|
|
24094
|
-
* to be ignored.
|
|
24095
|
-
*/
|
|
24096
|
-
var ignoredStallTimeStamp = null;
|
|
24097
24270
|
var playbackRateUpdater = new PlaybackRateUpdater(this._playbackObserver, this._speed);
|
|
24098
24271
|
this._canceller.signal.register(function () {
|
|
24099
24272
|
playbackRateUpdater.dispose();
|
|
24100
24273
|
});
|
|
24101
24274
|
var prevFreezingState = null;
|
|
24102
24275
|
this._playbackObserver.listen(function (observation) {
|
|
24103
|
-
var _a;
|
|
24104
24276
|
var discontinuitiesStore = _this2._discontinuitiesStore;
|
|
24105
24277
|
var buffered = observation.buffered,
|
|
24106
24278
|
position = observation.position,
|
|
@@ -24109,31 +24281,24 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24109
24281
|
freezing = observation.freezing;
|
|
24110
24282
|
var _config$getCurrent = config.getCurrent(),
|
|
24111
24283
|
BUFFER_DISCONTINUITY_THRESHOLD = _config$getCurrent.BUFFER_DISCONTINUITY_THRESHOLD,
|
|
24112
|
-
FORCE_DISCONTINUITY_SEEK_DELAY = _config$getCurrent.FORCE_DISCONTINUITY_SEEK_DELAY,
|
|
24113
24284
|
FREEZING_STALLED_DELAY = _config$getCurrent.FREEZING_STALLED_DELAY,
|
|
24114
24285
|
UNFREEZING_SEEK_DELAY = _config$getCurrent.UNFREEZING_SEEK_DELAY,
|
|
24115
24286
|
UNFREEZING_DELTA_POSITION = _config$getCurrent.UNFREEZING_DELTA_POSITION;
|
|
24116
|
-
if (!observation.seeking && is_seeking_approximate && ignoredStallTimeStamp === null && lastSeekingPosition !== null && observation.position < lastSeekingPosition) {
|
|
24117
|
-
src_log.debug("Init: the device appeared to have seeked back by itself.");
|
|
24118
|
-
var now = getMonotonicTimeStamp();
|
|
24119
|
-
ignoredStallTimeStamp = now;
|
|
24120
|
-
}
|
|
24121
|
-
lastSeekingPosition = observation.seeking ? Math.max((_a = observation.pendingInternalSeek) !== null && _a !== void 0 ? _a : 0, observation.position) : null;
|
|
24122
24287
|
if (_this2._checkDecipherabilityFreeze(observation)) {
|
|
24123
24288
|
return;
|
|
24124
24289
|
}
|
|
24125
24290
|
if (freezing !== null) {
|
|
24126
|
-
var
|
|
24291
|
+
var now = getMonotonicTimeStamp();
|
|
24127
24292
|
var referenceTimestamp = prevFreezingState === null ? freezing.timestamp : prevFreezingState.attemptTimestamp;
|
|
24128
|
-
if (
|
|
24293
|
+
if (!position.isAwaitingFuturePosition() && now - referenceTimestamp > UNFREEZING_SEEK_DELAY) {
|
|
24129
24294
|
src_log.warn("Init: trying to seek to un-freeze player");
|
|
24130
24295
|
_this2._playbackObserver.setCurrentTime(_this2._playbackObserver.getCurrentTime() + UNFREEZING_DELTA_POSITION);
|
|
24131
24296
|
prevFreezingState = {
|
|
24132
|
-
attemptTimestamp:
|
|
24297
|
+
attemptTimestamp: now
|
|
24133
24298
|
};
|
|
24134
24299
|
}
|
|
24135
|
-
if (
|
|
24136
|
-
if (rebuffering === null
|
|
24300
|
+
if (now - freezing.timestamp > FREEZING_STALLED_DELAY) {
|
|
24301
|
+
if (rebuffering === null) {
|
|
24137
24302
|
playbackRateUpdater.stopRebuffering();
|
|
24138
24303
|
} else {
|
|
24139
24304
|
playbackRateUpdater.startRebuffering();
|
|
@@ -24150,8 +24315,8 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24150
24315
|
// With a readyState set to 1, we should still not be able to play:
|
|
24151
24316
|
// Return that we're stalled
|
|
24152
24317
|
var reason;
|
|
24153
|
-
if (observation.seeking) {
|
|
24154
|
-
reason = observation.
|
|
24318
|
+
if (observation.seeking !== 0 /* SeekingState.None */) {
|
|
24319
|
+
reason = observation.seeking === 1 /* SeekingState.Internal */ ? "internal-seek" : "seeking";
|
|
24155
24320
|
} else {
|
|
24156
24321
|
reason = "not-ready";
|
|
24157
24322
|
}
|
|
@@ -24163,19 +24328,13 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24163
24328
|
}
|
|
24164
24329
|
// We want to separate a stall situation when a seek is due to a seek done
|
|
24165
24330
|
// internally by the player to when its due to a regular user seek.
|
|
24166
|
-
var stalledReason = rebuffering.reason === "seeking" && observation.
|
|
24167
|
-
if (
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
_this2.trigger("stalled", stalledReason);
|
|
24173
|
-
return;
|
|
24174
|
-
} else {
|
|
24175
|
-
src_log.warn("Init: ignored stall for too long, considering it", _now2 - ignoredStallTimeStamp);
|
|
24176
|
-
}
|
|
24331
|
+
var stalledReason = rebuffering.reason === "seeking" && observation.seeking === 1 /* SeekingState.Internal */ ? "internal-seek" : rebuffering.reason;
|
|
24332
|
+
if (position.isAwaitingFuturePosition()) {
|
|
24333
|
+
playbackRateUpdater.stopRebuffering();
|
|
24334
|
+
src_log.debug("Init: let rebuffering happen as we're awaiting a future position");
|
|
24335
|
+
_this2.trigger("stalled", stalledReason);
|
|
24336
|
+
return;
|
|
24177
24337
|
}
|
|
24178
|
-
ignoredStallTimeStamp = null;
|
|
24179
24338
|
playbackRateUpdater.startRebuffering();
|
|
24180
24339
|
if (_this2._manifest === null) {
|
|
24181
24340
|
_this2.trigger("stalled", stalledReason);
|
|
@@ -24190,14 +24349,14 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24190
24349
|
if (realSeekTime <= _this2._playbackObserver.getCurrentTime()) {
|
|
24191
24350
|
src_log.info("Init: position to seek already reached, no seeking", _this2._playbackObserver.getCurrentTime(), realSeekTime);
|
|
24192
24351
|
} else {
|
|
24193
|
-
src_log.warn("SA: skippable discontinuity found in the stream", position, realSeekTime);
|
|
24352
|
+
src_log.warn("SA: skippable discontinuity found in the stream", position.getPolled(), realSeekTime);
|
|
24194
24353
|
_this2._playbackObserver.setCurrentTime(realSeekTime);
|
|
24195
24354
|
_this2.trigger("warning", generateDiscontinuityError(stalledPosition, realSeekTime));
|
|
24196
24355
|
return;
|
|
24197
24356
|
}
|
|
24198
24357
|
}
|
|
24199
24358
|
}
|
|
24200
|
-
var
|
|
24359
|
+
var positionBlockedAt = stalledPosition !== null && stalledPosition !== void 0 ? stalledPosition : position.getPolled();
|
|
24201
24360
|
// Is it a very short discontinuity in buffer ? -> Seek at the beginning of the
|
|
24202
24361
|
// next range
|
|
24203
24362
|
//
|
|
@@ -24205,13 +24364,13 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24205
24364
|
// calculate a stalled state. This is useful for some
|
|
24206
24365
|
// implementation that might drop an injected segment, or in
|
|
24207
24366
|
// case of small discontinuity in the content.
|
|
24208
|
-
var nextBufferRangeGap = getNextBufferedTimeRangeGap(buffered,
|
|
24367
|
+
var nextBufferRangeGap = getNextBufferedTimeRangeGap(buffered, positionBlockedAt);
|
|
24209
24368
|
if (_this2._speed.getValue() > 0 && nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD) {
|
|
24210
|
-
var seekTo =
|
|
24369
|
+
var seekTo = positionBlockedAt + nextBufferRangeGap + rebuffering_controller_EPSILON;
|
|
24211
24370
|
if (_this2._playbackObserver.getCurrentTime() < seekTo) {
|
|
24212
|
-
src_log.warn("Init: discontinuity encountered inferior to the threshold",
|
|
24371
|
+
src_log.warn("Init: discontinuity encountered inferior to the threshold", positionBlockedAt, seekTo, BUFFER_DISCONTINUITY_THRESHOLD);
|
|
24213
24372
|
_this2._playbackObserver.setCurrentTime(seekTo);
|
|
24214
|
-
_this2.trigger("warning", generateDiscontinuityError(
|
|
24373
|
+
_this2.trigger("warning", generateDiscontinuityError(positionBlockedAt, seekTo));
|
|
24215
24374
|
return;
|
|
24216
24375
|
}
|
|
24217
24376
|
}
|
|
@@ -24219,11 +24378,11 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24219
24378
|
// next period
|
|
24220
24379
|
for (var i = _this2._manifest.periods.length - 2; i >= 0; i--) {
|
|
24221
24380
|
var period = _this2._manifest.periods[i];
|
|
24222
|
-
if (period.end !== undefined && period.end <=
|
|
24223
|
-
if (_this2._manifest.periods[i + 1].start >
|
|
24381
|
+
if (period.end !== undefined && period.end <= positionBlockedAt) {
|
|
24382
|
+
if (_this2._manifest.periods[i + 1].start > positionBlockedAt && _this2._manifest.periods[i + 1].start > _this2._playbackObserver.getCurrentTime()) {
|
|
24224
24383
|
var nextPeriod = _this2._manifest.periods[i + 1];
|
|
24225
24384
|
_this2._playbackObserver.setCurrentTime(nextPeriod.start);
|
|
24226
|
-
_this2.trigger("warning", generateDiscontinuityError(
|
|
24385
|
+
_this2.trigger("warning", generateDiscontinuityError(positionBlockedAt, nextPeriod.start));
|
|
24227
24386
|
return;
|
|
24228
24387
|
}
|
|
24229
24388
|
break;
|
|
@@ -24265,10 +24424,10 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24265
24424
|
if (!observation.rebuffering || observation.paused || this._speed.getValue() <= 0 || bufferType !== "audio" && bufferType !== "video") {
|
|
24266
24425
|
return;
|
|
24267
24426
|
}
|
|
24268
|
-
var
|
|
24269
|
-
var rebufferingPos = (_a = observation.rebuffering.position) !== null && _a !== void 0 ? _a :
|
|
24427
|
+
var loadedPos = observation.position.getWanted();
|
|
24428
|
+
var rebufferingPos = (_a = observation.rebuffering.position) !== null && _a !== void 0 ? _a : loadedPos;
|
|
24270
24429
|
var lockedPeriodStart = period.start;
|
|
24271
|
-
if (
|
|
24430
|
+
if (loadedPos < lockedPeriodStart && Math.abs(rebufferingPos - lockedPeriodStart) < 1) {
|
|
24272
24431
|
src_log.warn("Init: rebuffering because of a future locked stream.\n" + "Trying to unlock by seeking to the next Period");
|
|
24273
24432
|
this._playbackObserver.setCurrentTime(lockedPeriodStart + 0.001);
|
|
24274
24433
|
}
|
|
@@ -24301,7 +24460,6 @@ var RebufferingController = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24301
24460
|
* right handling steps.
|
|
24302
24461
|
*/;
|
|
24303
24462
|
_proto._checkDecipherabilityFreeze = function _checkDecipherabilityFreeze(observation) {
|
|
24304
|
-
// XXX TODO allow this in in-worker configuration
|
|
24305
24463
|
var readyState = observation.readyState,
|
|
24306
24464
|
rebuffering = observation.rebuffering,
|
|
24307
24465
|
freezing = observation.freezing;
|
|
@@ -24421,8 +24579,9 @@ function eventContainsDiscontinuity(evt) {
|
|
|
24421
24579
|
* @returns {Array.<Object>}
|
|
24422
24580
|
*/
|
|
24423
24581
|
function updateDiscontinuitiesStore(discontinuitiesStore, evt, observation) {
|
|
24582
|
+
var gcTime = Math.min(observation.position.getPolled(), observation.position.getWanted());
|
|
24424
24583
|
// First, perform clean-up of old discontinuities
|
|
24425
|
-
while (discontinuitiesStore.length > 0 && discontinuitiesStore[0].period.end !== undefined && discontinuitiesStore[0].period.end + 10 <
|
|
24584
|
+
while (discontinuitiesStore.length > 0 && discontinuitiesStore[0].period.end !== undefined && discontinuitiesStore[0].period.end + 10 < gcTime) {
|
|
24426
24585
|
discontinuitiesStore.shift();
|
|
24427
24586
|
}
|
|
24428
24587
|
var period = evt.period,
|
|
@@ -24748,9 +24907,11 @@ var StreamEventsEmitter = /*#__PURE__*/function (_EventEmitter) {
|
|
|
24748
24907
|
clearInterval(intervalId);
|
|
24749
24908
|
});
|
|
24750
24909
|
function constructObservation() {
|
|
24751
|
-
var
|
|
24910
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
24911
|
+
var currentTime = mediaElement.currentTime;
|
|
24912
|
+
var isSeeking = lastObservation.seeking !== 0 /* SeekingState.None */;
|
|
24752
24913
|
return {
|
|
24753
|
-
currentTime:
|
|
24914
|
+
currentTime: currentTime,
|
|
24754
24915
|
isSeeking: isSeeking
|
|
24755
24916
|
};
|
|
24756
24917
|
}
|
|
@@ -25263,12 +25424,18 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
25263
25424
|
cancelSignal.register(function () {
|
|
25264
25425
|
segmentBuffersStore.disposeAll();
|
|
25265
25426
|
});
|
|
25266
|
-
var _performInitialSeekAn = performInitialSeekAndPlay(
|
|
25267
|
-
|
|
25427
|
+
var _performInitialSeekAn = performInitialSeekAndPlay({
|
|
25428
|
+
mediaElement: mediaElement,
|
|
25429
|
+
playbackObserver: playbackObserver,
|
|
25430
|
+
startTime: initialTime,
|
|
25431
|
+
mustAutoPlay: autoPlay,
|
|
25432
|
+
onWarning: function onWarning(err) {
|
|
25433
|
+
_this6.trigger("warning", err);
|
|
25434
|
+
},
|
|
25435
|
+
isDirectfile: false
|
|
25268
25436
|
}, cancelSignal),
|
|
25269
25437
|
autoPlayResult = _performInitialSeekAn.autoPlayResult,
|
|
25270
|
-
initialPlayPerformed = _performInitialSeekAn.initialPlayPerformed
|
|
25271
|
-
initialSeekPerformed = _performInitialSeekAn.initialSeekPerformed;
|
|
25438
|
+
initialPlayPerformed = _performInitialSeekAn.initialPlayPerformed;
|
|
25272
25439
|
if (cancelSignal.isCancelled()) {
|
|
25273
25440
|
return;
|
|
25274
25441
|
}
|
|
@@ -25295,15 +25462,19 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
25295
25462
|
autoPlay: autoPlay,
|
|
25296
25463
|
manifest: manifest,
|
|
25297
25464
|
initialPlayPerformed: initialPlayPerformed,
|
|
25298
|
-
|
|
25299
|
-
speed: speed,
|
|
25300
|
-
startTime: initialTime
|
|
25465
|
+
speed: speed
|
|
25301
25466
|
}, cancelSignal);
|
|
25302
25467
|
var rebufferingController = this._createRebufferingController(playbackObserver, manifest, segmentBuffersStore, speed, cancelSignal);
|
|
25303
25468
|
rebufferingController.addEventListener("needsReload", function () {
|
|
25469
|
+
var position;
|
|
25470
|
+
var lastObservation = playbackObserver.getReference().getValue();
|
|
25471
|
+
if (lastObservation.position.isAwaitingFuturePosition()) {
|
|
25472
|
+
position = lastObservation.position.getWanted();
|
|
25473
|
+
} else {
|
|
25474
|
+
position = playbackObserver.getCurrentTime();
|
|
25475
|
+
}
|
|
25304
25476
|
// NOTE couldn't both be always calculated at event destination?
|
|
25305
25477
|
// Maybe there are exceptions?
|
|
25306
|
-
var position = initialSeekPerformed.getValue() ? playbackObserver.getCurrentTime() : initialTime;
|
|
25307
25478
|
var autoplay = initialPlayPerformed.getValue() ? !playbackObserver.getIsPaused() : autoPlay;
|
|
25308
25479
|
onReloadOrder({
|
|
25309
25480
|
position: position,
|
|
@@ -25370,9 +25541,9 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
25370
25541
|
// Data is buffered around the current position
|
|
25371
25542
|
obs.currentRange !== null ||
|
|
25372
25543
|
// Or, for whatever reason, we have no buffer but we're already advancing
|
|
25373
|
-
obs.position > seekedTime + 0.1) {
|
|
25544
|
+
obs.position.getPolled() > seekedTime + 0.1) {
|
|
25374
25545
|
stopListening();
|
|
25375
|
-
playbackObserver.setCurrentTime(obs.position + 0.001);
|
|
25546
|
+
playbackObserver.setCurrentTime(obs.position.getWanted() + 0.001);
|
|
25376
25547
|
}
|
|
25377
25548
|
}, {
|
|
25378
25549
|
includeLastObservation: false,
|
|
@@ -25461,10 +25632,10 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
25461
25632
|
return self.trigger("bitrateEstimateChange", value);
|
|
25462
25633
|
},
|
|
25463
25634
|
needsMediaSourceReload: function needsMediaSourceReload(payload) {
|
|
25464
|
-
var _a
|
|
25635
|
+
var _a;
|
|
25465
25636
|
var lastObservation = streamObserver.getReference().getValue();
|
|
25466
|
-
var currentPosition = (
|
|
25467
|
-
var isPaused = (
|
|
25637
|
+
var currentPosition = lastObservation.position.isAwaitingFuturePosition() ? lastObservation.position.getWanted() : streamObserver.getCurrentTime();
|
|
25638
|
+
var isPaused = (_a = lastObservation.paused.pending) !== null && _a !== void 0 ? _a : streamObserver.getIsPaused();
|
|
25468
25639
|
var position = currentPosition + payload.timeOffset;
|
|
25469
25640
|
if (payload.minimumPosition !== undefined) {
|
|
25470
25641
|
position = Math.max(payload.minimumPosition, position);
|
|
@@ -25478,19 +25649,19 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
25478
25649
|
});
|
|
25479
25650
|
},
|
|
25480
25651
|
needsDecipherabilityFlush: function needsDecipherabilityFlush() {
|
|
25481
|
-
var _a
|
|
25652
|
+
var _a;
|
|
25482
25653
|
var keySystem = get_key_system_configuration_getKeySystemConfiguration(mediaElement);
|
|
25483
25654
|
if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem === null || keySystem === void 0 ? void 0 : keySystem[0])) {
|
|
25484
25655
|
var lastObservation = streamObserver.getReference().getValue();
|
|
25485
|
-
var position = (
|
|
25486
|
-
var isPaused = (
|
|
25656
|
+
var position = lastObservation.position.isAwaitingFuturePosition() ? lastObservation.position.getWanted() : streamObserver.getCurrentTime();
|
|
25657
|
+
var isPaused = (_a = lastObservation.paused.pending) !== null && _a !== void 0 ? _a : streamObserver.getIsPaused();
|
|
25487
25658
|
onReloadOrder({
|
|
25488
25659
|
position: position,
|
|
25489
25660
|
autoPlay: !isPaused
|
|
25490
25661
|
});
|
|
25491
25662
|
} else {
|
|
25492
25663
|
var _lastObservation = streamObserver.getReference().getValue();
|
|
25493
|
-
var _position = (
|
|
25664
|
+
var _position = _lastObservation.position.isAwaitingFuturePosition() ? _lastObservation.position.getWanted() : streamObserver.getCurrentTime();
|
|
25494
25665
|
// simple seek close to the current position
|
|
25495
25666
|
// to flush the buffers
|
|
25496
25667
|
if (_position + 0.001 < _lastObservation.duration) {
|
|
@@ -40936,8 +41107,15 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
40936
41107
|
src_log.debug("Init: Initial time calculated:", initTime);
|
|
40937
41108
|
return initTime;
|
|
40938
41109
|
};
|
|
40939
|
-
performInitialSeekAndPlay(
|
|
40940
|
-
|
|
41110
|
+
performInitialSeekAndPlay({
|
|
41111
|
+
mediaElement: mediaElement,
|
|
41112
|
+
playbackObserver: playbackObserver,
|
|
41113
|
+
startTime: initialTime,
|
|
41114
|
+
mustAutoPlay: autoPlay,
|
|
41115
|
+
onWarning: function onWarning(err) {
|
|
41116
|
+
return _this3.trigger("warning", err);
|
|
41117
|
+
},
|
|
41118
|
+
isDirectfile: true
|
|
40941
41119
|
}, cancelSignal).autoPlayResult.then(function () {
|
|
40942
41120
|
return getLoadedReference(playbackObserver, mediaElement, true, cancelSignal).onUpdate(function (isLoaded, stopListening) {
|
|
40943
41121
|
if (isLoaded) {
|
|
@@ -44951,12 +45129,9 @@ var serverCertificateHashesMap = new WeakMap();
|
|
|
44951
45129
|
* @returns {Object|null}
|
|
44952
45130
|
*/
|
|
44953
45131
|
function createPersistentSessionsStorage(keySystemOptions) {
|
|
44954
|
-
if (is_null_or_undefined_isNullOrUndefined(keySystemOptions.persistentLicenseConfig)) {
|
|
44955
|
-
return null;
|
|
44956
|
-
}
|
|
44957
45132
|
var persistentLicenseConfig = keySystemOptions.persistentLicenseConfig;
|
|
44958
|
-
if (persistentLicenseConfig
|
|
44959
|
-
|
|
45133
|
+
if (is_null_or_undefined_isNullOrUndefined(persistentLicenseConfig)) {
|
|
45134
|
+
return null;
|
|
44960
45135
|
}
|
|
44961
45136
|
src_log.debug("DRM: Set the given license storage");
|
|
44962
45137
|
return new PersistentSessionsStore(persistentLicenseConfig);
|
|
@@ -47485,7 +47660,7 @@ var NativeTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
47485
47660
|
}
|
|
47486
47661
|
this._buffered.insert(start, end);
|
|
47487
47662
|
if (infos.inventoryInfos !== null) {
|
|
47488
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
47663
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
47489
47664
|
}
|
|
47490
47665
|
} catch (err) {
|
|
47491
47666
|
return Promise.reject(err);
|
|
@@ -50648,7 +50823,7 @@ var HTMLTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
50648
50823
|
return;
|
|
50649
50824
|
}
|
|
50650
50825
|
if (infos.inventoryInfos !== null) {
|
|
50651
|
-
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
50826
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos, true);
|
|
50652
50827
|
}
|
|
50653
50828
|
this._buffer.insert(cues, start, end);
|
|
50654
50829
|
this._buffered.insert(start, end);
|
|
@@ -51061,10 +51236,11 @@ function applyFontSize(element, fontSize) {
|
|
|
51061
51236
|
*/
|
|
51062
51237
|
function applyLineHeight(element, lineHeight) {
|
|
51063
51238
|
var trimmedLineHeight = lineHeight.trim();
|
|
51239
|
+
var splittedLineHeight = trimmedLineHeight.split(" ");
|
|
51064
51240
|
if (trimmedLineHeight === "auto") {
|
|
51065
51241
|
return;
|
|
51066
51242
|
}
|
|
51067
|
-
var firstLineHeight = REGXP_LENGTH.exec(
|
|
51243
|
+
var firstLineHeight = REGXP_LENGTH.exec(splittedLineHeight[0]);
|
|
51068
51244
|
if (firstLineHeight === null) {
|
|
51069
51245
|
return;
|
|
51070
51246
|
}
|