rx-player 3.26.1 → 3.26.2
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/.github/workflows/checks.yml +99 -0
- package/.github/workflows/sonarcloud_analysis.yml +20 -0
- package/CHANGELOG.md +99 -71
- package/README.md +19 -18
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/clear_element_src.js +8 -6
- package/dist/_esm5.processed/compat/eme/close_session.js +1 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +1 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +6 -4
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +1 -2
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +1 -2
- package/dist/_esm5.processed/compat/eme/load_session.js +2 -3
- package/dist/_esm5.processed/compat/event_listeners.d.ts +3 -2
- package/dist/_esm5.processed/compat/event_listeners.js +8 -14
- package/dist/_esm5.processed/compat/make_vtt_cue.js +1 -1
- package/dist/_esm5.processed/compat/on_height_width_change.js +1 -2
- package/dist/_esm5.processed/compat/set_element_src.js +1 -1
- package/dist/_esm5.processed/compat/when_loaded_metadata.js +1 -2
- package/dist/_esm5.processed/compat/when_media_source_open.js +1 -2
- package/dist/_esm5.processed/config.d.ts +3 -8
- package/dist/_esm5.processed/config.js +4 -9
- package/dist/_esm5.processed/core/abr/abr_manager.d.ts +11 -10
- package/dist/_esm5.processed/core/abr/abr_manager.js +47 -8
- package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +1 -1
- package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +2 -2
- package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +3 -3
- package/dist/_esm5.processed/core/abr/get_buffer_levels.js +3 -0
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +3 -3
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +3 -3
- package/dist/_esm5.processed/core/abr/guess_based_chooser.d.ts +95 -0
- package/dist/_esm5.processed/core/abr/guess_based_chooser.js +242 -0
- package/dist/_esm5.processed/core/abr/index.d.ts +3 -3
- package/dist/_esm5.processed/core/abr/last_estimate_storage.d.ts +61 -0
- package/dist/_esm5.processed/core/abr/last_estimate_storage.js +37 -0
- package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +25 -7
- package/dist/_esm5.processed/core/abr/network_analyzer.js +68 -31
- package/dist/_esm5.processed/core/abr/pending_requests_store.d.ts +56 -28
- package/dist/_esm5.processed/core/abr/pending_requests_store.js +9 -7
- package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +34 -51
- package/dist/_esm5.processed/core/abr/representation_estimator.js +111 -52
- package/dist/_esm5.processed/core/abr/representation_score_calculator.d.ts +5 -8
- package/dist/_esm5.processed/core/abr/representation_score_calculator.js +20 -23
- package/dist/_esm5.processed/core/abr/{ewma.d.ts → utils/ewma.d.ts} +0 -0
- package/dist/_esm5.processed/core/abr/{ewma.js → utils/ewma.js} +0 -0
- package/dist/_esm5.processed/core/abr/{filter_by_bitrate.d.ts → utils/filter_by_bitrate.d.ts} +1 -1
- package/dist/_esm5.processed/core/abr/{filter_by_bitrate.js → utils/filter_by_bitrate.js} +1 -1
- package/dist/_esm5.processed/core/abr/{filter_by_width.d.ts → utils/filter_by_width.d.ts} +1 -1
- package/dist/_esm5.processed/core/abr/{filter_by_width.js → utils/filter_by_width.js} +2 -2
- package/dist/_esm5.processed/core/abr/{select_optimal_representation.d.ts → utils/select_optimal_representation.d.ts} +1 -1
- package/dist/_esm5.processed/core/abr/{select_optimal_representation.js → utils/select_optimal_representation.js} +1 -1
- package/dist/_esm5.processed/core/api/emit_seek_events.d.ts +4 -4
- package/dist/_esm5.processed/core/api/emit_seek_events.js +12 -10
- package/dist/_esm5.processed/core/api/index.d.ts +3 -1
- package/dist/_esm5.processed/core/api/index.js +2 -0
- package/dist/_esm5.processed/core/api/option_utils.js +4 -4
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +280 -0
- package/dist/_esm5.processed/core/api/playback_observer.js +461 -0
- package/dist/_esm5.processed/core/api/public_api.d.ts +8 -7
- package/dist/_esm5.processed/core/api/public_api.js +98 -94
- package/dist/_esm5.processed/core/api/track_choice_manager.js +3 -3
- package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.js +1 -0
- package/dist/_esm5.processed/core/eme/attach_media_keys.js +1 -2
- package/dist/_esm5.processed/core/eme/check_key_statuses.js +4 -5
- package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js +1 -2
- package/dist/_esm5.processed/core/eme/clear_eme_session.js +6 -2
- package/dist/_esm5.processed/core/eme/create_session.js +1 -2
- package/dist/_esm5.processed/core/eme/dispose_media_keys.js +2 -3
- package/dist/_esm5.processed/core/eme/eme_manager.js +4 -5
- package/dist/_esm5.processed/core/eme/find_key_system.js +4 -5
- package/dist/_esm5.processed/core/eme/get_media_keys.js +2 -3
- package/dist/_esm5.processed/core/eme/get_session.js +1 -2
- package/dist/_esm5.processed/core/eme/init_media_keys.js +5 -5
- package/dist/_esm5.processed/core/eme/session_events_listener.js +6 -7
- package/dist/_esm5.processed/core/eme/set_server_certificate.js +8 -3
- package/dist/_esm5.processed/core/eme/types.d.ts +12 -4
- package/dist/_esm5.processed/core/eme/utils/close_session.js +2 -3
- package/dist/_esm5.processed/core/eme/utils/is_session_usable.js +1 -1
- package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +3 -4
- package/dist/_esm5.processed/core/eme/utils/persistent_sessions_store.js +3 -3
- package/dist/_esm5.processed/core/fetchers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/index.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.d.ts +12 -29
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +3 -7
- package/dist/_esm5.processed/core/fetchers/segment/prioritizer.d.ts +53 -53
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +42 -11
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +118 -46
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +21 -20
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +9 -8
- package/dist/_esm5.processed/core/init/create_eme_manager.js +1 -2
- package/dist/_esm5.processed/core/init/create_media_source.js +3 -4
- package/dist/_esm5.processed/core/init/create_stream_playback_observer.d.ts +39 -0
- package/dist/_esm5.processed/core/init/create_stream_playback_observer.js +50 -0
- package/dist/_esm5.processed/core/init/duration_updater.js +16 -7
- package/dist/_esm5.processed/core/init/emit_loaded_event.d.ts +4 -3
- package/dist/_esm5.processed/core/init/emit_loaded_event.js +8 -8
- package/dist/_esm5.processed/core/init/end_of_stream.js +1 -2
- package/dist/_esm5.processed/core/init/get_initial_time.js +2 -3
- package/dist/_esm5.processed/core/init/initial_seek_and_play.d.ts +32 -31
- package/dist/_esm5.processed/core/init/initial_seek_and_play.js +25 -32
- package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +6 -5
- package/dist/_esm5.processed/core/init/initialize_directfile.js +16 -12
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +10 -10
- package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -12
- package/dist/_esm5.processed/core/init/load_on_media_source.d.ts +8 -11
- package/dist/_esm5.processed/core/init/load_on_media_source.js +16 -19
- package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +8 -7
- package/dist/_esm5.processed/core/init/stall_avoider.d.ts +4 -6
- package/dist/_esm5.processed/core/init/stall_avoider.js +56 -42
- package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.d.ts +2 -2
- package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +20 -15
- package/dist/_esm5.processed/core/init/throw_on_media_error.js +1 -2
- package/dist/_esm5.processed/core/init/types.d.ts +0 -20
- package/dist/_esm5.processed/core/init/update_playback_rate.d.ts +5 -4
- package/dist/_esm5.processed/core/init/update_playback_rate.js +10 -11
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.d.ts +4 -4
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +12 -7
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +8 -7
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +9 -10
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +4 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +1 -12
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +10 -10
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +1 -1
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +15 -13
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +36 -23
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.d.ts +9 -17
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +11 -20
- package/dist/_esm5.processed/core/stream/adaptation/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/orchestrator/active_period_emitter.js +5 -6
- package/dist/_esm5.processed/core/stream/orchestrator/are_streams_complete.js +1 -2
- package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +10 -8
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +22 -21
- package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.d.ts +6 -4
- package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +11 -10
- package/dist/_esm5.processed/core/stream/period/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +23 -7
- package/dist/_esm5.processed/core/stream/period/period_stream.js +38 -24
- package/dist/_esm5.processed/core/stream/reload_after_switch.d.ts +5 -4
- package/dist/_esm5.processed/core/stream/reload_after_switch.js +8 -7
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +10 -8
- package/dist/_esm5.processed/core/stream/representation/downloading_queue.d.ts +9 -9
- package/dist/_esm5.processed/core/stream/representation/downloading_queue.js +10 -12
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.d.ts +1 -3
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +6 -8
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +3 -7
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +7 -8
- package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/get_segment_priority.d.ts +6 -9
- package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +7 -8
- package/dist/_esm5.processed/core/stream/representation/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/representation/push_init_segment.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/representation/push_init_segment.js +3 -5
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.d.ts +6 -4
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -5
- package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +9 -12
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +30 -21
- package/dist/_esm5.processed/errors/error_message.js +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/create_request.d.ts +5 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/create_request.js +21 -8
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.js +2 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_segments.d.ts +2 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_segments.js +4 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +2 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +17 -6
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +1 -2
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -1
- package/dist/_esm5.processed/features/initialize_features.js +47 -44
- package/dist/_esm5.processed/index.js +2 -2
- package/dist/_esm5.processed/manifest/index.d.ts +2 -2
- package/dist/_esm5.processed/manifest/index.js +2 -2
- package/dist/_esm5.processed/manifest/representation.js +1 -1
- package/dist/_esm5.processed/manifest/representation_index/static.js +1 -0
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +24 -3
- package/dist/_esm5.processed/manifest/update_period_in_place.js +1 -1
- package/dist/_esm5.processed/manifest/{are_same_content.d.ts → utils.d.ts} +9 -7
- package/dist/_esm5.processed/manifest/{are_same_content.js → utils.js} +18 -1
- package/dist/_esm5.processed/minimal.js +2 -2
- package/dist/_esm5.processed/parsers/containers/isobmff/get_box.d.ts +18 -9
- package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +32 -9
- package/dist/_esm5.processed/parsers/containers/isobmff/read.d.ts +18 -5
- package/dist/_esm5.processed/parsers/containers/isobmff/read.js +28 -6
- package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +52 -47
- package/dist/_esm5.processed/parsers/images/bif.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +3 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +1 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +7 -9
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +11 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +10 -9
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +6 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +5 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +4 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +3 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +19 -18
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +14 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +7 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +3 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +5 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +3 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +17 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.d.ts +7 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +22 -21
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +10 -0
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +9 -9
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +24 -0
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +7 -5
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +12 -9
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +5 -2
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +8 -0
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +11 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +7 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +11 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +7 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +5 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +5 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +13 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +23 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +5 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +3 -1
- package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +11 -3
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +5 -5
- package/dist/_esm5.processed/parsers/manifest/utils/is_segment_still_available.js +3 -6
- package/dist/_esm5.processed/parsers/texttracks/sami/html.js +2 -2
- package/dist/_esm5.processed/parsers/texttracks/sami/native.js +2 -2
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +13 -1
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +4 -4
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.js +2 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +5 -5
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +89 -20
- package/dist/_esm5.processed/transports/dash/segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/local/segment_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
- package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +1 -1
- package/dist/_esm5.processed/transports/smooth/pipelines.js +2 -2
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +3 -3
- package/dist/_esm5.processed/transports/types.d.ts +29 -15
- package/dist/_esm5.processed/transports/utils/byte_range.js +2 -2
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +6 -1
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +6 -4
- package/dist/_esm5.processed/utils/assert.js +3 -3
- package/dist/_esm5.processed/utils/concat_map_latest.js +1 -2
- package/dist/_esm5.processed/utils/defer_subscriptions.js +1 -2
- package/dist/_esm5.processed/utils/filter_map.js +1 -2
- package/dist/_esm5.processed/utils/reference.d.ts +108 -0
- package/dist/_esm5.processed/utils/reference.js +137 -0
- package/dist/_esm5.processed/utils/request/fetch.d.ts +1 -1
- package/dist/_esm5.processed/utils/request/fetch.js +3 -3
- package/dist/_esm5.processed/utils/request/xhr.d.ts +1 -1
- package/dist/_esm5.processed/utils/request/xhr.js +1 -1
- package/dist/_esm5.processed/utils/rx-retry_with_backoff.js +1 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.d.ts +1 -15
- package/dist/rx-player.js +3666 -2470
- package/dist/rx-player.min.d.ts +1 -15
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +28 -1
- package/package.json +43 -43
- package/scripts/build/constants.d.ts +50 -0
- package/scripts/build/generate_build.js +1 -189
- package/scripts/doc-generator/construct_table_of_contents.js +31 -24
- package/scripts/doc-generator/convert_MD_to_HMTL.js +4 -8
- package/scripts/doc-generator/create_documentation.js +331 -0
- package/scripts/doc-generator/create_documentation_page.js +209 -0
- package/scripts/doc-generator/create_page.js +117 -35
- package/scripts/doc-generator/generate_header_html.js +148 -0
- package/scripts/doc-generator/generate_page_html.js +116 -0
- package/scripts/doc-generator/generate_page_list_html.js +93 -0
- package/scripts/doc-generator/generate_sidebar_html.js +88 -0
- package/scripts/doc-generator/get_search_data_for_content.js +137 -0
- package/scripts/doc-generator/index.js +14 -15
- package/scripts/doc-generator/parse_doc_configs.js +327 -0
- package/scripts/doc-generator/scripts/lunr.js +10 -0
- package/scripts/doc-generator/scripts/script.js +451 -0
- package/scripts/doc-generator/styles/style.css +712 -144
- package/scripts/doc-generator/utils.js +85 -0
- package/scripts/fast_demo_build.js +143 -0
- package/scripts/generate_documentation_list.js +6 -2
- package/scripts/generate_full_demo.js +26 -49
- package/scripts/start_demo_web_server.js +14 -4
- package/scripts/update-version +1 -1
- package/sonar-project.properties +2 -1
- package/src/compat/__tests__/add_text_track.test.ts +1 -0
- package/src/compat/__tests__/clear_element_src.test.ts +55 -28
- package/src/compat/__tests__/set_element_src.test.ts +2 -2
- package/src/compat/__tests__/when_loaded_metadata.test.ts +4 -5
- package/src/compat/__tests__/when_media_source_open.test.ts +4 -5
- package/src/compat/clear_element_src.ts +8 -6
- package/src/compat/eme/close_session.ts +3 -5
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
- package/src/compat/eme/custom_media_keys/index.ts +6 -6
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +6 -3
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +1 -1
- package/src/compat/eme/generate_key_request.ts +1 -1
- package/src/compat/eme/load_session.ts +4 -6
- package/src/compat/event_listeners.ts +12 -21
- package/src/compat/on_height_width_change.ts +3 -5
- package/src/compat/set_element_src.ts +1 -1
- package/src/compat/when_loaded_metadata.ts +1 -1
- package/src/compat/when_media_source_open.ts +1 -1
- package/src/config.ts +4 -9
- package/src/core/abr/README.md +7 -7
- package/src/core/abr/abr_manager.ts +62 -21
- package/src/core/abr/bandwidth_estimator.ts +1 -1
- package/src/core/abr/buffer_based_chooser.ts +8 -6
- package/src/core/abr/get_buffer_levels.ts +3 -0
- package/src/core/abr/get_estimate_from_buffer_levels.ts +4 -4
- package/src/core/abr/guess_based_chooser.ts +308 -0
- package/src/core/abr/index.ts +7 -3
- package/src/core/abr/last_estimate_storage.ts +79 -0
- package/src/core/abr/network_analyzer.ts +74 -31
- package/src/core/abr/pending_requests_store.ts +76 -42
- package/src/core/abr/representation_estimator.ts +200 -125
- package/src/core/abr/representation_score_calculator.ts +33 -26
- package/src/core/abr/{__tests__ → utils/__tests__}/ewma.test.ts +0 -0
- package/src/core/abr/{__tests__ → utils/__tests__}/filter_by_bitrate.test.ts +1 -1
- package/src/core/abr/{__tests__ → utils/__tests__}/filter_by_width.test.ts +1 -1
- package/src/core/abr/{__tests__ → utils/__tests__}/select_optimal_representation.test.ts +1 -1
- package/src/core/abr/{ewma.ts → utils/ewma.ts} +0 -0
- package/src/core/abr/{filter_by_bitrate.ts → utils/filter_by_bitrate.ts} +2 -2
- package/src/core/abr/{filter_by_width.ts → utils/filter_by_width.ts} +3 -3
- package/src/core/abr/{select_optimal_representation.ts → utils/select_optimal_representation.ts} +2 -2
- package/src/core/api/README.md +4 -3
- package/src/core/api/__tests__/option_utils.test.ts +1 -0
- package/src/core/api/emit_seek_events.ts +21 -20
- package/src/core/api/index.ts +6 -2
- package/src/core/api/playback_observer.ts +768 -0
- package/src/core/api/public_api.ts +111 -111
- package/src/core/api/track_choice_manager.ts +6 -3
- package/src/core/eme/__tests__/__global__/get_license.test.ts +5 -3
- package/src/core/eme/__tests__/__global__/init_data.test.ts +11 -12
- package/src/core/eme/__tests__/__global__/media_key_system_access.test.ts +2 -1
- package/src/core/eme/__tests__/__global__/media_keys.test.ts +5 -8
- package/src/core/eme/__tests__/__global__/server_certificate.test.ts +8 -6
- package/src/core/eme/__tests__/__global__/utils.ts +1 -0
- package/src/core/eme/__tests__/init_media_keys.test.ts +6 -65
- package/src/core/eme/attach_media_keys.ts +2 -1
- package/src/core/eme/check_key_statuses.ts +10 -8
- package/src/core/eme/clean_old_loaded_sessions.ts +2 -4
- package/src/core/eme/clear_eme_session.ts +6 -1
- package/src/core/eme/create_session.ts +3 -5
- package/src/core/eme/dispose_media_keys.ts +2 -2
- package/src/core/eme/eme_manager.ts +10 -12
- package/src/core/eme/find_key_system.ts +3 -5
- package/src/core/eme/get_media_keys.ts +4 -6
- package/src/core/eme/get_session.ts +2 -4
- package/src/core/eme/init_media_keys.ts +9 -9
- package/src/core/eme/session_events_listener.ts +14 -15
- package/src/core/eme/set_server_certificate.ts +9 -5
- package/src/core/eme/types.ts +15 -4
- package/src/core/eme/utils/close_session.ts +7 -7
- package/src/core/eme/utils/is_session_usable.ts +1 -1
- package/src/core/eme/utils/loaded_sessions_store.ts +2 -2
- package/src/core/eme/utils/persistent_sessions_store.ts +2 -2
- package/src/core/fetchers/index.ts +2 -2
- package/src/core/fetchers/manifest/manifest_fetcher.ts +1 -1
- package/src/core/fetchers/segment/__tests__/prioritizer.test.ts +3 -4
- package/src/core/fetchers/segment/index.ts +2 -2
- package/src/core/fetchers/segment/prioritized_segment_fetcher.ts +37 -45
- package/src/core/fetchers/segment/prioritizer.ts +82 -82
- package/src/core/fetchers/segment/segment_fetcher.ts +178 -80
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +23 -31
- package/src/core/init/create_eme_manager.ts +1 -1
- package/src/core/init/create_media_source.ts +5 -7
- package/src/core/init/create_stream_playback_observer.ts +88 -0
- package/src/core/init/duration_updater.ts +20 -17
- package/src/core/init/emit_loaded_event.ts +11 -15
- package/src/core/init/end_of_stream.ts +2 -4
- package/src/core/init/get_initial_time.ts +0 -1
- package/src/core/init/initial_seek_and_play.ts +67 -51
- package/src/core/init/initialize_directfile.ts +26 -35
- package/src/core/init/initialize_media_source.ts +28 -28
- package/src/core/init/load_on_media_source.ts +51 -58
- package/src/core/init/manifest_update_scheduler.ts +11 -12
- package/src/core/init/stall_avoider.ts +64 -47
- package/src/core/init/stream_events_emitter/stream_events_emitter.ts +24 -21
- package/src/core/init/throw_on_media_error.ts +1 -1
- package/src/core/init/types.ts +0 -24
- package/src/core/init/update_playback_rate.ts +15 -16
- package/src/core/segment_buffers/README.md +3 -3
- package/src/core/segment_buffers/garbage_collector.ts +15 -11
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -7
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +14 -16
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +1 -1
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
- package/src/core/segment_buffers/implementations/utils/manual_time_ranges.ts +2 -2
- package/src/core/segment_buffers/inventory/buffered_history.ts +2 -2
- package/src/core/segment_buffers/inventory/segment_inventory.ts +1 -13
- package/src/core/stream/adaptation/adaptation_stream.ts +78 -56
- package/src/core/stream/adaptation/create_representation_estimator.ts +19 -45
- package/src/core/stream/adaptation/index.ts +2 -2
- package/src/core/stream/index.ts +2 -2
- package/src/core/stream/orchestrator/active_period_emitter.ts +6 -8
- package/src/core/stream/orchestrator/are_streams_complete.ts +2 -4
- package/src/core/stream/orchestrator/index.ts +2 -2
- package/src/core/stream/orchestrator/stream_orchestrator.ts +58 -49
- package/src/core/stream/period/create_empty_adaptation_stream.ts +14 -10
- package/src/core/stream/period/index.ts +2 -2
- package/src/core/stream/period/period_stream.ts +118 -75
- package/src/core/stream/reload_after_switch.ts +13 -10
- package/src/core/stream/representation/append_segment_to_buffer.ts +20 -16
- package/src/core/stream/representation/downloading_queue.ts +21 -24
- package/src/core/stream/representation/force_garbage_collection.ts +16 -23
- package/src/core/stream/representation/get_buffer_status.ts +9 -11
- package/src/core/stream/representation/get_needed_segments.ts +1 -1
- package/src/core/stream/representation/get_segment_priority.ts +8 -10
- package/src/core/stream/representation/index.ts +2 -2
- package/src/core/stream/representation/push_init_segment.ts +19 -16
- package/src/core/stream/representation/push_media_segment.ts +21 -17
- package/src/core/stream/representation/representation_stream.ts +50 -47
- package/src/experimental/features/__tests__/dash_wasm.test.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/create_request.ts +32 -17
- package/src/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.ts +6 -9
- package/src/experimental/tools/VideoThumbnailLoader/load_segments.ts +12 -6
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +4 -2
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +2 -2
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +21 -12
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +1 -1
- package/src/experimental/tools/createMetaplaylist/index.ts +1 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +4 -2
- package/src/features/__tests__/initialize_features.test.ts +191 -101
- package/src/features/initialize_features.ts +40 -37
- package/src/features/list/__tests__/bif_parser.test.ts +1 -0
- package/src/features/list/__tests__/dash.test.ts +1 -0
- package/src/features/list/__tests__/directfile.test.ts +1 -0
- package/src/features/list/__tests__/eme.test.ts +1 -0
- package/src/features/list/__tests__/html_sami_parser.test.ts +1 -0
- package/src/features/list/__tests__/html_srt_parser.test.ts +1 -0
- package/src/features/list/__tests__/html_text_buffer.test.ts +1 -0
- package/src/features/list/__tests__/html_ttml_parser.test.ts +1 -0
- package/src/features/list/__tests__/html_vtt_parser.test.ts +1 -0
- package/src/features/list/__tests__/image_buffer.test.ts +1 -0
- package/src/features/list/__tests__/native_sami_parser.test.ts +1 -0
- package/src/features/list/__tests__/native_srt_parser.test.ts +1 -0
- package/src/features/list/__tests__/native_text_buffer.test.ts +1 -0
- package/src/features/list/__tests__/native_ttml_parser.test.ts +1 -0
- package/src/features/list/__tests__/native_vtt_parser.test.ts +1 -0
- package/src/features/list/__tests__/smooth.test.ts +1 -0
- package/src/index.ts +2 -2
- package/src/manifest/__tests__/manifest.test.ts +1 -0
- package/src/manifest/index.ts +7 -1
- package/src/manifest/representation_index/__tests__/static.test.ts +1 -0
- package/src/manifest/representation_index/static.ts +1 -0
- package/src/manifest/representation_index/types.ts +25 -3
- package/src/manifest/{are_same_content.ts → utils.ts} +26 -9
- package/src/minimal.ts +3 -2
- package/src/parsers/containers/isobmff/get_box.ts +35 -8
- package/src/parsers/containers/isobmff/read.ts +32 -5
- package/src/parsers/containers/isobmff/utils.ts +52 -47
- package/src/parsers/manifest/dash/common/__tests__/flatten_overlapping_period.test.ts +4 -4
- package/src/parsers/manifest/dash/common/flatten_overlapping_periods.ts +4 -2
- package/src/parsers/manifest/dash/common/get_clock_offset.ts +3 -3
- package/src/parsers/manifest/dash/common/get_http_utc-timing_url.ts +15 -6
- package/src/parsers/manifest/dash/common/indexes/base.ts +5 -3
- package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +1 -0
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +9 -9
- package/src/parsers/manifest/dash/common/indexes/list.ts +6 -3
- package/src/parsers/manifest/dash/common/indexes/template.ts +13 -6
- package/src/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.ts +10 -9
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +13 -5
- package/src/parsers/manifest/dash/common/indexes/tokens.ts +4 -4
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_mpd.ts +21 -13
- package/src/parsers/manifest/dash/common/parse_periods.ts +7 -8
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +12 -12
- package/src/parsers/manifest/dash/common/parse_representations.ts +23 -4
- package/src/parsers/manifest/dash/common/resolve_base_urls.ts +33 -24
- package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +12 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/BaseURL.ts +13 -9
- package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +28 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.ts +8 -5
- package/src/parsers/manifest/dash/js-parser/node_parsers/utils.ts +3 -0
- package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +5 -2
- package/src/parsers/manifest/dash/node_parser_types.ts +8 -0
- package/src/parsers/manifest/dash/parsers_types.ts +8 -2
- package/src/parsers/manifest/dash/wasm-parser/rs/lib.rs +1 -8
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +26 -5
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/mod.rs +75 -521
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +7 -4
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +13 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +8 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.ts +6 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/MPD.ts +6 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Period.ts +14 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +26 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.ts +6 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/XLink.ts +7 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/root.ts +7 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +1 -1
- package/src/parsers/manifest/local/representation_index.ts +2 -0
- package/src/parsers/manifest/smooth/create_parser.ts +1 -1
- package/src/parsers/manifest/smooth/representation_index.ts +3 -1
- package/src/parsers/manifest/utils/clear_timeline_from_position.ts +1 -1
- package/src/parsers/manifest/utils/index_helpers.ts +21 -11
- package/src/parsers/manifest/utils/is_segment_still_available.ts +4 -6
- package/src/parsers/texttracks/sami/html.ts +1 -1
- package/src/parsers/texttracks/sami/native.ts +1 -1
- package/src/parsers/texttracks/ttml/html/apply_font_size.ts +11 -1
- package/src/transports/dash/image_pipelines.ts +4 -4
- package/src/transports/dash/init_segment_loader.ts +1 -1
- package/src/transports/dash/manifest_parser.ts +99 -25
- package/src/transports/dash/segment_loader.ts +1 -1
- package/src/transports/dash/segment_parser.ts +4 -4
- package/src/transports/dash/text_parser.ts +8 -8
- package/src/transports/local/segment_loader.ts +2 -2
- package/src/transports/local/segment_parser.ts +4 -4
- package/src/transports/local/text_parser.ts +8 -8
- package/src/transports/metaplaylist/pipelines.ts +11 -11
- package/src/transports/smooth/extract_timings_infos.ts +1 -1
- package/src/transports/smooth/pipelines.ts +8 -8
- package/src/transports/smooth/segment_loader.ts +3 -3
- package/src/transports/types.ts +31 -17
- package/src/transports/utils/call_custom_manifest_loader.ts +1 -1
- package/src/transports/utils/get_isobmff_timing_infos.ts +6 -1
- package/src/transports/utils/parse_text_track.ts +4 -2
- package/src/typings/globals.d.ts +57 -40
- package/src/utils/__tests__/concat_map_latest.test.ts +7 -9
- package/src/utils/__tests__/defer_subscriptions.test.ts +4 -4
- package/src/utils/__tests__/event_emitter.test.ts +1 -1
- package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -0
- package/src/utils/assert.ts +1 -1
- package/src/utils/concat_map_latest.ts +2 -4
- package/src/utils/defer_subscriptions.ts +1 -1
- package/src/utils/filter_map.ts +2 -4
- package/src/utils/reference.ts +234 -0
- package/src/utils/request/fetch.ts +3 -3
- package/src/utils/request/xhr.ts +2 -2
- package/src/utils/rx-retry_with_backoff.ts +2 -4
- package/tsconfig.json +4 -1
- package/tsconfig.modules.json +8 -3
- package/dist/_esm5.processed/core/abr/create_filters.d.ts +0 -27
- package/dist/_esm5.processed/core/abr/create_filters.js +0 -56
- package/dist/_esm5.processed/core/api/clock.d.ts +0 -157
- package/dist/_esm5.processed/core/api/clock.js +0 -363
- package/dist/_esm5.processed/core/init/create_stream_clock.d.ts +0 -34
- package/dist/_esm5.processed/core/init/create_stream_clock.js +0 -55
- package/dist/_esm5.processed/parsers/manifest/dash/common/extract_minimum_availability_time_offset.d.ts +0 -31
- package/dist/_esm5.processed/parsers/manifest/dash/common/extract_minimum_availability_time_offset.js +0 -37
- package/scripts/doc-generator/construct_html.js +0 -135
- package/scripts/doc-generator/construct_page_list.js +0 -120
- package/scripts/doc-generator/create_for_dir.js +0 -151
- package/scripts/doc-generator/get_files_to_convert.js +0 -71
- package/scripts/doc-generator/mkdir_parent.js +0 -21
- package/scripts/doc-generator/read_title_from_md.js +0 -22
- package/scripts/doc-generator/remove_toc_from_md.js +0 -20
- package/src/core/abr/create_filters.ts +0 -59
- package/src/core/api/clock.ts +0 -573
- package/src/core/init/create_stream_clock.ts +0 -93
- package/src/parsers/manifest/dash/common/extract_minimum_availability_time_offset.ts +0 -41
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Observable } from "rxjs";
|
|
17
|
+
import { IPlaybackObservation } from "../api";
|
|
17
18
|
import SegmentBuffersStore from "../segment_buffers";
|
|
18
|
-
import {
|
|
19
|
+
import { ILoadedEvent } from "./types";
|
|
19
20
|
/**
|
|
20
21
|
* Emit a `ILoadedEvent` once the content can be considered as loaded.
|
|
21
|
-
* @param {Observable}
|
|
22
|
+
* @param {Observable} observation$
|
|
22
23
|
* @param {HTMLMediaElement} mediaElement
|
|
23
24
|
* @param {Object|null} segmentBuffersStore
|
|
24
25
|
* @param {boolean} isDirectfile - `true` if this is a directfile content
|
|
25
26
|
* @returns {Observable}
|
|
26
27
|
*/
|
|
27
|
-
export default function emitLoadedEvent(
|
|
28
|
+
export default function emitLoadedEvent(observation$: Observable<IPlaybackObservation>, mediaElement: HTMLMediaElement, segmentBuffersStore: SegmentBuffersStore | null, isDirectfile: boolean): Observable<ILoadedEvent>;
|
|
@@ -13,30 +13,30 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { take, } from "rxjs
|
|
16
|
+
import { take, } from "rxjs";
|
|
17
17
|
import { shouldValidateMetadata, shouldWaitForDataBeforeLoaded, } from "../../compat";
|
|
18
18
|
import filterMap from "../../utils/filter_map";
|
|
19
19
|
import EVENTS from "./events_generators";
|
|
20
20
|
/**
|
|
21
21
|
* Emit a `ILoadedEvent` once the content can be considered as loaded.
|
|
22
|
-
* @param {Observable}
|
|
22
|
+
* @param {Observable} observation$
|
|
23
23
|
* @param {HTMLMediaElement} mediaElement
|
|
24
24
|
* @param {Object|null} segmentBuffersStore
|
|
25
25
|
* @param {boolean} isDirectfile - `true` if this is a directfile content
|
|
26
26
|
* @returns {Observable}
|
|
27
27
|
*/
|
|
28
|
-
export default function emitLoadedEvent(
|
|
29
|
-
return
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
export default function emitLoadedEvent(observation$, mediaElement, segmentBuffersStore, isDirectfile) {
|
|
29
|
+
return observation$.pipe(filterMap(function (observation) {
|
|
30
|
+
if (observation.rebuffering !== null ||
|
|
31
|
+
observation.freezing !== null ||
|
|
32
|
+
observation.readyState === 0) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
if (!shouldWaitForDataBeforeLoaded(isDirectfile, mediaElement.hasAttribute("playsinline"))) {
|
|
36
36
|
return mediaElement.duration > 0 ? EVENTS.loaded(segmentBuffersStore) :
|
|
37
37
|
null;
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
39
|
+
if (observation.readyState >= 3 && observation.currentRange !== null) {
|
|
40
40
|
if (!shouldValidateMetadata() || mediaElement.duration > 0) {
|
|
41
41
|
return EVENTS.loaded(segmentBuffersStore);
|
|
42
42
|
}
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { defer as observableDefer, merge as observableMerge, of as observableOf, race as observableRace, } from "rxjs";
|
|
17
|
-
import { mergeMap, startWith, switchMap, take, takeLast, } from "rxjs/operators";
|
|
16
|
+
import { defer as observableDefer, merge as observableMerge, mergeMap, of as observableOf, race as observableRace, startWith, switchMap, take, takeLast, } from "rxjs";
|
|
18
17
|
import { events } from "../../compat";
|
|
19
18
|
import log from "../../log";
|
|
20
19
|
var onRemoveSourceBuffers$ = events.onRemoveSourceBuffers$, onSourceOpen$ = events.onSourceOpen$, onUpdate$ = events.onUpdate$;
|
|
@@ -30,7 +30,6 @@ var DEFAULT_LIVE_GAP = config.DEFAULT_LIVE_GAP;
|
|
|
30
30
|
* @returns {Number}
|
|
31
31
|
*/
|
|
32
32
|
export default function getInitialTime(manifest, lowLatencyMode, startAt) {
|
|
33
|
-
log.debug("Init: calculating initial time");
|
|
34
33
|
if (startAt != null) {
|
|
35
34
|
var min = manifest.getMinimumPosition();
|
|
36
35
|
var max = manifest.getMaximumPosition();
|
|
@@ -94,8 +93,8 @@ export default function getInitialTime(manifest, lowLatencyMode, startAt) {
|
|
|
94
93
|
var diffFromLiveTime = suggestedPresentationDelay !== undefined ? suggestedPresentationDelay :
|
|
95
94
|
lowLatencyMode ? DEFAULT_LIVE_GAP.LOW_LATENCY :
|
|
96
95
|
DEFAULT_LIVE_GAP.DEFAULT;
|
|
97
|
-
log.debug("Init: "
|
|
98
|
-
|
|
96
|
+
log.debug("Init: ".concat(liveTime, " defined as the live time, applying a live gap") +
|
|
97
|
+
" of ".concat(diffFromLiveTime));
|
|
99
98
|
return Math.max(liveTime - diffFromLiveTime, minimumPosition);
|
|
100
99
|
}
|
|
101
100
|
log.info("Init: starting at the minimum available position:", minimumPosition);
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Observable } from "rxjs";
|
|
17
|
-
import {
|
|
17
|
+
import { IReadOnlySharedReference } from "../../utils/reference";
|
|
18
|
+
import { IPlaybackObservation, PlaybackObserver } from "../api";
|
|
19
|
+
import { IWarningEvent } from "./types";
|
|
18
20
|
/** Event emitted when trying to perform the initial `play`. */
|
|
19
21
|
export declare type IInitialPlayEvent =
|
|
20
22
|
/** Autoplay is not enabled, but all required steps to do so are there. */
|
|
@@ -35,46 +37,45 @@ export declare type IInitialPlayEvent =
|
|
|
35
37
|
/** Warnings preventing the initial play from happening normally. */
|
|
36
38
|
IWarningEvent;
|
|
37
39
|
/**
|
|
38
|
-
* Emit once as soon as the
|
|
39
|
-
* played by calling the `play` method.
|
|
40
|
+
* Emit once as soon as the playback observation announces that the content can
|
|
41
|
+
* begin to be played by calling the `play` method.
|
|
40
42
|
*
|
|
41
43
|
* This depends on browser-defined criteria (e.g. the readyState status) as well
|
|
42
44
|
* as RxPlayer-defined ones (e.g.) not rebuffering.
|
|
43
45
|
*
|
|
44
|
-
* @param {Observable}
|
|
46
|
+
* @param {Observable} observation$
|
|
45
47
|
* @returns {Observable.<undefined>}
|
|
46
48
|
*/
|
|
47
|
-
export declare function waitUntilPlayable(
|
|
49
|
+
export declare function waitUntilPlayable(observation$: Observable<IPlaybackObservation>): Observable<undefined>;
|
|
50
|
+
/** Object returned by `initialSeekAndPlay`. */
|
|
51
|
+
export interface IInitialSeekAndPlayObject {
|
|
52
|
+
/**
|
|
53
|
+
* Observable which, when subscribed, will try to seek at the initial position
|
|
54
|
+
* then play if needed as soon as the HTMLMediaElement's properties are right.
|
|
55
|
+
*
|
|
56
|
+
* Emits various events relative to the status of this operation.
|
|
57
|
+
*/
|
|
58
|
+
seekAndPlay$: Observable<IInitialPlayEvent>;
|
|
59
|
+
/**
|
|
60
|
+
* Shared reference whose value becomes `true` once the initial seek has
|
|
61
|
+
* been considered / has been done by `seekAndPlay$`.
|
|
62
|
+
*/
|
|
63
|
+
initialSeekPerformed: IReadOnlySharedReference<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Shared reference whose value becomes `true` once the initial play has
|
|
66
|
+
* been considered / has been done by `seekAndPlay$`.
|
|
67
|
+
*/
|
|
68
|
+
initialPlayPerformed: IReadOnlySharedReference<boolean>;
|
|
69
|
+
}
|
|
48
70
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* - seek$: when subscribed, will seek to the wanted started time as soon as
|
|
52
|
-
* it can. Emit and complete when done.
|
|
53
|
-
*
|
|
54
|
-
* - play$: when subscribed, will autoplay if and only if the `mustAutoPlay`
|
|
55
|
-
* option is set as soon as it can.
|
|
56
|
-
* Emit and complete when done.
|
|
57
|
-
* Might also emit some warning events if issues related to the initial
|
|
58
|
-
* playback arised
|
|
59
|
-
*
|
|
60
|
-
* Both Observables are `shareReplay`, meaning that they re-emit everything on
|
|
61
|
-
* subscription.
|
|
62
|
-
*
|
|
63
|
-
* /!\ `play$` has a dependency on `seek$`, as such, the player will try to seek
|
|
64
|
-
* as soon as either Observable is subscribed to.
|
|
65
|
-
*
|
|
71
|
+
* Creates an Observable allowing to seek at the initially wanted position and
|
|
72
|
+
* to play if autoPlay is wanted.
|
|
66
73
|
* @param {Object} args
|
|
67
74
|
* @returns {Object}
|
|
68
75
|
*/
|
|
69
|
-
export default function initialSeekAndPlay({
|
|
70
|
-
|
|
71
|
-
isDirectfile: boolean;
|
|
76
|
+
export default function initialSeekAndPlay({ mediaElement, playbackObserver, startTime, mustAutoPlay }: {
|
|
77
|
+
playbackObserver: PlaybackObserver;
|
|
72
78
|
mediaElement: HTMLMediaElement;
|
|
73
79
|
mustAutoPlay: boolean;
|
|
74
|
-
/** Perform an internal seek. */
|
|
75
|
-
setCurrentTime: (nb: number) => void;
|
|
76
80
|
startTime: number | (() => number);
|
|
77
|
-
}):
|
|
78
|
-
seek$: Observable<unknown>;
|
|
79
|
-
play$: Observable<IInitialPlayEvent>;
|
|
80
|
-
};
|
|
81
|
+
}): IInitialSeekAndPlayObject;
|
|
@@ -13,29 +13,29 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { concat as observableConcat, of as observableOf, } from "rxjs";
|
|
17
|
-
import { catchError, filter, mapTo, mergeMap, shareReplay, startWith, take, tap, } from "rxjs/operators";
|
|
16
|
+
import { catchError, concat as observableConcat, filter, map, mergeMap, of as observableOf, shareReplay, startWith, take, tap, } from "rxjs";
|
|
18
17
|
import { play, shouldValidateMetadata, whenLoadedMetadata$, } from "../../compat";
|
|
19
18
|
import { MediaError } from "../../errors";
|
|
20
19
|
import log from "../../log";
|
|
20
|
+
import { createSharedReference, } from "../../utils/reference";
|
|
21
21
|
import EVENTS from "./events_generators";
|
|
22
22
|
/**
|
|
23
|
-
* Emit once as soon as the
|
|
24
|
-
* played by calling the `play` method.
|
|
23
|
+
* Emit once as soon as the playback observation announces that the content can
|
|
24
|
+
* begin to be played by calling the `play` method.
|
|
25
25
|
*
|
|
26
26
|
* This depends on browser-defined criteria (e.g. the readyState status) as well
|
|
27
27
|
* as RxPlayer-defined ones (e.g.) not rebuffering.
|
|
28
28
|
*
|
|
29
|
-
* @param {Observable}
|
|
29
|
+
* @param {Observable} observation$
|
|
30
30
|
* @returns {Observable.<undefined>}
|
|
31
31
|
*/
|
|
32
|
-
export function waitUntilPlayable(
|
|
33
|
-
return
|
|
32
|
+
export function waitUntilPlayable(observation$) {
|
|
33
|
+
return observation$.pipe(filter(function (_a) {
|
|
34
34
|
var seeking = _a.seeking, rebuffering = _a.rebuffering, readyState = _a.readyState;
|
|
35
35
|
return !seeking &&
|
|
36
36
|
rebuffering === null &&
|
|
37
37
|
readyState >= 1;
|
|
38
|
-
}), take(1),
|
|
38
|
+
}), take(1), map(function () { return undefined; }));
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Try to play content then handle autoplay errors.
|
|
@@ -43,7 +43,7 @@ export function waitUntilPlayable(clock$) {
|
|
|
43
43
|
* @returns {Observable}
|
|
44
44
|
*/
|
|
45
45
|
function autoPlay(mediaElement) {
|
|
46
|
-
return play(mediaElement).pipe(
|
|
46
|
+
return play(mediaElement).pipe(map(function () { return "autoplay"; }), catchError(function (error) {
|
|
47
47
|
if (error instanceof Error && error.name === "NotAllowedError") {
|
|
48
48
|
// auto-play was probably prevented.
|
|
49
49
|
log.warn("Init: Media element can't play." +
|
|
@@ -56,42 +56,31 @@ function autoPlay(mediaElement) {
|
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* - seek$: when subscribed, will seek to the wanted started time as soon as
|
|
62
|
-
* it can. Emit and complete when done.
|
|
63
|
-
*
|
|
64
|
-
* - play$: when subscribed, will autoplay if and only if the `mustAutoPlay`
|
|
65
|
-
* option is set as soon as it can.
|
|
66
|
-
* Emit and complete when done.
|
|
67
|
-
* Might also emit some warning events if issues related to the initial
|
|
68
|
-
* playback arised
|
|
69
|
-
*
|
|
70
|
-
* Both Observables are `shareReplay`, meaning that they re-emit everything on
|
|
71
|
-
* subscription.
|
|
72
|
-
*
|
|
73
|
-
* /!\ `play$` has a dependency on `seek$`, as such, the player will try to seek
|
|
74
|
-
* as soon as either Observable is subscribed to.
|
|
75
|
-
*
|
|
59
|
+
* Creates an Observable allowing to seek at the initially wanted position and
|
|
60
|
+
* to play if autoPlay is wanted.
|
|
76
61
|
* @param {Object} args
|
|
77
62
|
* @returns {Object}
|
|
78
63
|
*/
|
|
79
64
|
export default function initialSeekAndPlay(_a) {
|
|
80
|
-
var
|
|
65
|
+
var mediaElement = _a.mediaElement, playbackObserver = _a.playbackObserver, startTime = _a.startTime, mustAutoPlay = _a.mustAutoPlay;
|
|
66
|
+
var initialSeekPerformed = createSharedReference(false);
|
|
67
|
+
var initialPlayPerformed = createSharedReference(false);
|
|
81
68
|
var seek$ = whenLoadedMetadata$(mediaElement).pipe(take(1), tap(function () {
|
|
82
69
|
log.info("Init: Set initial time", startTime);
|
|
83
70
|
var initialTime = typeof startTime === "function" ? startTime() :
|
|
84
71
|
startTime;
|
|
85
|
-
setCurrentTime(initialTime);
|
|
72
|
+
playbackObserver.setCurrentTime(initialTime);
|
|
73
|
+
initialSeekPerformed.setValue(true);
|
|
74
|
+
initialSeekPerformed.finish();
|
|
86
75
|
}), shareReplay({ refCount: true }));
|
|
87
|
-
var
|
|
76
|
+
var seekAndPlay$ = seek$.pipe(mergeMap(function () {
|
|
88
77
|
if (!shouldValidateMetadata() || mediaElement.duration > 0) {
|
|
89
|
-
return waitUntilPlayable(
|
|
78
|
+
return waitUntilPlayable(playbackObserver.observe(true));
|
|
90
79
|
}
|
|
91
80
|
else {
|
|
92
81
|
var error = new MediaError("MEDIA_ERR_NOT_LOADED_METADATA", "Cannot load automatically: your browser " +
|
|
93
82
|
"falsely announced having loaded the content.");
|
|
94
|
-
return waitUntilPlayable(
|
|
83
|
+
return waitUntilPlayable(playbackObserver.observe(true))
|
|
95
84
|
.pipe(startWith(EVENTS.warning(error)));
|
|
96
85
|
}
|
|
97
86
|
}), mergeMap(function (evt) {
|
|
@@ -104,9 +93,13 @@ export default function initialSeekAndPlay(_a) {
|
|
|
104
93
|
log.warn("Init: autoplay is enabled on HTML media element. " +
|
|
105
94
|
"Media will play as soon as possible.");
|
|
106
95
|
}
|
|
96
|
+
initialPlayPerformed.setValue(true);
|
|
97
|
+
initialPlayPerformed.finish();
|
|
107
98
|
return observableOf({ type: "skipped" });
|
|
108
99
|
}
|
|
109
100
|
return autoPlay(mediaElement).pipe(mergeMap(function (autoplayEvt) {
|
|
101
|
+
initialPlayPerformed.setValue(true);
|
|
102
|
+
initialPlayPerformed.finish();
|
|
110
103
|
if (autoplayEvt === "autoplay") {
|
|
111
104
|
return observableOf({ type: "autoplay" });
|
|
112
105
|
}
|
|
@@ -117,5 +110,5 @@ export default function initialSeekAndPlay(_a) {
|
|
|
117
110
|
}
|
|
118
111
|
}));
|
|
119
112
|
}), shareReplay({ refCount: true }));
|
|
120
|
-
return {
|
|
113
|
+
return { seekAndPlay$: seekAndPlay$, initialPlayPerformed: initialPlayPerformed, initialSeekPerformed: initialSeekPerformed };
|
|
121
114
|
}
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
* It always should be imported through the `features` object.
|
|
19
19
|
*/
|
|
20
20
|
import { Observable } from "rxjs";
|
|
21
|
+
import { IReadOnlySharedReference } from "../../utils/reference";
|
|
22
|
+
import { PlaybackObserver } from "../api";
|
|
21
23
|
import { IKeySystemOption } from "../eme";
|
|
22
24
|
import { IInitialTimeOptions } from "./get_initial_time";
|
|
23
|
-
import { IDirectfileEvent
|
|
25
|
+
import { IDirectfileEvent } from "./types";
|
|
24
26
|
export interface IDirectFileOptions {
|
|
25
27
|
autoPlay: boolean;
|
|
26
|
-
clock$: Observable<IInitClockTick>;
|
|
27
28
|
keySystems: IKeySystemOption[];
|
|
28
29
|
mediaElement: HTMLMediaElement;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
playbackObserver: PlaybackObserver;
|
|
31
|
+
speed: IReadOnlySharedReference<number>;
|
|
31
32
|
startAt?: IInitialTimeOptions;
|
|
32
33
|
url?: string;
|
|
33
34
|
}
|
|
@@ -36,5 +37,5 @@ export interface IDirectFileOptions {
|
|
|
36
37
|
* @param {Object} directfileOptions
|
|
37
38
|
* @returns {Observable}
|
|
38
39
|
*/
|
|
39
|
-
export default function initializeDirectfileContent({ autoPlay,
|
|
40
|
+
export default function initializeDirectfileContent({ autoPlay, keySystems, mediaElement, playbackObserver, speed, startAt, url, }: IDirectFileOptions): Observable<IDirectfileEvent>;
|
|
40
41
|
export { IDirectfileEvent };
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
* /!\ This file is feature-switchable.
|
|
18
18
|
* It always should be imported through the `features` object.
|
|
19
19
|
*/
|
|
20
|
-
import { EMPTY, merge as observableMerge, of as observableOf, } from "rxjs";
|
|
21
|
-
import { filter, ignoreElements, mergeMap, mergeMapTo, switchMap, share, take, } from "rxjs/operators";
|
|
20
|
+
import { EMPTY, filter, ignoreElements, merge as observableMerge, mergeMap, switchMap, of as observableOf, share, take, } from "rxjs";
|
|
22
21
|
import { clearElementSrc, setElementSrc$, } from "../../compat";
|
|
23
22
|
import log from "../../log";
|
|
24
23
|
import deferSubscriptions from "../../utils/defer_subscriptions";
|
|
@@ -75,7 +74,7 @@ function getDirectFileInitialTime(mediaElement, startAt) {
|
|
|
75
74
|
* @returns {Observable}
|
|
76
75
|
*/
|
|
77
76
|
export default function initializeDirectfileContent(_a) {
|
|
78
|
-
var autoPlay = _a.autoPlay,
|
|
77
|
+
var autoPlay = _a.autoPlay, keySystems = _a.keySystems, mediaElement = _a.mediaElement, playbackObserver = _a.playbackObserver, speed = _a.speed, startAt = _a.startAt, url = _a.url;
|
|
79
78
|
clearElementSrc(mediaElement);
|
|
80
79
|
if (url == null) {
|
|
81
80
|
throw new Error("No URL for a DirectFile content");
|
|
@@ -85,23 +84,29 @@ export default function initializeDirectfileContent(_a) {
|
|
|
85
84
|
log.debug("Init: Calculating initial time");
|
|
86
85
|
var initialTime = function () { return getDirectFileInitialTime(mediaElement, startAt); };
|
|
87
86
|
log.debug("Init: Initial time calculated:", initialTime);
|
|
88
|
-
var
|
|
89
|
-
mustAutoPlay: autoPlay
|
|
87
|
+
var seekAndPlay$ = initialSeekAndPlay({ mediaElement: mediaElement, playbackObserver: playbackObserver, startTime: initialTime,
|
|
88
|
+
mustAutoPlay: autoPlay }).seekAndPlay$;
|
|
90
89
|
// Create EME Manager, an observable which will manage every EME-related
|
|
91
90
|
// issue.
|
|
92
91
|
var emeManager$ = linkURL$.pipe(mergeMap(function () { return createEMEManager(mediaElement, keySystems, EMPTY); }), deferSubscriptions(), share());
|
|
93
92
|
// Translate errors coming from the media element into RxPlayer errors
|
|
94
93
|
// through a throwing Observable.
|
|
95
94
|
var mediaError$ = throwOnMediaError(mediaElement);
|
|
95
|
+
var observation$ = playbackObserver.observe(true);
|
|
96
96
|
// Set the speed set by the user on the media element while pausing a
|
|
97
97
|
// little longer while the buffer is empty.
|
|
98
|
-
var playbackRate$ = updatePlaybackRate(mediaElement, speed
|
|
98
|
+
var playbackRate$ = updatePlaybackRate(mediaElement, speed, observation$)
|
|
99
|
+
// NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
|
|
100
|
+
// first type parameter as `any` instead of the perfectly fine `unknown`,
|
|
101
|
+
// leading to linter issues, as it forbids the usage of `any`.
|
|
102
|
+
// This is why we're disabling the eslint rule.
|
|
103
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
99
104
|
.pipe(ignoreElements());
|
|
100
105
|
/**
|
|
101
106
|
* Observable trying to avoid various stalling situations, emitting "stalled"
|
|
102
107
|
* events when it cannot, as well as "unstalled" events when it get out of one.
|
|
103
108
|
*/
|
|
104
|
-
var stallAvoider$ = StallAvoider(
|
|
109
|
+
var stallAvoider$ = StallAvoider(playbackObserver, null, EMPTY, EMPTY);
|
|
105
110
|
/**
|
|
106
111
|
* Emit a "loaded" events once the initial play has been performed and the
|
|
107
112
|
* media can begin playback.
|
|
@@ -109,16 +114,15 @@ export default function initializeDirectfileContent(_a) {
|
|
|
109
114
|
*/
|
|
110
115
|
var loadingEvts$ = emeManager$.pipe(filter(function isEMEReady(evt) {
|
|
111
116
|
if (evt.type === "created-media-keys") {
|
|
112
|
-
evt.value.
|
|
117
|
+
evt.value.canAttachMediaKeys.setValue(true);
|
|
113
118
|
return true;
|
|
114
119
|
}
|
|
115
120
|
return evt.type === "eme-disabled" || evt.type === "attached-media-keys";
|
|
116
|
-
}), take(1),
|
|
121
|
+
}), take(1), mergeMap(function () { return seekAndPlay$; }), switchMap(function (evt) {
|
|
117
122
|
if (evt.type === "warning") {
|
|
118
123
|
return observableOf(evt);
|
|
119
124
|
}
|
|
120
|
-
return emitLoadedEvent(
|
|
125
|
+
return emitLoadedEvent(observation$, mediaElement, null, true);
|
|
121
126
|
}));
|
|
122
|
-
|
|
123
|
-
return observableMerge(loadingEvts$, initialSeek$, emeManager$, mediaError$, playbackRate$, stallAvoider$);
|
|
127
|
+
return observableMerge(loadingEvts$, emeManager$, mediaError$, playbackRate$, stallAvoider$);
|
|
124
128
|
}
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { Observable } from "rxjs";
|
|
17
|
+
import { IReadOnlySharedReference } from "../../utils/reference";
|
|
17
18
|
import { IABRManagerArguments } from "../abr";
|
|
19
|
+
import { PlaybackObserver } from "../api";
|
|
18
20
|
import { IKeySystemOption } from "../eme";
|
|
19
21
|
import { IManifestFetcherParsedResult, IManifestFetcherWarningEvent, ManifestFetcher, SegmentFetcherCreator } from "../fetchers";
|
|
20
22
|
import { ITextTrackSegmentBufferOptions } from "../segment_buffers";
|
|
21
23
|
import { IInitialTimeOptions } from "./get_initial_time";
|
|
22
|
-
import {
|
|
24
|
+
import { IInitEvent } from "./types";
|
|
23
25
|
/** Arguments to give to the `InitializeOnMediaSource` function. */
|
|
24
26
|
export interface IInitializeArguments {
|
|
25
27
|
/** Options concerning the ABR logic. */
|
|
@@ -29,11 +31,11 @@ export interface IInitializeArguments {
|
|
|
29
31
|
/** Options concerning the media buffers. */
|
|
30
32
|
bufferOptions: {
|
|
31
33
|
/** Buffer "goal" at which we stop downloading new segments. */
|
|
32
|
-
wantedBufferAhead
|
|
34
|
+
wantedBufferAhead: IReadOnlySharedReference<number>;
|
|
33
35
|
/** Max buffer size after the current position, in seconds (we GC further up). */
|
|
34
|
-
maxBufferAhead
|
|
36
|
+
maxBufferAhead: IReadOnlySharedReference<number>;
|
|
35
37
|
/** Max buffer size before the current position, in seconds (we GC further down). */
|
|
36
|
-
maxBufferBehind
|
|
38
|
+
maxBufferBehind: IReadOnlySharedReference<number>;
|
|
37
39
|
/** Strategy when switching the current bitrate manually (smooth vs reload). */
|
|
38
40
|
manualBitrateSwitchingMode: "seamless" | "direct";
|
|
39
41
|
/**
|
|
@@ -47,7 +49,7 @@ export interface IInitializeArguments {
|
|
|
47
49
|
onCodecSwitch: "continue" | "reload";
|
|
48
50
|
};
|
|
49
51
|
/** Regularly emit current playback conditions. */
|
|
50
|
-
|
|
52
|
+
playbackObserver: PlaybackObserver;
|
|
51
53
|
/** Every encryption configuration set. */
|
|
52
54
|
keySystems: IKeySystemOption[];
|
|
53
55
|
/** `true` to play low-latency contents optimally. */
|
|
@@ -62,10 +64,8 @@ export interface IInitializeArguments {
|
|
|
62
64
|
minimumManifestUpdateInterval: number;
|
|
63
65
|
/** Interface allowing to load segments */
|
|
64
66
|
segmentFetcherCreator: SegmentFetcherCreator;
|
|
65
|
-
/** Perform an internal seek */
|
|
66
|
-
setCurrentTime: (time: number) => void;
|
|
67
67
|
/** Emit the playback rate (speed) set by the user. */
|
|
68
|
-
speed
|
|
68
|
+
speed: IReadOnlySharedReference<number>;
|
|
69
69
|
/** The configured starting position. */
|
|
70
70
|
startAt?: IInitialTimeOptions;
|
|
71
71
|
/** Configuration specific to the text track. */
|
|
@@ -102,4 +102,4 @@ export interface IInitializeArguments {
|
|
|
102
102
|
* @param {Object} args
|
|
103
103
|
* @returns {Observable}
|
|
104
104
|
*/
|
|
105
|
-
export default function InitializeOnMediaSource({ adaptiveOptions, autoPlay, bufferOptions,
|
|
105
|
+
export default function InitializeOnMediaSource({ adaptiveOptions, autoPlay, bufferOptions, keySystems, lowLatencyMode, manifest$, manifestFetcher, mediaElement, minimumManifestUpdateInterval, playbackObserver, segmentFetcherCreator, speed, startAt, textTrackOptions }: IInitializeArguments): Observable<IInitEvent>;
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { combineLatest as observableCombineLatest, EMPTY, merge as observableMerge, of as observableOf, Subject, } from "rxjs";
|
|
17
|
-
import { exhaustMap, filter, finalize, ignoreElements, map, mapTo, mergeMap, mergeScan, share, shareReplay, startWith, switchMap, take, takeUntil, tap, } from "rxjs/operators";
|
|
16
|
+
import { combineLatest as observableCombineLatest, EMPTY, exhaustMap, filter, finalize, ignoreElements, map, merge as observableMerge, mergeMap, mergeScan, of as observableOf, share, shareReplay, startWith, Subject, switchMap, take, takeUntil, tap, } from "rxjs";
|
|
18
17
|
import { shouldReloadMediaSourceOnDecipherabilityUpdate } from "../../compat";
|
|
19
18
|
import config from "../../config";
|
|
20
19
|
import log from "../../log";
|
|
@@ -64,7 +63,7 @@ var OUT_OF_SYNC_MANIFEST_REFRESH_DELAY = config.OUT_OF_SYNC_MANIFEST_REFRESH_DEL
|
|
|
64
63
|
* @returns {Observable}
|
|
65
64
|
*/
|
|
66
65
|
export default function InitializeOnMediaSource(_a) {
|
|
67
|
-
var adaptiveOptions = _a.adaptiveOptions, autoPlay = _a.autoPlay, bufferOptions = _a.bufferOptions,
|
|
66
|
+
var adaptiveOptions = _a.adaptiveOptions, autoPlay = _a.autoPlay, bufferOptions = _a.bufferOptions, keySystems = _a.keySystems, lowLatencyMode = _a.lowLatencyMode, manifest$ = _a.manifest$, manifestFetcher = _a.manifestFetcher, mediaElement = _a.mediaElement, minimumManifestUpdateInterval = _a.minimumManifestUpdateInterval, playbackObserver = _a.playbackObserver, segmentFetcherCreator = _a.segmentFetcherCreator, speed = _a.speed, startAt = _a.startAt, textTrackOptions = _a.textTrackOptions;
|
|
68
67
|
/** Choose the right "Representation" for a given "Adaptation". */
|
|
69
68
|
var abrManager = new ABRManager(adaptiveOptions);
|
|
70
69
|
/**
|
|
@@ -115,10 +114,12 @@ export default function InitializeOnMediaSource(_a) {
|
|
|
115
114
|
return openMediaSource$.pipe(mergeMap(function () {
|
|
116
115
|
// Now that the MediaSource has been opened and linked to the media
|
|
117
116
|
// element we can attach the MediaKeys instance to the latter.
|
|
118
|
-
evt.value.
|
|
117
|
+
evt.value.canAttachMediaKeys.setValue(true);
|
|
119
118
|
// If the `disableMediaKeysAttachmentLock` option has been set to
|
|
120
119
|
// `true`, we should not wait until the MediaKeys instance has been
|
|
121
120
|
// attached to start loading the content.
|
|
121
|
+
// TODO we may want to keep keySystems option knowledge in the EME
|
|
122
|
+
// code
|
|
122
123
|
var shouldDisableLock = evt.value.options
|
|
123
124
|
.disableMediaKeysAttachmentLock === true;
|
|
124
125
|
return shouldDisableLock ? observableOf({ isEmeReady: true, drmSystemId: drmSystemId_1 }) :
|
|
@@ -147,12 +148,11 @@ export default function InitializeOnMediaSource(_a) {
|
|
|
147
148
|
var mediaSourceLoader = createMediaSourceLoader({
|
|
148
149
|
abrManager: abrManager,
|
|
149
150
|
bufferOptions: objectAssign({ textTrackOptions: textTrackOptions, drmSystemId: drmSystemId }, bufferOptions),
|
|
150
|
-
clock$: clock$,
|
|
151
151
|
manifest: manifest,
|
|
152
152
|
mediaElement: mediaElement,
|
|
153
|
+
playbackObserver: playbackObserver,
|
|
153
154
|
segmentFetcherCreator: segmentFetcherCreator,
|
|
154
|
-
speed
|
|
155
|
-
setCurrentTime: setCurrentTime,
|
|
155
|
+
speed: speed,
|
|
156
156
|
});
|
|
157
157
|
// handle initial load and reloads
|
|
158
158
|
var recursiveLoad$ = recursivelyLoadOnMediaSource(initialMediaSource, initialTime, autoPlay);
|
|
@@ -160,7 +160,7 @@ export default function InitializeOnMediaSource(_a) {
|
|
|
160
160
|
var scheduleRefresh$ = new Subject();
|
|
161
161
|
var manifestUpdate$ = manifestUpdateScheduler({ initialManifest: manifestEvt, manifestFetcher: manifestFetcher, minimumManifestUpdateInterval: minimumManifestUpdateInterval, scheduleRefresh$: scheduleRefresh$ });
|
|
162
162
|
var manifestEvents$ = observableMerge(fromEvent(manifest, "manifestUpdate")
|
|
163
|
-
.pipe(
|
|
163
|
+
.pipe(map(function () { return EVENTS.manifestUpdate(); })), fromEvent(manifest, "decipherabilityUpdate")
|
|
164
164
|
.pipe(map(EVENTS.decipherabilityUpdate)));
|
|
165
165
|
var setUndecipherableRepresentations$ = emeManager$.pipe(tap(function (evt) {
|
|
166
166
|
if (evt.type === "keys-update") {
|
|
@@ -170,7 +170,13 @@ export default function InitializeOnMediaSource(_a) {
|
|
|
170
170
|
log.info("Init: blacklisting Representations based on protection data.");
|
|
171
171
|
manifest.addUndecipherableProtectionData(evt.value);
|
|
172
172
|
}
|
|
173
|
-
}),
|
|
173
|
+
}),
|
|
174
|
+
// NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
|
|
175
|
+
// first type parameter as `any` instead of the perfectly fine `unknown`,
|
|
176
|
+
// leading to linter issues, as it forbids the usage of `any`.
|
|
177
|
+
// This is why we're disabling the eslint rule.
|
|
178
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
179
|
+
ignoreElements());
|
|
174
180
|
return observableMerge(manifestEvents$, manifestUpdate$, setUndecipherableRepresentations$, recursiveLoad$)
|
|
175
181
|
.pipe(startWith(EVENTS.manifestReady(manifest)), finalize(function () { scheduleRefresh$.complete(); }));
|
|
176
182
|
/**
|
|
@@ -212,17 +218,17 @@ export default function InitializeOnMediaSource(_a) {
|
|
|
212
218
|
// to flush the buffers
|
|
213
219
|
var position = evt.value.position;
|
|
214
220
|
if (position + 0.001 < evt.value.duration) {
|
|
215
|
-
setCurrentTime(mediaElement.currentTime + 0.001);
|
|
221
|
+
playbackObserver.setCurrentTime(mediaElement.currentTime + 0.001);
|
|
216
222
|
}
|
|
217
223
|
else {
|
|
218
|
-
setCurrentTime(position);
|
|
224
|
+
playbackObserver.setCurrentTime(position);
|
|
219
225
|
}
|
|
220
226
|
return null;
|
|
221
227
|
case "encryption-data-encountered":
|
|
222
228
|
protectedSegments$.next(evt.value);
|
|
223
229
|
return null;
|
|
224
230
|
case "needs-buffer-flush":
|
|
225
|
-
setCurrentTime(mediaElement.currentTime + 0.001);
|
|
231
|
+
playbackObserver.setCurrentTime(mediaElement.currentTime + 0.001);
|
|
226
232
|
return null;
|
|
227
233
|
}
|
|
228
234
|
return evt;
|
|
@@ -15,30 +15,27 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Observable } from "rxjs";
|
|
17
17
|
import Manifest from "../../manifest";
|
|
18
|
+
import { IReadOnlySharedReference } from "../../utils/reference";
|
|
18
19
|
import ABRManager from "../abr";
|
|
20
|
+
import { PlaybackObserver } from "../api";
|
|
19
21
|
import { SegmentFetcherCreator } from "../fetchers";
|
|
20
22
|
import { IStreamOrchestratorOptions } from "../stream";
|
|
21
|
-
import {
|
|
23
|
+
import { IMediaSourceLoaderEvent } from "./types";
|
|
22
24
|
/** Arguments needed by `createMediaSourceLoader`. */
|
|
23
25
|
export interface IMediaSourceLoaderArguments {
|
|
24
26
|
/** Module helping to choose the right Representation. */
|
|
25
27
|
abrManager: ABRManager;
|
|
26
28
|
/** Various stream-related options. */
|
|
27
29
|
bufferOptions: IStreamOrchestratorOptions;
|
|
28
|
-
/** Observable emitting playback conditions regularly. */
|
|
29
|
-
clock$: Observable<IInitClockTick>;
|
|
30
30
|
manifest: Manifest;
|
|
31
31
|
/** Media Element on which the content will be played. */
|
|
32
32
|
mediaElement: HTMLMediaElement;
|
|
33
|
+
/** Emit playback conditions regularly. */
|
|
34
|
+
playbackObserver: PlaybackObserver;
|
|
33
35
|
/** Module to facilitate segment fetching. */
|
|
34
36
|
segmentFetcherCreator: SegmentFetcherCreator;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
* Replay the last value on subscription.
|
|
38
|
-
*/
|
|
39
|
-
speed$: Observable<number>;
|
|
40
|
-
/** Perform an internal seek */
|
|
41
|
-
setCurrentTime: (nb: number) => void;
|
|
37
|
+
/** Last wanted playback rate. */
|
|
38
|
+
speed: IReadOnlySharedReference<number>;
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Returns a function allowing to load or reload the content in arguments into
|
|
@@ -46,4 +43,4 @@ export interface IMediaSourceLoaderArguments {
|
|
|
46
43
|
* @param {Object} args
|
|
47
44
|
* @returns {Function}
|
|
48
45
|
*/
|
|
49
|
-
export default function createMediaSourceLoader({ mediaElement, manifest,
|
|
46
|
+
export default function createMediaSourceLoader({ mediaElement, manifest, speed, bufferOptions, abrManager, playbackObserver, segmentFetcherCreator }: IMediaSourceLoaderArguments): (mediaSource: MediaSource, initialTime: number, autoPlay: boolean) => Observable<IMediaSourceLoaderEvent>;
|