rx-player 4.0.0-beta.2 → 4.0.0-beta.3
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/.eslintrc.js +9 -0
- package/CHANGELOG.md +173 -63
- package/CONTRIBUTING.md +27 -13
- package/FILES.md +0 -4
- package/README.md +0 -25
- 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.d.ts +0 -1
- package/dist/_esm5.processed/compat/browser_compatibility_types.js +16 -11
- package/dist/_esm5.processed/compat/browser_detection.js +49 -33
- 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.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +81 -101
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +6 -27
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +16 -159
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.js +31 -26
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ms_media_keys_constructor.js +14 -14
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +75 -89
- package/dist/_esm5.processed/compat/eme/custom_media_keys/types.d.ts +1 -1
- 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.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +97 -119
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +14 -16
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.d.ts +78 -0
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +198 -0
- 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.d.ts +5 -3
- 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.d.ts +13 -5
- package/dist/_esm5.processed/compat/event_listeners.js +132 -108
- package/dist/_esm5.processed/compat/get_start_date.js +7 -4
- package/dist/_esm5.processed/compat/global_scope.d.ts +9 -0
- package/dist/_esm5.processed/compat/global_scope.js +15 -0
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +6 -3
- package/dist/_esm5.processed/compat/index.d.ts +2 -3
- package/dist/_esm5.processed/compat/index.js +47 -25
- package/dist/_esm5.processed/compat/is_codec_supported.js +8 -5
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.d.ts +7 -0
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +12 -0
- package/dist/_esm5.processed/compat/is_node.d.ts +1 -0
- package/dist/_esm5.processed/compat/is_node.js +6 -2
- package/dist/_esm5.processed/compat/is_seeking_approximate.js +5 -3
- package/dist/_esm5.processed/compat/is_vtt_cue.js +6 -2
- package/dist/_esm5.processed/compat/is_worker.d.ts +5 -0
- package/dist/_esm5.processed/compat/is_worker.js +7 -0
- package/dist/_esm5.processed/compat/make_vtt_cue.js +10 -6
- package/dist/_esm5.processed/compat/on_height_width_change.js +25 -27
- package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +19 -16
- 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.d.ts +13 -0
- package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.js +19 -0
- package/dist/_esm5.processed/config.js +15 -14
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +136 -104
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +19 -3
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +66 -46
- package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +37 -43
- package/dist/_esm5.processed/core/adaptive/index.js +4 -2
- package/dist/_esm5.processed/core/adaptive/network_analyzer.js +75 -73
- 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.d.ts +13 -3
- 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 -29
- 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.d.ts +1 -1
- package/dist/_esm5.processed/core/api/option_utils.js +86 -59
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +8 -2
- package/dist/_esm5.processed/core/api/playback_observer.js +135 -123
- package/dist/_esm5.processed/core/api/public_api.d.ts +6 -0
- package/dist/_esm5.processed/core/api/public_api.js +614 -676
- 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 -248
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +2 -2
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +47 -58
- package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +50 -29
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +325 -351
- package/dist/_esm5.processed/core/api/utils.js +32 -24
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +3 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +167 -190
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.d.ts +8 -2
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +44 -72
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +15 -12
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +9 -67
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +400 -542
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +44 -90
- package/dist/_esm5.processed/core/decrypt/create_session.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/create_session.js +90 -149
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +24 -60
- package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -162
- package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +6 -3
- package/dist/_esm5.processed/core/decrypt/get_media_keys.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +59 -109
- package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
- 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.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +84 -155
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +50 -103
- package/dist/_esm5.processed/core/decrypt/types.d.ts +61 -0
- package/dist/_esm5.processed/core/decrypt/types.js +43 -1
- package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +22 -19
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +15 -12
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +0 -13
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +14 -38
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +26 -26
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +206 -310
- package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.d.ts +2 -1
- package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +8 -6
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +103 -103
- package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +13 -12
- package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.d.ts +1 -1
- 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 -312
- 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 -233
- 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 -260
- package/dist/_esm5.processed/core/init/directfile_content_initializer.d.ts +60 -1
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +122 -105
- package/dist/_esm5.processed/core/init/index.d.ts +1 -4
- package/dist/_esm5.processed/core/init/index.js +5 -3
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +269 -307
- package/dist/_esm5.processed/core/init/types.d.ts +3 -17
- 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 -27
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.d.ts +9 -4
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +22 -14
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +30 -25
- package/dist/_esm5.processed/core/init/utils/get_initial_time.js +41 -37
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +15 -10
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +31 -28
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.d.ts +3 -3
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +48 -53
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +61 -58
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +3 -3
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +141 -160
- 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 -14
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +31 -9
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +103 -79
- 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 +131 -140
- 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.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +109 -128
- 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.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +25 -22
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +8 -3
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +152 -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.d.ts +1 -1
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +130 -171
- 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.d.ts +14 -8
- package/dist/_esm5.processed/core/stream/adaptation/types.js +2 -1
- package/dist/_esm5.processed/core/stream/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/index.js +4 -2
- package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +14 -21
- package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/orchestrator/index.js +4 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +15 -29
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +193 -235
- package/dist/_esm5.processed/core/stream/period/index.js +19 -3
- package/dist/_esm5.processed/core/stream/period/period_stream.js +204 -228
- package/dist/_esm5.processed/core/stream/period/types.d.ts +3 -3
- package/dist/_esm5.processed/core/stream/period/types.js +2 -1
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +18 -4
- 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.d.ts +1 -1
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +81 -68
- package/dist/_esm5.processed/core/stream/representation/types.d.ts +3 -4
- 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.d.ts +1 -1
- 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 -47
- 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.d.ts +2 -2
- 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.d.ts +1 -1
- 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.d.ts +1 -2
- package/dist/_esm5.processed/errors/error_message.js +5 -3
- 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.d.ts +2 -2
- package/dist/_esm5.processed/errors/media_error.js +34 -47
- 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 +27 -29
- package/dist/_esm5.processed/experimental/features/dash_wasm.js +15 -9
- package/dist/_esm5.processed/experimental/features/debug_element.js +7 -4
- package/dist/_esm5.processed/experimental/features/index.d.ts +0 -1
- package/dist/_esm5.processed/experimental/features/index.js +9 -4
- package/dist/_esm5.processed/experimental/features/local.js +10 -4
- package/dist/_esm5.processed/experimental/features/metaplaylist.js +10 -4
- 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.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +39 -44
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +34 -36
- 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.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +21 -17
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -17
- 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 -15
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +11 -7
- 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 +6 -3
- package/dist/_esm5.processed/features/index.js +7 -4
- package/dist/_esm5.processed/features/list/dash.js +12 -6
- 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 -4
- package/dist/_esm5.processed/features/list/html_srt_parser.js +9 -4
- package/dist/_esm5.processed/features/list/html_text_buffer.js +7 -4
- package/dist/_esm5.processed/features/list/html_ttml_parser.js +9 -4
- package/dist/_esm5.processed/features/list/html_vtt_parser.js +9 -4
- package/dist/_esm5.processed/features/list/index.js +31 -14
- package/dist/_esm5.processed/features/list/native_sami_parser.js +10 -4
- package/dist/_esm5.processed/features/list/native_srt_parser.js +10 -4
- package/dist/_esm5.processed/features/list/native_text_buffer.js +8 -4
- package/dist/_esm5.processed/features/list/native_ttml_parser.js +10 -4
- package/dist/_esm5.processed/features/list/native_vtt_parser.js +10 -4
- package/dist/_esm5.processed/features/list/smooth.js +10 -4
- package/dist/_esm5.processed/features/types.d.ts +84 -7
- package/dist/_esm5.processed/features/types.js +2 -1
- package/dist/_esm5.processed/index.d.ts +0 -4
- package/dist/_esm5.processed/index.js +24 -8
- 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.d.ts +4 -7
- package/dist/_esm5.processed/manifest/manifest.js +117 -135
- package/dist/_esm5.processed/manifest/period.d.ts +2 -7
- package/dist/_esm5.processed/manifest/period.js +39 -46
- package/dist/_esm5.processed/manifest/representation.d.ts +12 -0
- package/dist/_esm5.processed/manifest/representation.js +81 -63
- 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.d.ts +1 -17
- package/dist/_esm5.processed/minimal.js +9 -39
- 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.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.js +11 -7
- 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.d.ts +5 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +131 -128
- 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.d.ts +8 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +22 -19
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +111 -108
- 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.d.ts +6 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +86 -84
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +4 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +101 -84
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -2
- 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 +64 -65
- 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 +50 -38
- 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.d.ts +1 -0
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +4 -4
- 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 -237
- 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 +50 -35
- 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 +31 -26
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +71 -84
- package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +2 -0
- 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 +76 -71
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +52 -52
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +200 -175
- 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.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +102 -97
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +49 -47
- 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.d.ts +6 -4
- 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.d.ts +6 -8
- 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 -59
- 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 -22
- 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 +92 -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 +107 -96
- 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.d.ts +17 -8
- 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 -17
- 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.d.ts +0 -3
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +13 -13
- 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 +8 -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 +15 -10
- 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.d.ts +2 -5
- 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.d.ts +9 -0
- package/dist/_esm5.processed/utils/monotonic_timestamp.js +15 -0
- 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.d.ts +50 -8
- package/dist/_esm5.processed/utils/ranges.js +163 -64
- package/dist/_esm5.processed/utils/reference.d.ts +78 -37
- package/dist/_esm5.processed/utils/reference.js +235 -155
- package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -4
- package/dist/_esm5.processed/utils/request/fetch.js +79 -107
- package/dist/_esm5.processed/utils/request/index.js +9 -4
- package/dist/_esm5.processed/utils/request/xhr.js +49 -36
- 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 -72
- 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.d.ts +7 -0
- package/dist/_esm5.processed/utils/wrapInPromise.js +25 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +42885 -44008
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -22
- package/package.json +56 -57
- 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/list-npm-scripts.js +146 -38
- package/scripts/update-version +1 -4
- package/sonar-project.properties +1 -1
- package/src/compat/__tests__/browser_compatibility_types.test.ts +51 -72
- package/src/compat/__tests__/is_vtt_cue.test.ts +20 -16
- package/src/compat/__tests__/make_vtt_cue.test.ts +11 -9
- package/src/compat/__tests__/patch_webkit_source_buffer.test.ts +26 -25
- package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +11 -9
- package/src/compat/__tests__/should_wait_for_have_enough_data.test.ts +36 -0
- package/src/compat/browser_compatibility_types.ts +9 -16
- package/src/compat/browser_detection.ts +11 -8
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +11 -8
- package/src/compat/eme/custom_media_keys/index.ts +8 -184
- package/src/compat/eme/custom_media_keys/moz_media_keys_constructor.ts +26 -22
- package/src/compat/eme/custom_media_keys/ms_media_keys_constructor.ts +13 -15
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +11 -8
- package/src/compat/eme/custom_media_keys/types.ts +1 -1
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +15 -11
- package/src/compat/eme/custom_media_keys/webkit_media_keys_constructor.ts +14 -16
- package/src/compat/eme/eme-api-implementation.ts +319 -0
- package/src/compat/eme/index.ts +8 -6
- package/src/compat/event_listeners.ts +32 -39
- package/src/compat/global_scope.ts +18 -0
- package/src/compat/index.ts +2 -24
- package/src/compat/is_debug_mode_enabled.ts +12 -0
- package/src/compat/is_node.ts +4 -1
- package/src/compat/is_vtt_cue.ts +2 -1
- package/src/compat/is_worker.ts +9 -0
- package/src/compat/make_vtt_cue.ts +3 -2
- package/src/compat/on_height_width_change.ts +4 -9
- package/src/compat/patch_webkit_source_buffer.ts +4 -3
- package/src/compat/should_wait_for_have_enough_data.ts +17 -0
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +245 -102
- package/src/core/adaptive/adaptive_representation_selector.ts +52 -35
- package/src/core/adaptive/buffer_based_chooser.ts +41 -13
- package/src/core/adaptive/guess_based_chooser.ts +4 -3
- package/src/core/adaptive/network_analyzer.ts +8 -6
- package/src/core/adaptive/utils/pending_requests_store.ts +15 -5
- package/src/core/api/debug/buffer_size_graph.ts +3 -1
- package/src/core/api/option_utils.ts +2 -2
- package/src/core/api/playback_observer.ts +16 -9
- package/src/core/api/public_api.ts +47 -31
- package/src/core/api/track_management/track_dispatcher.ts +9 -6
- package/src/core/api/track_management/tracks_store.ts +112 -90
- package/src/core/api/utils.ts +3 -3
- package/src/core/decrypt/__tests__/__global__/get_license.test.ts +3 -3
- package/src/core/decrypt/__tests__/__global__/init_data.test.ts +24 -14
- package/src/core/decrypt/__tests__/__global__/media_key_system_access.test.ts +74 -48
- package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +21 -15
- package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +16 -13
- package/src/core/decrypt/__tests__/__global__/utils.ts +39 -24
- package/src/core/decrypt/attach_media_keys.ts +33 -8
- package/src/core/decrypt/clear_on_stop.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +213 -262
- package/src/core/decrypt/create_or_load_session.ts +1 -1
- package/src/core/decrypt/create_session.ts +1 -1
- package/src/core/decrypt/dispose_decryption_resources.ts +19 -4
- package/src/core/decrypt/find_key_system.ts +24 -19
- package/src/core/decrypt/get_media_keys.ts +2 -2
- package/src/core/decrypt/index.ts +1 -6
- package/src/core/decrypt/session_events_listener.ts +3 -4
- package/src/core/decrypt/set_server_certificate.ts +1 -1
- package/src/core/decrypt/types.ts +69 -0
- package/src/core/decrypt/utils/check_key_statuses.ts +1 -1
- package/src/core/decrypt/utils/is_session_usable.ts +1 -1
- package/src/core/decrypt/utils/key_id_comparison.ts +2 -27
- package/src/core/decrypt/utils/key_session_record.ts +3 -5
- package/src/core/decrypt/utils/loaded_sessions_store.ts +2 -2
- package/src/core/decrypt/utils/media_keys_infos_store.ts +4 -1
- package/src/core/decrypt/utils/persistent_sessions_store.ts +2 -5
- package/src/core/decrypt/utils/server_certificate_store.ts +1 -1
- package/src/core/fetchers/cdn_prioritizer.ts +1 -1
- package/src/core/fetchers/manifest/manifest_fetcher.ts +22 -18
- package/src/core/fetchers/segment/segment_fetcher.ts +3 -2
- package/src/core/fetchers/utils/schedule_request.ts +6 -5
- package/src/core/init/directfile_content_initializer.ts +85 -21
- package/src/core/init/index.ts +6 -7
- package/src/core/init/media_source_content_initializer.ts +56 -26
- package/src/core/init/types.ts +2 -16
- package/src/core/init/utils/__tests__/refresh_scheduled_events_list.test.ts +22 -8
- package/src/core/init/utils/create_media_source.ts +4 -1
- package/src/core/init/utils/create_stream_playback_observer.ts +24 -14
- package/src/core/init/utils/end_of_stream.ts +1 -0
- package/src/core/init/utils/get_initial_time.ts +3 -1
- package/src/core/init/utils/get_loaded_reference.ts +6 -3
- package/src/core/init/utils/initial_seek_and_play.ts +7 -7
- package/src/core/init/utils/initialize_content_decryption.ts +32 -39
- package/src/core/init/utils/media_source_duration_updater.ts +13 -9
- package/src/core/init/utils/rebuffering_controller.ts +13 -10
- package/src/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.ts +7 -4
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +113 -73
- package/src/core/segment_buffers/garbage_collector.ts +3 -3
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +17 -17
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +1 -1
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +2 -2
- package/src/core/segment_buffers/implementations/utils/manual_time_ranges.ts +2 -2
- package/src/core/segment_buffers/inventory/buffered_history.ts +4 -3
- package/src/core/segment_buffers/inventory/segment_inventory.ts +1 -0
- package/src/core/stream/adaptation/adaptation_stream.ts +43 -28
- package/src/core/stream/adaptation/types.ts +15 -9
- package/src/core/stream/index.ts +2 -0
- package/src/core/stream/orchestrator/get_time_ranges_for_content.ts +1 -6
- package/src/core/stream/orchestrator/index.ts +2 -0
- package/src/core/stream/orchestrator/stream_orchestrator.ts +38 -42
- package/src/core/stream/period/period_stream.ts +62 -23
- package/src/core/stream/period/types.ts +5 -3
- package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +10 -0
- package/src/core/stream/representation/representation_stream.ts +6 -3
- package/src/core/stream/representation/types.ts +5 -5
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +2 -2
- package/src/core/stream/representation/utils/downloading_queue.ts +4 -5
- package/src/core/stream/representation/utils/force_garbage_collection.ts +3 -3
- package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
- package/src/core/stream/representation/utils/push_init_segment.ts +2 -3
- package/src/core/stream/representation/utils/push_media_segment.ts +2 -2
- package/src/errors/__tests__/encrypted_media_error.test.ts +2 -2
- package/src/errors/__tests__/error_message.test.ts +1 -1
- package/src/errors/__tests__/format_error.test.ts +2 -2
- package/src/errors/__tests__/media_error.test.ts +3 -3
- package/src/errors/__tests__/network_error.test.ts +10 -9
- package/src/errors/__tests__/other_error.test.ts +3 -3
- package/src/errors/__tests__/request_error.test.ts +4 -4
- package/src/errors/custom_loader_error.ts +0 -1
- package/src/errors/encrypted_media_error.ts +4 -2
- package/src/errors/error_message.ts +2 -7
- package/src/errors/media_error.ts +26 -20
- package/src/errors/network_error.ts +1 -1
- package/src/errors/other_error.ts +1 -1
- package/src/errors/request_error.ts +16 -1
- package/src/experimental/features/__tests__/dash_wasm.test.ts +4 -12
- package/src/experimental/features/__tests__/debug_element.test.ts +7 -21
- package/src/experimental/features/__tests__/local.test.ts +14 -23
- package/src/experimental/features/__tests__/metaplaylist.test.ts +14 -21
- package/src/experimental/features/dash_wasm.ts +3 -0
- package/src/experimental/features/index.ts +0 -1
- package/src/experimental/features/local.ts +3 -0
- package/src/experimental/features/metaplaylist.ts +3 -0
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +10 -9
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +26 -18
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +24 -23
- package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -4
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +7 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +5 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +4 -3
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +4 -3
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +3 -2
- package/src/features/features_object.ts +2 -1
- package/src/features/list/__tests__/dash.test.ts +15 -15
- package/src/features/list/__tests__/directfile.test.ts +4 -13
- package/src/features/list/__tests__/eme.test.ts +4 -12
- package/src/features/list/__tests__/html_sami_parser.test.ts +9 -14
- package/src/features/list/__tests__/html_srt_parser.test.ts +5 -10
- package/src/features/list/__tests__/html_text_buffer.test.ts +10 -19
- package/src/features/list/__tests__/html_ttml_parser.test.ts +5 -10
- package/src/features/list/__tests__/html_vtt_parser.test.ts +5 -10
- package/src/features/list/__tests__/native_sami_parser.test.ts +9 -14
- package/src/features/list/__tests__/native_srt_parser.test.ts +5 -10
- package/src/features/list/__tests__/native_text_buffer.test.ts +5 -13
- package/src/features/list/__tests__/native_ttml_parser.test.ts +5 -10
- package/src/features/list/__tests__/native_vtt_parser.test.ts +5 -10
- package/src/features/list/__tests__/smooth.test.ts +10 -10
- package/src/features/list/dash.ts +3 -0
- package/src/features/list/eme.ts +1 -1
- package/src/features/list/html_sami_parser.ts +2 -0
- package/src/features/list/html_srt_parser.ts +2 -0
- package/src/features/list/html_text_buffer.ts +2 -2
- package/src/features/list/html_ttml_parser.ts +2 -0
- package/src/features/list/html_vtt_parser.ts +2 -0
- package/src/features/list/native_sami_parser.ts +3 -0
- package/src/features/list/native_srt_parser.ts +3 -0
- package/src/features/list/native_text_buffer.ts +3 -2
- package/src/features/list/native_ttml_parser.ts +3 -0
- package/src/features/list/native_vtt_parser.ts +3 -0
- package/src/features/list/smooth.ts +3 -0
- package/src/features/types.ts +89 -18
- package/src/index.ts +31 -5
- package/src/manifest/__tests__/manifest.test.ts +134 -75
- package/src/manifest/__tests__/period.test.ts +82 -55
- package/src/manifest/__tests__/update_periods.test.ts +4 -4
- package/src/manifest/manifest.ts +30 -20
- package/src/manifest/period.ts +3 -14
- package/src/manifest/representation.ts +21 -3
- package/src/minimal.ts +4 -18
- package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +2 -1
- package/src/parsers/manifest/dash/common/get_clock_offset.ts +5 -4
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +7 -4
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +11 -5
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +1 -0
- package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -5
- package/src/parsers/manifest/dash/common/parse_periods.ts +12 -6
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +2 -2
- package/src/parsers/manifest/dash/common/parse_representations.ts +10 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +7 -0
- package/src/parsers/manifest/dash/node_parser_types.ts +1 -0
- package/src/parsers/manifest/dash/parsers_types.ts +4 -4
- package/src/parsers/manifest/dash/wasm-parser/Cargo.lock +2 -2
- package/src/parsers/manifest/dash/wasm-parser/Cargo.toml +1 -1
- package/src/parsers/manifest/dash/wasm-parser/rs/errors.rs +3 -3
- package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +37 -67
- package/src/parsers/manifest/dash/wasm-parser/rs/lib.rs +7 -7
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +94 -105
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/mod.rs +119 -109
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/s_element.rs +24 -26
- package/src/parsers/manifest/dash/wasm-parser/rs/reader.rs +2 -2
- package/src/parsers/manifest/dash/wasm-parser/rs/reportable.rs +42 -18
- package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +29 -29
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +2 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +1 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +12 -0
- package/src/parsers/manifest/local/parse_local_manifest.ts +3 -1
- package/src/parsers/manifest/local/types.ts +2 -0
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +3 -1
- package/src/parsers/manifest/smooth/create_parser.ts +4 -3
- package/src/parsers/manifest/smooth/representation_index.ts +6 -5
- package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +6 -5
- package/src/parsers/manifest/types.ts +6 -4
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +1 -2
- package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts +2 -1
- package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +9 -7
- package/src/public_types.ts +11 -9
- package/src/transports/dash/manifest_parser.ts +8 -5
- package/src/transports/local/pipelines.ts +4 -3
- package/src/transports/metaplaylist/pipelines.ts +5 -3
- package/src/transports/smooth/pipelines.ts +4 -2
- package/src/transports/smooth/segment_loader.ts +1 -1
- package/src/transports/types.ts +17 -7
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +8 -8
- package/src/transports/utils/call_custom_manifest_loader.ts +2 -1
- package/src/transports/utils/get_isobmff_timing_infos.ts +0 -3
- package/src/typings/globals.d.ts +0 -44
- package/src/utils/__tests__/base64.test.ts +4 -2
- package/src/utils/__tests__/id_generator.test.ts +7 -4
- package/src/utils/__tests__/ranges.test.ts +354 -47
- package/src/utils/are_arrays_of_numbers_equal.ts +5 -1
- package/src/utils/assert.ts +4 -1
- package/src/utils/deep_merge.ts +2 -2
- package/src/utils/monotonic_timestamp.ts +12 -0
- package/src/utils/ranges.ts +110 -14
- package/src/utils/reference.ts +235 -237
- package/src/utils/request/fetch.ts +11 -9
- package/src/utils/request/xhr.ts +6 -5
- package/src/utils/string_parsing.ts +5 -4
- package/src/utils/wrapInPromise.ts +24 -0
- package/tsconfig.json +1 -1
- package/tsconfig.modules.json +3 -3
- package/appveyor.yml +0 -24
- package/dist/_esm5.processed/compat/has_eme_apis.d.ts +0 -21
- package/dist/_esm5.processed/compat/has_eme_apis.js +0 -24
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +0 -47
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +0 -70
- package/dist/_esm5.processed/core/stream/utils/create_reload_request.d.ts +0 -32
- package/dist/_esm5.processed/core/stream/utils/create_reload_request.js +0 -54
- package/dist/_esm5.processed/features/initialize_features.d.ts +0 -19
- package/dist/_esm5.processed/features/initialize_features.js +0 -100
- package/dist/rx-player.d.ts +0 -3
- package/dist/rx-player.min.d.ts +0 -3
- package/src/compat/__tests__/has_eme_apis.test.ts +0 -56
- package/src/compat/has_eme_apis.ts +0 -26
- package/src/core/stream/adaptation/utils/create_representation_estimator.ts +0 -114
- package/src/core/stream/utils/create_reload_request.ts +0 -69
- package/src/features/__tests__/initialize_features.test.ts +0 -477
- package/src/features/initialize_features.ts +0 -120
|
@@ -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,149 +38,149 @@ import TrackDispatcher from "./track_dispatcher";
|
|
|
51
38
|
*
|
|
52
39
|
* @class TracksStore
|
|
53
40
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function TracksStore(args) {
|
|
57
|
-
var _this = this;
|
|
41
|
+
class TracksStore extends event_emitter_1.default {
|
|
42
|
+
constructor(args) {
|
|
58
43
|
var _a;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
(_a = args.defaultAudioTrackSwitchingMode) !== null && _a !== void 0 ? _a :
|
|
66
|
-
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;
|
|
67
51
|
}
|
|
68
52
|
/**
|
|
69
53
|
* Return Array of Period information, to allow an outside application to
|
|
70
54
|
* modify the track of any Period.
|
|
71
55
|
* @returns {Array.<Object>}
|
|
72
56
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
getAvailablePeriods() {
|
|
58
|
+
return this._storedPeriodInfo.reduce((acc, p) => {
|
|
59
|
+
if (p.isPeriodAdvertised) {
|
|
60
|
+
acc.push(toExposedPeriod(p.period));
|
|
61
|
+
}
|
|
62
|
+
return acc;
|
|
63
|
+
}, []);
|
|
64
|
+
}
|
|
79
65
|
/**
|
|
80
66
|
* Update the list of Periods handled by the TracksStore and make a
|
|
81
67
|
* track choice decision for each of them.
|
|
82
68
|
* @param {Object} manifest - The new Manifest object
|
|
83
69
|
*/
|
|
84
|
-
|
|
85
|
-
var _a;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var DEFAULT_VIDEO_TRACK_SWITCHING_MODE = config.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE;
|
|
89
|
-
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;
|
|
90
74
|
// We assume that they are always sorted chronologically
|
|
91
75
|
// In dev mode, perform a runtime check that this is the case
|
|
92
76
|
if (0 /* __ENVIRONMENT__.CURRENT_ENV */ === 1 /* __ENVIRONMENT__.DEV */) {
|
|
93
|
-
for (
|
|
94
|
-
|
|
77
|
+
for (let i = 1; i < periods.length; i++) {
|
|
78
|
+
(0, assert_1.default)(periods[i - 1].start <= periods[i].start);
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
81
|
/** Periods which have just been added. */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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];
|
|
103
87
|
if (newPeriod === undefined) {
|
|
104
88
|
// We reached the end of the new Periods, remove remaining old Periods
|
|
105
|
-
for (
|
|
106
|
-
|
|
107
|
-
if (isPeriodItemRemovable(
|
|
108
|
-
|
|
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);
|
|
109
93
|
}
|
|
110
94
|
}
|
|
111
95
|
}
|
|
112
96
|
else if (oldPeriod === newPeriod) {
|
|
113
97
|
newPListIdx++;
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.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);
|
|
119
103
|
if (!stillHere) {
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
log_1.default.warn("TS: Chosen text Adaptation not available anymore");
|
|
105
|
+
const periodInfo = this._storedPeriodInfo[i];
|
|
122
106
|
periodInfo.text.storedSettings = null;
|
|
123
|
-
|
|
107
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
124
108
|
trackType: "text",
|
|
125
109
|
reason: "missing" });
|
|
126
110
|
// The previous event trigger could have had side-effects, so we
|
|
127
111
|
// re-check if we're still mostly in the same state
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
112
|
+
if (this._isDisposed) {
|
|
113
|
+
return; // The current TracksStore is disposed, we can abort
|
|
130
114
|
}
|
|
131
|
-
|
|
115
|
+
const periodItem = getPeriodItem(this._storedPeriodInfo, periodInfo.period.id);
|
|
132
116
|
if (periodItem !== undefined && periodItem.text.storedSettings === null) {
|
|
133
|
-
(
|
|
117
|
+
(_a = periodItem.text.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(null);
|
|
134
118
|
}
|
|
135
119
|
}
|
|
136
120
|
}
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.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);
|
|
142
126
|
if (!stillHere) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
127
|
+
log_1.default.warn("TS: Chosen video Adaptation not available anymore");
|
|
128
|
+
const periodItem = this._storedPeriodInfo[i];
|
|
129
|
+
let storedSettings;
|
|
146
130
|
if (videoAdaptations.length === 0) {
|
|
147
131
|
storedSettings = null;
|
|
148
132
|
}
|
|
149
133
|
else {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
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 };
|
|
154
141
|
}
|
|
155
142
|
periodItem.video.storedSettings = storedSettings;
|
|
156
|
-
|
|
143
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
157
144
|
trackType: "video",
|
|
158
145
|
reason: "missing" });
|
|
159
146
|
// The previous event trigger could have had side-effects, so we
|
|
160
147
|
// re-check if we're still mostly in the same state
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
148
|
+
if (this._isDisposed) {
|
|
149
|
+
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
163
150
|
}
|
|
164
|
-
|
|
151
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodItem.period.id);
|
|
165
152
|
if (newPeriodItem !== undefined &&
|
|
166
153
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
167
|
-
(
|
|
154
|
+
(_b = newPeriodItem.video.dispatcher) === null || _b === void 0 ? void 0 : _b.updateTrack(storedSettings);
|
|
168
155
|
}
|
|
169
156
|
}
|
|
170
157
|
}
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
.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);
|
|
176
163
|
if (!stillHere) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
164
|
+
log_1.default.warn("TS: Chosen audio Adaptation not available anymore");
|
|
165
|
+
const periodItem = this._storedPeriodInfo[i];
|
|
166
|
+
const storedSettings = audioAdaptations.length === 0 ?
|
|
180
167
|
null :
|
|
181
168
|
{ adaptation: audioAdaptations[0],
|
|
182
|
-
switchingMode:
|
|
183
|
-
lockedRepresentations:
|
|
169
|
+
switchingMode: this._defaultAudioTrackSwitchingMode,
|
|
170
|
+
lockedRepresentations: new reference_1.default(null) };
|
|
184
171
|
periodItem.audio.storedSettings = storedSettings;
|
|
185
|
-
|
|
172
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(newPeriod),
|
|
186
173
|
trackType: "audio",
|
|
187
174
|
reason: "missing" });
|
|
188
175
|
// The previous event trigger could have had side-effects, so we
|
|
189
176
|
// re-check if we're still mostly in the same state
|
|
190
|
-
if (
|
|
191
|
-
return
|
|
177
|
+
if (this._isDisposed) {
|
|
178
|
+
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
192
179
|
}
|
|
193
|
-
|
|
180
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodItem.period.id);
|
|
194
181
|
if (newPeriodItem !== undefined &&
|
|
195
182
|
newPeriodItem.audio.storedSettings === storedSettings) {
|
|
196
|
-
(
|
|
183
|
+
(_c = newPeriodItem.audio.dispatcher) === null || _c === void 0 ? void 0 : _c.updateTrack(storedSettings);
|
|
197
184
|
}
|
|
198
185
|
}
|
|
199
186
|
}
|
|
@@ -201,47 +188,30 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
201
188
|
}
|
|
202
189
|
else if (oldPeriod.start <= newPeriod.start) {
|
|
203
190
|
// This old Period does not exist anymore.
|
|
204
|
-
|
|
205
|
-
if (isPeriodItemRemovable(
|
|
206
|
-
|
|
191
|
+
this._storedPeriodInfo[i].inManifest = false;
|
|
192
|
+
if (isPeriodItemRemovable(this._storedPeriodInfo[i])) {
|
|
193
|
+
this._removePeriodObject(i);
|
|
207
194
|
i--;
|
|
208
195
|
}
|
|
209
196
|
}
|
|
210
197
|
else {
|
|
211
|
-
|
|
198
|
+
const newPeriodInfo = generatePeriodInfo(newPeriod, true, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode);
|
|
212
199
|
// oldPeriod.start > newPeriod.start: insert newPeriod before
|
|
213
|
-
|
|
200
|
+
this._storedPeriodInfo.splice(i, 0, newPeriodInfo);
|
|
214
201
|
addedPeriods.push(newPeriodInfo);
|
|
215
202
|
newPListIdx++;
|
|
216
203
|
// Note: we don't increment `i` on purpose here, as we want to check the
|
|
217
204
|
// same oldPeriod at the next loop iteration
|
|
218
205
|
}
|
|
219
|
-
out_i_1 = i;
|
|
220
|
-
};
|
|
221
|
-
var this_1 = this, out_i_1;
|
|
222
|
-
for (var i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
223
|
-
var state_1 = _loop_1(i);
|
|
224
|
-
i = out_i_1;
|
|
225
|
-
if (typeof state_1 === "object")
|
|
226
|
-
return state_1.value;
|
|
227
206
|
}
|
|
228
207
|
if (newPListIdx < periods.length) {
|
|
229
208
|
// Add further new Period
|
|
230
|
-
|
|
231
|
-
.map(
|
|
232
|
-
|
|
233
|
-
addedPeriods.push
|
|
234
|
-
}
|
|
235
|
-
var periodsAdded = addedPeriods.reduce(function (acc, p) {
|
|
236
|
-
if (!p.isRemoved) {
|
|
237
|
-
acc.push({ id: p.period.id, start: p.period.start, end: p.period.end });
|
|
238
|
-
}
|
|
239
|
-
return acc;
|
|
240
|
-
}, []);
|
|
241
|
-
if (periodsAdded.length > 0) {
|
|
242
|
-
this.trigger("newAvailablePeriods", periodsAdded);
|
|
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);
|
|
243
213
|
}
|
|
244
|
-
}
|
|
214
|
+
}
|
|
245
215
|
/**
|
|
246
216
|
* Add shared reference to choose Adaptation for new "audio", "video" or
|
|
247
217
|
* "text" Period.
|
|
@@ -254,86 +224,105 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
254
224
|
* @param {Object} adaptationRef - A reference through which
|
|
255
225
|
* the choice will be given.
|
|
256
226
|
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
227
|
+
addTrackReference(bufferType, manifest, period, adaptationRef) {
|
|
228
|
+
let periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
260
229
|
if (periodObj === undefined) { // The Period has not yet been added.
|
|
261
|
-
periodObj = this.
|
|
230
|
+
periodObj = generatePeriodInfo(period, false, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode);
|
|
231
|
+
let found = false;
|
|
232
|
+
for (let i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
233
|
+
if (this._storedPeriodInfo[i].period.start > period.start) {
|
|
234
|
+
this._storedPeriodInfo.splice(i, 0, periodObj);
|
|
235
|
+
found = true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (!found) {
|
|
239
|
+
this._storedPeriodInfo.push(periodObj);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (!periodObj.isPeriodAdvertised) {
|
|
243
|
+
periodObj.isPeriodAdvertised = true;
|
|
262
244
|
this.trigger("newAvailablePeriods", [{ id: period.id,
|
|
263
245
|
start: period.start,
|
|
264
246
|
end: period.end }]);
|
|
247
|
+
if (this._isDisposed) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
265
250
|
}
|
|
266
251
|
if (periodObj[bufferType].dispatcher !== null) {
|
|
267
|
-
|
|
268
|
-
|
|
252
|
+
log_1.default.error(`TS: Subject already added for ${bufferType} ` +
|
|
253
|
+
`and Period ${period.start}`);
|
|
269
254
|
return;
|
|
270
255
|
}
|
|
271
|
-
|
|
272
|
-
|
|
256
|
+
const trackSetting = periodObj[bufferType].storedSettings;
|
|
257
|
+
const dispatcher = new track_dispatcher_1.default(manifest, adaptationRef);
|
|
273
258
|
periodObj[bufferType].dispatcher = dispatcher;
|
|
274
|
-
dispatcher.addEventListener("noPlayableRepresentation",
|
|
259
|
+
dispatcher.addEventListener("noPlayableRepresentation", () => {
|
|
275
260
|
var _a, _b, _c;
|
|
276
|
-
|
|
277
|
-
|
|
261
|
+
const nextAdaptation = (0, array_find_1.default)(period.getAdaptationsForType(bufferType), (a) => {
|
|
262
|
+
const playableRepresentations = a.getPlayableRepresentations();
|
|
278
263
|
return playableRepresentations.length > 0;
|
|
279
264
|
});
|
|
280
265
|
if (nextAdaptation === undefined) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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();
|
|
284
269
|
return;
|
|
285
270
|
}
|
|
286
|
-
|
|
287
|
-
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)) {
|
|
288
273
|
return;
|
|
289
274
|
}
|
|
290
|
-
|
|
291
|
-
|
|
275
|
+
const switchingMode = bufferType === "audio" ?
|
|
276
|
+
this._defaultAudioTrackSwitchingMode :
|
|
292
277
|
"reload";
|
|
293
|
-
|
|
278
|
+
const storedSettings = {
|
|
279
|
+
adaptation: nextAdaptation,
|
|
280
|
+
switchingMode,
|
|
281
|
+
lockedRepresentations: new reference_1.default(null),
|
|
282
|
+
};
|
|
294
283
|
typeInfo.storedSettings = storedSettings;
|
|
295
|
-
|
|
284
|
+
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
296
285
|
trackType: bufferType,
|
|
297
286
|
reason: "no-playable-representation" });
|
|
298
287
|
// The previous event trigger could have had side-effects, so we
|
|
299
288
|
// re-check if we're still mostly in the same state
|
|
300
|
-
if (
|
|
289
|
+
if (this._isDisposed) {
|
|
301
290
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
302
291
|
}
|
|
303
|
-
typeInfo = (_b = getPeriodItem(
|
|
304
|
-
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) {
|
|
305
294
|
return;
|
|
306
295
|
}
|
|
307
296
|
(_c = typeInfo.dispatcher) === null || _c === void 0 ? void 0 : _c.updateTrack(storedSettings);
|
|
308
297
|
});
|
|
309
|
-
dispatcher.addEventListener("noPlayableLockedRepresentation",
|
|
298
|
+
dispatcher.addEventListener("noPlayableLockedRepresentation", () => {
|
|
310
299
|
// TODO check that it doesn't already lead to segment loading or MediaSource
|
|
311
300
|
// reloading
|
|
312
301
|
trackSetting === null || trackSetting === void 0 ? void 0 : trackSetting.lockedRepresentations.setValue(null);
|
|
313
|
-
|
|
302
|
+
this.trigger("brokenRepresentationsLock", { period: { id: period.id,
|
|
314
303
|
start: period.start,
|
|
315
304
|
end: period.end },
|
|
316
305
|
trackType: bufferType });
|
|
317
306
|
});
|
|
318
307
|
dispatcher.start(trackSetting);
|
|
319
|
-
}
|
|
308
|
+
}
|
|
320
309
|
/**
|
|
321
310
|
* Remove shared reference to choose an "audio", "video" or "text" Adaptation
|
|
322
311
|
* for a Period.
|
|
323
312
|
* @param {string} bufferType - The concerned buffer type
|
|
324
313
|
* @param {Period} period - The concerned Period.
|
|
325
314
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
315
|
+
removeTrackReference(bufferType, period) {
|
|
316
|
+
const periodIndex = findPeriodIndex(this._storedPeriodInfo, period);
|
|
328
317
|
if (periodIndex === undefined) {
|
|
329
|
-
|
|
318
|
+
log_1.default.warn(`TS: ${bufferType} not found for period`, period.start);
|
|
330
319
|
return;
|
|
331
320
|
}
|
|
332
|
-
|
|
333
|
-
|
|
321
|
+
const periodObj = this._storedPeriodInfo[periodIndex];
|
|
322
|
+
const choiceItem = periodObj[bufferType];
|
|
334
323
|
if ((choiceItem === null || choiceItem === void 0 ? void 0 : choiceItem.dispatcher) === null) {
|
|
335
|
-
|
|
336
|
-
|
|
324
|
+
log_1.default.warn(`TS: TrackDispatcher already removed for ${bufferType} ` +
|
|
325
|
+
`and Period ${period.start}`);
|
|
337
326
|
return;
|
|
338
327
|
}
|
|
339
328
|
choiceItem.dispatcher.dispose();
|
|
@@ -341,7 +330,7 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
341
330
|
if (isPeriodItemRemovable(periodObj)) {
|
|
342
331
|
this._removePeriodObject(periodIndex);
|
|
343
332
|
}
|
|
344
|
-
}
|
|
333
|
+
}
|
|
345
334
|
/**
|
|
346
335
|
* Allows to recuperate a "Period Object" - used in get/set methods of the
|
|
347
336
|
* `TracksStore` - by giving the Period itself.
|
|
@@ -360,13 +349,13 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
360
349
|
* @param {Object} period
|
|
361
350
|
* @returns {Object}
|
|
362
351
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
352
|
+
getPeriodObjectFromPeriod(period) {
|
|
353
|
+
const periodObj = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
365
354
|
if (periodObj === undefined && period !== undefined) {
|
|
366
355
|
return this._cachedPeriodInfo.get(period);
|
|
367
356
|
}
|
|
368
357
|
return periodObj;
|
|
369
|
-
}
|
|
358
|
+
}
|
|
370
359
|
/**
|
|
371
360
|
* Allows to recuperate a "Period Object" - used in get/set methods of the
|
|
372
361
|
* `TracksStore` - by giving the Period's id.
|
|
@@ -381,23 +370,23 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
381
370
|
* @param {string} periodId - The concerned Period's id
|
|
382
371
|
* @returns {Object}
|
|
383
372
|
*/
|
|
384
|
-
|
|
373
|
+
getPeriodObjectFromId(periodId) {
|
|
385
374
|
return getPeriodItem(this._storedPeriodInfo, periodId);
|
|
386
|
-
}
|
|
387
|
-
|
|
375
|
+
}
|
|
376
|
+
disableVideoTrickModeTracks() {
|
|
388
377
|
if (!this._isTrickModeTrackEnabled) {
|
|
389
378
|
return;
|
|
390
379
|
}
|
|
391
380
|
this._isTrickModeTrackEnabled = false;
|
|
392
381
|
this._resetVideoTrackChoices("trickmode-disabled");
|
|
393
|
-
}
|
|
394
|
-
|
|
382
|
+
}
|
|
383
|
+
enableVideoTrickModeTracks() {
|
|
395
384
|
if (this._isTrickModeTrackEnabled) {
|
|
396
385
|
return;
|
|
397
386
|
}
|
|
398
387
|
this._isTrickModeTrackEnabled = true;
|
|
399
388
|
this._resetVideoTrackChoices("trickmode-enabled");
|
|
400
|
-
}
|
|
389
|
+
}
|
|
401
390
|
/**
|
|
402
391
|
* Reset the TracksStore's Period objects:
|
|
403
392
|
* - All Period which are not in the manifest currently will be removed.
|
|
@@ -405,10 +394,10 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
405
394
|
*
|
|
406
395
|
* You might want to call this API when restarting playback.
|
|
407
396
|
*/
|
|
408
|
-
|
|
397
|
+
resetPeriodObjects() {
|
|
409
398
|
var _a, _b, _c;
|
|
410
|
-
for (
|
|
411
|
-
|
|
399
|
+
for (let i = this._storedPeriodInfo.length - 1; i >= 0; i--) {
|
|
400
|
+
const storedObj = this._storedPeriodInfo[i];
|
|
412
401
|
(_a = storedObj.audio.dispatcher) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
413
402
|
storedObj.audio.dispatcher = null;
|
|
414
403
|
(_b = storedObj.video.dispatcher) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -419,13 +408,13 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
419
408
|
this._removePeriodObject(i);
|
|
420
409
|
}
|
|
421
410
|
}
|
|
422
|
-
}
|
|
411
|
+
}
|
|
423
412
|
/**
|
|
424
413
|
* @returns {boolean}
|
|
425
414
|
*/
|
|
426
|
-
|
|
415
|
+
isTrickModeEnabled() {
|
|
427
416
|
return this._isTrickModeTrackEnabled;
|
|
428
|
-
}
|
|
417
|
+
}
|
|
429
418
|
/**
|
|
430
419
|
* Set audio track based on the ID of its Adaptation for a given added Period.
|
|
431
420
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -436,17 +425,17 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
436
425
|
* locked after switchingMode to that track.
|
|
437
426
|
* `null` if no Audio Representation should be locked.
|
|
438
427
|
*/
|
|
439
|
-
|
|
428
|
+
setAudioTrack(periodObj, wantedId, switchingMode, reprsToLock) {
|
|
440
429
|
return this._setAudioOrTextTrack("audio", periodObj, wantedId, switchingMode !== null && switchingMode !== void 0 ? switchingMode : this._defaultAudioTrackSwitchingMode, reprsToLock);
|
|
441
|
-
}
|
|
430
|
+
}
|
|
442
431
|
/**
|
|
443
432
|
* Set text track based on the ID of its Adaptation for a given added Period.
|
|
444
433
|
* @param {Object} periodObj - The concerned Period's object.
|
|
445
434
|
* @param {string} wantedId - adaptation id of the wanted track.
|
|
446
435
|
*/
|
|
447
|
-
|
|
436
|
+
setTextTrack(periodObj, wantedId) {
|
|
448
437
|
return this._setAudioOrTextTrack("text", periodObj, wantedId, "direct", null);
|
|
449
|
-
}
|
|
438
|
+
}
|
|
450
439
|
/**
|
|
451
440
|
* Set audio track based on the ID of its Adaptation for a given added Period.
|
|
452
441
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -457,32 +446,31 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
457
446
|
* locked after switchingMode to that track.
|
|
458
447
|
* `null` if no Audio Representation should be locked.
|
|
459
448
|
*/
|
|
460
|
-
|
|
449
|
+
_setAudioOrTextTrack(bufferType, periodObj, wantedId, switchingMode, reprsToLock) {
|
|
461
450
|
var _a;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
var id = _a.id;
|
|
465
|
-
return id === wantedId;
|
|
466
|
-
});
|
|
451
|
+
const period = periodObj.period;
|
|
452
|
+
const wantedAdaptation = (0, array_find_1.default)(period.getSupportedAdaptations(bufferType), ({ id }) => id === wantedId);
|
|
467
453
|
if (wantedAdaptation === undefined) {
|
|
468
|
-
throw new Error(
|
|
454
|
+
throw new Error(`Wanted ${bufferType} track not found.`);
|
|
469
455
|
}
|
|
470
|
-
|
|
471
|
-
|
|
456
|
+
const typeInfo = periodObj[bufferType];
|
|
457
|
+
let lockedRepresentations;
|
|
472
458
|
if (reprsToLock === null) {
|
|
473
|
-
lockedRepresentations =
|
|
459
|
+
lockedRepresentations = new reference_1.default(null);
|
|
474
460
|
}
|
|
475
461
|
else {
|
|
476
|
-
|
|
477
|
-
|
|
462
|
+
const representationsToLock = this._getRepresentationsToLock(wantedAdaptation, reprsToLock);
|
|
463
|
+
const repSwitchingMode = bufferType === "audio" ?
|
|
478
464
|
this._defaultAudioTrackSwitchingMode :
|
|
479
465
|
"direct";
|
|
480
|
-
lockedRepresentations =
|
|
466
|
+
lockedRepresentations = new reference_1.default({
|
|
481
467
|
representations: representationsToLock,
|
|
482
468
|
switchingMode: repSwitchingMode,
|
|
483
469
|
});
|
|
484
470
|
}
|
|
485
|
-
|
|
471
|
+
const storedSettings = { adaptation: wantedAdaptation,
|
|
472
|
+
switchingMode,
|
|
473
|
+
lockedRepresentations };
|
|
486
474
|
typeInfo.storedSettings = storedSettings;
|
|
487
475
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
488
476
|
trackType: bufferType,
|
|
@@ -492,12 +480,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
492
480
|
if (this._isDisposed) {
|
|
493
481
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
494
482
|
}
|
|
495
|
-
|
|
483
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
496
484
|
if (newPeriodItem !== undefined &&
|
|
497
485
|
newPeriodItem[bufferType].storedSettings === storedSettings) {
|
|
498
486
|
(_a = newPeriodItem[bufferType].dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
499
487
|
}
|
|
500
|
-
}
|
|
488
|
+
}
|
|
501
489
|
/**
|
|
502
490
|
* Set video track based on the ID of its Adaptation for a given added Period.
|
|
503
491
|
* @param {Object} periodObj - The concerned Period's object.
|
|
@@ -508,34 +496,32 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
508
496
|
* locked after switchingMode to that track.
|
|
509
497
|
* `null` if no Video Representation should be locked.
|
|
510
498
|
*/
|
|
511
|
-
|
|
499
|
+
setVideoTrack(periodObj, wantedId, switchingMode, reprsToLock) {
|
|
512
500
|
var _a;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
var id = _a.id;
|
|
516
|
-
return id === wantedId;
|
|
517
|
-
});
|
|
501
|
+
const period = periodObj.period;
|
|
502
|
+
const wantedAdaptation = (0, array_find_1.default)(period.getSupportedAdaptations("video"), ({ id }) => id === wantedId);
|
|
518
503
|
if (wantedAdaptation === undefined) {
|
|
519
504
|
throw new Error("Wanted video track not found.");
|
|
520
505
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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;
|
|
525
510
|
if (reprsToLock === null) {
|
|
526
|
-
lockedRepresentations =
|
|
511
|
+
lockedRepresentations = new reference_1.default(null);
|
|
527
512
|
}
|
|
528
513
|
else {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
lockedRepresentations =
|
|
514
|
+
const representationsToLock = this._getRepresentationsToLock(wantedAdaptation, reprsToLock);
|
|
515
|
+
const repSwitchingMode = DEFAULT_VIDEO_TRACK_SWITCHING_MODE;
|
|
516
|
+
lockedRepresentations = new reference_1.default({
|
|
532
517
|
representations: representationsToLock,
|
|
533
518
|
switchingMode: repSwitchingMode,
|
|
534
519
|
});
|
|
535
520
|
}
|
|
536
|
-
|
|
521
|
+
const storedSettings = { adaptationBase: wantedAdaptation,
|
|
537
522
|
switchingMode: switchingMode !== null && switchingMode !== void 0 ? switchingMode : DEFAULT_VIDEO_TRACK_SWITCHING_MODE,
|
|
538
|
-
adaptation: newAdaptation,
|
|
523
|
+
adaptation: newAdaptation,
|
|
524
|
+
lockedRepresentations };
|
|
539
525
|
typeInfo.storedSettings = storedSettings;
|
|
540
526
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
541
527
|
trackType: "video",
|
|
@@ -545,12 +531,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
545
531
|
if (this._isDisposed) {
|
|
546
532
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
547
533
|
}
|
|
548
|
-
|
|
534
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
549
535
|
if (newPeriodItem !== undefined &&
|
|
550
536
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
551
537
|
(_a = newPeriodItem.video.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
552
538
|
}
|
|
553
|
-
}
|
|
539
|
+
}
|
|
554
540
|
/**
|
|
555
541
|
* Disable the current text track for a given period.
|
|
556
542
|
*
|
|
@@ -558,9 +544,9 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
558
544
|
* @param {string} bufferType - The type of track to disable.
|
|
559
545
|
* @throws Error - Throws if the period given has not been added
|
|
560
546
|
*/
|
|
561
|
-
|
|
547
|
+
disableTrack(periodObj, bufferType) {
|
|
562
548
|
var _a, _b;
|
|
563
|
-
|
|
549
|
+
const trackInfo = periodObj[bufferType];
|
|
564
550
|
if (trackInfo.storedSettings === null) {
|
|
565
551
|
return;
|
|
566
552
|
}
|
|
@@ -577,12 +563,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
577
563
|
if (this._isDisposed) {
|
|
578
564
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
579
565
|
}
|
|
580
|
-
|
|
566
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, periodObj.period.id);
|
|
581
567
|
if (newPeriodItem !== undefined &&
|
|
582
568
|
newPeriodItem[bufferType].storedSettings === null) {
|
|
583
569
|
(_b = newPeriodItem[bufferType].dispatcher) === null || _b === void 0 ? void 0 : _b.updateTrack(null);
|
|
584
570
|
}
|
|
585
|
-
}
|
|
571
|
+
}
|
|
586
572
|
/**
|
|
587
573
|
* Returns an object describing the chosen audio track for the given audio
|
|
588
574
|
* Period.
|
|
@@ -601,11 +587,11 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
601
587
|
* `null` if audio tracks were disabled and `undefined` if the Period is not
|
|
602
588
|
* known.
|
|
603
589
|
*/
|
|
604
|
-
|
|
590
|
+
getChosenAudioTrack(periodObj) {
|
|
605
591
|
return periodObj.audio.storedSettings === null ?
|
|
606
592
|
null :
|
|
607
593
|
periodObj.audio.storedSettings.adaptation.toAudioTrack(true);
|
|
608
|
-
}
|
|
594
|
+
}
|
|
609
595
|
/**
|
|
610
596
|
* Returns an object describing the chosen text track for the given text
|
|
611
597
|
* Period.
|
|
@@ -616,11 +602,11 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
616
602
|
* @param {Object} periodObj - The concerned Period's object
|
|
617
603
|
* @returns {Object|null} - The text track chosen for this Period
|
|
618
604
|
*/
|
|
619
|
-
|
|
605
|
+
getChosenTextTrack(periodObj) {
|
|
620
606
|
return periodObj.text.storedSettings === null ?
|
|
621
607
|
null :
|
|
622
608
|
periodObj.text.storedSettings.adaptation.toTextTrack();
|
|
623
|
-
}
|
|
609
|
+
}
|
|
624
610
|
/**
|
|
625
611
|
* Returns an object describing the chosen video track for the given video
|
|
626
612
|
* Period.
|
|
@@ -631,12 +617,12 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
631
617
|
* @param {Object} periodObj - The concerned Period's object
|
|
632
618
|
* @returns {Object|null} - The video track chosen for this Period
|
|
633
619
|
*/
|
|
634
|
-
|
|
620
|
+
getChosenVideoTrack(periodObj) {
|
|
635
621
|
if (periodObj.video.storedSettings === null) {
|
|
636
622
|
return null;
|
|
637
623
|
}
|
|
638
624
|
return periodObj.video.storedSettings.adaptation.toVideoTrack(true);
|
|
639
|
-
}
|
|
625
|
+
}
|
|
640
626
|
/**
|
|
641
627
|
* Returns all available audio tracks for a given Period, as an array of
|
|
642
628
|
* objects.
|
|
@@ -646,18 +632,18 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
646
632
|
* @param {Object} periodObj - The concerned Period's object
|
|
647
633
|
* @returns {Array.<Object>}
|
|
648
634
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
635
|
+
getAvailableAudioTracks(periodObj) {
|
|
636
|
+
const storedSettings = periodObj.audio.storedSettings;
|
|
637
|
+
const currentId = storedSettings !== null ?
|
|
652
638
|
storedSettings.adaptation.id :
|
|
653
639
|
null;
|
|
654
640
|
return periodObj.period.getSupportedAdaptations("audio")
|
|
655
|
-
.map(
|
|
656
|
-
|
|
641
|
+
.map((adaptation) => {
|
|
642
|
+
const active = currentId === null ? false :
|
|
657
643
|
currentId === adaptation.id;
|
|
658
|
-
return
|
|
644
|
+
return (0, object_assign_1.default)(adaptation.toAudioTrack(true), { active });
|
|
659
645
|
});
|
|
660
|
-
}
|
|
646
|
+
}
|
|
661
647
|
/**
|
|
662
648
|
* Returns all available text tracks for a given Period, as an array of
|
|
663
649
|
* objects.
|
|
@@ -667,18 +653,18 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
667
653
|
* @param {Object} periodObj - The concerned Period's object
|
|
668
654
|
* @returns {Array.<Object>}
|
|
669
655
|
*/
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
656
|
+
getAvailableTextTracks(periodObj) {
|
|
657
|
+
const storedSettings = periodObj.text.storedSettings;
|
|
658
|
+
const currentId = storedSettings !== null ?
|
|
673
659
|
storedSettings.adaptation.id :
|
|
674
660
|
null;
|
|
675
661
|
return periodObj.period.getSupportedAdaptations("text")
|
|
676
|
-
.map(
|
|
677
|
-
|
|
662
|
+
.map((adaptation) => {
|
|
663
|
+
const active = currentId === null ? false :
|
|
678
664
|
currentId === adaptation.id;
|
|
679
|
-
return
|
|
665
|
+
return (0, object_assign_1.default)(adaptation.toTextTrack(), { active });
|
|
680
666
|
});
|
|
681
|
-
}
|
|
667
|
+
}
|
|
682
668
|
/**
|
|
683
669
|
* Returns all available video tracks for a given Period, as an array of
|
|
684
670
|
* objects.
|
|
@@ -688,121 +674,108 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
688
674
|
* @param {Object} periodObj - The concerned Period's object
|
|
689
675
|
* @returns {Array.<Object>}
|
|
690
676
|
*/
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
677
|
+
getAvailableVideoTracks(periodObj) {
|
|
678
|
+
const storedSettings = periodObj.video.storedSettings;
|
|
679
|
+
const currentId = storedSettings === null ?
|
|
694
680
|
undefined :
|
|
695
681
|
storedSettings.adaptation.id;
|
|
696
682
|
return periodObj.period.getSupportedAdaptations("video")
|
|
697
|
-
.map(
|
|
698
|
-
|
|
683
|
+
.map((adaptation) => {
|
|
684
|
+
const active = currentId === null ? false :
|
|
699
685
|
currentId === adaptation.id;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
track.trickModeTracks.map(
|
|
703
|
-
|
|
686
|
+
const track = adaptation.toVideoTrack(true);
|
|
687
|
+
const trickModeTracks = track.trickModeTracks !== undefined ?
|
|
688
|
+
track.trickModeTracks.map((trickModeAdaptation) => {
|
|
689
|
+
const isActive = currentId === null ? false :
|
|
704
690
|
currentId === trickModeAdaptation.id;
|
|
705
|
-
return
|
|
691
|
+
return (0, object_assign_1.default)(trickModeAdaptation, { active: isActive });
|
|
706
692
|
}) :
|
|
707
693
|
[];
|
|
708
|
-
|
|
694
|
+
const availableTrack = (0, object_assign_1.default)(track, { active });
|
|
709
695
|
if (trickModeTracks !== undefined) {
|
|
710
696
|
availableTrack.trickModeTracks = trickModeTracks;
|
|
711
697
|
}
|
|
712
698
|
return availableTrack;
|
|
713
699
|
});
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
700
|
+
}
|
|
701
|
+
getLockedAudioRepresentations(periodObj) {
|
|
702
|
+
const { storedSettings } = periodObj.audio;
|
|
717
703
|
if (storedSettings === null) {
|
|
718
704
|
return null;
|
|
719
705
|
}
|
|
720
|
-
|
|
706
|
+
const lastLockedSettings = storedSettings.lockedRepresentations.getValue();
|
|
721
707
|
return lastLockedSettings === null ?
|
|
722
708
|
null :
|
|
723
|
-
lastLockedSettings.representations.map(
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
709
|
+
lastLockedSettings.representations.map(r => r.id);
|
|
710
|
+
}
|
|
711
|
+
getLockedVideoRepresentations(periodObj) {
|
|
712
|
+
const { storedSettings } = periodObj.video;
|
|
727
713
|
if (storedSettings === null) {
|
|
728
714
|
return null;
|
|
729
715
|
}
|
|
730
|
-
|
|
716
|
+
const lastLockedSettings = storedSettings.lockedRepresentations.getValue();
|
|
731
717
|
return lastLockedSettings === null ?
|
|
732
718
|
null :
|
|
733
|
-
lastLockedSettings.representations.map(
|
|
734
|
-
}
|
|
735
|
-
|
|
719
|
+
lastLockedSettings.representations.map(r => r.id);
|
|
720
|
+
}
|
|
721
|
+
lockAudioRepresentations(periodObj, lockSettings) {
|
|
736
722
|
var _a;
|
|
737
|
-
|
|
723
|
+
const { storedSettings } = periodObj.audio;
|
|
738
724
|
if (storedSettings === null) {
|
|
739
725
|
return;
|
|
740
726
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
745
|
-
|
|
746
|
-
|
|
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) {
|
|
747
734
|
var _a;
|
|
748
|
-
|
|
735
|
+
const { storedSettings } = periodObj.video;
|
|
749
736
|
if (storedSettings === null) {
|
|
750
737
|
return;
|
|
751
738
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
storedSettings.lockedRepresentations.setValue({ representations: filtered,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
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;
|
|
759
747
|
if (storedSettings === null ||
|
|
760
748
|
storedSettings.lockedRepresentations.getValue() === null) {
|
|
761
749
|
return;
|
|
762
750
|
}
|
|
763
751
|
storedSettings.lockedRepresentations.setValue(null);
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
|
|
752
|
+
}
|
|
753
|
+
unlockVideoRepresentations(periodObj) {
|
|
754
|
+
const { storedSettings } = periodObj.video;
|
|
767
755
|
if (storedSettings === null ||
|
|
768
756
|
storedSettings.lockedRepresentations.getValue() === null) {
|
|
769
757
|
return;
|
|
770
758
|
}
|
|
771
759
|
storedSettings.lockedRepresentations.setValue(null);
|
|
772
|
-
}
|
|
773
|
-
|
|
760
|
+
}
|
|
761
|
+
dispose() {
|
|
774
762
|
this._isDisposed = true;
|
|
775
763
|
while (true) {
|
|
776
|
-
|
|
764
|
+
const lastPeriod = this._storedPeriodInfo.pop();
|
|
777
765
|
if (lastPeriod === undefined) {
|
|
778
766
|
return;
|
|
779
767
|
}
|
|
780
768
|
lastPeriod.isRemoved = true;
|
|
781
769
|
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
* @param {Period} period
|
|
785
|
-
* @returns {Object}
|
|
786
|
-
*/
|
|
787
|
-
TracksStore.prototype._addPeriod = function (period) {
|
|
788
|
-
var periodObj = generatePeriodInfo(period, false, this._isTrickModeTrackEnabled, this._defaultAudioTrackSwitchingMode);
|
|
789
|
-
for (var i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
790
|
-
if (this._storedPeriodInfo[i].period.start > period.start) {
|
|
791
|
-
this._storedPeriodInfo.splice(i, 0, periodObj);
|
|
792
|
-
return periodObj;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
this._storedPeriodInfo.push(periodObj);
|
|
796
|
-
return periodObj;
|
|
797
|
-
};
|
|
798
|
-
TracksStore.prototype._resetVideoTrackChoices = function (reason) {
|
|
770
|
+
}
|
|
771
|
+
_resetVideoTrackChoices(reason) {
|
|
799
772
|
var _a;
|
|
800
|
-
for (
|
|
801
|
-
|
|
773
|
+
for (let i = 0; i < this._storedPeriodInfo.length; i++) {
|
|
774
|
+
const periodObj = this._storedPeriodInfo[i];
|
|
802
775
|
if (periodObj.video.storedSettings !== null) {
|
|
803
|
-
|
|
776
|
+
const chosenBaseTrack = periodObj.video.storedSettings.adaptationBase;
|
|
804
777
|
if (chosenBaseTrack !== null) {
|
|
805
|
-
|
|
778
|
+
const chosenTrack = getRightVideoTrack(chosenBaseTrack, this._isTrickModeTrackEnabled);
|
|
806
779
|
periodObj.video.storedSettings.adaptationBase = chosenBaseTrack;
|
|
807
780
|
periodObj.video.storedSettings.adaptation = chosenTrack;
|
|
808
781
|
}
|
|
@@ -810,41 +783,42 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
810
783
|
}
|
|
811
784
|
// Clone the current Period list to not be influenced if Periods are removed
|
|
812
785
|
// or added while the loop is running.
|
|
813
|
-
|
|
814
|
-
for (
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
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;
|
|
818
791
|
this.trigger("trackUpdate", { period: toExposedPeriod(period),
|
|
819
|
-
trackType: "video",
|
|
792
|
+
trackType: "video",
|
|
793
|
+
reason });
|
|
820
794
|
// The previous event trigger could have had side-effects, so we
|
|
821
795
|
// re-check if we're still mostly in the same state
|
|
822
796
|
if (this._isDisposed) {
|
|
823
797
|
return; // Someone disposed the `TracksStore` on the previous side-effect
|
|
824
798
|
}
|
|
825
|
-
|
|
799
|
+
const newPeriodItem = getPeriodItem(this._storedPeriodInfo, period.id);
|
|
826
800
|
if (newPeriodItem !== undefined &&
|
|
827
801
|
newPeriodItem.video.storedSettings === storedSettings) {
|
|
828
802
|
(_a = newPeriodItem.video.dispatcher) === null || _a === void 0 ? void 0 : _a.updateTrack(storedSettings);
|
|
829
803
|
}
|
|
830
804
|
}
|
|
831
|
-
}
|
|
832
|
-
|
|
805
|
+
}
|
|
806
|
+
_removePeriodObject(index) {
|
|
833
807
|
if (0 /* __ENVIRONMENT__.CURRENT_ENV */ === 1 /* __ENVIRONMENT__.DEV */) {
|
|
834
|
-
|
|
808
|
+
(0, assert_1.default)(index < this._storedPeriodInfo.length, "Invalid index for Period removal");
|
|
835
809
|
}
|
|
836
|
-
|
|
810
|
+
const oldPeriodItem = this._storedPeriodInfo[index];
|
|
837
811
|
this._storedPeriodInfo[index].isRemoved = true;
|
|
838
812
|
this._storedPeriodInfo.splice(index, 1);
|
|
839
813
|
this._cachedPeriodInfo.set(oldPeriodItem.period, oldPeriodItem);
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
814
|
+
}
|
|
815
|
+
_getRepresentationsToLock(adaptation, representationIds) {
|
|
816
|
+
const filtered = representationIds.reduce((acc, repId) => {
|
|
817
|
+
const foundRep = (0, array_find_1.default)(adaptation.representations, (r) => {
|
|
844
818
|
return r.id === repId;
|
|
845
819
|
});
|
|
846
820
|
if (foundRep === undefined) {
|
|
847
|
-
|
|
821
|
+
log_1.default.warn("API: Wanted locked Representation not found.");
|
|
848
822
|
}
|
|
849
823
|
else {
|
|
850
824
|
acc.push(foundRep);
|
|
@@ -856,10 +830,9 @@ var TracksStore = /** @class */ (function (_super) {
|
|
|
856
830
|
"None of the given Representation id are found");
|
|
857
831
|
}
|
|
858
832
|
return filtered;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
export default TracksStore;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
exports.default = TracksStore;
|
|
863
836
|
/**
|
|
864
837
|
* Returns the index of the given `period` in the given `periods`
|
|
865
838
|
* Array.
|
|
@@ -869,8 +842,8 @@ export default TracksStore;
|
|
|
869
842
|
* @returns {number|undefined}
|
|
870
843
|
*/
|
|
871
844
|
function findPeriodIndex(periods, period) {
|
|
872
|
-
for (
|
|
873
|
-
|
|
845
|
+
for (let i = 0; i < periods.length; i++) {
|
|
846
|
+
const periodI = periods[i];
|
|
874
847
|
if (periodI.period.id === period.id) {
|
|
875
848
|
return i;
|
|
876
849
|
}
|
|
@@ -885,15 +858,15 @@ function findPeriodIndex(periods, period) {
|
|
|
885
858
|
* @returns {Object|undefined}
|
|
886
859
|
*/
|
|
887
860
|
function getPeriodItem(periods, periodId) {
|
|
888
|
-
for (
|
|
889
|
-
|
|
861
|
+
for (let i = 0; i < periods.length; i++) {
|
|
862
|
+
const periodI = periods[i];
|
|
890
863
|
if (periodI.period.id === periodId) {
|
|
891
864
|
return periodI;
|
|
892
865
|
}
|
|
893
866
|
}
|
|
894
867
|
}
|
|
895
868
|
/**
|
|
896
|
-
* A `
|
|
869
|
+
* A `ITSPeriodObject` should only be removed once all References linked to it
|
|
897
870
|
* do not exist anymore, to keep the possibility of making track choices.
|
|
898
871
|
* @param {Object} periodObj
|
|
899
872
|
* @returns {boolean}
|
|
@@ -914,7 +887,7 @@ function getRightVideoTrack(adaptation, isTrickModeEnabled) {
|
|
|
914
887
|
return adaptation;
|
|
915
888
|
}
|
|
916
889
|
/**
|
|
917
|
-
* Generate an `
|
|
890
|
+
* Generate an `ITSPeriodObject` object for the given Period, selecting the
|
|
918
891
|
* default track for each type.
|
|
919
892
|
* @param {Object} period
|
|
920
893
|
* @param {boolean} inManifest
|
|
@@ -923,44 +896,45 @@ function getRightVideoTrack(adaptation, isTrickModeEnabled) {
|
|
|
923
896
|
*/
|
|
924
897
|
function generatePeriodInfo(period, inManifest, isTrickModeTrackEnabled, defaultAudioTrackSwitchingMode) {
|
|
925
898
|
var _a;
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
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 ?
|
|
931
904
|
{ adaptation: audioAdaptation,
|
|
932
905
|
switchingMode: defaultAudioTrackSwitchingMode,
|
|
933
|
-
lockedRepresentations:
|
|
906
|
+
lockedRepresentations: new reference_1.default(null) } :
|
|
934
907
|
null;
|
|
935
|
-
|
|
908
|
+
const videoSettings = videoAdaptation !== undefined ?
|
|
936
909
|
{ adaptation: videoAdaptation,
|
|
937
910
|
adaptationBase: baseVideoAdaptation,
|
|
938
911
|
switchingMode: DEFAULT_VIDEO_TRACK_SWITCHING_MODE,
|
|
939
|
-
lockedRepresentations:
|
|
912
|
+
lockedRepresentations: new reference_1.default(null) } :
|
|
940
913
|
null;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
.filter(
|
|
914
|
+
let textAdaptation = null;
|
|
915
|
+
const forcedSubtitles = period.getAdaptationsForType("text")
|
|
916
|
+
.filter((ad) => ad.isForcedSubtitles === true);
|
|
944
917
|
if (forcedSubtitles.length > 0) {
|
|
945
918
|
if (audioAdaptation !== null && audioAdaptation !== undefined) {
|
|
946
|
-
|
|
947
|
-
return f.normalizedLanguage === audioAdaptation.normalizedLanguage;
|
|
948
|
-
});
|
|
919
|
+
const sameLanguage = (0, array_find_1.default)(forcedSubtitles, (f) => f.normalizedLanguage === audioAdaptation.normalizedLanguage);
|
|
949
920
|
if (sameLanguage !== undefined) {
|
|
950
921
|
textAdaptation = sameLanguage;
|
|
951
922
|
}
|
|
952
923
|
}
|
|
953
924
|
if (textAdaptation === null) {
|
|
954
|
-
textAdaptation = (_a =
|
|
925
|
+
textAdaptation = (_a = (0, array_find_1.default)(forcedSubtitles, (f) => f.normalizedLanguage === undefined)) !== null && _a !== void 0 ? _a : null;
|
|
955
926
|
}
|
|
956
927
|
}
|
|
957
|
-
|
|
928
|
+
let textSettings = null;
|
|
958
929
|
if (textAdaptation !== null) {
|
|
959
930
|
textSettings = { adaptation: textAdaptation,
|
|
960
931
|
switchingMode: "direct",
|
|
961
|
-
lockedRepresentations:
|
|
932
|
+
lockedRepresentations: new reference_1.default(null) };
|
|
962
933
|
}
|
|
963
|
-
return { period
|
|
934
|
+
return { period,
|
|
935
|
+
inManifest,
|
|
936
|
+
isPeriodAdvertised: false,
|
|
937
|
+
isRemoved: false,
|
|
964
938
|
audio: { storedSettings: audioSettings,
|
|
965
939
|
dispatcher: null },
|
|
966
940
|
video: { storedSettings: videoSettings,
|