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,35 +14,21 @@
|
|
|
13
14
|
* See the License for the specific language governing permissions and
|
|
14
15
|
* limitations under the License.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
var extendStatics = function (d, b) {
|
|
18
|
-
extendStatics = Object.setPrototypeOf ||
|
|
19
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
-
return extendStatics(d, b);
|
|
22
|
-
};
|
|
23
|
-
return function (d, b) {
|
|
24
|
-
if (typeof b !== "function" && b !== null)
|
|
25
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
26
|
-
extendStatics(d, b);
|
|
27
|
-
function __() { this.constructor = d; }
|
|
28
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
-
};
|
|
30
|
-
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
18
|
/**
|
|
32
19
|
* This file is used to abstract the notion of text, audio and video tracks
|
|
33
20
|
* switching for an easier API management.
|
|
34
21
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
const config_1 = require("../../../config");
|
|
23
|
+
const errors_1 = require("../../../errors");
|
|
24
|
+
const log_1 = require("../../../log");
|
|
25
|
+
const array_find_1 = require("../../../utils/array_find");
|
|
26
|
+
const assert_1 = require("../../../utils/assert");
|
|
27
|
+
const event_emitter_1 = require("../../../utils/event_emitter");
|
|
28
|
+
const is_null_or_undefined_1 = require("../../../utils/is_null_or_undefined");
|
|
29
|
+
const object_assign_1 = require("../../../utils/object_assign");
|
|
30
|
+
const reference_1 = require("../../../utils/reference");
|
|
31
|
+
const track_dispatcher_1 = require("./track_dispatcher");
|
|
45
32
|
/**
|
|
46
33
|
* Class helping with the management of the audio, video and text tracks and
|
|
47
34
|
* qualities.
|
|
@@ -51,150 +38,149 @@ import TrackDispatcher from "./track_dispatcher";
|
|
|
51
38
|
*
|
|
52
39
|
* @class TracksStore
|
|
53
40
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function TracksStore(args) {
|
|
41
|
+
class TracksStore extends event_emitter_1.default {
|
|
42
|
+
constructor(args) {
|
|
57
43
|
var _a;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
(_a = args.defaultAudioTrackSwitchingMode) !== null && _a !== void 0 ? _a :
|
|
65
|
-
return _this;
|
|
44
|
+
super();
|
|
45
|
+
this._storedPeriodInfo = [];
|
|
46
|
+
this._isDisposed = false;
|
|
47
|
+
this._cachedPeriodInfo = new WeakMap();
|
|
48
|
+
this._isTrickModeTrackEnabled = args.preferTrickModeTracks;
|
|
49
|
+
this._defaultAudioTrackSwitchingMode =
|
|
50
|
+
(_a = args.defaultAudioTrackSwitchingMode) !== null && _a !== void 0 ? _a : config_1.default.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE;
|
|
66
51
|
}
|
|
67
52
|
/**
|
|
68
53
|
* Return Array of Period information, to allow an outside application to
|
|
69
54
|
* modify the track of any Period.
|
|
70
55
|
* @returns {Array.<Object>}
|
|
71
56
|
*/
|
|
72
|
-
|
|
73
|
-
return this._storedPeriodInfo.reduce(
|
|
57
|
+
getAvailablePeriods() {
|
|
58
|
+
return this._storedPeriodInfo.reduce((acc, p) => {
|
|
74
59
|
if (p.isPeriodAdvertised) {
|
|
75
60
|
acc.push(toExposedPeriod(p.period));
|
|
76
61
|
}
|
|
77
62
|
return acc;
|
|
78
63
|
}, []);
|
|
79
|
-
}
|
|
64
|
+
}
|
|
80
65
|
/**
|
|
81
66
|
* Update the list of Periods handled by the TracksStore and make a
|
|
82
67
|
* track choice decision for each of them.
|
|
83
68
|
* @param {Object} manifest - The new Manifest object
|
|
84
69
|
*/
|
|
85
|
-
|
|
86
|
-
var _a;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var DEFAULT_VIDEO_TRACK_SWITCHING_MODE = config.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE;
|
|
90
|
-
var periods = manifest.periods;
|
|
70
|
+
updatePeriodList(manifest) {
|
|
71
|
+
var _a, _b, _c;
|
|
72
|
+
const { DEFAULT_VIDEO_TRACK_SWITCHING_MODE } = config_1.default.getCurrent();
|
|
73
|
+
const { periods } = manifest;
|
|
91
74
|
// We assume that they are always sorted chronologically
|
|
92
75
|
// In dev mode, perform a runtime check that this is the case
|
|
93
76
|
if (0 /* __ENVIRONMENT__.CURRENT_ENV */ === 1 /* __ENVIRONMENT__.DEV */) {
|
|
94
|
-
for (
|
|
95
|
-
|
|
77
|
+
for (let i = 1; i < periods.length; i++) {
|
|
78
|
+
(0, assert_1.default)(periods[i - 1].start <= periods[i].start);
|
|
96
79
|
}
|
|
97
80
|
}
|
|
98
81
|
/** Periods which have just been added. */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
const addedPeriods = [];
|
|
83
|
+
let newPListIdx = 0;
|
|
84
|
+
for (let i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
85
|
+
const oldPeriod = this._storedPeriodInfo[i].period;
|
|
86
|
+
const newPeriod = periods[newPListIdx];
|
|
104
87
|
if (newPeriod === undefined) {
|
|
105
88
|
// We reached the end of the new Periods, remove remaining old Periods
|
|
106
|
-
for (
|
|
107
|
-
|
|
108
|
-
if (isPeriodItemRemovable(
|
|
109
|
-
|
|
89
|
+
for (let j = this._storedPeriodInfo.length - 1; j >= i; j--) {
|
|
90
|
+
this._storedPeriodInfo[j].inManifest = false;
|
|
91
|
+
if (isPeriodItemRemovable(this._storedPeriodInfo[j])) {
|
|
92
|
+
this._removePeriodObject(j);
|
|
110
93
|
}
|
|
111
94
|
}
|
|
112
95
|
}
|
|
113
96
|
else if (oldPeriod === newPeriod) {
|
|
114
97
|
newPListIdx++;
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.some(
|
|
98
|
+
const curWantedTextTrack = this._storedPeriodInfo[i].text.storedSettings;
|
|
99
|
+
if (curWantedTextTrack !== null) {
|
|
100
|
+
const textAdaptations = newPeriod.getSupportedAdaptations("text");
|
|
101
|
+
const stillHere = textAdaptations
|
|
102
|
+
.some(a => a.id === curWantedTextTrack.adaptation.id);
|
|
120
103
|
if (!stillHere) {
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
log_1.default.warn("TS: Chosen text Adaptation not available anymore");
|
|
105
|
+
const periodInfo = this._storedPeriodInfo[i];
|
|
123
106
|
periodInfo.text.storedSettings = null;
|
|
124
|
-
|
|
107
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
125
108
|
trackType: "text",
|
|
126
109
|
reason: "missing" });
|
|
127
110
|
// The previous event trigger could have had side-effects, so we
|
|
128
111
|
// re-check if we're still mostly in the same state
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
112
|
+
if (this._isDisposed) {
|
|
113
|
+
return; // The current TracksStore is disposed, we can abort
|
|
131
114
|
}
|
|
132
|
-
|
|
115
|
+
const periodItem = getPeriodItem(this._storedPeriodInfo, periodInfo.period.id);
|
|
133
116
|
if (periodItem !== undefined && periodItem.text.storedSettings === null) {
|
|
134
|
-
(
|
|
117
|
+
(_a = periodItem.text.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(null);
|
|
135
118
|
}
|
|
136
119
|
}
|
|
137
120
|
}
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.some(
|
|
121
|
+
const curWantedVideoTrack = this._storedPeriodInfo[i].video.storedSettings;
|
|
122
|
+
if (curWantedVideoTrack !== null) {
|
|
123
|
+
const videoAdaptations = newPeriod.getSupportedAdaptations("video");
|
|
124
|
+
const stillHere = videoAdaptations
|
|
125
|
+
.some(a => a.id === curWantedVideoTrack.adaptation.id);
|
|
143
126
|
if (!stillHere) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
127
|
+
log_1.default.warn("TS: Chosen video Adaptation not available anymore");
|
|
128
|
+
const periodItem = this._storedPeriodInfo[i];
|
|
129
|
+
let storedSettings;
|
|
147
130
|
if (videoAdaptations.length === 0) {
|
|
148
131
|
storedSettings = null;
|
|
149
132
|
}
|
|
150
133
|
else {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
storedSettings = { adaptationBase
|
|
134
|
+
const adaptationBase = videoAdaptations[0];
|
|
135
|
+
const adaptation = getRightVideoTrack(adaptationBase, this._isTrickModeTrackEnabled);
|
|
136
|
+
const lockedRepresentations = new reference_1.default(null);
|
|
137
|
+
storedSettings = { adaptationBase,
|
|
138
|
+
adaptation,
|
|
139
|
+
switchingMode: DEFAULT_VIDEO_TRACK_SWITCHING_MODE,
|
|
140
|
+
lockedRepresentations };
|
|
155
141
|
}
|
|
156
142
|
periodItem.video.storedSettings = storedSettings;
|
|
157
|
-
|
|
143
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
158
144
|
trackType: "video",
|
|
159
145
|
reason: "missing" });
|
|
160
146
|
// The previous event trigger could have had side-effects, so we
|
|
161
147
|
// re-check if we're still mostly in the same state
|
|
162
|
-
if (
|
|
163
|
-
return
|
|
148
|
+
if (this._isDisposed) {
|
|
149
|
+
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
164
150
|
}
|
|
165
|
-
|
|
151
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodItem.period.id);
|
|
166
152
|
if (newPeriodItem !== undefined &&
|
|
167
153
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
168
|
-
(
|
|
154
|
+
(_b = newPeriodItem.video.dispatcher) === null || _b === void 0 ? void 0 : _b.updateTrack(storedSettings);
|
|
169
155
|
}
|
|
170
156
|
}
|
|
171
157
|
}
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
.some(
|
|
158
|
+
const curWantedAudioTrack = this._storedPeriodInfo[i].audio.storedSettings;
|
|
159
|
+
if (curWantedAudioTrack !== null) {
|
|
160
|
+
const audioAdaptations = newPeriod.getSupportedAdaptations("audio");
|
|
161
|
+
const stillHere = audioAdaptations
|
|
162
|
+
.some(a => a.id === curWantedAudioTrack.adaptation.id);
|
|
177
163
|
if (!stillHere) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
log_1.default.warn("TS: Chosen audio Adaptation not available anymore");
|
|
165
|
+
const periodItem = this._storedPeriodInfo[i];
|
|
166
|
+
const storedSettings = audioAdaptations.length === 0 ?
|
|
181
167
|
null :
|
|
182
168
|
{ adaptation: audioAdaptations[0],
|
|
183
|
-
switchingMode:
|
|
184
|
-
lockedRepresentations: new
|
|
169
|
+
switchingMode: this._defaultAudioTrackSwitchingMode,
|
|
170
|
+
lockedRepresentations: new reference_1.default(null) };
|
|
185
171
|
periodItem.audio.storedSettings = storedSettings;
|
|
186
|
-
|
|
172
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
187
173
|
trackType: "audio",
|
|
188
174
|
reason: "missing" });
|
|
189
175
|
// The previous event trigger could have had side-effects, so we
|
|
190
176
|
// re-check if we're still mostly in the same state
|
|
191
|
-
if (
|
|
192
|
-
return
|
|
177
|
+
if (this._isDisposed) {
|
|
178
|
+
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
193
179
|
}
|
|
194
|
-
|
|
180
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodItem.period.id);
|
|
195
181
|
if (newPeriodItem !== undefined &&
|
|
196
182
|
newPeriodItem.audio.storedSettings === storedSettings) {
|
|
197
|
-
(
|
|
183
|
+
(_c = newPeriodItem.audio.dispatcher) === null || _c === void 0 ? void 0 : _c.updateTrack(storedSettings);
|
|
198
184
|
}
|
|
199
185
|
}
|
|
200
186
|
}
|
|
@@ -202,38 +188,30 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
202
188
|
}
|
|
203
189
|
else if (oldPeriod.start <= newPeriod.start) {
|
|
204
190
|
// This old Period does not exist anymore.
|
|
205
|
-
|
|
206
|
-
if (isPeriodItemRemovable(
|
|
207
|
-
|
|
191
|
+
this._storedPeriodInfo[i].inManifest = false;
|
|
192
|
+
if (isPeriodItemRemovable(this._storedPeriodInfo[i])) {
|
|
193
|
+
this._removePeriodObject(i);
|
|
208
194
|
i--;
|
|
209
195
|
}
|
|
210
196
|
}
|
|
211
197
|
else {
|
|
212
|
-
|
|
198
|
+
const newPeriodInfo = generatePeriodInfo(newPeriod, true, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode);
|
|
213
199
|
// oldPeriod.start > newPeriod.start: insert newPeriod before
|
|
214
|
-
|
|
200
|
+
this._storedPeriodInfo.splice(i, 0, newPeriodInfo);
|
|
215
201
|
addedPeriods.push(newPeriodInfo);
|
|
216
202
|
newPListIdx++;
|
|
217
203
|
// Note: we don't increment `i` on purpose here, as we want to check the
|
|
218
204
|
// same oldPeriod at the next loop iteration
|
|
219
205
|
}
|
|
220
|
-
out_i_1 = i;
|
|
221
|
-
};
|
|
222
|
-
var this_1 = this, out_i_1;
|
|
223
|
-
for (var i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
224
|
-
var state_1 = _loop_1(i);
|
|
225
|
-
i = out_i_1;
|
|
226
|
-
if (typeof state_1 === "object")
|
|
227
|
-
return state_1.value;
|
|
228
206
|
}
|
|
229
207
|
if (newPListIdx < periods.length) {
|
|
230
208
|
// Add further new Period
|
|
231
|
-
|
|
232
|
-
.map(
|
|
233
|
-
|
|
234
|
-
addedPeriods.push
|
|
209
|
+
const periodsToAdd = periods.slice(newPListIdx)
|
|
210
|
+
.map(p => generatePeriodInfo(p, true, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode));
|
|
211
|
+
this._storedPeriodInfo.push(...periodsToAdd);
|
|
212
|
+
addedPeriods.push(...periodsToAdd);
|
|
235
213
|
}
|
|
236
|
-
}
|
|
214
|
+
}
|
|
237
215
|
/**
|
|
238
216
|
* Add shared reference to choose Adaptation for new "audio", "video" or
|
|
239
217
|
* "text" Period.
|
|
@@ -246,13 +224,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
246
224
|
* @param {Object} adaptationRef - A reference through which
|
|
247
225
|
* the choice will be given.
|
|
248
226
|
*/
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
227
|
+
addTrackReference(bufferType, manifest, period, adaptationRef) {
|
|
228
|
+
let periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
252
229
|
if (periodObj === undefined) { // The Period has not yet been added.
|
|
253
230
|
periodObj = generatePeriodInfo(period, false, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode);
|
|
254
|
-
|
|
255
|
-
for (
|
|
231
|
+
let found = false;
|
|
232
|
+
for (let i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
256
233
|
if (this._storedPeriodInfo[i].period.start > period.start) {
|
|
257
234
|
this._storedPeriodInfo.splice(i, 0, periodObj);
|
|
258
235
|
found = true;
|
|
@@ -272,80 +249,80 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
272
249
|
}
|
|
273
250
|
}
|
|
274
251
|
if (periodObj[bufferType].dispatcher !== null) {
|
|
275
|
-
|
|
276
|
-
|
|
252
|
+
log_1.default.error(`TS: Subject already added for ${bufferType} ` +
|
|
253
|
+
`and Period ${period.start}`);
|
|
277
254
|
return;
|
|
278
255
|
}
|
|
279
|
-
|
|
280
|
-
|
|
256
|
+
const trackSetting = periodObj[bufferType].storedSettings;
|
|
257
|
+
const dispatcher = new track_dispatcher_1.default(manifest, adaptationRef);
|
|
281
258
|
periodObj[bufferType].dispatcher = dispatcher;
|
|
282
|
-
dispatcher.addEventListener("noPlayableRepresentation",
|
|
259
|
+
dispatcher.addEventListener("noPlayableRepresentation", () => {
|
|
283
260
|
var _a, _b, _c;
|
|
284
|
-
|
|
285
|
-
|
|
261
|
+
const nextAdaptation = (0, array_find_1.default)(period.getAdaptationsForType(bufferType), (a) => {
|
|
262
|
+
const playableRepresentations = a.getPlayableRepresentations();
|
|
286
263
|
return playableRepresentations.length > 0;
|
|
287
264
|
});
|
|
288
265
|
if (nextAdaptation === undefined) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
266
|
+
const noRepErr = new errors_1.MediaError("NO_PLAYABLE_REPRESENTATION", `No ${bufferType} Representation can be played`, { adaptations: undefined });
|
|
267
|
+
this.trigger("error", noRepErr);
|
|
268
|
+
this.dispose();
|
|
292
269
|
return;
|
|
293
270
|
}
|
|
294
|
-
|
|
295
|
-
if (
|
|
271
|
+
let typeInfo = (_a = getPeriodItem(this._storedPeriodInfo, period.id)) === null || _a === void 0 ? void 0 : _a[bufferType];
|
|
272
|
+
if ((0, is_null_or_undefined_1.default)(typeInfo)) {
|
|
296
273
|
return;
|
|
297
274
|
}
|
|
298
|
-
|
|
299
|
-
|
|
275
|
+
const switchingMode = bufferType === "audio" ?
|
|
276
|
+
this._defaultAudioTrackSwitchingMode :
|
|
300
277
|
"reload";
|
|
301
|
-
|
|
278
|
+
const storedSettings = {
|
|
302
279
|
adaptation: nextAdaptation,
|
|
303
|
-
switchingMode
|
|
304
|
-
lockedRepresentations: new
|
|
280
|
+
switchingMode,
|
|
281
|
+
lockedRepresentations: new reference_1.default(null),
|
|
305
282
|
};
|
|
306
283
|
typeInfo.storedSettings = storedSettings;
|
|
307
|
-
|
|
284
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
308
285
|
trackType: bufferType,
|
|
309
286
|
reason: "no-playable-representation" });
|
|
310
287
|
// The previous event trigger could have had side-effects, so we
|
|
311
288
|
// re-check if we're still mostly in the same state
|
|
312
|
-
if (
|
|
289
|
+
if (this._isDisposed) {
|
|
313
290
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
314
291
|
}
|
|
315
|
-
typeInfo = (_b = getPeriodItem(
|
|
316
|
-
if (
|
|
292
|
+
typeInfo = (_b = getPeriodItem(this._storedPeriodInfo, period.id)) === null || _b === void 0 ? void 0 : _b[bufferType];
|
|
293
|
+
if ((0, is_null_or_undefined_1.default)(typeInfo) || typeInfo.storedSettings !== storedSettings) {
|
|
317
294
|
return;
|
|
318
295
|
}
|
|
319
296
|
(_c = typeInfo.dispatcher) === null || _c === void 0 ? void 0 : _c.updateTrack(storedSettings);
|
|
320
297
|
});
|
|
321
|
-
dispatcher.addEventListener("noPlayableLockedRepresentation",
|
|
298
|
+
dispatcher.addEventListener("noPlayableLockedRepresentation", () => {
|
|
322
299
|
// TODO check that it doesn't already lead to segment loading or MediaSource
|
|
323
300
|
// reloading
|
|
324
301
|
trackSetting === null || trackSetting === void 0 ? void 0 : trackSetting.lockedRepresentations.setValue(null);
|
|
325
|
-
|
|
302
|
+
this.trigger("brokenRepresentationsLock", { period: { id: period.id,
|
|
326
303
|
start: period.start,
|
|
327
304
|
end: period.end },
|
|
328
305
|
trackType: bufferType });
|
|
329
306
|
});
|
|
330
307
|
dispatcher.start(trackSetting);
|
|
331
|
-
}
|
|
308
|
+
}
|
|
332
309
|
/**
|
|
333
310
|
* Remove shared reference to choose an "audio", "video" or "text" Adaptation
|
|
334
311
|
* for a Period.
|
|
335
312
|
* @param {string} bufferType - The concerned buffer type
|
|
336
313
|
* @param {Period} period - The concerned Period.
|
|
337
314
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
315
|
+
removeTrackReference(bufferType, period) {
|
|
316
|
+
const periodIndex = findPeriodIndex(this._storedPeriodInfo, period);
|
|
340
317
|
if (periodIndex === undefined) {
|
|
341
|
-
|
|
318
|
+
log_1.default.warn(`TS: ${bufferType} not found for period`, period.start);
|
|
342
319
|
return;
|
|
343
320
|
}
|
|
344
|
-
|
|
345
|
-
|
|
321
|
+
const periodObj = this._storedPeriodInfo[periodIndex];
|
|
322
|
+
const choiceItem = periodObj[bufferType];
|
|
346
323
|
if ((choiceItem === null || choiceItem === void 0 ? void 0 : choiceItem.dispatcher) === null) {
|
|
347
|
-
|
|
348
|
-
|
|
324
|
+
log_1.default.warn(`TS: TrackDispatcher already removed for ${bufferType} ` +
|
|
325
|
+
`and Period ${period.start}`);
|
|
349
326
|
return;
|
|
350
327
|
}
|
|
351
328
|
choiceItem.dispatcher.dispose();
|
|
@@ -353,7 +330,7 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
353
330
|
if (isPeriodItemRemovable(periodObj)) {
|
|
354
331
|
this._removePeriodObject(periodIndex);
|
|
355
332
|
}
|
|
356
|
-
}
|
|
333
|
+
}
|
|
357
334
|
/**
|
|
358
335
|
* Allows to recuperate a "Period Object" - used in get/set methods of the
|
|
359
336
|
* `TracksStore` - by giving the Period itself.
|
|
@@ -372,13 +349,13 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
372
349
|
* @param {Object} period
|
|
373
350
|
* @returns {Object}
|
|
374
351
|
*/
|
|
375
|
-
|
|
376
|
-
|
|
352
|
+
getPeriodObjectFromPeriod(period) {
|
|
353
|
+
const periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
377
354
|
if (periodObj === undefined && period !== undefined) {
|
|
378
355
|
return this._cachedPeriodInfo.get(period);
|
|
379
356
|
}
|
|
380
357
|
return periodObj;
|
|
381
|
-
}
|
|
358
|
+
}
|
|
382
359
|
/**
|
|
383
360
|
* Allows to recuperate a "Period Object" - used in get/set methods of the
|
|
384
361
|
* `TracksStore` - by giving the Period's id.
|
|
@@ -393,23 +370,23 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
393
370
|
* @param {string} periodId - The concerned Period's id
|
|
394
371
|
* @returns {Object}
|
|
395
372
|
*/
|
|
396
|
-
|
|
373
|
+
getPeriodObjectFromId(periodId) {
|
|
397
374
|
return getPeriodItem(this._storedPeriodInfo, periodId);
|
|
398
|
-
}
|
|
399
|
-
|
|
375
|
+
}
|
|
376
|
+
disableVideoTrickModeTracks() {
|
|
400
377
|
if (!this._isTrickModeTrackEnabled) {
|
|
401
378
|
return;
|
|
402
379
|
}
|
|
403
380
|
this._isTrickModeTrackEnabled = false;
|
|
404
381
|
this._resetVideoTrackChoices("trickmode-disabled");
|
|
405
|
-
}
|
|
406
|
-
|
|
382
|
+
}
|
|
383
|
+
enableVideoTrickModeTracks() {
|
|
407
384
|
if (this._isTrickModeTrackEnabled) {
|
|
408
385
|
return;
|
|
409
386
|
}
|
|
410
387
|
this._isTrickModeTrackEnabled = true;
|
|
411
388
|
this._resetVideoTrackChoices("trickmode-enabled");
|
|
412
|
-
}
|
|
389
|
+
}
|
|
413
390
|
/**
|
|
414
391
|
* Reset the TracksStore's Period objects:
|
|
415
392
|
* - All Period which are not in the manifest currently will be removed.
|
|
@@ -417,10 +394,10 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
417
394
|
*
|
|
418
395
|
* You might want to call this API when restarting playback.
|
|
419
396
|
*/
|
|
420
|
-
|
|
397
|
+
resetPeriodObjects() {
|
|
421
398
|
var _a, _b, _c;
|
|
422
|
-
for (
|
|
423
|
-
|
|
399
|
+
for (let i = this._storedPeriodInfo.length - 1; i >= 0; i--) {
|
|
400
|
+
const storedObj = this._storedPeriodInfo[i];
|
|
424
401
|
(_a = storedObj.audio.dispatcher) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
425
402
|
storedObj.audio.dispatcher = null;
|
|
426
403
|
(_b = storedObj.video.dispatcher) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -431,13 +408,13 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
431
408
|
this._removePeriodObject(i);
|
|
432
409
|
}
|
|
433
410
|
}
|
|
434
|
-
}
|
|
411
|
+
}
|
|
435
412
|
/**
|
|
436
413
|
* @returns {boolean}
|
|
437
414
|
*/
|
|
438
|
-
|
|
415
|
+
isTrickModeEnabled() {
|
|
439
416
|
return this._isTrickModeTrackEnabled;
|
|
440
|
-
}
|
|
417
|
+
}
|
|
441
418
|
/**
|
|
442
419
|
* Set audio track based on the ID of its Adaptation for a given added Period.
|
|
443
420
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -448,17 +425,17 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
448
425
|
* locked after switchingMode to that track.
|
|
449
426
|
* `null` if no Audio Representation should be locked.
|
|
450
427
|
*/
|
|
451
|
-
|
|
428
|
+
setAudioTrack(periodObj, wantedId, switchingMode, reprsToLock) {
|
|
452
429
|
return this._setAudioOrTextTrack("audio", periodObj, wantedId, switchingMode !== null && switchingMode !== void 0 ? switchingMode : this._defaultAudioTrackSwitchingMode, reprsToLock);
|
|
453
|
-
}
|
|
430
|
+
}
|
|
454
431
|
/**
|
|
455
432
|
* Set text track based on the ID of its Adaptation for a given added Period.
|
|
456
433
|
* @param {Object} periodObj - The concerned Period's object.
|
|
457
434
|
* @param {string} wantedId - adaptation id of the wanted track.
|
|
458
435
|
*/
|
|
459
|
-
|
|
436
|
+
setTextTrack(periodObj, wantedId) {
|
|
460
437
|
return this._setAudioOrTextTrack("text", periodObj, wantedId, "direct", null);
|
|
461
|
-
}
|
|
438
|
+
}
|
|
462
439
|
/**
|
|
463
440
|
* Set audio track based on the ID of its Adaptation for a given added Period.
|
|
464
441
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -469,32 +446,31 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
469
446
|
* locked after switchingMode to that track.
|
|
470
447
|
* `null` if no Audio Representation should be locked.
|
|
471
448
|
*/
|
|
472
|
-
|
|
449
|
+
_setAudioOrTextTrack(bufferType, periodObj, wantedId, switchingMode, reprsToLock) {
|
|
473
450
|
var _a;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
var id = _a.id;
|
|
477
|
-
return id === wantedId;
|
|
478
|
-
});
|
|
451
|
+
const period = periodObj.period;
|
|
452
|
+
const wantedAdaptation = (0, array_find_1.default)(period.getSupportedAdaptations(bufferType), ({ id }) => id === wantedId);
|
|
479
453
|
if (wantedAdaptation === undefined) {
|
|
480
|
-
throw new Error(
|
|
454
|
+
throw new Error(`Wanted ${bufferType} track not found.`);
|
|
481
455
|
}
|
|
482
|
-
|
|
483
|
-
|
|
456
|
+
const typeInfo = periodObj[bufferType];
|
|
457
|
+
let lockedRepresentations;
|
|
484
458
|
if (reprsToLock === null) {
|
|
485
|
-
lockedRepresentations = new
|
|
459
|
+
lockedRepresentations = new reference_1.default(null);
|
|
486
460
|
}
|
|
487
461
|
else {
|
|
488
|
-
|
|
489
|
-
|
|
462
|
+
const representationsToLock = this._getRepresentationsToLock(wantedAdaptation, reprsToLock);
|
|
463
|
+
const repSwitchingMode = bufferType === "audio" ?
|
|
490
464
|
this._defaultAudioTrackSwitchingMode :
|
|
491
465
|
"direct";
|
|
492
|
-
lockedRepresentations = new
|
|
466
|
+
lockedRepresentations = new reference_1.default({
|
|
493
467
|
representations: representationsToLock,
|
|
494
468
|
switchingMode: repSwitchingMode,
|
|
495
469
|
});
|
|
496
470
|
}
|
|
497
|
-
|
|
471
|
+
const storedSettings = { adaptation: wantedAdaptation,
|
|
472
|
+
switchingMode,
|
|
473
|
+
lockedRepresentations };
|
|
498
474
|
typeInfo.storedSettings = storedSettings;
|
|
499
475
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
500
476
|
trackType: bufferType,
|
|
@@ -504,12 +480,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
504
480
|
if (this._isDisposed) {
|
|
505
481
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
506
482
|
}
|
|
507
|
-
|
|
483
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
508
484
|
if (newPeriodItem !== undefined &&
|
|
509
485
|
newPeriodItem[bufferType].storedSettings === storedSettings) {
|
|
510
486
|
(_a = newPeriodItem[bufferType].dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
511
487
|
}
|
|
512
|
-
}
|
|
488
|
+
}
|
|
513
489
|
/**
|
|
514
490
|
* Set video track based on the ID of its Adaptation for a given added Period.
|
|
515
491
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -520,34 +496,32 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
520
496
|
* locked after switchingMode to that track.
|
|
521
497
|
* `null` if no Video Representation should be locked.
|
|
522
498
|
*/
|
|
523
|
-
|
|
499
|
+
setVideoTrack(periodObj, wantedId, switchingMode, reprsToLock) {
|
|
524
500
|
var _a;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
var id = _a.id;
|
|
528
|
-
return id === wantedId;
|
|
529
|
-
});
|
|
501
|
+
const period = periodObj.period;
|
|
502
|
+
const wantedAdaptation = (0, array_find_1.default)(period.getSupportedAdaptations("video"), ({ id }) => id === wantedId);
|
|
530
503
|
if (wantedAdaptation === undefined) {
|
|
531
504
|
throw new Error("Wanted video track not found.");
|
|
532
505
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
506
|
+
const { DEFAULT_VIDEO_TRACK_SWITCHING_MODE } = config_1.default.getCurrent();
|
|
507
|
+
const typeInfo = periodObj.video;
|
|
508
|
+
const newAdaptation = getRightVideoTrack(wantedAdaptation, this._isTrickModeTrackEnabled);
|
|
509
|
+
let lockedRepresentations;
|
|
537
510
|
if (reprsToLock === null) {
|
|
538
|
-
lockedRepresentations = new
|
|
511
|
+
lockedRepresentations = new reference_1.default(null);
|
|
539
512
|
}
|
|
540
513
|
else {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
lockedRepresentations = new
|
|
514
|
+
const representationsToLock = this._getRepresentationsToLock(wantedAdaptation, reprsToLock);
|
|
515
|
+
const repSwitchingMode = DEFAULT_VIDEO_TRACK_SWITCHING_MODE;
|
|
516
|
+
lockedRepresentations = new reference_1.default({
|
|
544
517
|
representations: representationsToLock,
|
|
545
518
|
switchingMode: repSwitchingMode,
|
|
546
519
|
});
|
|
547
520
|
}
|
|
548
|
-
|
|
521
|
+
const storedSettings = { adaptationBase: wantedAdaptation,
|
|
549
522
|
switchingMode: switchingMode !== null && switchingMode !== void 0 ? switchingMode : DEFAULT_VIDEO_TRACK_SWITCHING_MODE,
|
|
550
|
-
adaptation: newAdaptation,
|
|
523
|
+
adaptation: newAdaptation,
|
|
524
|
+
lockedRepresentations };
|
|
551
525
|
typeInfo.storedSettings = storedSettings;
|
|
552
526
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
553
527
|
trackType: "video",
|
|
@@ -557,12 +531,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
557
531
|
if (this._isDisposed) {
|
|
558
532
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
559
533
|
}
|
|
560
|
-
|
|
534
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
561
535
|
if (newPeriodItem !== undefined &&
|
|
562
536
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
563
537
|
(_a = newPeriodItem.video.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
564
538
|
}
|
|
565
|
-
}
|
|
539
|
+
}
|
|
566
540
|
/**
|
|
567
541
|
* Disable the current text track for a given period.
|
|
568
542
|
*
|
|
@@ -570,9 +544,9 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
570
544
|
* @param {string} bufferType - The type of track to disable.
|
|
571
545
|
* @throws Error - Throws if the period given has not been added
|
|
572
546
|
*/
|
|
573
|
-
|
|
547
|
+
disableTrack(periodObj, bufferType) {
|
|
574
548
|
var _a, _b;
|
|
575
|
-
|
|
549
|
+
const trackInfo = periodObj[bufferType];
|
|
576
550
|
if (trackInfo.storedSettings === null) {
|
|
577
551
|
return;
|
|
578
552
|
}
|
|
@@ -589,12 +563,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
589
563
|
if (this._isDisposed) {
|
|
590
564
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
591
565
|
}
|
|
592
|
-
|
|
566
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodObj.period.id);
|
|
593
567
|
if (newPeriodItem !== undefined &&
|
|
594
568
|
newPeriodItem[bufferType].storedSettings === null) {
|
|
595
569
|
(_b = newPeriodItem[bufferType].dispatcher) === null || _b === void 0 ? void 0 : _b.updateTrack(null);
|
|
596
570
|
}
|
|
597
|
-
}
|
|
571
|
+
}
|
|
598
572
|
/**
|
|
599
573
|
* Returns an object describing the chosen audio track for the given audio
|
|
600
574
|
* Period.
|
|
@@ -613,11 +587,11 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
613
587
|
* `null` if audio tracks were disabled and `undefined` if the Period is not
|
|
614
588
|
* known.
|
|
615
589
|
*/
|
|
616
|
-
|
|
590
|
+
getChosenAudioTrack(periodObj) {
|
|
617
591
|
return periodObj.audio.storedSettings === null ?
|
|
618
592
|
null :
|
|
619
593
|
periodObj.audio.storedSettings.adaptation.toAudioTrack(true);
|
|
620
|
-
}
|
|
594
|
+
}
|
|
621
595
|
/**
|
|
622
596
|
* Returns an object describing the chosen text track for the given text
|
|
623
597
|
* Period.
|
|
@@ -628,11 +602,11 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
628
602
|
* @param {Object} periodObj - The concerned Period's object
|
|
629
603
|
* @returns {Object|null} - The text track chosen for this Period
|
|
630
604
|
*/
|
|
631
|
-
|
|
605
|
+
getChosenTextTrack(periodObj) {
|
|
632
606
|
return periodObj.text.storedSettings === null ?
|
|
633
607
|
null :
|
|
634
608
|
periodObj.text.storedSettings.adaptation.toTextTrack();
|
|
635
|
-
}
|
|
609
|
+
}
|
|
636
610
|
/**
|
|
637
611
|
* Returns an object describing the chosen video track for the given video
|
|
638
612
|
* Period.
|
|
@@ -643,12 +617,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
643
617
|
* @param {Object} periodObj - The concerned Period's object
|
|
644
618
|
* @returns {Object|null} - The video track chosen for this Period
|
|
645
619
|
*/
|
|
646
|
-
|
|
620
|
+
getChosenVideoTrack(periodObj) {
|
|
647
621
|
if (periodObj.video.storedSettings === null) {
|
|
648
622
|
return null;
|
|
649
623
|
}
|
|
650
624
|
return periodObj.video.storedSettings.adaptation.toVideoTrack(true);
|
|
651
|
-
}
|
|
625
|
+
}
|
|
652
626
|
/**
|
|
653
627
|
* Returns all available audio tracks for a given Period, as an array of
|
|
654
628
|
* objects.
|
|
@@ -658,18 +632,18 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
658
632
|
* @param {Object} periodObj - The concerned Period's object
|
|
659
633
|
* @returns {Array.<Object>}
|
|
660
634
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
635
|
+
getAvailableAudioTracks(periodObj) {
|
|
636
|
+
const storedSettings = periodObj.audio.storedSettings;
|
|
637
|
+
const currentId = storedSettings !== null ?
|
|
664
638
|
storedSettings.adaptation.id :
|
|
665
639
|
null;
|
|
666
640
|
return periodObj.period.getSupportedAdaptations("audio")
|
|
667
|
-
.map(
|
|
668
|
-
|
|
641
|
+
.map((adaptation) => {
|
|
642
|
+
const active = currentId === null ? false :
|
|
669
643
|
currentId === adaptation.id;
|
|
670
|
-
return
|
|
644
|
+
return (0, object_assign_1.default)(adaptation.toAudioTrack(true), { active });
|
|
671
645
|
});
|
|
672
|
-
}
|
|
646
|
+
}
|
|
673
647
|
/**
|
|
674
648
|
* Returns all available text tracks for a given Period, as an array of
|
|
675
649
|
* objects.
|
|
@@ -679,18 +653,18 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
679
653
|
* @param {Object} periodObj - The concerned Period's object
|
|
680
654
|
* @returns {Array.<Object>}
|
|
681
655
|
*/
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
656
|
+
getAvailableTextTracks(periodObj) {
|
|
657
|
+
const storedSettings = periodObj.text.storedSettings;
|
|
658
|
+
const currentId = storedSettings !== null ?
|
|
685
659
|
storedSettings.adaptation.id :
|
|
686
660
|
null;
|
|
687
661
|
return periodObj.period.getSupportedAdaptations("text")
|
|
688
|
-
.map(
|
|
689
|
-
|
|
662
|
+
.map((adaptation) => {
|
|
663
|
+
const active = currentId === null ? false :
|
|
690
664
|
currentId === adaptation.id;
|
|
691
|
-
return
|
|
665
|
+
return (0, object_assign_1.default)(adaptation.toTextTrack(), { active });
|
|
692
666
|
});
|
|
693
|
-
}
|
|
667
|
+
}
|
|
694
668
|
/**
|
|
695
669
|
* Returns all available video tracks for a given Period, as an array of
|
|
696
670
|
* objects.
|
|
@@ -700,106 +674,108 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
700
674
|
* @param {Object} periodObj - The concerned Period's object
|
|
701
675
|
* @returns {Array.<Object>}
|
|
702
676
|
*/
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
677
|
+
getAvailableVideoTracks(periodObj) {
|
|
678
|
+
const storedSettings = periodObj.video.storedSettings;
|
|
679
|
+
const currentId = storedSettings === null ?
|
|
706
680
|
undefined :
|
|
707
681
|
storedSettings.adaptation.id;
|
|
708
682
|
return periodObj.period.getSupportedAdaptations("video")
|
|
709
|
-
.map(
|
|
710
|
-
|
|
683
|
+
.map((adaptation) => {
|
|
684
|
+
const active = currentId === null ? false :
|
|
711
685
|
currentId === adaptation.id;
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
track.trickModeTracks.map(
|
|
715
|
-
|
|
686
|
+
const track = adaptation.toVideoTrack(true);
|
|
687
|
+
const trickModeTracks = track.trickModeTracks !== undefined ?
|
|
688
|
+
track.trickModeTracks.map((trickModeAdaptation) => {
|
|
689
|
+
const isActive = currentId === null ? false :
|
|
716
690
|
currentId === trickModeAdaptation.id;
|
|
717
|
-
return
|
|
691
|
+
return (0, object_assign_1.default)(trickModeAdaptation, { active: isActive });
|
|
718
692
|
}) :
|
|
719
693
|
[];
|
|
720
|
-
|
|
694
|
+
const availableTrack = (0, object_assign_1.default)(track, { active });
|
|
721
695
|
if (trickModeTracks !== undefined) {
|
|
722
696
|
availableTrack.trickModeTracks = trickModeTracks;
|
|
723
697
|
}
|
|
724
698
|
return availableTrack;
|
|
725
699
|
});
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
|
|
700
|
+
}
|
|
701
|
+
getLockedAudioRepresentations(periodObj) {
|
|
702
|
+
const { storedSettings } = periodObj.audio;
|
|
729
703
|
if (storedSettings === null) {
|
|
730
704
|
return null;
|
|
731
705
|
}
|
|
732
|
-
|
|
706
|
+
const lastLockedSettings = storedSettings.lockedRepresentations.getValue();
|
|
733
707
|
return lastLockedSettings === null ?
|
|
734
708
|
null :
|
|
735
|
-
lastLockedSettings.representations.map(
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
|
|
709
|
+
lastLockedSettings.representations.map(r => r.id);
|
|
710
|
+
}
|
|
711
|
+
getLockedVideoRepresentations(periodObj) {
|
|
712
|
+
const { storedSettings } = periodObj.video;
|
|
739
713
|
if (storedSettings === null) {
|
|
740
714
|
return null;
|
|
741
715
|
}
|
|
742
|
-
|
|
716
|
+
const lastLockedSettings = storedSettings.lockedRepresentations.getValue();
|
|
743
717
|
return lastLockedSettings === null ?
|
|
744
718
|
null :
|
|
745
|
-
lastLockedSettings.representations.map(
|
|
746
|
-
}
|
|
747
|
-
|
|
719
|
+
lastLockedSettings.representations.map(r => r.id);
|
|
720
|
+
}
|
|
721
|
+
lockAudioRepresentations(periodObj, lockSettings) {
|
|
748
722
|
var _a;
|
|
749
|
-
|
|
723
|
+
const { storedSettings } = periodObj.audio;
|
|
750
724
|
if (storedSettings === null) {
|
|
751
725
|
return;
|
|
752
726
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
757
|
-
|
|
758
|
-
|
|
727
|
+
const { DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE } = config_1.default.getCurrent();
|
|
728
|
+
const filtered = this._getRepresentationsToLock(storedSettings.adaptation, lockSettings.representations);
|
|
729
|
+
const switchingMode = (_a = lockSettings.switchingMode) !== null && _a !== void 0 ? _a : DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE;
|
|
730
|
+
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
731
|
+
switchingMode });
|
|
732
|
+
}
|
|
733
|
+
lockVideoRepresentations(periodObj, lockSettings) {
|
|
759
734
|
var _a;
|
|
760
|
-
|
|
735
|
+
const { storedSettings } = periodObj.video;
|
|
761
736
|
if (storedSettings === null) {
|
|
762
737
|
return;
|
|
763
738
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
739
|
+
const { DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE } = config_1.default.getCurrent();
|
|
740
|
+
const filtered = this._getRepresentationsToLock(storedSettings.adaptation, lockSettings.representations);
|
|
741
|
+
const switchingMode = (_a = lockSettings.switchingMode) !== null && _a !== void 0 ? _a : DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE;
|
|
742
|
+
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
743
|
+
switchingMode });
|
|
744
|
+
}
|
|
745
|
+
unlockAudioRepresentations(periodObj) {
|
|
746
|
+
const { storedSettings } = periodObj.audio;
|
|
771
747
|
if (storedSettings === null ||
|
|
772
748
|
storedSettings.lockedRepresentations.getValue() === null) {
|
|
773
749
|
return;
|
|
774
750
|
}
|
|
775
751
|
storedSettings.lockedRepresentations.setValue(null);
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
752
|
+
}
|
|
753
|
+
unlockVideoRepresentations(periodObj) {
|
|
754
|
+
const { storedSettings } = periodObj.video;
|
|
779
755
|
if (storedSettings === null ||
|
|
780
756
|
storedSettings.lockedRepresentations.getValue() === null) {
|
|
781
757
|
return;
|
|
782
758
|
}
|
|
783
759
|
storedSettings.lockedRepresentations.setValue(null);
|
|
784
|
-
}
|
|
785
|
-
|
|
760
|
+
}
|
|
761
|
+
dispose() {
|
|
786
762
|
this._isDisposed = true;
|
|
787
763
|
while (true) {
|
|
788
|
-
|
|
764
|
+
const lastPeriod = this._storedPeriodInfo.pop();
|
|
789
765
|
if (lastPeriod === undefined) {
|
|
790
766
|
return;
|
|
791
767
|
}
|
|
792
768
|
lastPeriod.isRemoved = true;
|
|
793
769
|
}
|
|
794
|
-
}
|
|
795
|
-
|
|
770
|
+
}
|
|
771
|
+
_resetVideoTrackChoices(reason) {
|
|
796
772
|
var _a;
|
|
797
|
-
for (
|
|
798
|
-
|
|
773
|
+
for (let i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
774
|
+
const periodObj = this._storedPeriodInfo[i];
|
|
799
775
|
if (periodObj.video.storedSettings !== null) {
|
|
800
|
-
|
|
776
|
+
const chosenBaseTrack = periodObj.video.storedSettings.adaptationBase;
|
|
801
777
|
if (chosenBaseTrack !== null) {
|
|
802
|
-
|
|
778
|
+
const chosenTrack = getRightVideoTrack(chosenBaseTrack, this._isTrickModeTrackEnabled);
|
|
803
779
|
periodObj.video.storedSettings.adaptationBase = chosenBaseTrack;
|
|
804
780
|
periodObj.video.storedSettings.adaptation = chosenTrack;
|
|
805
781
|
}
|
|
@@ -807,41 +783,42 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
807
783
|
}
|
|
808
784
|
// Clone the current Period list to not be influenced if Periods are removed
|
|
809
785
|
// or added while the loop is running.
|
|
810
|
-
|
|
811
|
-
for (
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
786
|
+
const sliced = this._storedPeriodInfo.slice();
|
|
787
|
+
for (let i = 0; i < sliced.length; i++) {
|
|
788
|
+
const period = sliced[i].period;
|
|
789
|
+
const videoItem = sliced[i].video;
|
|
790
|
+
const storedSettings = videoItem.storedSettings;
|
|
815
791
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
816
|
-
trackType: "video",
|
|
792
|
+
trackType: "video",
|
|
793
|
+
reason });
|
|
817
794
|
// The previous event trigger could have had side-effects, so we
|
|
818
795
|
// re-check if we're still mostly in the same state
|
|
819
796
|
if (this._isDisposed) {
|
|
820
797
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
821
798
|
}
|
|
822
|
-
|
|
799
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
823
800
|
if (newPeriodItem !== undefined &&
|
|
824
801
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
825
802
|
(_a = newPeriodItem.video.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
826
803
|
}
|
|
827
804
|
}
|
|
828
|
-
}
|
|
829
|
-
|
|
805
|
+
}
|
|
806
|
+
_removePeriodObject(index) {
|
|
830
807
|
if (0 /* __ENVIRONMENT__.CURRENT_ENV */ === 1 /* __ENVIRONMENT__.DEV */) {
|
|
831
|
-
|
|
808
|
+
(0, assert_1.default)(index < this._storedPeriodInfo.length, "Invalid index for Period removal");
|
|
832
809
|
}
|
|
833
|
-
|
|
810
|
+
const oldPeriodItem = this._storedPeriodInfo[index];
|
|
834
811
|
this._storedPeriodInfo[index].isRemoved = true;
|
|
835
812
|
this._storedPeriodInfo.splice(index, 1);
|
|
836
813
|
this._cachedPeriodInfo.set(oldPeriodItem.period, oldPeriodItem);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
814
|
+
}
|
|
815
|
+
_getRepresentationsToLock(adaptation, representationIds) {
|
|
816
|
+
const filtered = representationIds.reduce((acc, repId) => {
|
|
817
|
+
const foundRep = (0, array_find_1.default)(adaptation.representations, (r) => {
|
|
841
818
|
return r.id === repId;
|
|
842
819
|
});
|
|
843
820
|
if (foundRep === undefined) {
|
|
844
|
-
|
|
821
|
+
log_1.default.warn("API: Wanted locked Representation not found.");
|
|
845
822
|
}
|
|
846
823
|
else {
|
|
847
824
|
acc.push(foundRep);
|
|
@@ -853,10 +830,9 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
853
830
|
"None of the given Representation id are found");
|
|
854
831
|
}
|
|
855
832
|
return filtered;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
export default TracksStore;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
exports.default = TracksStore;
|
|
860
836
|
/**
|
|
861
837
|
* Returns the index of the given `period` in the given `periods`
|
|
862
838
|
* Array.
|
|
@@ -866,8 +842,8 @@ export default TracksStore;
|
|
|
866
842
|
* @returns {number|undefined}
|
|
867
843
|
*/
|
|
868
844
|
function findPeriodIndex(periods, period) {
|
|
869
|
-
for (
|
|
870
|
-
|
|
845
|
+
for (let i = 0; i < periods.length; i++) {
|
|
846
|
+
const periodI = periods[i];
|
|
871
847
|
if (periodI.period.id === period.id) {
|
|
872
848
|
return i;
|
|
873
849
|
}
|
|
@@ -882,8 +858,8 @@ function findPeriodIndex(periods, period) {
|
|
|
882
858
|
* @returns {Object|undefined}
|
|
883
859
|
*/
|
|
884
860
|
function getPeriodItem(periods, periodId) {
|
|
885
|
-
for (
|
|
886
|
-
|
|
861
|
+
for (let i = 0; i < periods.length; i++) {
|
|
862
|
+
const periodI = periods[i];
|
|
887
863
|
if (periodI.period.id === periodId) {
|
|
888
864
|
return periodI;
|
|
889
865
|
}
|
|
@@ -920,44 +896,44 @@ function getRightVideoTrack(adaptation, isTrickModeEnabled) {
|
|
|
920
896
|
*/
|
|
921
897
|
function generatePeriodInfo(period, inManifest, isTrickModeTrackEnabled, defaultAudioTrackSwitchingMode) {
|
|
922
898
|
var _a;
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
899
|
+
const audioAdaptation = period.getSupportedAdaptations("audio")[0];
|
|
900
|
+
const baseVideoAdaptation = period.getSupportedAdaptations("video")[0];
|
|
901
|
+
const videoAdaptation = getRightVideoTrack(baseVideoAdaptation, isTrickModeTrackEnabled);
|
|
902
|
+
const { DEFAULT_VIDEO_TRACK_SWITCHING_MODE } = config_1.default.getCurrent();
|
|
903
|
+
const audioSettings = audioAdaptation !== undefined ?
|
|
928
904
|
{ adaptation: audioAdaptation,
|
|
929
905
|
switchingMode: defaultAudioTrackSwitchingMode,
|
|
930
|
-
lockedRepresentations: new
|
|
906
|
+
lockedRepresentations: new reference_1.default(null) } :
|
|
931
907
|
null;
|
|
932
|
-
|
|
908
|
+
const videoSettings = videoAdaptation !== undefined ?
|
|
933
909
|
{ adaptation: videoAdaptation,
|
|
934
910
|
adaptationBase: baseVideoAdaptation,
|
|
935
911
|
switchingMode: DEFAULT_VIDEO_TRACK_SWITCHING_MODE,
|
|
936
|
-
lockedRepresentations: new
|
|
912
|
+
lockedRepresentations: new reference_1.default(null) } :
|
|
937
913
|
null;
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
.filter(
|
|
914
|
+
let textAdaptation = null;
|
|
915
|
+
const forcedSubtitles = period.getAdaptationsForType("text")
|
|
916
|
+
.filter((ad) => ad.isForcedSubtitles === true);
|
|
941
917
|
if (forcedSubtitles.length > 0) {
|
|
942
918
|
if (audioAdaptation !== null && audioAdaptation !== undefined) {
|
|
943
|
-
|
|
944
|
-
return f.normalizedLanguage === audioAdaptation.normalizedLanguage;
|
|
945
|
-
});
|
|
919
|
+
const sameLanguage = (0, array_find_1.default)(forcedSubtitles, (f) => f.normalizedLanguage === audioAdaptation.normalizedLanguage);
|
|
946
920
|
if (sameLanguage !== undefined) {
|
|
947
921
|
textAdaptation = sameLanguage;
|
|
948
922
|
}
|
|
949
923
|
}
|
|
950
924
|
if (textAdaptation === null) {
|
|
951
|
-
textAdaptation = (_a =
|
|
925
|
+
textAdaptation = (_a = (0, array_find_1.default)(forcedSubtitles, (f) => f.normalizedLanguage === undefined)) !== null && _a !== void 0 ? _a : null;
|
|
952
926
|
}
|
|
953
927
|
}
|
|
954
|
-
|
|
928
|
+
let textSettings = null;
|
|
955
929
|
if (textAdaptation !== null) {
|
|
956
930
|
textSettings = { adaptation: textAdaptation,
|
|
957
931
|
switchingMode: "direct",
|
|
958
|
-
lockedRepresentations: new
|
|
932
|
+
lockedRepresentations: new reference_1.default(null) };
|
|
959
933
|
}
|
|
960
|
-
return { period
|
|
934
|
+
return { period,
|
|
935
|
+
inManifest,
|
|
936
|
+
isPeriodAdvertised: false,
|
|
961
937
|
isRemoved: false,
|
|
962
938
|
audio: { storedSettings: audioSettings,
|
|
963
939
|
dispatcher: null },
|