rx-player 4.0.0-dev.2023092900 → 4.0.0-dev.2023102700
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 +221 -12
- package/FILES.md +0 -4
- package/MAINTAINERS.md +1 -0
- package/README.md +0 -21
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/add_class_name.js +6 -3
- package/dist/_esm5.processed/compat/add_text_track.js +11 -8
- package/dist/_esm5.processed/compat/browser_compatibility_types.js +13 -9
- package/dist/_esm5.processed/compat/browser_detection.js +49 -34
- package/dist/_esm5.processed/compat/browser_version.js +11 -8
- package/dist/_esm5.processed/compat/can_patch_isobmff.js +6 -3
- package/dist/_esm5.processed/compat/can_rely_on_video_visibility_and_size.js +9 -6
- package/dist/_esm5.processed/compat/can_reuse_media_keys.js +6 -3
- package/dist/_esm5.processed/compat/change_source_buffer_type.js +6 -3
- package/dist/_esm5.processed/compat/clear_element_src.js +12 -9
- package/dist/_esm5.processed/compat/eme/close_session.js +45 -106
- package/dist/_esm5.processed/compat/eme/constants.js +6 -3
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +18 -22
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +78 -102
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +16 -6
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.js +18 -15
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ms_media_keys_constructor.js +7 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +70 -88
- package/dist/_esm5.processed/compat/eme/custom_media_keys/types.js +2 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +91 -117
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +7 -7
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +82 -83
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +36 -31
- package/dist/_esm5.processed/compat/eme/get_init_data.js +28 -25
- package/dist/_esm5.processed/compat/eme/get_uuid_kid_from_keystatus_kid.js +8 -5
- package/dist/_esm5.processed/compat/eme/get_webkit_fairplay_initdata.js +17 -14
- package/dist/_esm5.processed/compat/eme/index.js +13 -7
- package/dist/_esm5.processed/compat/eme/load_session.js +26 -69
- package/dist/_esm5.processed/compat/enable_audio_track.js +7 -4
- package/dist/_esm5.processed/compat/event_listeners.js +130 -102
- package/dist/_esm5.processed/compat/get_start_date.js +7 -4
- package/dist/_esm5.processed/compat/global_scope.js +7 -5
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +6 -3
- package/dist/_esm5.processed/compat/index.js +47 -24
- package/dist/_esm5.processed/compat/is_codec_supported.js +8 -5
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +4 -1
- package/dist/_esm5.processed/compat/is_node.js +5 -3
- package/dist/_esm5.processed/compat/is_seeking_approximate.js +5 -3
- package/dist/_esm5.processed/compat/is_vtt_cue.js +6 -3
- package/dist/_esm5.processed/compat/is_worker.js +3 -1
- package/dist/_esm5.processed/compat/make_vtt_cue.js +10 -7
- package/dist/_esm5.processed/compat/on_height_width_change.js +25 -22
- package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +19 -17
- package/dist/_esm5.processed/compat/remove_cue.js +12 -9
- package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +7 -4
- package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +4 -1
- package/dist/_esm5.processed/compat/should_renew_media_key_system_access.js +6 -3
- package/dist/_esm5.processed/compat/should_unset_media_keys.js +6 -3
- package/dist/_esm5.processed/compat/should_validate_metadata.js +6 -3
- package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +6 -3
- package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.js +6 -3
- package/dist/_esm5.processed/config.js +15 -14
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +123 -94
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +43 -42
- package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +37 -44
- package/dist/_esm5.processed/core/adaptive/index.js +4 -2
- package/dist/_esm5.processed/core/adaptive/network_analyzer.js +75 -74
- package/dist/_esm5.processed/core/adaptive/utils/bandwidth_estimator.js +24 -23
- package/dist/_esm5.processed/core/adaptive/utils/ewma.js +13 -12
- package/dist/_esm5.processed/core/adaptive/utils/filter_by_bitrate.js +9 -6
- package/dist/_esm5.processed/core/adaptive/utils/filter_by_resolution.js +18 -19
- package/dist/_esm5.processed/core/adaptive/utils/get_buffer_levels.js +10 -7
- package/dist/_esm5.processed/core/adaptive/utils/last_estimate_storage.js +8 -7
- package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.js +26 -23
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +25 -23
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +6 -3
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +41 -40
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +31 -30
- package/dist/_esm5.processed/core/api/debug/constants.js +4 -1
- package/dist/_esm5.processed/core/api/debug/index.js +4 -2
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +64 -72
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +49 -46
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +15 -12
- package/dist/_esm5.processed/core/api/debug/render.js +16 -13
- package/dist/_esm5.processed/core/api/debug/utils.js +18 -13
- package/dist/_esm5.processed/core/api/index.js +7 -4
- package/dist/_esm5.processed/core/api/option_utils.js +85 -58
- package/dist/_esm5.processed/core/api/playback_observer.js +135 -124
- package/dist/_esm5.processed/core/api/public_api.js +610 -684
- package/dist/_esm5.processed/core/api/track_management/index.js +19 -3
- package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +233 -247
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +45 -58
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +300 -324
- package/dist/_esm5.processed/core/api/utils.js +32 -24
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +155 -185
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +42 -81
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +15 -12
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +392 -510
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +44 -90
- package/dist/_esm5.processed/core/decrypt/create_session.js +90 -149
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +24 -67
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +94 -155
- package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +6 -3
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +59 -109
- package/dist/_esm5.processed/core/decrypt/index.js +26 -7
- package/dist/_esm5.processed/core/decrypt/init_media_keys.js +17 -59
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +84 -155
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +50 -103
- package/dist/_esm5.processed/core/decrypt/types.js +5 -2
- package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +22 -19
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +40 -61
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +17 -61
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_stored_persistent_info.js +8 -5
- package/dist/_esm5.processed/core/decrypt/utils/get_drm_system_id.js +8 -5
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +23 -23
- package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +15 -12
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +14 -21
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +26 -27
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +206 -310
- package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +8 -6
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +103 -102
- package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +13 -12
- package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.js +18 -16
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +37 -56
- package/dist/_esm5.processed/core/fetchers/index.js +7 -3
- package/dist/_esm5.processed/core/fetchers/manifest/index.js +4 -2
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +233 -313
- package/dist/_esm5.processed/core/fetchers/segment/index.js +4 -2
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +12 -9
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +218 -234
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +20 -19
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +73 -74
- package/dist/_esm5.processed/core/fetchers/utils/error_selector.js +8 -5
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +210 -261
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +73 -99
- package/dist/_esm5.processed/core/init/index.js +5 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +256 -320
- package/dist/_esm5.processed/core/init/types.js +7 -24
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +109 -135
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +35 -30
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +12 -10
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +30 -26
- package/dist/_esm5.processed/core/init/utils/get_initial_time.js +41 -38
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +13 -10
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +29 -26
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +30 -27
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +58 -60
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +140 -161
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/are_same_stream_events.js +3 -1
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/index.js +4 -2
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +28 -30
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +71 -90
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/types.js +2 -1
- package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +16 -13
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +75 -126
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +130 -147
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/index.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/index.js +20 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +106 -125
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/index.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/parsers.js +11 -8
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +48 -47
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/types.js +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/update_proportional_elements.js +18 -15
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +22 -15
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/index.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +65 -82
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/parsers.js +11 -8
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.js +19 -17
- package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +23 -22
- package/dist/_esm5.processed/core/segment_buffers/index.js +13 -6
- package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +24 -22
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +8 -3
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +151 -150
- package/dist/_esm5.processed/core/segment_buffers/inventory/types.js +2 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +9 -4
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +82 -89
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +118 -166
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +31 -28
- package/dist/_esm5.processed/core/stream/adaptation/index.js +19 -3
- package/dist/_esm5.processed/core/stream/adaptation/types.js +2 -1
- package/dist/_esm5.processed/core/stream/index.js +4 -2
- package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +14 -16
- package/dist/_esm5.processed/core/stream/orchestrator/index.js +4 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +175 -222
- package/dist/_esm5.processed/core/stream/period/index.js +19 -3
- package/dist/_esm5.processed/core/stream/period/period_stream.js +172 -216
- package/dist/_esm5.processed/core/stream/period/types.js +2 -1
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +34 -33
- package/dist/_esm5.processed/core/stream/representation/index.js +19 -3
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +80 -68
- package/dist/_esm5.processed/core/stream/representation/types.js +2 -1
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +33 -84
- package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.js +32 -29
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +126 -145
- package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.js +32 -88
- package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +61 -48
- package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +71 -69
- package/dist/_esm5.processed/core/stream/representation/utils/get_segment_priority.js +8 -5
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +22 -63
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +49 -86
- package/dist/_esm5.processed/default_config.js +4 -2
- package/dist/_esm5.processed/errors/assertion_error.js +10 -26
- package/dist/_esm5.processed/errors/custom_loader_error.js +12 -28
- package/dist/_esm5.processed/errors/encrypted_media_error.js +16 -32
- package/dist/_esm5.processed/errors/error_codes.js +9 -4
- package/dist/_esm5.processed/errors/error_message.js +5 -2
- package/dist/_esm5.processed/errors/format_error.js +9 -7
- package/dist/_esm5.processed/errors/index.js +25 -11
- package/dist/_esm5.processed/errors/is_known_error.js +14 -11
- package/dist/_esm5.processed/errors/media_error.js +17 -33
- package/dist/_esm5.processed/errors/network_error.js +21 -37
- package/dist/_esm5.processed/errors/other_error.js +15 -31
- package/dist/_esm5.processed/errors/request_error.js +17 -33
- package/dist/_esm5.processed/experimental/features/dash_wasm.js +14 -11
- package/dist/_esm5.processed/experimental/features/debug_element.js +7 -4
- package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
- package/dist/_esm5.processed/experimental/features/index.js +11 -3
- package/dist/_esm5.processed/experimental/features/local.js +9 -6
- package/dist/_esm5.processed/experimental/features/metaplaylist.js +9 -6
- package/dist/_esm5.processed/experimental/index.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/dash.js +6 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +6 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +7 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +22 -16
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +22 -19
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +6 -3
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.js +2 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +125 -186
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +11 -27
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +76 -119
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +24 -15
- package/dist/_esm5.processed/experimental/tools/index.js +11 -5
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +38 -43
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +31 -34
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.js +21 -18
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +4 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/log.js +5 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +20 -17
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -18
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +13 -10
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +16 -13
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/index.js +16 -14
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +14 -11
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +14 -11
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +19 -16
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +11 -8
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.js +5 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.js +25 -22
- package/dist/_esm5.processed/experimental/tools/parseBIFThumbnails.js +7 -4
- package/dist/_esm5.processed/features/add_features.js +11 -8
- package/dist/_esm5.processed/features/features_object.js +4 -2
- package/dist/_esm5.processed/features/index.js +7 -4
- package/dist/_esm5.processed/features/list/dash.js +11 -8
- package/dist/_esm5.processed/features/list/directfile.js +9 -5
- package/dist/_esm5.processed/features/list/eme.js +7 -4
- package/dist/_esm5.processed/features/list/html_sami_parser.js +9 -6
- package/dist/_esm5.processed/features/list/html_srt_parser.js +9 -6
- package/dist/_esm5.processed/features/list/html_text_buffer.js +7 -4
- package/dist/_esm5.processed/features/list/html_ttml_parser.js +9 -6
- package/dist/_esm5.processed/features/list/html_vtt_parser.js +9 -6
- package/dist/_esm5.processed/features/list/index.js +31 -14
- package/dist/_esm5.processed/features/list/native_sami_parser.js +9 -6
- package/dist/_esm5.processed/features/list/native_srt_parser.js +9 -6
- package/dist/_esm5.processed/features/list/native_text_buffer.js +7 -4
- package/dist/_esm5.processed/features/list/native_ttml_parser.js +9 -6
- package/dist/_esm5.processed/features/list/native_vtt_parser.js +9 -6
- package/dist/_esm5.processed/features/list/smooth.js +9 -6
- package/dist/_esm5.processed/features/types.js +2 -1
- package/dist/_esm5.processed/index.js +24 -9
- package/dist/_esm5.processed/log.js +5 -3
- package/dist/_esm5.processed/manifest/adaptation.js +52 -55
- package/dist/_esm5.processed/manifest/index.js +32 -13
- package/dist/_esm5.processed/manifest/manifest.js +112 -134
- package/dist/_esm5.processed/manifest/period.js +38 -42
- package/dist/_esm5.processed/manifest/representation.js +78 -61
- package/dist/_esm5.processed/manifest/representation_index/index.js +5 -2
- package/dist/_esm5.processed/manifest/representation_index/static.js +43 -42
- package/dist/_esm5.processed/manifest/representation_index/types.js +2 -1
- package/dist/_esm5.processed/manifest/types.js +5 -2
- package/dist/_esm5.processed/manifest/update_period_in_place.js +38 -48
- package/dist/_esm5.processed/manifest/update_periods.js +59 -69
- package/dist/_esm5.processed/manifest/utils.js +14 -9
- package/dist/_esm5.processed/minimal.js +9 -7
- package/dist/_esm5.processed/parsers/containers/isobmff/constants.js +4 -1
- package/dist/_esm5.processed/parsers/containers/isobmff/create_box.js +14 -10
- package/dist/_esm5.processed/parsers/containers/isobmff/drm/index.js +5 -1
- package/dist/_esm5.processed/parsers/containers/isobmff/drm/playready.js +15 -11
- package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +48 -40
- package/dist/_esm5.processed/parsers/containers/isobmff/index.js +27 -6
- package/dist/_esm5.processed/parsers/containers/isobmff/read.js +20 -14
- package/dist/_esm5.processed/parsers/containers/isobmff/take_pssh_out.js +25 -20
- package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +130 -112
- package/dist/_esm5.processed/parsers/containers/matroska/index.js +6 -1
- package/dist/_esm5.processed/parsers/containers/matroska/utils.js +67 -63
- package/dist/_esm5.processed/parsers/images/bif.js +40 -29
- package/dist/_esm5.processed/parsers/manifest/dash/common/attach_trickmode_track.js +10 -12
- package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +10 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.js +8 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.js +10 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +7 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +10 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.js +14 -9
- package/dist/_esm5.processed/parsers/manifest/dash/common/index.js +10 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +73 -67
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +9 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +32 -25
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/index.js +11 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +81 -70
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +130 -123
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +15 -12
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +35 -32
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +14 -9
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +30 -22
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +14 -11
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +131 -129
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +16 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/utils.js +7 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +19 -18
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +18 -17
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +111 -111
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_availability_start_time.js +4 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +86 -85
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +97 -82
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +39 -37
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +61 -69
- package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +12 -9
- package/dist/_esm5.processed/parsers/manifest/dash/index.js +8 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +66 -62
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +7 -4
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +7 -4
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +22 -19
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +22 -19
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +11 -8
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.js +38 -34
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.js +34 -30
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +44 -40
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +24 -21
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +15 -12
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +21 -18
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +6 -3
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +12 -9
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +60 -64
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +33 -27
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +192 -238
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +67 -62
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +8 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +11 -7
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +17 -13
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +29 -24
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +38 -33
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +37 -32
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +43 -38
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +9 -5
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +16 -12
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +11 -7
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +20 -16
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +11 -7
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +11 -7
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/index.js +5 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +10 -6
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +22 -20
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.js +6 -2
- package/dist/_esm5.processed/parsers/manifest/index.js +17 -1
- package/dist/_esm5.processed/parsers/manifest/local/index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +30 -27
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +71 -84
- package/dist/_esm5.processed/parsers/manifest/local/types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/index.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +75 -72
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +52 -52
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +200 -176
- package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +13 -8
- package/dist/_esm5.processed/parsers/manifest/smooth/index.js +7 -4
- package/dist/_esm5.processed/parsers/manifest/smooth/parse_C_nodes.js +17 -14
- package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +17 -15
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +102 -98
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +49 -48
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/parseBoolean.js +4 -1
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/reduceChildren.js +6 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.js +5 -1
- package/dist/_esm5.processed/parsers/manifest/types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.js +27 -24
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +10 -7
- package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +8 -5
- package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +8 -5
- package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.js +15 -12
- package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.js +15 -12
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +31 -22
- package/dist/_esm5.processed/parsers/manifest/utils/is_segment_still_available.js +9 -6
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +38 -45
- package/dist/_esm5.processed/parsers/texttracks/index.js +2 -1
- package/dist/_esm5.processed/parsers/texttracks/sami/html.js +45 -43
- package/dist/_esm5.processed/parsers/texttracks/sami/native.js +41 -39
- package/dist/_esm5.processed/parsers/texttracks/srt/find_end_of_cue_block.js +7 -4
- package/dist/_esm5.processed/parsers/texttracks/srt/get_cue_blocks.js +11 -8
- package/dist/_esm5.processed/parsers/texttracks/srt/html.js +32 -29
- package/dist/_esm5.processed/parsers/texttracks/srt/native.js +16 -13
- package/dist/_esm5.processed/parsers/texttracks/srt/parse_cue.js +21 -18
- package/dist/_esm5.processed/parsers/texttracks/srt/parse_timestamp.js +10 -7
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_parameters.js +37 -30
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_styling.js +48 -48
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.js +14 -11
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +7 -2
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +15 -12
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +15 -12
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +11 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +15 -12
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_padding.js +25 -22
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +117 -124
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +11 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/index.js +4 -2
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.js +12 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_ttml_to_div.js +14 -11
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +10 -7
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/index.js +4 -2
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.js +38 -35
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +11 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.js +58 -58
- package/dist/_esm5.processed/parsers/texttracks/ttml/regexps.js +27 -13
- package/dist/_esm5.processed/parsers/texttracks/ttml/resolve_styles_inheritance.js +18 -18
- package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.js +28 -26
- package/dist/_esm5.processed/parsers/texttracks/ttml/xml_utils.js +37 -25
- package/dist/_esm5.processed/parsers/texttracks/types.js +2 -1
- package/dist/_esm5.processed/parsers/texttracks/webvtt/get_cue_blocks.js +12 -9
- package/dist/_esm5.processed/parsers/texttracks/webvtt/get_style_blocks.js +14 -11
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/convert_payload_to_html.js +11 -8
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.js +8 -5
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +60 -60
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.js +30 -27
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/index.js +4 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_style_block.js +23 -26
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +20 -17
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.js +23 -18
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/index.js +4 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +19 -16
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/set_settings_on_cue.js +20 -17
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.js +8 -5
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.js +26 -18
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_timestamp.js +10 -7
- package/dist/_esm5.processed/parsers/texttracks/webvtt/utils.js +15 -7
- package/dist/_esm5.processed/public_types.js +2 -1
- package/dist/_esm5.processed/tools/TextTrackRenderer/index.js +13 -6
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +26 -24
- package/dist/_esm5.processed/tools/index.js +6 -4
- package/dist/_esm5.processed/tools/string_utils.js +10 -1
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +16 -24
- package/dist/_esm5.processed/transports/dash/construct_segment_url.js +6 -3
- package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +17 -14
- package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.js +19 -16
- package/dist/_esm5.processed/transports/dash/index.js +4 -2
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +47 -27
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +23 -16
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +68 -60
- package/dist/_esm5.processed/transports/dash/pipelines.js +20 -17
- package/dist/_esm5.processed/transports/dash/segment_loader.js +49 -39
- package/dist/_esm5.processed/transports/dash/segment_parser.js +58 -39
- package/dist/_esm5.processed/transports/dash/text_loader.js +36 -30
- package/dist/_esm5.processed/transports/dash/text_parser.js +39 -29
- package/dist/_esm5.processed/transports/index.js +17 -1
- package/dist/_esm5.processed/transports/local/index.js +4 -2
- package/dist/_esm5.processed/transports/local/pipelines.js +26 -23
- package/dist/_esm5.processed/transports/local/segment_loader.js +26 -23
- package/dist/_esm5.processed/transports/local/segment_parser.js +36 -25
- package/dist/_esm5.processed/transports/local/text_parser.js +42 -27
- package/dist/_esm5.processed/transports/metaplaylist/index.js +4 -2
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +11 -7
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +91 -96
- package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +26 -20
- package/dist/_esm5.processed/transports/smooth/index.js +4 -2
- package/dist/_esm5.processed/transports/smooth/is_mp4_embedded_track.js +4 -1
- package/dist/_esm5.processed/transports/smooth/isobmff/create_audio_init_segment.js +22 -19
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +92 -67
- package/dist/_esm5.processed/transports/smooth/isobmff/create_init_segment.js +29 -26
- package/dist/_esm5.processed/transports/smooth/isobmff/create_traf_box.js +9 -6
- package/dist/_esm5.processed/transports/smooth/isobmff/create_video_init_segment.js +23 -20
- package/dist/_esm5.processed/transports/smooth/isobmff/get_aaces_header.js +10 -7
- package/dist/_esm5.processed/transports/smooth/isobmff/index.js +13 -6
- package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfrf.js +19 -16
- package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfxd.js +9 -6
- package/dist/_esm5.processed/transports/smooth/isobmff/patch_segment.js +41 -38
- package/dist/_esm5.processed/transports/smooth/pipelines.js +106 -96
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +149 -153
- package/dist/_esm5.processed/transports/smooth/utils.js +7 -3
- package/dist/_esm5.processed/transports/types.js +2 -1
- package/dist/_esm5.processed/transports/utils/byte_range.js +6 -4
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +23 -18
- package/dist/_esm5.processed/transports/utils/check_isobmff_integrity.js +14 -11
- package/dist/_esm5.processed/transports/utils/find_complete_box.js +11 -8
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +22 -14
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +13 -10
- package/dist/_esm5.processed/transports/utils/infer_segment_container.js +4 -1
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +40 -26
- package/dist/_esm5.processed/utils/are_arrays_of_numbers_equal.js +5 -2
- package/dist/_esm5.processed/utils/are_codecs_compatible.js +11 -9
- package/dist/_esm5.processed/utils/array_find.js +7 -4
- package/dist/_esm5.processed/utils/array_find_index.js +6 -3
- package/dist/_esm5.processed/utils/array_includes.js +12 -11
- package/dist/_esm5.processed/utils/assert.js +13 -9
- package/dist/_esm5.processed/utils/assert_unreachable.js +6 -3
- package/dist/_esm5.processed/utils/base64.js +23 -18
- package/dist/_esm5.processed/utils/byte_parsing.js +30 -17
- package/dist/_esm5.processed/utils/cancellable_sleep.js +8 -5
- package/dist/_esm5.processed/utils/create_cancellable_promise.js +7 -4
- package/dist/_esm5.processed/utils/deep_merge.js +10 -21
- package/dist/_esm5.processed/utils/event_emitter.js +24 -24
- package/dist/_esm5.processed/utils/flat_map.js +7 -4
- package/dist/_esm5.processed/utils/get_fuzzed_delay.js +6 -3
- package/dist/_esm5.processed/utils/hash_buffer.js +7 -4
- package/dist/_esm5.processed/utils/id_generator.js +6 -3
- package/dist/_esm5.processed/utils/initialization_segment_cache.js +11 -12
- package/dist/_esm5.processed/utils/is_non_empty_string.js +4 -1
- package/dist/_esm5.processed/utils/is_null_or_undefined.js +4 -1
- package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +4 -2
- package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +4 -2
- package/dist/_esm5.processed/utils/languages/index.js +7 -3
- package/dist/_esm5.processed/utils/languages/normalize.js +26 -20
- package/dist/_esm5.processed/utils/logger.js +24 -23
- package/dist/_esm5.processed/utils/monotonic_timestamp.js +4 -1
- package/dist/_esm5.processed/utils/noop.js +4 -1
- package/dist/_esm5.processed/utils/object_assign.js +8 -10
- package/dist/_esm5.processed/utils/object_values.js +6 -3
- package/dist/_esm5.processed/utils/ranges.js +94 -71
- package/dist/_esm5.processed/utils/reference.js +48 -52
- package/dist/_esm5.processed/utils/request/fetch.js +79 -109
- package/dist/_esm5.processed/utils/request/index.js +9 -4
- package/dist/_esm5.processed/utils/request/xhr.js +49 -37
- package/dist/_esm5.processed/utils/resolve_url.js +18 -18
- package/dist/_esm5.processed/utils/retry_promise_with_backoff.js +34 -81
- package/dist/_esm5.processed/utils/sleep.js +5 -2
- package/dist/_esm5.processed/utils/slice_uint8array.js +3 -1
- package/dist/_esm5.processed/utils/sorted_list.js +37 -40
- package/dist/_esm5.processed/utils/starts_with.js +5 -2
- package/dist/_esm5.processed/utils/string_parsing.js +84 -73
- package/dist/_esm5.processed/utils/take_first_set.js +9 -10
- package/dist/_esm5.processed/utils/task_canceller.js +51 -71
- package/dist/_esm5.processed/utils/warn_once.js +7 -4
- package/dist/_esm5.processed/utils/weak_map_memory.js +12 -11
- package/dist/_esm5.processed/utils/wrapInPromise.js +5 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +43758 -45493
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -22
- package/package.json +22 -23
- package/scripts/build/constants.d.ts +1 -23
- package/scripts/build/generate_build.js +1 -1
- package/scripts/check_nodejs_import_compatibility.js +1 -1
- package/scripts/update-version +1 -4
- package/sonar-project.properties +1 -1
- package/src/compat/event_listeners.ts +8 -8
- package/src/compat/global_scope.ts +2 -0
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +3 -3
- package/src/core/adaptive/adaptive_representation_selector.ts +27 -9
- package/src/core/adaptive/buffer_based_chooser.ts +1 -1
- package/src/core/adaptive/network_analyzer.ts +5 -4
- package/src/core/api/public_api.ts +2 -2
- package/src/core/api/track_management/track_dispatcher.ts +2 -1
- package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +1 -1
- package/src/core/fetchers/cdn_prioritizer.ts +1 -1
- package/src/experimental/features/__tests__/index.test.ts +19 -0
- package/src/experimental/features/index.ts +1 -0
- package/src/features/list/__tests__/index.test.ts +49 -0
- package/src/index.ts +28 -3
- package/src/transports/smooth/segment_loader.ts +4 -4
- package/src/typings/globals.d.ts +0 -42
- package/src/utils/request/fetch.ts +1 -1
- package/src/utils/request/xhr.ts +1 -1
- package/tsconfig.json +1 -1
- package/tsconfig.modules.json +3 -3
- package/dist/_esm5.processed/features/initialize_features.d.ts +0 -19
- package/dist/_esm5.processed/features/initialize_features.js +0 -108
- package/src/features/__tests__/initialize_features.test.ts +0 -657
- package/src/features/initialize_features.ts +0 -129
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Copyright 2015 CANAL+ Group
|
|
3
4
|
*
|
|
@@ -13,75 +14,24 @@
|
|
|
13
14
|
* See the License for the specific language governing permissions and
|
|
14
15
|
* limitations under the License.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
-
};
|
|
30
|
-
})();
|
|
31
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
41
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
42
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
43
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
44
|
-
function step(op) {
|
|
45
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
46
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
47
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
48
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
49
|
-
switch (op[0]) {
|
|
50
|
-
case 0: case 1: t = op; break;
|
|
51
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
52
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
53
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
54
|
-
default:
|
|
55
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
56
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
57
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
58
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
59
|
-
if (t[2]) _.ops.pop();
|
|
60
|
-
_.trys.pop(); continue;
|
|
61
|
-
}
|
|
62
|
-
op = body.call(thisArg, _);
|
|
63
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
64
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
import config from "../../../config";
|
|
68
|
-
import { formatError } from "../../../errors";
|
|
69
|
-
import log from "../../../log";
|
|
70
|
-
import Manifest from "../../../manifest";
|
|
71
|
-
import EventEmitter from "../../../utils/event_emitter";
|
|
72
|
-
import isNullOrUndefined from "../../../utils/is_null_or_undefined";
|
|
73
|
-
import getMonotonicTimeStamp from "../../../utils/monotonic_timestamp";
|
|
74
|
-
import noop from "../../../utils/noop";
|
|
75
|
-
import TaskCanceller from "../../../utils/task_canceller";
|
|
76
|
-
import errorSelector from "../utils/error_selector";
|
|
77
|
-
import { scheduleRequestPromise, } from "../utils/schedule_request";
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const config_1 = require("../../../config");
|
|
19
|
+
const errors_1 = require("../../../errors");
|
|
20
|
+
const log_1 = require("../../../log");
|
|
21
|
+
const manifest_1 = require("../../../manifest");
|
|
22
|
+
const event_emitter_1 = require("../../../utils/event_emitter");
|
|
23
|
+
const is_null_or_undefined_1 = require("../../../utils/is_null_or_undefined");
|
|
24
|
+
const monotonic_timestamp_1 = require("../../../utils/monotonic_timestamp");
|
|
25
|
+
const noop_1 = require("../../../utils/noop");
|
|
26
|
+
const task_canceller_1 = require("../../../utils/task_canceller");
|
|
27
|
+
const error_selector_1 = require("../utils/error_selector");
|
|
28
|
+
const schedule_request_1 = require("../utils/schedule_request");
|
|
78
29
|
/**
|
|
79
30
|
* Class allowing to facilitate the task of loading and parsing a Manifest, as
|
|
80
31
|
* well as automatically refreshing it.
|
|
81
32
|
* @class ManifestFetcher
|
|
82
33
|
*/
|
|
83
|
-
|
|
84
|
-
__extends(ManifestFetcher, _super);
|
|
34
|
+
class ManifestFetcher extends event_emitter_1.default {
|
|
85
35
|
/**
|
|
86
36
|
* Construct a new ManifestFetcher.
|
|
87
37
|
* @param {Array.<string> | undefined} urls - Manifest URLs, will be used when
|
|
@@ -92,18 +42,17 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
92
42
|
* Manifest loading and parsing operations.
|
|
93
43
|
* @param {Object} settings - Configure the `ManifestFetcher`.
|
|
94
44
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return _this;
|
|
45
|
+
constructor(urls, pipelines, settings) {
|
|
46
|
+
super();
|
|
47
|
+
this.scheduleManualRefresh = noop_1.default;
|
|
48
|
+
this._manifestUrls = urls;
|
|
49
|
+
this._pipelines = pipelines.manifest;
|
|
50
|
+
this._settings = settings;
|
|
51
|
+
this._canceller = new task_canceller_1.default();
|
|
52
|
+
this._isStarted = false;
|
|
53
|
+
this._isRefreshPending = false;
|
|
54
|
+
this._consecutiveUnsafeMode = 0;
|
|
55
|
+
this._prioritizedContentUrl = null;
|
|
107
56
|
}
|
|
108
57
|
/**
|
|
109
58
|
* Free resources and stop refresh mechanism from happening.
|
|
@@ -111,10 +60,10 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
111
60
|
* Once `dispose` has been called. This `ManifestFetcher` cannot be relied on
|
|
112
61
|
* anymore.
|
|
113
62
|
*/
|
|
114
|
-
|
|
63
|
+
dispose() {
|
|
115
64
|
this._canceller.cancel();
|
|
116
65
|
this.removeEventListener();
|
|
117
|
-
}
|
|
66
|
+
}
|
|
118
67
|
/**
|
|
119
68
|
* Start requesting the Manifest as well as the Manifest refreshing logic, if
|
|
120
69
|
* needed.
|
|
@@ -122,15 +71,14 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
122
71
|
* Once `start` has been called, this mechanism can only be stopped by calling
|
|
123
72
|
* `dispose`.
|
|
124
73
|
*/
|
|
125
|
-
|
|
126
|
-
var _this = this;
|
|
74
|
+
start() {
|
|
127
75
|
if (this._isStarted) {
|
|
128
76
|
return;
|
|
129
77
|
}
|
|
130
78
|
this._isStarted = true;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (initialManifest instanceof
|
|
79
|
+
let manifestProm;
|
|
80
|
+
const initialManifest = this._settings.initialManifest;
|
|
81
|
+
if (initialManifest instanceof manifest_1.default) {
|
|
134
82
|
manifestProm = Promise.resolve({ manifest: initialManifest });
|
|
135
83
|
}
|
|
136
84
|
else if (initialManifest !== undefined) {
|
|
@@ -138,19 +86,19 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
138
86
|
}
|
|
139
87
|
else {
|
|
140
88
|
manifestProm = this._fetchManifest(undefined)
|
|
141
|
-
.then(
|
|
89
|
+
.then((val) => {
|
|
142
90
|
return val.parse({ previousManifest: null, unsafeMode: false });
|
|
143
91
|
});
|
|
144
92
|
}
|
|
145
93
|
manifestProm
|
|
146
|
-
.then(
|
|
147
|
-
|
|
148
|
-
if (!
|
|
149
|
-
|
|
94
|
+
.then((val) => {
|
|
95
|
+
this.trigger("manifestReady", val.manifest);
|
|
96
|
+
if (!this._canceller.isUsed()) {
|
|
97
|
+
this._recursivelyRefreshManifest(val.manifest, val);
|
|
150
98
|
}
|
|
151
99
|
})
|
|
152
|
-
.catch(
|
|
153
|
-
}
|
|
100
|
+
.catch((err) => this._onFatalError(err));
|
|
101
|
+
}
|
|
154
102
|
/**
|
|
155
103
|
* Update URL of the fetched Manifest.
|
|
156
104
|
* @param {Array.<string> | undefined} urls - New Manifest URLs by order of
|
|
@@ -158,7 +106,7 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
158
106
|
* @param {boolean} refreshNow - If set to `true`, the next Manifest refresh
|
|
159
107
|
* will be triggered immediately.
|
|
160
108
|
*/
|
|
161
|
-
|
|
109
|
+
updateContentUrls(urls, refreshNow) {
|
|
162
110
|
var _a;
|
|
163
111
|
this._prioritizedContentUrl = (_a = urls === null || urls === void 0 ? void 0 : urls[0]) !== null && _a !== void 0 ? _a : undefined;
|
|
164
112
|
if (refreshNow) {
|
|
@@ -168,7 +116,7 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
168
116
|
canUseUnsafeMode: false,
|
|
169
117
|
});
|
|
170
118
|
}
|
|
171
|
-
}
|
|
119
|
+
}
|
|
172
120
|
/**
|
|
173
121
|
* (re-)Load the Manifest.
|
|
174
122
|
* This method does not yet parse it, parsing will then be available through
|
|
@@ -181,58 +129,46 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
181
129
|
* @param {string | undefined} url
|
|
182
130
|
* @returns {Promise}
|
|
183
131
|
*/
|
|
184
|
-
|
|
132
|
+
async _fetchManifest(url) {
|
|
185
133
|
var _a;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*/
|
|
194
|
-
function callLoaderWithRetries(manifestUrl) {
|
|
195
|
-
var loadManifest = pipelines.loadManifest;
|
|
196
|
-
var requestTimeout = isNullOrUndefined(settings.requestTimeout) ?
|
|
197
|
-
config.getCurrent().DEFAULT_REQUEST_TIMEOUT :
|
|
198
|
-
settings.requestTimeout;
|
|
199
|
-
if (requestTimeout < 0) {
|
|
200
|
-
requestTimeout = undefined;
|
|
201
|
-
}
|
|
202
|
-
var callLoader = function () { return loadManifest(manifestUrl, { timeout: requestTimeout }, cancelSignal); };
|
|
203
|
-
return scheduleRequestPromise(callLoader, backoffSettings, cancelSignal);
|
|
204
|
-
}
|
|
205
|
-
var cancelSignal, settings, pipelines, requestUrl, backoffSettings, response_1, err_1;
|
|
206
|
-
var _this = this;
|
|
207
|
-
return __generator(this, function (_b) {
|
|
208
|
-
switch (_b.label) {
|
|
209
|
-
case 0:
|
|
210
|
-
cancelSignal = this._canceller.signal;
|
|
211
|
-
settings = this._settings;
|
|
212
|
-
pipelines = this._pipelines;
|
|
213
|
-
requestUrl = url !== null && url !== void 0 ? url : (_a = this._manifestUrls) === null || _a === void 0 ? void 0 : _a[0];
|
|
214
|
-
backoffSettings = this._getBackoffSetting(function (err) {
|
|
215
|
-
_this.trigger("warning", errorSelector(err));
|
|
216
|
-
});
|
|
217
|
-
_b.label = 1;
|
|
218
|
-
case 1:
|
|
219
|
-
_b.trys.push([1, 3, , 4]);
|
|
220
|
-
return [4 /*yield*/, callLoaderWithRetries(requestUrl)];
|
|
221
|
-
case 2:
|
|
222
|
-
response_1 = _b.sent();
|
|
223
|
-
return [2 /*return*/, {
|
|
224
|
-
parse: function (parserOptions) {
|
|
225
|
-
return _this._parseLoadedManifest(response_1, parserOptions, requestUrl);
|
|
226
|
-
},
|
|
227
|
-
}];
|
|
228
|
-
case 3:
|
|
229
|
-
err_1 = _b.sent();
|
|
230
|
-
throw errorSelector(err_1);
|
|
231
|
-
case 4: return [2 /*return*/];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
134
|
+
const cancelSignal = this._canceller.signal;
|
|
135
|
+
const settings = this._settings;
|
|
136
|
+
const pipelines = this._pipelines;
|
|
137
|
+
// TODO Better handle multiple Manifest URLs
|
|
138
|
+
const requestUrl = url !== null && url !== void 0 ? url : (_a = this._manifestUrls) === null || _a === void 0 ? void 0 : _a[0];
|
|
139
|
+
const backoffSettings = this._getBackoffSetting((err) => {
|
|
140
|
+
this.trigger("warning", (0, error_selector_1.default)(err));
|
|
234
141
|
});
|
|
235
|
-
|
|
142
|
+
try {
|
|
143
|
+
const response = await callLoaderWithRetries(requestUrl);
|
|
144
|
+
return {
|
|
145
|
+
parse: (parserOptions) => {
|
|
146
|
+
return this._parseLoadedManifest(response, parserOptions, requestUrl);
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
throw (0, error_selector_1.default)(err);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Call the loader part of the pipeline, retrying if it fails according
|
|
155
|
+
* to the current settings.
|
|
156
|
+
* Returns the Promise of the last attempt.
|
|
157
|
+
* @param {string | undefined} manifestUrl
|
|
158
|
+
* @returns {Promise}
|
|
159
|
+
*/
|
|
160
|
+
function callLoaderWithRetries(manifestUrl) {
|
|
161
|
+
const { loadManifest } = pipelines;
|
|
162
|
+
let requestTimeout = (0, is_null_or_undefined_1.default)(settings.requestTimeout) ?
|
|
163
|
+
config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT :
|
|
164
|
+
settings.requestTimeout;
|
|
165
|
+
if (requestTimeout < 0) {
|
|
166
|
+
requestTimeout = undefined;
|
|
167
|
+
}
|
|
168
|
+
const callLoader = () => loadManifest(manifestUrl, { timeout: requestTimeout }, cancelSignal);
|
|
169
|
+
return (0, schedule_request_1.scheduleRequestPromise)(callLoader, backoffSettings, cancelSignal);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
236
172
|
/**
|
|
237
173
|
* Parse an already loaded Manifest.
|
|
238
174
|
*
|
|
@@ -245,11 +181,11 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
245
181
|
* @param {string | undefined} originalUrl
|
|
246
182
|
* @returns {Promise}
|
|
247
183
|
*/
|
|
248
|
-
|
|
184
|
+
parse(manifest, parserOptions, originalUrl) {
|
|
249
185
|
return this._parseLoadedManifest({ responseData: manifest,
|
|
250
186
|
size: undefined,
|
|
251
187
|
requestDuration: undefined }, parserOptions, originalUrl);
|
|
252
|
-
}
|
|
188
|
+
}
|
|
253
189
|
/**
|
|
254
190
|
* Parse a Manifest.
|
|
255
191
|
*
|
|
@@ -259,132 +195,115 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
259
195
|
* @param {string | undefined} requestUrl
|
|
260
196
|
* @returns {Promise}
|
|
261
197
|
*/
|
|
262
|
-
|
|
198
|
+
async _parseLoadedManifest(loaded, parserOptions, requestUrl) {
|
|
263
199
|
var _a;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
data = _a.sent();
|
|
281
|
-
return [2 /*return*/, data];
|
|
282
|
-
case 2:
|
|
283
|
-
err_3 = _a.sent();
|
|
284
|
-
throw errorSelector(err_3);
|
|
285
|
-
case 3: return [2 /*return*/];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
200
|
+
const parsingTimeStart = (0, monotonic_timestamp_1.default)();
|
|
201
|
+
const cancelSignal = this._canceller.signal;
|
|
202
|
+
const trigger = this.trigger.bind(this);
|
|
203
|
+
const { sendingTime, receivedTime } = loaded;
|
|
204
|
+
const backoffSettings = this._getBackoffSetting((err) => {
|
|
205
|
+
this.trigger("warning", (0, error_selector_1.default)(err));
|
|
206
|
+
});
|
|
207
|
+
const originalUrl = requestUrl !== null && requestUrl !== void 0 ? requestUrl : (_a = this._manifestUrls) === null || _a === void 0 ? void 0 : _a[0];
|
|
208
|
+
const opts = { externalClockOffset: parserOptions.externalClockOffset,
|
|
209
|
+
unsafeMode: parserOptions.unsafeMode,
|
|
210
|
+
previousManifest: parserOptions.previousManifest,
|
|
211
|
+
originalUrl };
|
|
212
|
+
try {
|
|
213
|
+
const res = this._pipelines.parseManifest(loaded, opts, onWarnings, cancelSignal, scheduleRequest);
|
|
214
|
+
if (!isPromise(res)) {
|
|
215
|
+
return finish(res.manifest, res.warnings);
|
|
289
216
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
*/
|
|
294
|
-
function onWarnings(warnings) {
|
|
295
|
-
for (var _i = 0, warnings_1 = warnings; _i < warnings_1.length; _i++) {
|
|
296
|
-
var warning = warnings_1[_i];
|
|
297
|
-
if (cancelSignal.isCancelled()) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
var formattedError = formatError(warning, {
|
|
301
|
-
defaultCode: "PIPELINE_PARSE_ERROR",
|
|
302
|
-
defaultReason: "Unknown error when parsing the Manifest",
|
|
303
|
-
});
|
|
304
|
-
trigger("warning", formattedError);
|
|
305
|
-
}
|
|
217
|
+
else {
|
|
218
|
+
const { manifest, warnings } = await res;
|
|
219
|
+
return finish(manifest, warnings);
|
|
306
220
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
const formattedError = (0, errors_1.formatError)(err, {
|
|
224
|
+
defaultCode: "PIPELINE_PARSE_ERROR",
|
|
225
|
+
defaultReason: "Unknown error when parsing the Manifest",
|
|
226
|
+
});
|
|
227
|
+
throw formattedError;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Perform a request with the same retry mechanisms and error handling
|
|
231
|
+
* than for a Manifest loader.
|
|
232
|
+
* @param {Function} performRequest
|
|
233
|
+
* @returns {Function}
|
|
234
|
+
*/
|
|
235
|
+
async function scheduleRequest(performRequest) {
|
|
236
|
+
try {
|
|
237
|
+
const data = await (0, schedule_request_1.scheduleRequestPromise)(performRequest, backoffSettings, cancelSignal);
|
|
238
|
+
return data;
|
|
317
239
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
originalUrl = requestUrl !== null && requestUrl !== void 0 ? requestUrl : (_a = this._manifestUrls) === null || _a === void 0 ? void 0 : _a[0];
|
|
331
|
-
opts = { externalClockOffset: parserOptions.externalClockOffset,
|
|
332
|
-
unsafeMode: parserOptions.unsafeMode,
|
|
333
|
-
previousManifest: parserOptions.previousManifest, originalUrl: originalUrl };
|
|
334
|
-
_c.label = 1;
|
|
335
|
-
case 1:
|
|
336
|
-
_c.trys.push([1, 5, , 6]);
|
|
337
|
-
res = this._pipelines.parseManifest(loaded, opts, onWarnings, cancelSignal, scheduleRequest);
|
|
338
|
-
if (!!isPromise(res)) return [3 /*break*/, 2];
|
|
339
|
-
return [2 /*return*/, finish(res.manifest, res.warnings)];
|
|
340
|
-
case 2: return [4 /*yield*/, res];
|
|
341
|
-
case 3:
|
|
342
|
-
_b = _c.sent(), manifest = _b.manifest, warnings = _b.warnings;
|
|
343
|
-
return [2 /*return*/, finish(manifest, warnings)];
|
|
344
|
-
case 4: return [3 /*break*/, 6];
|
|
345
|
-
case 5:
|
|
346
|
-
err_2 = _c.sent();
|
|
347
|
-
formattedError = formatError(err_2, {
|
|
348
|
-
defaultCode: "PIPELINE_PARSE_ERROR",
|
|
349
|
-
defaultReason: "Unknown error when parsing the Manifest",
|
|
350
|
-
});
|
|
351
|
-
throw formattedError;
|
|
352
|
-
case 6: return [2 /*return*/];
|
|
240
|
+
catch (err) {
|
|
241
|
+
throw (0, error_selector_1.default)(err);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Handle minor errors encountered by a Manifest parser.
|
|
246
|
+
* @param {Array.<Error>} warnings
|
|
247
|
+
*/
|
|
248
|
+
function onWarnings(warnings) {
|
|
249
|
+
for (const warning of warnings) {
|
|
250
|
+
if (cancelSignal.isCancelled()) {
|
|
251
|
+
return;
|
|
353
252
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
253
|
+
const formattedError = (0, errors_1.formatError)(warning, {
|
|
254
|
+
defaultCode: "PIPELINE_PARSE_ERROR",
|
|
255
|
+
defaultReason: "Unknown error when parsing the Manifest",
|
|
256
|
+
});
|
|
257
|
+
trigger("warning", formattedError);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Emit a formatted "parsed" event through `obs`.
|
|
262
|
+
* To call once the Manifest has been parsed.
|
|
263
|
+
* @param {Object} manifest
|
|
264
|
+
*/
|
|
265
|
+
function finish(manifest, warnings) {
|
|
266
|
+
onWarnings(warnings);
|
|
267
|
+
const parsingTime = (0, monotonic_timestamp_1.default)() - parsingTimeStart;
|
|
268
|
+
log_1.default.info(`MF: Manifest parsed in ${parsingTime}ms`);
|
|
269
|
+
return { manifest,
|
|
270
|
+
sendingTime,
|
|
271
|
+
receivedTime,
|
|
272
|
+
parsingTime };
|
|
273
|
+
}
|
|
274
|
+
}
|
|
357
275
|
/**
|
|
358
276
|
* Construct "backoff settings" that can be used with a range of functions
|
|
359
277
|
* allowing to perform multiple request attempts
|
|
360
278
|
* @param {Function} onRetry
|
|
361
279
|
* @returns {Object}
|
|
362
280
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
281
|
+
_getBackoffSetting(onRetry) {
|
|
282
|
+
const { DEFAULT_MAX_MANIFEST_REQUEST_RETRY, INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE } = config_1.default.getCurrent();
|
|
283
|
+
const { lowLatencyMode, maxRetry: ogRegular } = this._settings;
|
|
284
|
+
const baseDelay = lowLatencyMode ? INITIAL_BACKOFF_DELAY_BASE.LOW_LATENCY :
|
|
367
285
|
INITIAL_BACKOFF_DELAY_BASE.REGULAR;
|
|
368
|
-
|
|
286
|
+
const maxDelay = lowLatencyMode ? MAX_BACKOFF_DELAY_BASE.LOW_LATENCY :
|
|
369
287
|
MAX_BACKOFF_DELAY_BASE.REGULAR;
|
|
370
|
-
|
|
371
|
-
return { onRetry
|
|
372
|
-
|
|
288
|
+
const maxRetry = ogRegular !== null && ogRegular !== void 0 ? ogRegular : DEFAULT_MAX_MANIFEST_REQUEST_RETRY;
|
|
289
|
+
return { onRetry,
|
|
290
|
+
baseDelay,
|
|
291
|
+
maxDelay,
|
|
292
|
+
maxRetry };
|
|
293
|
+
}
|
|
373
294
|
/**
|
|
374
295
|
* Performs Manifest refresh (recursively) when it judges it is time to do so.
|
|
375
296
|
* @param {Object} manifest
|
|
376
297
|
* @param {Object} manifestRequestInfos - Various information linked to the
|
|
377
298
|
* last Manifest loading and parsing operations.
|
|
378
299
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
var sendingTime = _a.sendingTime, parsingTime = _a.parsingTime, updatingTime = _a.updatingTime;
|
|
382
|
-
var _b = config.getCurrent(), MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE = _b.MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE, MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE = _b.MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE;
|
|
300
|
+
_recursivelyRefreshManifest(manifest, { sendingTime, parsingTime, updatingTime }) {
|
|
301
|
+
const { MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE, MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE } = config_1.default.getCurrent();
|
|
383
302
|
/**
|
|
384
303
|
* Total time taken to fully update the last Manifest, in milliseconds.
|
|
385
304
|
* Note: this time also includes possible requests done by the parsers.
|
|
386
305
|
*/
|
|
387
|
-
|
|
306
|
+
const totalUpdateTime = parsingTime !== undefined ?
|
|
388
307
|
parsingTime + (updatingTime !== null && updatingTime !== void 0 ? updatingTime : 0) :
|
|
389
308
|
undefined;
|
|
390
309
|
/**
|
|
@@ -395,56 +314,56 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
395
314
|
* Only perform parsing in `unsafeMode` when the last full parsing took a
|
|
396
315
|
* lot of time and do not go higher than the maximum consecutive time.
|
|
397
316
|
*/
|
|
398
|
-
|
|
317
|
+
const unsafeModeEnabled = this._consecutiveUnsafeMode > 0 ?
|
|
399
318
|
this._consecutiveUnsafeMode < MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE :
|
|
400
319
|
totalUpdateTime !== undefined ?
|
|
401
320
|
(totalUpdateTime >= MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE) :
|
|
402
321
|
false;
|
|
403
322
|
/** Time elapsed since the beginning of the Manifest request, in milliseconds. */
|
|
404
|
-
|
|
323
|
+
const timeSinceRequest = sendingTime === undefined ?
|
|
405
324
|
0 :
|
|
406
|
-
|
|
325
|
+
(0, monotonic_timestamp_1.default)() - sendingTime;
|
|
407
326
|
/** Minimum update delay we should not go below, in milliseconds. */
|
|
408
|
-
|
|
327
|
+
const minInterval = Math.max(this._settings.minimumManifestUpdateInterval -
|
|
409
328
|
timeSinceRequest, 0);
|
|
410
329
|
/**
|
|
411
330
|
* Multiple refresh trigger are scheduled here, but only the first one should
|
|
412
331
|
* be effectively considered.
|
|
413
332
|
* `nextRefreshCanceller` will allow to cancel every other when one is triggered.
|
|
414
333
|
*/
|
|
415
|
-
|
|
334
|
+
const nextRefreshCanceller = new task_canceller_1.default();
|
|
416
335
|
nextRefreshCanceller.linkToSignal(this._canceller.signal);
|
|
417
336
|
/* Function to manually schedule a Manifest refresh */
|
|
418
|
-
this.scheduleManualRefresh =
|
|
419
|
-
|
|
420
|
-
|
|
337
|
+
this.scheduleManualRefresh = (settings) => {
|
|
338
|
+
const { enablePartialRefresh, delay, canUseUnsafeMode } = settings;
|
|
339
|
+
const unsafeMode = canUseUnsafeMode && unsafeModeEnabled;
|
|
421
340
|
// The value allows to set a delay relatively to the last Manifest refresh
|
|
422
341
|
// (to avoid asking for it too often).
|
|
423
|
-
|
|
342
|
+
const timeSinceLastRefresh = sendingTime === undefined ?
|
|
424
343
|
0 :
|
|
425
|
-
|
|
426
|
-
|
|
344
|
+
(0, monotonic_timestamp_1.default)() - sendingTime;
|
|
345
|
+
const _minInterval = Math.max(this._settings.minimumManifestUpdateInterval -
|
|
427
346
|
timeSinceLastRefresh, 0);
|
|
428
|
-
|
|
347
|
+
const timeoutId = setTimeout(() => {
|
|
429
348
|
nextRefreshCanceller.cancel();
|
|
430
|
-
|
|
349
|
+
this._triggerNextManifestRefresh(manifest, { enablePartialRefresh, unsafeMode });
|
|
431
350
|
}, Math.max((delay !== null && delay !== void 0 ? delay : 0) - timeSinceLastRefresh, _minInterval));
|
|
432
|
-
nextRefreshCanceller.signal.register(
|
|
351
|
+
nextRefreshCanceller.signal.register(() => {
|
|
433
352
|
clearTimeout(timeoutId);
|
|
434
353
|
});
|
|
435
354
|
};
|
|
436
355
|
/* Handle Manifest expiration. */
|
|
437
356
|
if (manifest.expired !== null) {
|
|
438
|
-
|
|
357
|
+
const timeoutId = setTimeout(() => {
|
|
439
358
|
var _a;
|
|
440
|
-
(_a = manifest.expired) === null || _a === void 0 ? void 0 : _a.then(
|
|
359
|
+
(_a = manifest.expired) === null || _a === void 0 ? void 0 : _a.then(() => {
|
|
441
360
|
nextRefreshCanceller.cancel();
|
|
442
|
-
|
|
361
|
+
this._triggerNextManifestRefresh(manifest, { enablePartialRefresh: false,
|
|
443
362
|
unsafeMode: unsafeModeEnabled });
|
|
444
|
-
},
|
|
363
|
+
}, noop_1.default /* `expired` should not reject */);
|
|
445
364
|
}, minInterval);
|
|
446
|
-
nextRefreshCanceller.signal.register(
|
|
447
|
-
clearTimeout(
|
|
365
|
+
nextRefreshCanceller.signal.register(() => {
|
|
366
|
+
clearTimeout(timeoutId);
|
|
448
367
|
});
|
|
449
368
|
}
|
|
450
369
|
/*
|
|
@@ -454,9 +373,9 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
454
373
|
*/
|
|
455
374
|
if (manifest.lifetime !== undefined && manifest.lifetime >= 0) {
|
|
456
375
|
/** Regular refresh delay as asked by the Manifest. */
|
|
457
|
-
|
|
376
|
+
const regularRefreshDelay = manifest.lifetime * 1000 - timeSinceRequest;
|
|
458
377
|
/** Actually choosen delay to refresh the Manifest. */
|
|
459
|
-
|
|
378
|
+
let actualRefreshInterval;
|
|
460
379
|
if (totalUpdateTime === undefined) {
|
|
461
380
|
actualRefreshInterval = regularRefreshDelay;
|
|
462
381
|
}
|
|
@@ -473,7 +392,7 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
473
392
|
// This avoid perpetually postponing a Manifest update when
|
|
474
393
|
// performance seems to have been abysmal one time.
|
|
475
394
|
regularRefreshDelay * 6);
|
|
476
|
-
|
|
395
|
+
log_1.default.info("MUS: Manifest update rythm is too frequent. Postponing next request.", regularRefreshDelay, actualRefreshInterval);
|
|
477
396
|
}
|
|
478
397
|
else if (totalUpdateTime >= (manifest.lifetime * 1000) / 10) {
|
|
479
398
|
// If Manifest updating time is very long relative to its lifetime,
|
|
@@ -486,21 +405,21 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
486
405
|
// This avoid perpetually postponing a Manifest update when
|
|
487
406
|
// performance seems to have been abysmal one time.
|
|
488
407
|
regularRefreshDelay * 6);
|
|
489
|
-
|
|
408
|
+
log_1.default.info("MUS: Manifest took too long to parse. Postponing next request", actualRefreshInterval, actualRefreshInterval);
|
|
490
409
|
}
|
|
491
410
|
else {
|
|
492
411
|
actualRefreshInterval = regularRefreshDelay;
|
|
493
412
|
}
|
|
494
|
-
|
|
413
|
+
const timeoutId = setTimeout(() => {
|
|
495
414
|
nextRefreshCanceller.cancel();
|
|
496
|
-
|
|
415
|
+
this._triggerNextManifestRefresh(manifest, { enablePartialRefresh: false,
|
|
497
416
|
unsafeMode: unsafeModeEnabled });
|
|
498
417
|
}, Math.max(actualRefreshInterval, minInterval));
|
|
499
|
-
nextRefreshCanceller.signal.register(
|
|
500
|
-
clearTimeout(
|
|
418
|
+
nextRefreshCanceller.signal.register(() => {
|
|
419
|
+
clearTimeout(timeoutId);
|
|
501
420
|
});
|
|
502
421
|
}
|
|
503
|
-
}
|
|
422
|
+
}
|
|
504
423
|
/**
|
|
505
424
|
* Refresh the Manifest, performing a full update if a partial update failed.
|
|
506
425
|
* Also re-call `recursivelyRefreshManifest` to schedule the next refresh
|
|
@@ -508,12 +427,10 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
508
427
|
* @param {Object} manifest
|
|
509
428
|
* @param {Object} refreshInformation
|
|
510
429
|
*/
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
var fullRefresh;
|
|
516
|
-
var refreshURL;
|
|
430
|
+
_triggerNextManifestRefresh(manifest, { enablePartialRefresh, unsafeMode }) {
|
|
431
|
+
const manifestUpdateUrl = manifest.updateUrl;
|
|
432
|
+
let fullRefresh;
|
|
433
|
+
let refreshURL;
|
|
517
434
|
if (this._prioritizedContentUrl !== null) {
|
|
518
435
|
fullRefresh = true;
|
|
519
436
|
refreshURL = this._prioritizedContentUrl;
|
|
@@ -524,14 +441,14 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
524
441
|
refreshURL = fullRefresh ? manifest.getUrls()[0] :
|
|
525
442
|
manifestUpdateUrl;
|
|
526
443
|
}
|
|
527
|
-
|
|
444
|
+
const externalClockOffset = manifest.clockOffset;
|
|
528
445
|
if (unsafeMode) {
|
|
529
446
|
this._consecutiveUnsafeMode += 1;
|
|
530
|
-
|
|
447
|
+
log_1.default.info("Init: Refreshing the Manifest in \"unsafeMode\" for the " +
|
|
531
448
|
String(this._consecutiveUnsafeMode) + " consecutive time.");
|
|
532
449
|
}
|
|
533
450
|
else if (this._consecutiveUnsafeMode > 0) {
|
|
534
|
-
|
|
451
|
+
log_1.default.info("Init: Not parsing the Manifest in \"unsafeMode\" anymore after " +
|
|
535
452
|
String(this._consecutiveUnsafeMode) + " consecutive times.");
|
|
536
453
|
this._consecutiveUnsafeMode = 0;
|
|
537
454
|
}
|
|
@@ -540,11 +457,13 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
540
457
|
}
|
|
541
458
|
this._isRefreshPending = true;
|
|
542
459
|
this._fetchManifest(refreshURL)
|
|
543
|
-
.then(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
460
|
+
.then(res => res.parse({ externalClockOffset,
|
|
461
|
+
previousManifest: manifest,
|
|
462
|
+
unsafeMode }))
|
|
463
|
+
.then(res => {
|
|
464
|
+
this._isRefreshPending = false;
|
|
465
|
+
const { manifest: newManifest, sendingTime: newSendingTime, parsingTime } = res;
|
|
466
|
+
const updateTimeStart = (0, monotonic_timestamp_1.default)();
|
|
548
467
|
if (fullRefresh) {
|
|
549
468
|
manifest.replace(newManifest);
|
|
550
469
|
}
|
|
@@ -553,48 +472,49 @@ var ManifestFetcher = /** @class */ (function (_super) {
|
|
|
553
472
|
manifest.update(newManifest);
|
|
554
473
|
}
|
|
555
474
|
catch (e) {
|
|
556
|
-
|
|
475
|
+
const message = e instanceof Error ? e.message :
|
|
557
476
|
"unknown error";
|
|
558
|
-
|
|
559
|
-
|
|
477
|
+
log_1.default.warn(`MUS: Attempt to update Manifest failed: ${message}`, "Re-downloading the Manifest fully");
|
|
478
|
+
const { FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY } = config_1.default.getCurrent();
|
|
560
479
|
// The value allows to set a delay relatively to the last Manifest refresh
|
|
561
480
|
// (to avoid asking for it too often).
|
|
562
|
-
|
|
481
|
+
const timeSinceLastRefresh = newSendingTime === undefined ?
|
|
563
482
|
0 :
|
|
564
|
-
|
|
565
|
-
|
|
483
|
+
(0, monotonic_timestamp_1.default)() - newSendingTime;
|
|
484
|
+
const _minInterval = Math.max(this._settings.minimumManifestUpdateInterval -
|
|
566
485
|
timeSinceLastRefresh, 0);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
486
|
+
let unregisterCanceller = noop_1.default;
|
|
487
|
+
const timeoutId = setTimeout(() => {
|
|
488
|
+
unregisterCanceller();
|
|
489
|
+
this._triggerNextManifestRefresh(manifest, { enablePartialRefresh: false,
|
|
571
490
|
unsafeMode: false });
|
|
572
491
|
}, Math.max(FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY -
|
|
573
492
|
timeSinceLastRefresh, _minInterval));
|
|
574
|
-
|
|
575
|
-
clearTimeout(
|
|
493
|
+
unregisterCanceller = this._canceller.signal.register(() => {
|
|
494
|
+
clearTimeout(timeoutId);
|
|
576
495
|
});
|
|
577
496
|
return;
|
|
578
497
|
}
|
|
579
498
|
}
|
|
580
|
-
|
|
581
|
-
|
|
499
|
+
const updatingTime = (0, monotonic_timestamp_1.default)() - updateTimeStart;
|
|
500
|
+
this._recursivelyRefreshManifest(manifest, { sendingTime: newSendingTime,
|
|
501
|
+
parsingTime,
|
|
502
|
+
updatingTime });
|
|
582
503
|
})
|
|
583
|
-
.catch(
|
|
584
|
-
|
|
585
|
-
|
|
504
|
+
.catch((err) => {
|
|
505
|
+
this._isRefreshPending = false;
|
|
506
|
+
this._onFatalError(err);
|
|
586
507
|
});
|
|
587
|
-
}
|
|
588
|
-
|
|
508
|
+
}
|
|
509
|
+
_onFatalError(err) {
|
|
589
510
|
if (this._canceller.isUsed()) {
|
|
590
511
|
return;
|
|
591
512
|
}
|
|
592
513
|
this.trigger("error", err);
|
|
593
514
|
this.dispose();
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
export default ManifestFetcher;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
exports.default = ManifestFetcher;
|
|
598
518
|
/**
|
|
599
519
|
* Returns `true` when the returned value seems to be a Promise instance, as
|
|
600
520
|
* created by the RxPlayer.
|