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,149 +14,115 @@
|
|
|
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
|
-
})();
|
|
31
|
-
var __assign = (this && this.__assign) || function () {
|
|
32
|
-
__assign = Object.assign || function(t) {
|
|
33
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
34
|
-
s = arguments[i];
|
|
35
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
36
|
-
t[p] = s[p];
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
};
|
|
40
|
-
return __assign.apply(this, arguments);
|
|
41
|
-
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
18
|
/**
|
|
43
19
|
* This file defines the public API for the RxPlayer.
|
|
44
20
|
* It also starts the different sub-parts of the player on various API calls.
|
|
45
21
|
*/
|
|
46
|
-
|
|
22
|
+
const compat_1 = require("../../compat");
|
|
47
23
|
/* eslint-disable-next-line max-len */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
import { constructPlayerStateReference, emitPlayPauseEvents, emitSeekEvents, isLoadedState, } from "./utils";
|
|
24
|
+
const can_rely_on_video_visibility_and_size_1 = require("../../compat/can_rely_on_video_visibility_and_size");
|
|
25
|
+
const config_1 = require("../../config");
|
|
26
|
+
const errors_1 = require("../../errors");
|
|
27
|
+
const features_1 = require("../../features");
|
|
28
|
+
const log_1 = require("../../log");
|
|
29
|
+
const array_find_1 = require("../../utils/array_find");
|
|
30
|
+
const array_includes_1 = require("../../utils/array_includes");
|
|
31
|
+
const assert_1 = require("../../utils/assert");
|
|
32
|
+
const assert_unreachable_1 = require("../../utils/assert_unreachable");
|
|
33
|
+
const event_emitter_1 = require("../../utils/event_emitter");
|
|
34
|
+
const id_generator_1 = require("../../utils/id_generator");
|
|
35
|
+
const is_null_or_undefined_1 = require("../../utils/is_null_or_undefined");
|
|
36
|
+
const object_assign_1 = require("../../utils/object_assign");
|
|
37
|
+
const ranges_1 = require("../../utils/ranges");
|
|
38
|
+
const reference_1 = require("../../utils/reference");
|
|
39
|
+
const task_canceller_1 = require("../../utils/task_canceller");
|
|
40
|
+
const decrypt_1 = require("../decrypt");
|
|
41
|
+
const option_utils_1 = require("./option_utils");
|
|
42
|
+
const playback_observer_1 = require("./playback_observer");
|
|
43
|
+
const tracks_store_1 = require("./track_management/tracks_store");
|
|
44
|
+
const utils_1 = require("./utils");
|
|
70
45
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
const generateContentId = (0, id_generator_1.default)();
|
|
47
|
+
const { getPictureOnPictureStateRef, getVideoVisibilityRef, getElementResolutionRef, getScreenResolutionRef } = compat_1.events;
|
|
73
48
|
/**
|
|
74
49
|
* @class Player
|
|
75
50
|
* @extends EventEmitter
|
|
76
51
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
class Player extends event_emitter_1.default {
|
|
53
|
+
/** All possible Error types emitted by the RxPlayer. */
|
|
54
|
+
static get ErrorTypes() {
|
|
55
|
+
return errors_1.ErrorTypes;
|
|
56
|
+
}
|
|
57
|
+
/** All possible Error codes emitted by the RxPlayer. */
|
|
58
|
+
static get ErrorCodes() {
|
|
59
|
+
return errors_1.ErrorCodes;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Current log level.
|
|
63
|
+
* Update current log level.
|
|
64
|
+
* Should be either (by verbosity ascending):
|
|
65
|
+
* - "NONE"
|
|
66
|
+
* - "ERROR"
|
|
67
|
+
* - "WARNING"
|
|
68
|
+
* - "INFO"
|
|
69
|
+
* - "DEBUG"
|
|
70
|
+
* Any other value will be translated to "NONE".
|
|
71
|
+
*/
|
|
72
|
+
static get LogLevel() {
|
|
73
|
+
return log_1.default.getLevel();
|
|
74
|
+
}
|
|
75
|
+
static set LogLevel(logLevel) {
|
|
76
|
+
log_1.default.setLevel(logLevel);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Add feature(s) to the RxPlayer.
|
|
80
|
+
* @param {Array.<Object>} featureList - Features wanted.
|
|
81
|
+
*/
|
|
82
|
+
static addFeatures(featureList) {
|
|
83
|
+
(0, features_1.addFeatures)(featureList);
|
|
84
|
+
}
|
|
79
85
|
/**
|
|
80
86
|
* @constructor
|
|
81
87
|
* @param {Object} options
|
|
82
88
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var DEFAULT_UNMUTED_VOLUME = config.getCurrent().DEFAULT_UNMUTED_VOLUME;
|
|
89
|
+
constructor(options = {}) {
|
|
90
|
+
super();
|
|
91
|
+
const { baseBandwidth, videoResolutionLimit, maxBufferAhead, maxBufferBehind, throttleVideoBitrateWhenHidden, videoElement, wantedBufferAhead, maxVideoBufferSize } = (0, option_utils_1.parseConstructorOptions)(options);
|
|
92
|
+
const { DEFAULT_UNMUTED_VOLUME } = config_1.default.getCurrent();
|
|
88
93
|
// Workaround to support Firefox autoplay on FF 42.
|
|
89
94
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
90
95
|
videoElement.preload = "auto";
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
wantedBufferAhead:
|
|
103
|
-
maxBufferAhead:
|
|
104
|
-
maxBufferBehind:
|
|
105
|
-
maxVideoBufferSize:
|
|
96
|
+
this.version = /* PLAYER_VERSION */ "4.0.0-beta.3";
|
|
97
|
+
this.log = log_1.default;
|
|
98
|
+
this.state = "STOPPED";
|
|
99
|
+
this.videoElement = videoElement;
|
|
100
|
+
const destroyCanceller = new task_canceller_1.default();
|
|
101
|
+
this._destroyCanceller = destroyCanceller;
|
|
102
|
+
this._priv_pictureInPictureRef = getPictureOnPictureStateRef(videoElement, destroyCanceller.signal);
|
|
103
|
+
this._priv_speed = new reference_1.default(videoElement.playbackRate, this._destroyCanceller.signal);
|
|
104
|
+
this._priv_preferTrickModeTracks = false;
|
|
105
|
+
this._priv_contentLock = new reference_1.default(false, this._destroyCanceller.signal);
|
|
106
|
+
this._priv_bufferOptions = {
|
|
107
|
+
wantedBufferAhead: new reference_1.default(wantedBufferAhead, this._destroyCanceller.signal),
|
|
108
|
+
maxBufferAhead: new reference_1.default(maxBufferAhead, this._destroyCanceller.signal),
|
|
109
|
+
maxBufferBehind: new reference_1.default(maxBufferBehind, this._destroyCanceller.signal),
|
|
110
|
+
maxVideoBufferSize: new reference_1.default(maxVideoBufferSize, this._destroyCanceller.signal),
|
|
106
111
|
};
|
|
107
|
-
|
|
112
|
+
this._priv_bitrateInfos = {
|
|
108
113
|
lastBitrates: { audio: baseBandwidth,
|
|
109
114
|
video: baseBandwidth },
|
|
110
115
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
Object.defineProperty(Player, "ErrorTypes", {
|
|
123
|
-
/** All possible Error types emitted by the RxPlayer. */
|
|
124
|
-
get: function () {
|
|
125
|
-
return ErrorTypes;
|
|
126
|
-
},
|
|
127
|
-
enumerable: false,
|
|
128
|
-
configurable: true
|
|
129
|
-
});
|
|
130
|
-
Object.defineProperty(Player, "ErrorCodes", {
|
|
131
|
-
/** All possible Error codes emitted by the RxPlayer. */
|
|
132
|
-
get: function () {
|
|
133
|
-
return ErrorCodes;
|
|
134
|
-
},
|
|
135
|
-
enumerable: false,
|
|
136
|
-
configurable: true
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(Player, "LogLevel", {
|
|
139
|
-
/**
|
|
140
|
-
* Current log level.
|
|
141
|
-
* Update current log level.
|
|
142
|
-
* Should be either (by verbosity ascending):
|
|
143
|
-
* - "NONE"
|
|
144
|
-
* - "ERROR"
|
|
145
|
-
* - "WARNING"
|
|
146
|
-
* - "INFO"
|
|
147
|
-
* - "DEBUG"
|
|
148
|
-
* Any other value will be translated to "NONE".
|
|
149
|
-
*/
|
|
150
|
-
get: function () {
|
|
151
|
-
return log.getLevel();
|
|
152
|
-
},
|
|
153
|
-
set: function (logLevel) {
|
|
154
|
-
log.setLevel(logLevel);
|
|
155
|
-
},
|
|
156
|
-
enumerable: false,
|
|
157
|
-
configurable: true
|
|
158
|
-
});
|
|
116
|
+
this._priv_throttleVideoBitrateWhenHidden = throttleVideoBitrateWhenHidden;
|
|
117
|
+
this._priv_videoResolutionLimit = videoResolutionLimit;
|
|
118
|
+
this._priv_mutedMemory = DEFAULT_UNMUTED_VOLUME;
|
|
119
|
+
this._priv_currentError = null;
|
|
120
|
+
this._priv_contentInfos = null;
|
|
121
|
+
this._priv_contentEventsMemory = {};
|
|
122
|
+
this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
123
|
+
this._priv_reloadingMetadata = {};
|
|
124
|
+
this._priv_lastAutoPlay = false;
|
|
125
|
+
}
|
|
159
126
|
/**
|
|
160
127
|
* Register a new callback for a player event event.
|
|
161
128
|
*
|
|
@@ -164,17 +131,17 @@ var Player = /** @class */ (function (_super) {
|
|
|
164
131
|
* The callback will take as argument the eventual payload of the event
|
|
165
132
|
* (single argument).
|
|
166
133
|
*/
|
|
167
|
-
|
|
134
|
+
addEventListener(evt, fn) {
|
|
168
135
|
// The EventEmitter's `addEventListener` method takes an optional third
|
|
169
136
|
// argument that we do not want to expose in the public API.
|
|
170
137
|
// We thus overwrite that function to remove any possible usage of that
|
|
171
138
|
// third argument.
|
|
172
|
-
return
|
|
173
|
-
}
|
|
139
|
+
return super.addEventListener(evt, fn);
|
|
140
|
+
}
|
|
174
141
|
/**
|
|
175
142
|
* Stop the playback for the current content.
|
|
176
143
|
*/
|
|
177
|
-
|
|
144
|
+
stop() {
|
|
178
145
|
if (this._priv_contentInfos !== null) {
|
|
179
146
|
this._priv_contentInfos.currentContentCanceller.cancel();
|
|
180
147
|
}
|
|
@@ -182,21 +149,21 @@ var Player = /** @class */ (function (_super) {
|
|
|
182
149
|
if (this.state !== "STOPPED" /* PLAYER_STATES.STOPPED */) {
|
|
183
150
|
this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
184
151
|
}
|
|
185
|
-
}
|
|
152
|
+
}
|
|
186
153
|
/**
|
|
187
154
|
* Free the resources used by the player.
|
|
188
155
|
* /!\ The player cannot be "used" anymore after this method has been called.
|
|
189
156
|
*/
|
|
190
|
-
|
|
157
|
+
dispose() {
|
|
191
158
|
// free resources linked to the loaded content
|
|
192
159
|
this.stop();
|
|
193
160
|
if (this.videoElement !== null) {
|
|
194
161
|
// free resources used for decryption management
|
|
195
|
-
disposeDecryptionResources(this.videoElement)
|
|
196
|
-
.catch(
|
|
197
|
-
|
|
162
|
+
(0, decrypt_1.disposeDecryptionResources)(this.videoElement)
|
|
163
|
+
.catch((err) => {
|
|
164
|
+
const message = err instanceof Error ? err.message :
|
|
198
165
|
"Unknown error";
|
|
199
|
-
|
|
166
|
+
log_1.default.error("API: Could not dispose decryption resources: " + message);
|
|
200
167
|
});
|
|
201
168
|
}
|
|
202
169
|
// free resources linked to the Player instance
|
|
@@ -204,30 +171,30 @@ var Player = /** @class */ (function (_super) {
|
|
|
204
171
|
this._priv_reloadingMetadata = {};
|
|
205
172
|
// un-attach video element
|
|
206
173
|
this.videoElement = null;
|
|
207
|
-
}
|
|
174
|
+
}
|
|
208
175
|
/**
|
|
209
176
|
* Load a new video.
|
|
210
177
|
* @param {Object} opts
|
|
211
178
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this._priv_reloadingMetadata = { options
|
|
179
|
+
loadVideo(opts) {
|
|
180
|
+
const options = (0, option_utils_1.parseLoadVideoOptions)(opts);
|
|
181
|
+
log_1.default.info("API: Calling loadvideo", options.url, options.transport);
|
|
182
|
+
this._priv_reloadingMetadata = { options };
|
|
216
183
|
this._priv_initializeContentPlayback(options);
|
|
217
184
|
this._priv_lastAutoPlay = options.autoPlay;
|
|
218
|
-
}
|
|
185
|
+
}
|
|
219
186
|
/**
|
|
220
187
|
* Reload the last loaded content.
|
|
221
188
|
* @param {Object} reloadOpts
|
|
222
189
|
*/
|
|
223
|
-
|
|
190
|
+
reload(reloadOpts) {
|
|
224
191
|
var _a, _b;
|
|
225
|
-
|
|
192
|
+
const { options, manifest, reloadPosition, reloadInPause } = this._priv_reloadingMetadata;
|
|
226
193
|
if (options === undefined) {
|
|
227
194
|
throw new Error("API: Can't reload without having previously loaded a content.");
|
|
228
195
|
}
|
|
229
|
-
checkReloadOptions(reloadOpts);
|
|
230
|
-
|
|
196
|
+
(0, option_utils_1.checkReloadOptions)(reloadOpts);
|
|
197
|
+
let startAt;
|
|
231
198
|
if (((_a = reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.reloadAt) === null || _a === void 0 ? void 0 : _a.position) !== undefined) {
|
|
232
199
|
startAt = { position: reloadOpts.reloadAt.position };
|
|
233
200
|
}
|
|
@@ -242,14 +209,14 @@ var Player = /** @class */ (function (_super) {
|
|
|
242
209
|
else if (reloadPosition !== undefined) {
|
|
243
210
|
startAt = { position: reloadPosition };
|
|
244
211
|
}
|
|
245
|
-
|
|
212
|
+
let autoPlay;
|
|
246
213
|
if ((reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.autoPlay) !== undefined) {
|
|
247
214
|
autoPlay = reloadOpts.autoPlay;
|
|
248
215
|
}
|
|
249
216
|
else if (reloadInPause !== undefined) {
|
|
250
217
|
autoPlay = !reloadInPause;
|
|
251
218
|
}
|
|
252
|
-
|
|
219
|
+
const newOptions = Object.assign(Object.assign({}, options), { initialManifest: manifest });
|
|
253
220
|
if (startAt !== undefined) {
|
|
254
221
|
newOptions.startAt = startAt;
|
|
255
222
|
}
|
|
@@ -257,66 +224,79 @@ var Player = /** @class */ (function (_super) {
|
|
|
257
224
|
newOptions.autoPlay = autoPlay;
|
|
258
225
|
}
|
|
259
226
|
this._priv_initializeContentPlayback(newOptions);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (
|
|
227
|
+
}
|
|
228
|
+
createDebugElement(element) {
|
|
229
|
+
if (features_1.default.createDebugElement === null) {
|
|
263
230
|
throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");
|
|
264
231
|
}
|
|
265
|
-
|
|
266
|
-
|
|
232
|
+
const canceller = new task_canceller_1.default();
|
|
233
|
+
features_1.default.createDebugElement(element, this, canceller.signal);
|
|
267
234
|
return {
|
|
268
|
-
dispose
|
|
235
|
+
dispose() {
|
|
269
236
|
canceller.cancel();
|
|
270
237
|
},
|
|
271
238
|
};
|
|
272
|
-
}
|
|
239
|
+
}
|
|
273
240
|
/**
|
|
274
241
|
* From given options, initialize content playback.
|
|
275
242
|
* @param {Object} options
|
|
276
243
|
*/
|
|
277
|
-
|
|
278
|
-
var _this = this;
|
|
244
|
+
_priv_initializeContentPlayback(options) {
|
|
279
245
|
var _a, _b, _c, _d;
|
|
280
|
-
|
|
246
|
+
const { autoPlay, defaultAudioTrackSwitchingMode, enableFastSwitching, initialManifest, keySystems, lowLatencyMode, minimumManifestUpdateInterval, requestConfig, onCodecSwitch, startAt, transport, checkMediaSegmentIntegrity, manifestLoader, referenceDateTime, representationFilter, segmentLoader, serverSyncInfos, __priv_manifestUpdateUrl, __priv_patchLastSegmentInSidx, url } = options;
|
|
281
247
|
// Perform multiple checks on the given options
|
|
282
248
|
if (this.videoElement === null) {
|
|
283
249
|
throw new Error("the attached video element is disposed");
|
|
284
250
|
}
|
|
285
|
-
|
|
251
|
+
const isDirectFile = transport === "directfile";
|
|
286
252
|
/** Emit to stop the current content. */
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
253
|
+
const currentContentCanceller = new task_canceller_1.default();
|
|
254
|
+
const videoElement = this.videoElement;
|
|
255
|
+
let initializer;
|
|
256
|
+
let mediaElementTracksStore = null;
|
|
291
257
|
if (!isDirectFile) {
|
|
292
|
-
|
|
258
|
+
const transportFn = features_1.default.transports[transport];
|
|
293
259
|
if (typeof transportFn !== "function") {
|
|
294
260
|
// Stop previous content and reset its state
|
|
295
261
|
this.stop();
|
|
296
262
|
this._priv_currentError = null;
|
|
297
|
-
throw new Error(
|
|
263
|
+
throw new Error(`transport "${transport}" not supported`);
|
|
298
264
|
}
|
|
299
|
-
|
|
265
|
+
if (features_1.default.mediaSourceInit === null) {
|
|
266
|
+
throw new Error("MediaSource streaming not supported");
|
|
267
|
+
}
|
|
268
|
+
const transportPipelines = transportFn({ lowLatencyMode,
|
|
269
|
+
checkMediaSegmentIntegrity,
|
|
270
|
+
manifestLoader,
|
|
271
|
+
referenceDateTime,
|
|
272
|
+
representationFilter,
|
|
273
|
+
segmentLoader,
|
|
274
|
+
serverSyncInfos,
|
|
275
|
+
__priv_manifestUpdateUrl,
|
|
276
|
+
__priv_patchLastSegmentInSidx });
|
|
300
277
|
/** Interface used to load and refresh the Manifest. */
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
278
|
+
const manifestRequestSettings = { lowLatencyMode,
|
|
279
|
+
maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
|
|
280
|
+
requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout,
|
|
281
|
+
minimumManifestUpdateInterval,
|
|
282
|
+
initialManifest };
|
|
283
|
+
const relyOnVideoVisibilityAndSize = (0, can_rely_on_video_visibility_and_size_1.default)();
|
|
284
|
+
const throttlers = { throttleBitrate: {},
|
|
305
285
|
limitResolution: {} };
|
|
306
286
|
if (this._priv_throttleVideoBitrateWhenHidden) {
|
|
307
287
|
if (!relyOnVideoVisibilityAndSize) {
|
|
308
|
-
|
|
288
|
+
log_1.default.warn("API: Can't apply throttleVideoBitrateWhenHidden because " +
|
|
309
289
|
"browser can't be trusted for visibility.");
|
|
310
290
|
}
|
|
311
291
|
else {
|
|
312
292
|
throttlers.throttleBitrate = {
|
|
313
|
-
video: createMappedReference(getVideoVisibilityRef(this._priv_pictureInPictureRef, currentContentCanceller.signal),
|
|
293
|
+
video: (0, reference_1.createMappedReference)(getVideoVisibilityRef(this._priv_pictureInPictureRef, currentContentCanceller.signal), isActive => isActive ? Infinity : 0, currentContentCanceller.signal),
|
|
314
294
|
};
|
|
315
295
|
}
|
|
316
296
|
}
|
|
317
297
|
if (this._priv_videoResolutionLimit === "videoElement") {
|
|
318
298
|
if (!relyOnVideoVisibilityAndSize) {
|
|
319
|
-
|
|
299
|
+
log_1.default.warn("API: Can't apply videoResolutionLimit because browser can't be " +
|
|
320
300
|
"trusted for video size.");
|
|
321
301
|
}
|
|
322
302
|
else {
|
|
@@ -331,113 +311,102 @@ var Player = /** @class */ (function (_super) {
|
|
|
331
311
|
};
|
|
332
312
|
}
|
|
333
313
|
/** Options used by the adaptive logic. */
|
|
334
|
-
|
|
314
|
+
const adaptiveOptions = {
|
|
335
315
|
initialBitrates: this._priv_bitrateInfos.lastBitrates,
|
|
336
|
-
lowLatencyMode
|
|
337
|
-
throttlers
|
|
316
|
+
lowLatencyMode,
|
|
317
|
+
throttlers,
|
|
338
318
|
};
|
|
339
319
|
/** Options used by the TextTrack SegmentBuffer. */
|
|
340
|
-
|
|
320
|
+
const textTrackOptions = options.textTrackMode === "native" ?
|
|
341
321
|
{ textTrackMode: "native" } :
|
|
342
322
|
{ textTrackMode: "html",
|
|
343
323
|
textTrackElement: options.textTrackElement };
|
|
344
|
-
|
|
345
|
-
|
|
324
|
+
const bufferOptions = (0, object_assign_1.default)({ enableFastSwitching,
|
|
325
|
+
onCodecSwitch }, this._priv_bufferOptions);
|
|
326
|
+
const segmentRequestOptions = { lowLatencyMode,
|
|
327
|
+
maxRetry: (_c = requestConfig.segment) === null || _c === void 0 ? void 0 : _c.maxRetry,
|
|
346
328
|
requestTimeout: (_d = requestConfig.segment) === null || _d === void 0 ? void 0 : _d.timeout };
|
|
347
|
-
initializer = new
|
|
348
|
-
adaptiveOptions
|
|
349
|
-
autoPlay
|
|
350
|
-
bufferOptions
|
|
351
|
-
keySystems
|
|
352
|
-
lowLatencyMode
|
|
353
|
-
manifestRequestSettings
|
|
329
|
+
initializer = new features_1.default.mediaSourceInit({
|
|
330
|
+
adaptiveOptions,
|
|
331
|
+
autoPlay,
|
|
332
|
+
bufferOptions,
|
|
333
|
+
keySystems,
|
|
334
|
+
lowLatencyMode,
|
|
335
|
+
manifestRequestSettings,
|
|
354
336
|
transport: transportPipelines,
|
|
355
|
-
segmentRequestOptions
|
|
337
|
+
segmentRequestOptions,
|
|
356
338
|
speed: this._priv_speed,
|
|
357
|
-
startAt
|
|
358
|
-
textTrackOptions
|
|
359
|
-
url
|
|
339
|
+
startAt,
|
|
340
|
+
textTrackOptions,
|
|
341
|
+
url,
|
|
360
342
|
});
|
|
361
343
|
}
|
|
362
344
|
else {
|
|
363
|
-
if (
|
|
345
|
+
if (features_1.default.directfile === null) {
|
|
364
346
|
this.stop();
|
|
365
347
|
this._priv_currentError = null;
|
|
366
348
|
throw new Error("DirectFile feature not activated in your build.");
|
|
367
349
|
}
|
|
350
|
+
else if ((0, is_null_or_undefined_1.default)(url)) {
|
|
351
|
+
throw new Error("No URL for a DirectFile content");
|
|
352
|
+
}
|
|
368
353
|
mediaElementTracksStore =
|
|
369
354
|
this._priv_initializeMediaElementTracksStore(currentContentCanceller.signal);
|
|
370
355
|
if (currentContentCanceller.isUsed()) {
|
|
371
356
|
return;
|
|
372
357
|
}
|
|
373
|
-
initializer = new
|
|
358
|
+
initializer = new features_1.default.directfile.initDirectFile({ autoPlay,
|
|
359
|
+
keySystems,
|
|
360
|
+
speed: this._priv_speed,
|
|
361
|
+
startAt,
|
|
362
|
+
url });
|
|
374
363
|
}
|
|
375
364
|
/** Future `this._priv_contentInfos` related to this content. */
|
|
376
|
-
|
|
365
|
+
const contentInfos = {
|
|
377
366
|
contentId: generateContentId(),
|
|
378
367
|
originalUrl: url,
|
|
379
|
-
currentContentCanceller
|
|
380
|
-
defaultAudioTrackSwitchingMode
|
|
381
|
-
initializer
|
|
382
|
-
isDirectFile
|
|
368
|
+
currentContentCanceller,
|
|
369
|
+
defaultAudioTrackSwitchingMode,
|
|
370
|
+
initializer,
|
|
371
|
+
isDirectFile,
|
|
383
372
|
segmentBuffersStore: null,
|
|
384
373
|
manifest: null,
|
|
385
374
|
currentPeriod: null,
|
|
386
375
|
activeAdaptations: null,
|
|
387
376
|
activeRepresentations: null,
|
|
388
377
|
tracksStore: null,
|
|
389
|
-
mediaElementTracksStore
|
|
378
|
+
mediaElementTracksStore,
|
|
390
379
|
};
|
|
391
380
|
// Bind events
|
|
392
|
-
initializer.addEventListener("error",
|
|
393
|
-
|
|
381
|
+
initializer.addEventListener("error", (error) => {
|
|
382
|
+
this._priv_onFatalError(error, contentInfos);
|
|
394
383
|
});
|
|
395
|
-
initializer.addEventListener("warning",
|
|
396
|
-
|
|
384
|
+
initializer.addEventListener("warning", (error) => {
|
|
385
|
+
const formattedError = (0, errors_1.formatError)(error, {
|
|
397
386
|
defaultCode: "NONE",
|
|
398
387
|
defaultReason: "An unknown error happened.",
|
|
399
388
|
});
|
|
400
|
-
|
|
401
|
-
|
|
389
|
+
log_1.default.warn("API: Sending warning:", formattedError);
|
|
390
|
+
this.trigger("warning", formattedError);
|
|
402
391
|
});
|
|
403
|
-
initializer.addEventListener("reloadingMediaSource",
|
|
392
|
+
initializer.addEventListener("reloadingMediaSource", (payload) => {
|
|
404
393
|
contentInfos.segmentBuffersStore = null;
|
|
405
394
|
if (contentInfos.tracksStore !== null) {
|
|
406
395
|
contentInfos.tracksStore.resetPeriodObjects();
|
|
407
396
|
}
|
|
408
|
-
|
|
409
|
-
});
|
|
410
|
-
initializer.addEventListener("inbandEvents", function (inbandEvents) {
|
|
411
|
-
return _this.trigger("inbandEvents", inbandEvents);
|
|
412
|
-
});
|
|
413
|
-
initializer.addEventListener("streamEvent", function (streamEvent) {
|
|
414
|
-
return _this.trigger("streamEvent", streamEvent);
|
|
415
|
-
});
|
|
416
|
-
initializer.addEventListener("streamEventSkip", function (streamEventSkip) {
|
|
417
|
-
return _this.trigger("streamEventSkip", streamEventSkip);
|
|
418
|
-
});
|
|
419
|
-
initializer.addEventListener("activePeriodChanged", function (periodInfo) {
|
|
420
|
-
return _this._priv_onActivePeriodChanged(contentInfos, periodInfo);
|
|
421
|
-
});
|
|
422
|
-
initializer.addEventListener("periodStreamReady", function (periodReadyInfo) {
|
|
423
|
-
return _this._priv_onPeriodStreamReady(contentInfos, periodReadyInfo);
|
|
424
|
-
});
|
|
425
|
-
initializer.addEventListener("periodStreamCleared", function (periodClearedInfo) {
|
|
426
|
-
return _this._priv_onPeriodStreamCleared(contentInfos, periodClearedInfo);
|
|
427
|
-
});
|
|
428
|
-
initializer.addEventListener("representationChange", function (representationInfo) {
|
|
429
|
-
return _this._priv_onRepresentationChange(contentInfos, representationInfo);
|
|
397
|
+
this._priv_lastAutoPlay = payload.autoPlay;
|
|
430
398
|
});
|
|
431
|
-
initializer.addEventListener("
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
initializer.addEventListener("
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
initializer.addEventListener("
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
initializer.addEventListener("
|
|
399
|
+
initializer.addEventListener("inbandEvents", (inbandEvents) => this.trigger("inbandEvents", inbandEvents));
|
|
400
|
+
initializer.addEventListener("streamEvent", (streamEvent) => this.trigger("streamEvent", streamEvent));
|
|
401
|
+
initializer.addEventListener("streamEventSkip", (streamEventSkip) => this.trigger("streamEventSkip", streamEventSkip));
|
|
402
|
+
initializer.addEventListener("activePeriodChanged", (periodInfo) => this._priv_onActivePeriodChanged(contentInfos, periodInfo));
|
|
403
|
+
initializer.addEventListener("periodStreamReady", (periodReadyInfo) => this._priv_onPeriodStreamReady(contentInfos, periodReadyInfo));
|
|
404
|
+
initializer.addEventListener("periodStreamCleared", (periodClearedInfo) => this._priv_onPeriodStreamCleared(contentInfos, periodClearedInfo));
|
|
405
|
+
initializer.addEventListener("representationChange", (representationInfo) => this._priv_onRepresentationChange(contentInfos, representationInfo));
|
|
406
|
+
initializer.addEventListener("adaptationChange", (adaptationInfo) => this._priv_onAdaptationChange(contentInfos, adaptationInfo));
|
|
407
|
+
initializer.addEventListener("bitrateEstimateChange", (bitrateEstimateInfo) => this._priv_onBitrateEstimateChange(bitrateEstimateInfo));
|
|
408
|
+
initializer.addEventListener("manifestReady", (manifest) => this._priv_onManifestReady(contentInfos, manifest));
|
|
409
|
+
initializer.addEventListener("loaded", (evt) => {
|
|
441
410
|
contentInfos.segmentBuffersStore = evt.segmentBuffersStore;
|
|
442
411
|
});
|
|
443
412
|
// Now, that most events are linked, prepare the next content.
|
|
@@ -453,16 +422,16 @@ var Player = /** @class */ (function (_super) {
|
|
|
453
422
|
// content.
|
|
454
423
|
this.stop();
|
|
455
424
|
/** Global "playback observer" which will emit playback conditions */
|
|
456
|
-
|
|
425
|
+
const playbackObserver = new playback_observer_1.default(videoElement, {
|
|
457
426
|
withMediaSource: !isDirectFile,
|
|
458
|
-
lowLatencyMode
|
|
427
|
+
lowLatencyMode,
|
|
459
428
|
});
|
|
460
|
-
currentContentCanceller.signal.register(
|
|
429
|
+
currentContentCanceller.signal.register(() => {
|
|
461
430
|
playbackObserver.stop();
|
|
462
431
|
});
|
|
463
432
|
// Update the RxPlayer's state at the right events
|
|
464
|
-
|
|
465
|
-
currentContentCanceller.signal.register(
|
|
433
|
+
const playerStateRef = (0, utils_1.constructPlayerStateReference)(initializer, videoElement, playbackObserver, currentContentCanceller.signal);
|
|
434
|
+
currentContentCanceller.signal.register(() => {
|
|
466
435
|
initializer.dispose();
|
|
467
436
|
});
|
|
468
437
|
/**
|
|
@@ -471,21 +440,21 @@ var Player = /** @class */ (function (_super) {
|
|
|
471
440
|
* To call when either might change.
|
|
472
441
|
* @param {string} state - The player state we're about to switch to.
|
|
473
442
|
*/
|
|
474
|
-
|
|
443
|
+
const updateReloadingMetadata = (state) => {
|
|
475
444
|
switch (state) {
|
|
476
445
|
case "STOPPED":
|
|
477
446
|
case "RELOADING":
|
|
478
447
|
case "LOADING":
|
|
479
448
|
break; // keep previous metadata
|
|
480
449
|
case "ENDED":
|
|
481
|
-
|
|
482
|
-
|
|
450
|
+
this._priv_reloadingMetadata.reloadInPause = true;
|
|
451
|
+
this._priv_reloadingMetadata.reloadPosition =
|
|
483
452
|
playbackObserver.getReference().getValue().position;
|
|
484
453
|
break;
|
|
485
454
|
default:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
455
|
+
const o = playbackObserver.getReference().getValue();
|
|
456
|
+
this._priv_reloadingMetadata.reloadInPause = o.paused;
|
|
457
|
+
this._priv_reloadingMetadata.reloadPosition = o.position;
|
|
489
458
|
break;
|
|
490
459
|
}
|
|
491
460
|
};
|
|
@@ -494,41 +463,41 @@ var Player = /** @class */ (function (_super) {
|
|
|
494
463
|
* events.
|
|
495
464
|
* `null` when such events are not emitted currently.
|
|
496
465
|
*/
|
|
497
|
-
|
|
466
|
+
let playPauseEventsCanceller = null;
|
|
498
467
|
/**
|
|
499
468
|
* Callback emitting `"play"` and `"pause`" events once the content is
|
|
500
469
|
* loaded, starting from the state indicated in argument.
|
|
501
470
|
* @param {boolean} willAutoPlay - If `false`, we're currently paused.
|
|
502
471
|
*/
|
|
503
|
-
|
|
472
|
+
const triggerPlayPauseEventsWhenReady = (willAutoPlay) => {
|
|
504
473
|
if (playPauseEventsCanceller !== null) {
|
|
505
474
|
playPauseEventsCanceller.cancel(); // cancel previous logic
|
|
506
475
|
playPauseEventsCanceller = null;
|
|
507
476
|
}
|
|
508
|
-
playerStateRef.onUpdate(
|
|
509
|
-
if (!isLoadedState(val)) {
|
|
477
|
+
playerStateRef.onUpdate((val, stopListeningToStateUpdates) => {
|
|
478
|
+
if (!(0, utils_1.isLoadedState)(val)) {
|
|
510
479
|
return; // content not loaded yet: no event
|
|
511
480
|
}
|
|
512
481
|
stopListeningToStateUpdates();
|
|
513
482
|
if (playPauseEventsCanceller !== null) {
|
|
514
483
|
playPauseEventsCanceller.cancel();
|
|
515
484
|
}
|
|
516
|
-
playPauseEventsCanceller = new
|
|
485
|
+
playPauseEventsCanceller = new task_canceller_1.default();
|
|
517
486
|
playPauseEventsCanceller.linkToSignal(currentContentCanceller.signal);
|
|
518
487
|
if (willAutoPlay !== !videoElement.paused) {
|
|
519
488
|
// paused status is not at the expected value on load: emit event
|
|
520
489
|
if (videoElement.paused) {
|
|
521
|
-
|
|
490
|
+
this.trigger("pause", null);
|
|
522
491
|
}
|
|
523
492
|
else {
|
|
524
|
-
|
|
493
|
+
this.trigger("play", null);
|
|
525
494
|
}
|
|
526
495
|
}
|
|
527
|
-
emitPlayPauseEvents(videoElement,
|
|
496
|
+
(0, utils_1.emitPlayPauseEvents)(videoElement, () => this.trigger("play", null), () => this.trigger("pause", null), currentContentCanceller.signal);
|
|
528
497
|
}, { emitCurrentValue: false, clearSignal: currentContentCanceller.signal });
|
|
529
498
|
};
|
|
530
499
|
triggerPlayPauseEventsWhenReady(autoPlay);
|
|
531
|
-
initializer.addEventListener("reloadingMediaSource",
|
|
500
|
+
initializer.addEventListener("reloadingMediaSource", (payload) => {
|
|
532
501
|
triggerPlayPauseEventsWhenReady(payload.autoPlay);
|
|
533
502
|
});
|
|
534
503
|
/**
|
|
@@ -536,53 +505,53 @@ var Player = /** @class */ (function (_super) {
|
|
|
536
505
|
* events.
|
|
537
506
|
* `null` when such events are not emitted currently.
|
|
538
507
|
*/
|
|
539
|
-
|
|
508
|
+
let seekEventsCanceller = null;
|
|
540
509
|
// React to player state change
|
|
541
|
-
playerStateRef.onUpdate(
|
|
510
|
+
playerStateRef.onUpdate((newState) => {
|
|
542
511
|
updateReloadingMetadata(newState);
|
|
543
|
-
|
|
512
|
+
this._priv_setPlayerState(newState);
|
|
544
513
|
if (currentContentCanceller.isUsed()) {
|
|
545
514
|
return;
|
|
546
515
|
}
|
|
547
516
|
if (seekEventsCanceller !== null) {
|
|
548
|
-
if (!isLoadedState(
|
|
517
|
+
if (!(0, utils_1.isLoadedState)(this.state)) {
|
|
549
518
|
seekEventsCanceller.cancel();
|
|
550
519
|
seekEventsCanceller = null;
|
|
551
520
|
}
|
|
552
521
|
}
|
|
553
|
-
else if (isLoadedState(
|
|
554
|
-
seekEventsCanceller = new
|
|
522
|
+
else if ((0, utils_1.isLoadedState)(this.state)) {
|
|
523
|
+
seekEventsCanceller = new task_canceller_1.default();
|
|
555
524
|
seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
|
|
556
|
-
emitSeekEvents(videoElement, playbackObserver,
|
|
525
|
+
(0, utils_1.emitSeekEvents)(videoElement, playbackObserver, () => this.trigger("seeking", null), () => this.trigger("seeked", null), seekEventsCanceller.signal);
|
|
557
526
|
}
|
|
558
527
|
}, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
|
|
559
528
|
// React to playback conditions change
|
|
560
|
-
playbackObserver.listen(
|
|
561
|
-
updateReloadingMetadata(
|
|
562
|
-
|
|
529
|
+
playbackObserver.listen((observation) => {
|
|
530
|
+
updateReloadingMetadata(this.state);
|
|
531
|
+
this._priv_triggerPositionUpdate(contentInfos, observation);
|
|
563
532
|
}, { clearSignal: currentContentCanceller.signal });
|
|
564
533
|
this._priv_currentError = null;
|
|
565
534
|
this._priv_contentInfos = contentInfos;
|
|
566
|
-
currentContentCanceller.signal.register(
|
|
535
|
+
currentContentCanceller.signal.register(() => {
|
|
567
536
|
initializer.removeEventListener();
|
|
568
537
|
});
|
|
569
538
|
// initialize the content only when the lock is inactive
|
|
570
|
-
this._priv_contentLock.onUpdate(
|
|
539
|
+
this._priv_contentLock.onUpdate((isLocked, stopListeningToLock) => {
|
|
571
540
|
if (!isLocked) {
|
|
572
541
|
stopListeningToLock();
|
|
573
542
|
// start playback!
|
|
574
543
|
initializer.start(videoElement, playbackObserver);
|
|
575
544
|
}
|
|
576
545
|
}, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
|
|
577
|
-
}
|
|
546
|
+
}
|
|
578
547
|
/**
|
|
579
548
|
* Returns fatal error if one for the current content.
|
|
580
549
|
* null otherwise.
|
|
581
550
|
* @returns {Object|null} - The current Error (`null` when no error).
|
|
582
551
|
*/
|
|
583
|
-
|
|
552
|
+
getError() {
|
|
584
553
|
return this._priv_currentError;
|
|
585
|
-
}
|
|
554
|
+
}
|
|
586
555
|
/**
|
|
587
556
|
* Returns the media DOM element used by the player.
|
|
588
557
|
* You should not its HTML5 API directly and use the player's method instead,
|
|
@@ -590,30 +559,30 @@ var Player = /** @class */ (function (_super) {
|
|
|
590
559
|
* @returns {HTMLMediaElement|null} - The HTMLMediaElement used (`null` when
|
|
591
560
|
* disposed)
|
|
592
561
|
*/
|
|
593
|
-
|
|
562
|
+
getVideoElement() {
|
|
594
563
|
return this.videoElement;
|
|
595
|
-
}
|
|
564
|
+
}
|
|
596
565
|
/**
|
|
597
566
|
* Returns the player's current state.
|
|
598
567
|
* @returns {string} - The current Player's state
|
|
599
568
|
*/
|
|
600
|
-
|
|
569
|
+
getPlayerState() {
|
|
601
570
|
return this.state;
|
|
602
|
-
}
|
|
571
|
+
}
|
|
603
572
|
/**
|
|
604
573
|
* Returns true if a content is loaded.
|
|
605
574
|
* @returns {Boolean} - `true` if a content is loaded, `false` otherwise.
|
|
606
575
|
*/
|
|
607
|
-
|
|
608
|
-
return !
|
|
609
|
-
}
|
|
576
|
+
isContentLoaded() {
|
|
577
|
+
return !(0, array_includes_1.default)(["LOADING", "RELOADING", "STOPPED"], this.state);
|
|
578
|
+
}
|
|
610
579
|
/**
|
|
611
580
|
* Returns true if the player is buffering.
|
|
612
581
|
* @returns {Boolean} - `true` if the player is buffering, `false` otherwise.
|
|
613
582
|
*/
|
|
614
|
-
|
|
615
|
-
return
|
|
616
|
-
}
|
|
583
|
+
isBuffering() {
|
|
584
|
+
return (0, array_includes_1.default)(["BUFFERING", "SEEKING", "LOADING", "RELOADING"], this.state);
|
|
585
|
+
}
|
|
617
586
|
/**
|
|
618
587
|
* Returns the play/pause status of the player :
|
|
619
588
|
* - when `LOADING` or `RELOADING`, returns the scheduled play/pause condition
|
|
@@ -623,9 +592,9 @@ var Player = /** @class */ (function (_super) {
|
|
|
623
592
|
* @returns {Boolean} - `true` if the player is paused or will be after loading,
|
|
624
593
|
* `false` otherwise.
|
|
625
594
|
*/
|
|
626
|
-
|
|
595
|
+
isPaused() {
|
|
627
596
|
if (this.videoElement) {
|
|
628
|
-
if (
|
|
597
|
+
if ((0, array_includes_1.default)(["LOADING", "RELOADING"], this.state)) {
|
|
629
598
|
return !this._priv_lastAutoPlay;
|
|
630
599
|
}
|
|
631
600
|
else {
|
|
@@ -633,43 +602,43 @@ var Player = /** @class */ (function (_super) {
|
|
|
633
602
|
}
|
|
634
603
|
}
|
|
635
604
|
return true;
|
|
636
|
-
}
|
|
605
|
+
}
|
|
637
606
|
/**
|
|
638
607
|
* Returns true if both:
|
|
639
608
|
* - a content is loaded
|
|
640
609
|
* - the content loaded is a live content
|
|
641
610
|
* @returns {Boolean} - `true` if we're playing a live content, `false` otherwise.
|
|
642
611
|
*/
|
|
643
|
-
|
|
612
|
+
isLive() {
|
|
644
613
|
if (this._priv_contentInfos === null) {
|
|
645
614
|
return false;
|
|
646
615
|
}
|
|
647
|
-
|
|
616
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
648
617
|
if (isDirectFile || manifest === null) {
|
|
649
618
|
return false;
|
|
650
619
|
}
|
|
651
620
|
return manifest.isLive;
|
|
652
|
-
}
|
|
621
|
+
}
|
|
653
622
|
/**
|
|
654
623
|
* Returns `true` if trickmode playback is active (usually through the usage
|
|
655
624
|
* of the `setPlaybackRate` method), which means that the RxPlayer selects
|
|
656
625
|
* "trickmode" video tracks in priority.
|
|
657
626
|
* @returns {Boolean}
|
|
658
627
|
*/
|
|
659
|
-
|
|
628
|
+
areTrickModeTracksEnabled() {
|
|
660
629
|
return this._priv_preferTrickModeTracks;
|
|
661
|
-
}
|
|
630
|
+
}
|
|
662
631
|
/**
|
|
663
632
|
* Returns the URL(s) of the currently considered Manifest, or of the content for
|
|
664
633
|
* directfile content.
|
|
665
634
|
* @returns {Array.<string>|undefined} - Current URL. `undefined` if not known
|
|
666
635
|
* or no URL yet.
|
|
667
636
|
*/
|
|
668
|
-
|
|
637
|
+
getContentUrls() {
|
|
669
638
|
if (this._priv_contentInfos === null) {
|
|
670
639
|
return undefined;
|
|
671
640
|
}
|
|
672
|
-
|
|
641
|
+
const { isDirectFile, manifest, originalUrl } = this._priv_contentInfos;
|
|
673
642
|
if (isDirectFile) {
|
|
674
643
|
return originalUrl === undefined ? undefined :
|
|
675
644
|
[originalUrl];
|
|
@@ -678,7 +647,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
678
647
|
return manifest.getUrls();
|
|
679
648
|
}
|
|
680
649
|
return undefined;
|
|
681
|
-
}
|
|
650
|
+
}
|
|
682
651
|
/**
|
|
683
652
|
* Update URL of the content currently being played (e.g. DASH's MPD).
|
|
684
653
|
* @param {Array.<string>|undefined} urls - URLs to reach that content /
|
|
@@ -687,41 +656,41 @@ var Player = /** @class */ (function (_super) {
|
|
|
687
656
|
* @param {boolean} params.refresh - If `true` the resource in question
|
|
688
657
|
* (e.g. DASH's MPD) will be refreshed immediately.
|
|
689
658
|
*/
|
|
690
|
-
|
|
659
|
+
updateContentUrls(urls, params) {
|
|
691
660
|
if (this._priv_contentInfos === null) {
|
|
692
661
|
throw new Error("No content loaded");
|
|
693
662
|
}
|
|
694
|
-
|
|
663
|
+
const refreshNow = (params === null || params === void 0 ? void 0 : params.refresh) === true;
|
|
695
664
|
this._priv_contentInfos.initializer.updateContentUrls(urls, refreshNow);
|
|
696
|
-
}
|
|
665
|
+
}
|
|
697
666
|
/**
|
|
698
667
|
* Returns the video duration, in seconds.
|
|
699
668
|
* NaN if no video is playing.
|
|
700
669
|
* @returns {Number}
|
|
701
670
|
*/
|
|
702
|
-
|
|
671
|
+
getMediaDuration() {
|
|
703
672
|
if (this.videoElement === null) {
|
|
704
673
|
throw new Error("Disposed player");
|
|
705
674
|
}
|
|
706
675
|
return this.videoElement.duration;
|
|
707
|
-
}
|
|
676
|
+
}
|
|
708
677
|
/**
|
|
709
678
|
* Returns in seconds the difference between:
|
|
710
679
|
* - the end of the current contiguous loaded range.
|
|
711
680
|
* - the current time
|
|
712
681
|
* @returns {Number}
|
|
713
682
|
*/
|
|
714
|
-
|
|
683
|
+
getCurrentBufferGap() {
|
|
715
684
|
if (this.videoElement === null) {
|
|
716
685
|
throw new Error("Disposed player");
|
|
717
686
|
}
|
|
718
|
-
|
|
719
|
-
|
|
687
|
+
const videoElement = this.videoElement;
|
|
688
|
+
const bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(videoElement.buffered, videoElement.currentTime);
|
|
720
689
|
if (bufferGap === Infinity) {
|
|
721
690
|
return 0;
|
|
722
691
|
}
|
|
723
692
|
return bufferGap;
|
|
724
|
-
}
|
|
693
|
+
}
|
|
725
694
|
/**
|
|
726
695
|
* Get the current position, in s, in wall-clock time.
|
|
727
696
|
* That is:
|
|
@@ -736,27 +705,27 @@ var Player = /** @class */ (function (_super) {
|
|
|
736
705
|
*
|
|
737
706
|
* @returns {Number}
|
|
738
707
|
*/
|
|
739
|
-
|
|
708
|
+
getWallClockTime() {
|
|
740
709
|
if (this.videoElement === null) {
|
|
741
710
|
throw new Error("Disposed player");
|
|
742
711
|
}
|
|
743
712
|
if (this._priv_contentInfos === null) {
|
|
744
713
|
return this.videoElement.currentTime;
|
|
745
714
|
}
|
|
746
|
-
|
|
715
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
747
716
|
if (isDirectFile) {
|
|
748
|
-
|
|
717
|
+
const startDate = (0, compat_1.getStartDate)(this.videoElement);
|
|
749
718
|
return (startDate !== null && startDate !== void 0 ? startDate : 0) + this.videoElement.currentTime;
|
|
750
719
|
}
|
|
751
720
|
if (manifest !== null) {
|
|
752
|
-
|
|
753
|
-
|
|
721
|
+
const currentTime = this.videoElement.currentTime;
|
|
722
|
+
const ast = manifest.availabilityStartTime !== undefined ?
|
|
754
723
|
manifest.availabilityStartTime :
|
|
755
724
|
0;
|
|
756
725
|
return currentTime + ast;
|
|
757
726
|
}
|
|
758
727
|
return 0;
|
|
759
|
-
}
|
|
728
|
+
}
|
|
760
729
|
/**
|
|
761
730
|
* Get the current position, in seconds, of the video element.
|
|
762
731
|
*
|
|
@@ -768,27 +737,27 @@ var Player = /** @class */ (function (_super) {
|
|
|
768
737
|
*
|
|
769
738
|
* @returns {Number}
|
|
770
739
|
*/
|
|
771
|
-
|
|
740
|
+
getPosition() {
|
|
772
741
|
if (this.videoElement === null) {
|
|
773
742
|
throw new Error("Disposed player");
|
|
774
743
|
}
|
|
775
744
|
return this.videoElement.currentTime;
|
|
776
|
-
}
|
|
745
|
+
}
|
|
777
746
|
/**
|
|
778
747
|
* Returns the last stored content position, in seconds.
|
|
779
748
|
*
|
|
780
749
|
* @returns {number|undefined}
|
|
781
750
|
*/
|
|
782
|
-
|
|
751
|
+
getLastStoredContentPosition() {
|
|
783
752
|
return this._priv_reloadingMetadata.reloadPosition;
|
|
784
|
-
}
|
|
753
|
+
}
|
|
785
754
|
/**
|
|
786
755
|
* Returns the current playback rate at which the video plays.
|
|
787
756
|
* @returns {Number}
|
|
788
757
|
*/
|
|
789
|
-
|
|
758
|
+
getPlaybackRate() {
|
|
790
759
|
return this._priv_speed.getValue();
|
|
791
|
-
}
|
|
760
|
+
}
|
|
792
761
|
/**
|
|
793
762
|
* Update the playback rate of the video.
|
|
794
763
|
*
|
|
@@ -845,18 +814,18 @@ var Player = /** @class */ (function (_super) {
|
|
|
845
814
|
* @param {Number} rate
|
|
846
815
|
* @param {Object} opts
|
|
847
816
|
*/
|
|
848
|
-
|
|
817
|
+
setPlaybackRate(rate, opts) {
|
|
849
818
|
var _a;
|
|
850
819
|
if (rate !== this._priv_speed.getValue()) {
|
|
851
820
|
this._priv_speed.setValue(rate);
|
|
852
821
|
}
|
|
853
|
-
|
|
822
|
+
const preferTrickModeTracks = opts === null || opts === void 0 ? void 0 : opts.preferTrickModeTracks;
|
|
854
823
|
if (typeof preferTrickModeTracks !== "boolean") {
|
|
855
824
|
return;
|
|
856
825
|
}
|
|
857
826
|
this._priv_preferTrickModeTracks = preferTrickModeTracks;
|
|
858
|
-
|
|
859
|
-
if (!
|
|
827
|
+
const tracksStore = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore;
|
|
828
|
+
if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
|
|
860
829
|
if (preferTrickModeTracks && !tracksStore.isTrickModeEnabled()) {
|
|
861
830
|
tracksStore.enableVideoTrickModeTracks();
|
|
862
831
|
}
|
|
@@ -864,7 +833,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
864
833
|
tracksStore.disableVideoTrickModeTracks();
|
|
865
834
|
}
|
|
866
835
|
}
|
|
867
|
-
}
|
|
836
|
+
}
|
|
868
837
|
/**
|
|
869
838
|
* Returns video Representation currently considered for the current Period.
|
|
870
839
|
*
|
|
@@ -874,13 +843,13 @@ var Player = /** @class */ (function (_super) {
|
|
|
874
843
|
* when we don't know which Representation is playing.
|
|
875
844
|
* @returns {Object|null|undefined}
|
|
876
845
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
846
|
+
getVideoRepresentation() {
|
|
847
|
+
const representations = this.__priv_getCurrentRepresentations();
|
|
879
848
|
if (representations === null) {
|
|
880
849
|
return undefined;
|
|
881
850
|
}
|
|
882
851
|
return representations.video;
|
|
883
|
-
}
|
|
852
|
+
}
|
|
884
853
|
/**
|
|
885
854
|
* Returns audio Representation currently considered for the current Period.
|
|
886
855
|
*
|
|
@@ -890,51 +859,50 @@ var Player = /** @class */ (function (_super) {
|
|
|
890
859
|
* when we don't know which Representation is playing.
|
|
891
860
|
* @returns {Object|null|undefined}
|
|
892
861
|
*/
|
|
893
|
-
|
|
894
|
-
|
|
862
|
+
getAudioRepresentation() {
|
|
863
|
+
const representations = this.__priv_getCurrentRepresentations();
|
|
895
864
|
if (representations === null) {
|
|
896
865
|
return undefined;
|
|
897
866
|
}
|
|
898
867
|
return representations.audio;
|
|
899
|
-
}
|
|
868
|
+
}
|
|
900
869
|
/**
|
|
901
870
|
* Play/Resume the current video.
|
|
902
871
|
* @returns {Promise}
|
|
903
872
|
*/
|
|
904
|
-
|
|
905
|
-
var _this = this;
|
|
873
|
+
play() {
|
|
906
874
|
if (this.videoElement === null) {
|
|
907
875
|
throw new Error("Disposed player");
|
|
908
876
|
}
|
|
909
|
-
|
|
877
|
+
const playPromise = this.videoElement.play();
|
|
910
878
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
911
|
-
if (
|
|
879
|
+
if ((0, is_null_or_undefined_1.default)(playPromise) || typeof playPromise.catch !== "function") {
|
|
912
880
|
/* eslint-enable @typescript-eslint/unbound-method */
|
|
913
881
|
return Promise.resolve();
|
|
914
882
|
}
|
|
915
|
-
return playPromise.catch(
|
|
883
|
+
return playPromise.catch((error) => {
|
|
916
884
|
if (error.name === "NotAllowedError") {
|
|
917
|
-
|
|
918
|
-
|
|
885
|
+
const warning = new errors_1.MediaError("MEDIA_ERR_PLAY_NOT_ALLOWED", error.toString());
|
|
886
|
+
this.trigger("warning", warning);
|
|
919
887
|
}
|
|
920
888
|
throw error;
|
|
921
889
|
});
|
|
922
|
-
}
|
|
890
|
+
}
|
|
923
891
|
/**
|
|
924
892
|
* Pause the current video.
|
|
925
893
|
*/
|
|
926
|
-
|
|
894
|
+
pause() {
|
|
927
895
|
if (this.videoElement === null) {
|
|
928
896
|
throw new Error("Disposed player");
|
|
929
897
|
}
|
|
930
898
|
this.videoElement.pause();
|
|
931
|
-
}
|
|
899
|
+
}
|
|
932
900
|
/**
|
|
933
901
|
* Seek to a given absolute position.
|
|
934
902
|
* @param {Number|Object} time
|
|
935
903
|
* @returns {Number} - The time the player has seek to
|
|
936
904
|
*/
|
|
937
|
-
|
|
905
|
+
seekTo(time) {
|
|
938
906
|
var _a;
|
|
939
907
|
if (this.videoElement === null) {
|
|
940
908
|
throw new Error("Disposed player");
|
|
@@ -942,29 +910,29 @@ var Player = /** @class */ (function (_super) {
|
|
|
942
910
|
if (this._priv_contentInfos === null) {
|
|
943
911
|
throw new Error("player: no content loaded");
|
|
944
912
|
}
|
|
945
|
-
|
|
913
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
946
914
|
if (!isDirectFile && manifest === null) {
|
|
947
915
|
throw new Error("player: the content did not load yet");
|
|
948
916
|
}
|
|
949
|
-
|
|
917
|
+
let positionWanted;
|
|
950
918
|
if (typeof time === "number") {
|
|
951
919
|
positionWanted = time;
|
|
952
920
|
}
|
|
953
921
|
else if (typeof time === "object") {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if (!
|
|
922
|
+
const timeObj = time;
|
|
923
|
+
const currentTs = this.videoElement.currentTime;
|
|
924
|
+
if (!(0, is_null_or_undefined_1.default)(timeObj.relative)) {
|
|
957
925
|
positionWanted = currentTs + timeObj.relative;
|
|
958
926
|
}
|
|
959
|
-
else if (!
|
|
927
|
+
else if (!(0, is_null_or_undefined_1.default)(timeObj.position)) {
|
|
960
928
|
positionWanted = timeObj.position;
|
|
961
929
|
}
|
|
962
|
-
else if (!
|
|
930
|
+
else if (!(0, is_null_or_undefined_1.default)(timeObj.wallClockTime)) {
|
|
963
931
|
if (manifest !== null) {
|
|
964
932
|
positionWanted = timeObj.wallClockTime - ((_a = manifest.availabilityStartTime) !== null && _a !== void 0 ? _a : 0);
|
|
965
933
|
}
|
|
966
934
|
else if (isDirectFile && this.videoElement !== null) {
|
|
967
|
-
|
|
935
|
+
const startDate = (0, compat_1.getStartDate)(this.videoElement);
|
|
968
936
|
if (startDate !== undefined) {
|
|
969
937
|
positionWanted = timeObj.wallClockTime - startDate;
|
|
970
938
|
}
|
|
@@ -982,129 +950,129 @@ var Player = /** @class */ (function (_super) {
|
|
|
982
950
|
if (positionWanted === undefined) {
|
|
983
951
|
throw new Error("invalid time given");
|
|
984
952
|
}
|
|
985
|
-
|
|
953
|
+
log_1.default.info("API: API Seek to", positionWanted);
|
|
986
954
|
this.videoElement.currentTime = positionWanted;
|
|
987
955
|
return positionWanted;
|
|
988
|
-
}
|
|
956
|
+
}
|
|
989
957
|
/**
|
|
990
958
|
* Returns the current player's audio volume on the media element.
|
|
991
959
|
* From 0 (no audio) to 1 (maximum volume).
|
|
992
960
|
* @returns {Number}
|
|
993
961
|
*/
|
|
994
|
-
|
|
962
|
+
getVolume() {
|
|
995
963
|
if (this.videoElement === null) {
|
|
996
964
|
throw new Error("Disposed player");
|
|
997
965
|
}
|
|
998
966
|
return this.videoElement.volume;
|
|
999
|
-
}
|
|
967
|
+
}
|
|
1000
968
|
/**
|
|
1001
969
|
* Set the player's audio volume. From 0 (no volume) to 1 (maximum volume).
|
|
1002
970
|
* @param {Number} volume
|
|
1003
971
|
*/
|
|
1004
|
-
|
|
972
|
+
setVolume(volume) {
|
|
1005
973
|
if (this.videoElement === null) {
|
|
1006
974
|
throw new Error("Disposed player");
|
|
1007
975
|
}
|
|
1008
|
-
|
|
976
|
+
const videoElement = this.videoElement;
|
|
1009
977
|
if (volume !== videoElement.volume) {
|
|
1010
978
|
videoElement.volume = volume;
|
|
1011
979
|
this.trigger("volumeChange", volume);
|
|
1012
980
|
}
|
|
1013
|
-
}
|
|
981
|
+
}
|
|
1014
982
|
/**
|
|
1015
983
|
* Returns true if the volume is set to 0. false otherwise.
|
|
1016
984
|
* @returns {Boolean}
|
|
1017
985
|
*/
|
|
1018
|
-
|
|
986
|
+
isMute() {
|
|
1019
987
|
return this.getVolume() === 0;
|
|
1020
|
-
}
|
|
988
|
+
}
|
|
1021
989
|
/**
|
|
1022
990
|
* Set the volume to 0 and save current one for when unmuted.
|
|
1023
991
|
*/
|
|
1024
|
-
|
|
992
|
+
mute() {
|
|
1025
993
|
this._priv_mutedMemory = this.getVolume();
|
|
1026
994
|
this.setVolume(0);
|
|
1027
|
-
}
|
|
995
|
+
}
|
|
1028
996
|
/**
|
|
1029
997
|
* Set the volume back to when it was when mute was last called.
|
|
1030
998
|
* If the volume was set to 0, set a default volume instead (see config).
|
|
1031
999
|
*/
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1000
|
+
unMute() {
|
|
1001
|
+
const { DEFAULT_UNMUTED_VOLUME } = config_1.default.getCurrent();
|
|
1002
|
+
const vol = this.getVolume();
|
|
1035
1003
|
if (vol === 0) {
|
|
1036
1004
|
this.setVolume(this._priv_mutedMemory === 0 ? DEFAULT_UNMUTED_VOLUME :
|
|
1037
1005
|
this._priv_mutedMemory);
|
|
1038
1006
|
}
|
|
1039
|
-
}
|
|
1007
|
+
}
|
|
1040
1008
|
/**
|
|
1041
1009
|
* Set the max buffer size for the buffer behind the current position.
|
|
1042
1010
|
* Every buffer data before will be removed.
|
|
1043
1011
|
* @param {Number} depthInSeconds
|
|
1044
1012
|
*/
|
|
1045
|
-
|
|
1013
|
+
setMaxBufferBehind(depthInSeconds) {
|
|
1046
1014
|
this._priv_bufferOptions.maxBufferBehind.setValue(depthInSeconds);
|
|
1047
|
-
}
|
|
1015
|
+
}
|
|
1048
1016
|
/**
|
|
1049
1017
|
* Set the max buffer size for the buffer behind the current position.
|
|
1050
1018
|
* Every buffer data before will be removed.
|
|
1051
1019
|
* @param {Number} depthInSeconds
|
|
1052
1020
|
*/
|
|
1053
|
-
|
|
1021
|
+
setMaxBufferAhead(depthInSeconds) {
|
|
1054
1022
|
this._priv_bufferOptions.maxBufferAhead.setValue(depthInSeconds);
|
|
1055
|
-
}
|
|
1023
|
+
}
|
|
1056
1024
|
/**
|
|
1057
1025
|
* Set the max buffer size for the buffer ahead of the current position.
|
|
1058
1026
|
* The player will stop downloading chunks when this size is reached.
|
|
1059
1027
|
* @param {Number} sizeInSeconds
|
|
1060
1028
|
*/
|
|
1061
|
-
|
|
1029
|
+
setWantedBufferAhead(sizeInSeconds) {
|
|
1062
1030
|
this._priv_bufferOptions.wantedBufferAhead.setValue(sizeInSeconds);
|
|
1063
|
-
}
|
|
1031
|
+
}
|
|
1064
1032
|
/**
|
|
1065
1033
|
* Set the max buffer size the buffer should take in memory
|
|
1066
1034
|
* The player . will stop downloading chunks when this size is reached.
|
|
1067
1035
|
* @param {Number} sizeInKBytes
|
|
1068
1036
|
*/
|
|
1069
|
-
|
|
1037
|
+
setMaxVideoBufferSize(sizeInKBytes) {
|
|
1070
1038
|
this._priv_bufferOptions.maxVideoBufferSize.setValue(sizeInKBytes);
|
|
1071
|
-
}
|
|
1039
|
+
}
|
|
1072
1040
|
/**
|
|
1073
1041
|
* Returns the max buffer size for the buffer behind the current position.
|
|
1074
1042
|
* @returns {Number}
|
|
1075
1043
|
*/
|
|
1076
|
-
|
|
1044
|
+
getMaxBufferBehind() {
|
|
1077
1045
|
return this._priv_bufferOptions.maxBufferBehind.getValue();
|
|
1078
|
-
}
|
|
1046
|
+
}
|
|
1079
1047
|
/**
|
|
1080
1048
|
* Returns the max buffer size for the buffer behind the current position.
|
|
1081
1049
|
* @returns {Number}
|
|
1082
1050
|
*/
|
|
1083
|
-
|
|
1051
|
+
getMaxBufferAhead() {
|
|
1084
1052
|
return this._priv_bufferOptions.maxBufferAhead.getValue();
|
|
1085
|
-
}
|
|
1053
|
+
}
|
|
1086
1054
|
/**
|
|
1087
1055
|
* Returns the max buffer size for the buffer ahead of the current position.
|
|
1088
1056
|
* @returns {Number}
|
|
1089
1057
|
*/
|
|
1090
|
-
|
|
1058
|
+
getWantedBufferAhead() {
|
|
1091
1059
|
return this._priv_bufferOptions.wantedBufferAhead.getValue();
|
|
1092
|
-
}
|
|
1060
|
+
}
|
|
1093
1061
|
/**
|
|
1094
1062
|
* Returns the max buffer memory size for the buffer in kilobytes
|
|
1095
1063
|
* @returns {Number}
|
|
1096
1064
|
*/
|
|
1097
|
-
|
|
1065
|
+
getMaxVideoBufferSize() {
|
|
1098
1066
|
return this._priv_bufferOptions.maxVideoBufferSize.getValue();
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1067
|
+
}
|
|
1068
|
+
getCurrentPeriod() {
|
|
1101
1069
|
var _a;
|
|
1102
|
-
|
|
1103
|
-
if (
|
|
1070
|
+
const currentPeriod = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod;
|
|
1071
|
+
if ((0, is_null_or_undefined_1.default)(currentPeriod)) {
|
|
1104
1072
|
return null;
|
|
1105
1073
|
}
|
|
1106
1074
|
return { id: currentPeriod.id, start: currentPeriod.start, end: currentPeriod.end };
|
|
1107
|
-
}
|
|
1075
|
+
}
|
|
1108
1076
|
/**
|
|
1109
1077
|
* Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
|
|
1110
1078
|
* the `MediaKeySystemConfiguration` currently associated to the
|
|
@@ -1113,26 +1081,26 @@ var Player = /** @class */ (function (_super) {
|
|
|
1113
1081
|
* Returns `null` if no such capabilities is associated or if unknown.
|
|
1114
1082
|
* @returns {Object|null}
|
|
1115
1083
|
*/
|
|
1116
|
-
|
|
1084
|
+
getKeySystemConfiguration() {
|
|
1117
1085
|
if (this.videoElement === null) {
|
|
1118
1086
|
throw new Error("Disposed player");
|
|
1119
1087
|
}
|
|
1120
|
-
|
|
1088
|
+
const values = (0, decrypt_1.getKeySystemConfiguration)(this.videoElement);
|
|
1121
1089
|
if (values === null) {
|
|
1122
1090
|
return null;
|
|
1123
1091
|
}
|
|
1124
1092
|
return { keySystem: values[0], configuration: values[1] };
|
|
1125
|
-
}
|
|
1093
|
+
}
|
|
1126
1094
|
/**
|
|
1127
1095
|
* Returns the list of available Periods for which the current audio, video or
|
|
1128
1096
|
* text track can now be changed.
|
|
1129
1097
|
* @returns {Array.<Object>}
|
|
1130
1098
|
*/
|
|
1131
|
-
|
|
1099
|
+
getAvailablePeriods() {
|
|
1132
1100
|
if (this._priv_contentInfos === null) {
|
|
1133
1101
|
return [];
|
|
1134
1102
|
}
|
|
1135
|
-
|
|
1103
|
+
const { isDirectFile, tracksStore } = this._priv_contentInfos;
|
|
1136
1104
|
if (isDirectFile) {
|
|
1137
1105
|
return [];
|
|
1138
1106
|
}
|
|
@@ -1140,126 +1108,126 @@ var Player = /** @class */ (function (_super) {
|
|
|
1140
1108
|
return [];
|
|
1141
1109
|
}
|
|
1142
1110
|
return tracksStore.getAvailablePeriods().slice();
|
|
1143
|
-
}
|
|
1111
|
+
}
|
|
1144
1112
|
/**
|
|
1145
1113
|
* Returns every available audio tracks for a given Period - or the current
|
|
1146
1114
|
* one if no `periodId` is given.
|
|
1147
1115
|
* @param {string|undefined} [periodId]
|
|
1148
1116
|
* @returns {Array.<Object>}
|
|
1149
1117
|
*/
|
|
1150
|
-
|
|
1118
|
+
getAvailableAudioTracks(periodId) {
|
|
1151
1119
|
var _a;
|
|
1152
1120
|
if (this._priv_contentInfos === null) {
|
|
1153
1121
|
return [];
|
|
1154
1122
|
}
|
|
1155
|
-
|
|
1123
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1156
1124
|
if (isDirectFile) {
|
|
1157
1125
|
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableAudioTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1158
1126
|
}
|
|
1159
|
-
return this._priv_callTracksStoreGetterSetter(periodId, [],
|
|
1160
|
-
}
|
|
1127
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableAudioTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1128
|
+
}
|
|
1161
1129
|
/**
|
|
1162
1130
|
* Returns every available text tracks for a given Period - or the current
|
|
1163
1131
|
* one if no `periodId` is given.
|
|
1164
1132
|
* @param {string|undefined} [periodId]
|
|
1165
1133
|
* @returns {Array.<Object>}
|
|
1166
1134
|
*/
|
|
1167
|
-
|
|
1135
|
+
getAvailableTextTracks(periodId) {
|
|
1168
1136
|
var _a;
|
|
1169
1137
|
if (this._priv_contentInfos === null) {
|
|
1170
1138
|
return [];
|
|
1171
1139
|
}
|
|
1172
|
-
|
|
1140
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1173
1141
|
if (isDirectFile) {
|
|
1174
1142
|
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableTextTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1175
1143
|
}
|
|
1176
|
-
return this._priv_callTracksStoreGetterSetter(periodId, [],
|
|
1177
|
-
}
|
|
1144
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableTextTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1145
|
+
}
|
|
1178
1146
|
/**
|
|
1179
1147
|
* Returns every available video tracks for the current Period.
|
|
1180
1148
|
* @param {string|undefined} [periodId]
|
|
1181
1149
|
* @returns {Array.<Object>}
|
|
1182
1150
|
*/
|
|
1183
|
-
|
|
1151
|
+
getAvailableVideoTracks(periodId) {
|
|
1184
1152
|
var _a;
|
|
1185
1153
|
if (this._priv_contentInfos === null) {
|
|
1186
1154
|
return [];
|
|
1187
1155
|
}
|
|
1188
|
-
|
|
1156
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1189
1157
|
if (isDirectFile) {
|
|
1190
1158
|
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableVideoTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1191
1159
|
}
|
|
1192
|
-
return this._priv_callTracksStoreGetterSetter(periodId, [],
|
|
1193
|
-
}
|
|
1160
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableVideoTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1161
|
+
}
|
|
1194
1162
|
/**
|
|
1195
1163
|
* Returns currently chosen audio language for the current Period.
|
|
1196
1164
|
* @param {string|undefined} [periodId]
|
|
1197
1165
|
* @returns {Object|null|undefined}
|
|
1198
1166
|
*/
|
|
1199
|
-
|
|
1167
|
+
getAudioTrack(periodId) {
|
|
1200
1168
|
if (this._priv_contentInfos === null) {
|
|
1201
1169
|
return undefined;
|
|
1202
1170
|
}
|
|
1203
|
-
|
|
1171
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1204
1172
|
if (isDirectFile) {
|
|
1205
1173
|
if (mediaElementTracksStore === null) {
|
|
1206
1174
|
return undefined;
|
|
1207
1175
|
}
|
|
1208
1176
|
return mediaElementTracksStore.getChosenAudioTrack();
|
|
1209
1177
|
}
|
|
1210
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1211
|
-
}
|
|
1178
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenAudioTrack(periodRef));
|
|
1179
|
+
}
|
|
1212
1180
|
/**
|
|
1213
1181
|
* Returns currently chosen subtitle for the current Period.
|
|
1214
1182
|
* @param {string|undefined} [periodId]
|
|
1215
1183
|
* @returns {Object|null|undefined}
|
|
1216
1184
|
*/
|
|
1217
|
-
|
|
1185
|
+
getTextTrack(periodId) {
|
|
1218
1186
|
if (this._priv_contentInfos === null) {
|
|
1219
1187
|
return undefined;
|
|
1220
1188
|
}
|
|
1221
|
-
|
|
1189
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1222
1190
|
if (isDirectFile) {
|
|
1223
1191
|
if (mediaElementTracksStore === null) {
|
|
1224
1192
|
return undefined;
|
|
1225
1193
|
}
|
|
1226
1194
|
return mediaElementTracksStore.getChosenTextTrack();
|
|
1227
1195
|
}
|
|
1228
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1229
|
-
}
|
|
1196
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenTextTrack(periodRef));
|
|
1197
|
+
}
|
|
1230
1198
|
/**
|
|
1231
1199
|
* Returns currently chosen video track for the current Period.
|
|
1232
1200
|
* @param {string|undefined} [periodId]
|
|
1233
1201
|
* @returns {Object|null|undefined}
|
|
1234
1202
|
*/
|
|
1235
|
-
|
|
1203
|
+
getVideoTrack(periodId) {
|
|
1236
1204
|
if (this._priv_contentInfos === null) {
|
|
1237
1205
|
return undefined;
|
|
1238
1206
|
}
|
|
1239
|
-
|
|
1207
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1240
1208
|
if (isDirectFile) {
|
|
1241
1209
|
if (mediaElementTracksStore === null) {
|
|
1242
1210
|
return undefined;
|
|
1243
1211
|
}
|
|
1244
1212
|
return mediaElementTracksStore.getChosenVideoTrack();
|
|
1245
1213
|
}
|
|
1246
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1247
|
-
}
|
|
1214
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenVideoTrack(periodRef));
|
|
1215
|
+
}
|
|
1248
1216
|
/**
|
|
1249
1217
|
* Update the audio language for the current Period.
|
|
1250
1218
|
* @param {string | object} arg
|
|
1251
1219
|
* @throws Error - the current content has no TracksStore.
|
|
1252
1220
|
* @throws Error - the given id is linked to no audio track.
|
|
1253
1221
|
*/
|
|
1254
|
-
|
|
1222
|
+
setAudioTrack(arg) {
|
|
1255
1223
|
var _a;
|
|
1256
1224
|
if (this._priv_contentInfos === null) {
|
|
1257
1225
|
throw new Error("No content loaded");
|
|
1258
1226
|
}
|
|
1259
|
-
|
|
1227
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1260
1228
|
if (isDirectFile) {
|
|
1261
1229
|
try {
|
|
1262
|
-
|
|
1230
|
+
const audioId = typeof arg === "string" ? arg :
|
|
1263
1231
|
arg.trackId;
|
|
1264
1232
|
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setAudioTrackById(audioId);
|
|
1265
1233
|
return;
|
|
@@ -1268,10 +1236,10 @@ var Player = /** @class */ (function (_super) {
|
|
|
1268
1236
|
throw new Error("player: unknown audio track");
|
|
1269
1237
|
}
|
|
1270
1238
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1239
|
+
let periodId;
|
|
1240
|
+
let trackId;
|
|
1241
|
+
let switchingMode;
|
|
1242
|
+
let reprsToLock = null;
|
|
1275
1243
|
if (typeof arg === "string") {
|
|
1276
1244
|
trackId = arg;
|
|
1277
1245
|
}
|
|
@@ -1281,24 +1249,22 @@ var Player = /** @class */ (function (_super) {
|
|
|
1281
1249
|
switchingMode = arg.switchingMode;
|
|
1282
1250
|
reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
|
|
1283
1251
|
}
|
|
1284
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1285
|
-
|
|
1286
|
-
});
|
|
1287
|
-
};
|
|
1252
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setAudioTrack(periodRef, trackId, switchingMode, reprsToLock));
|
|
1253
|
+
}
|
|
1288
1254
|
/**
|
|
1289
1255
|
* Update the text language for the current Period.
|
|
1290
1256
|
* @param {string | Object} arg
|
|
1291
1257
|
* @throws Error - the current content has no TracksStore.
|
|
1292
1258
|
* @throws Error - the given id is linked to no text track.
|
|
1293
1259
|
*/
|
|
1294
|
-
|
|
1260
|
+
setTextTrack(arg) {
|
|
1295
1261
|
if (this._priv_contentInfos === null) {
|
|
1296
1262
|
throw new Error("No content loaded");
|
|
1297
1263
|
}
|
|
1298
|
-
|
|
1264
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1299
1265
|
if (isDirectFile) {
|
|
1300
1266
|
try {
|
|
1301
|
-
|
|
1267
|
+
const textId = typeof arg === "string" ? arg :
|
|
1302
1268
|
arg.trackId;
|
|
1303
1269
|
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setTextTrackById(textId);
|
|
1304
1270
|
return;
|
|
@@ -1307,8 +1273,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
1307
1273
|
throw new Error("player: unknown text track");
|
|
1308
1274
|
}
|
|
1309
1275
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1276
|
+
let periodId;
|
|
1277
|
+
let trackId;
|
|
1312
1278
|
if (typeof arg === "string") {
|
|
1313
1279
|
trackId = arg;
|
|
1314
1280
|
}
|
|
@@ -1316,38 +1282,38 @@ var Player = /** @class */ (function (_super) {
|
|
|
1316
1282
|
trackId = arg.trackId;
|
|
1317
1283
|
periodId = arg.periodId;
|
|
1318
1284
|
}
|
|
1319
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1320
|
-
}
|
|
1285
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setTextTrack(periodRef, trackId));
|
|
1286
|
+
}
|
|
1321
1287
|
/**
|
|
1322
1288
|
* Disable subtitles for the current content.
|
|
1323
1289
|
* @param {string|undefined} [periodId]
|
|
1324
1290
|
*/
|
|
1325
|
-
|
|
1291
|
+
disableTextTrack(periodId) {
|
|
1326
1292
|
if (this._priv_contentInfos === null) {
|
|
1327
1293
|
return;
|
|
1328
1294
|
}
|
|
1329
|
-
|
|
1295
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1330
1296
|
if (isDirectFile) {
|
|
1331
1297
|
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.disableTextTrack();
|
|
1332
1298
|
return;
|
|
1333
1299
|
}
|
|
1334
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1335
|
-
}
|
|
1300
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.disableTrack(periodRef, "text"));
|
|
1301
|
+
}
|
|
1336
1302
|
/**
|
|
1337
1303
|
* Update the video track for the current Period.
|
|
1338
1304
|
* @param {string | Object} arg
|
|
1339
1305
|
* @throws Error - the current content has no TracksStore.
|
|
1340
1306
|
* @throws Error - the given id is linked to no video track.
|
|
1341
1307
|
*/
|
|
1342
|
-
|
|
1308
|
+
setVideoTrack(arg) {
|
|
1343
1309
|
var _a;
|
|
1344
1310
|
if (this._priv_contentInfos === null) {
|
|
1345
1311
|
throw new Error("No content loaded");
|
|
1346
1312
|
}
|
|
1347
|
-
|
|
1313
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1348
1314
|
if (isDirectFile) {
|
|
1349
1315
|
try {
|
|
1350
|
-
|
|
1316
|
+
const videoId = typeof arg === "string" ? arg :
|
|
1351
1317
|
arg.trackId;
|
|
1352
1318
|
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setVideoTrackById(videoId);
|
|
1353
1319
|
return;
|
|
@@ -1356,10 +1322,10 @@ var Player = /** @class */ (function (_super) {
|
|
|
1356
1322
|
throw new Error("player: unknown video track");
|
|
1357
1323
|
}
|
|
1358
1324
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1325
|
+
let periodId;
|
|
1326
|
+
let trackId;
|
|
1327
|
+
let switchingMode;
|
|
1328
|
+
let reprsToLock = null;
|
|
1363
1329
|
if (typeof arg === "string") {
|
|
1364
1330
|
trackId = arg;
|
|
1365
1331
|
}
|
|
@@ -1369,35 +1335,33 @@ var Player = /** @class */ (function (_super) {
|
|
|
1369
1335
|
switchingMode = arg.switchingMode;
|
|
1370
1336
|
reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
|
|
1371
1337
|
}
|
|
1372
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1373
|
-
|
|
1374
|
-
});
|
|
1375
|
-
};
|
|
1338
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setVideoTrack(periodRef, trackId, switchingMode, reprsToLock));
|
|
1339
|
+
}
|
|
1376
1340
|
/**
|
|
1377
1341
|
* Disable video track for the current content.
|
|
1378
1342
|
* @param {string|undefined} [periodId]
|
|
1379
1343
|
*/
|
|
1380
|
-
|
|
1344
|
+
disableVideoTrack(periodId) {
|
|
1381
1345
|
if (this._priv_contentInfos === null) {
|
|
1382
1346
|
return;
|
|
1383
1347
|
}
|
|
1384
|
-
|
|
1348
|
+
const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
|
|
1385
1349
|
if (isDirectFile && mediaElementTracksStore !== null) {
|
|
1386
1350
|
return mediaElementTracksStore.disableVideoTrack();
|
|
1387
1351
|
}
|
|
1388
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1352
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.disableTrack(periodRef, "video"));
|
|
1353
|
+
}
|
|
1354
|
+
lockVideoRepresentations(arg) {
|
|
1391
1355
|
if (this._priv_contentInfos === null) {
|
|
1392
1356
|
throw new Error("No content loaded");
|
|
1393
1357
|
}
|
|
1394
|
-
|
|
1358
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1395
1359
|
if (isDirectFile) {
|
|
1396
1360
|
throw new Error("Cannot lock video Representations in directfile mode.");
|
|
1397
1361
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1362
|
+
let repsId;
|
|
1363
|
+
let periodId;
|
|
1364
|
+
let switchingMode;
|
|
1401
1365
|
if (Array.isArray(arg)) {
|
|
1402
1366
|
repsId = arg;
|
|
1403
1367
|
periodId = undefined;
|
|
@@ -1407,21 +1371,20 @@ var Player = /** @class */ (function (_super) {
|
|
|
1407
1371
|
periodId = arg.periodId;
|
|
1408
1372
|
switchingMode = arg.switchingMode;
|
|
1409
1373
|
}
|
|
1410
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
Player.prototype.lockAudioRepresentations = function (arg) {
|
|
1374
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.lockVideoRepresentations(periodRef, { representations: repsId,
|
|
1375
|
+
switchingMode }));
|
|
1376
|
+
}
|
|
1377
|
+
lockAudioRepresentations(arg) {
|
|
1415
1378
|
if (this._priv_contentInfos === null) {
|
|
1416
1379
|
throw new Error("No content loaded");
|
|
1417
1380
|
}
|
|
1418
|
-
|
|
1381
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1419
1382
|
if (isDirectFile) {
|
|
1420
1383
|
throw new Error("Cannot lock audio Representations in directfile mode.");
|
|
1421
1384
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1385
|
+
let repsId;
|
|
1386
|
+
let periodId;
|
|
1387
|
+
let switchingMode;
|
|
1425
1388
|
if (Array.isArray(arg)) {
|
|
1426
1389
|
repsId = arg;
|
|
1427
1390
|
periodId = undefined;
|
|
@@ -1431,76 +1394,75 @@ var Player = /** @class */ (function (_super) {
|
|
|
1431
1394
|
periodId = arg.periodId;
|
|
1432
1395
|
switchingMode = arg.switchingMode;
|
|
1433
1396
|
}
|
|
1434
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
Player.prototype.getLockedVideoRepresentations = function (periodId) {
|
|
1397
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.lockAudioRepresentations(periodRef, { representations: repsId,
|
|
1398
|
+
switchingMode }));
|
|
1399
|
+
}
|
|
1400
|
+
getLockedVideoRepresentations(periodId) {
|
|
1439
1401
|
if (this._priv_contentInfos === null) {
|
|
1440
1402
|
return null;
|
|
1441
1403
|
}
|
|
1442
|
-
|
|
1404
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1443
1405
|
if (isDirectFile) {
|
|
1444
1406
|
return null;
|
|
1445
1407
|
}
|
|
1446
|
-
return this._priv_callTracksStoreGetterSetter(periodId, null,
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1408
|
+
return this._priv_callTracksStoreGetterSetter(periodId, null, (tcm, periodRef) => tcm.getLockedVideoRepresentations(periodRef));
|
|
1409
|
+
}
|
|
1410
|
+
getLockedAudioRepresentations(periodId) {
|
|
1449
1411
|
if (this._priv_contentInfos === null) {
|
|
1450
1412
|
return null;
|
|
1451
1413
|
}
|
|
1452
|
-
|
|
1414
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1453
1415
|
if (isDirectFile) {
|
|
1454
1416
|
return null;
|
|
1455
1417
|
}
|
|
1456
|
-
return this._priv_callTracksStoreGetterSetter(periodId, null,
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1418
|
+
return this._priv_callTracksStoreGetterSetter(periodId, null, (tcm, periodRef) => tcm.getLockedAudioRepresentations(periodRef));
|
|
1419
|
+
}
|
|
1420
|
+
unlockVideoRepresentations(periodId) {
|
|
1459
1421
|
if (this._priv_contentInfos === null) {
|
|
1460
1422
|
return;
|
|
1461
1423
|
}
|
|
1462
|
-
|
|
1424
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1463
1425
|
if (isDirectFile) {
|
|
1464
1426
|
return;
|
|
1465
1427
|
}
|
|
1466
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1428
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.unlockVideoRepresentations(periodRef));
|
|
1429
|
+
}
|
|
1430
|
+
unlockAudioRepresentations(periodId) {
|
|
1469
1431
|
if (this._priv_contentInfos === null) {
|
|
1470
1432
|
return;
|
|
1471
1433
|
}
|
|
1472
|
-
|
|
1434
|
+
const { isDirectFile } = this._priv_contentInfos;
|
|
1473
1435
|
if (isDirectFile) {
|
|
1474
1436
|
return;
|
|
1475
1437
|
}
|
|
1476
|
-
return this._priv_callTracksStoreGetterSetter(periodId, undefined,
|
|
1477
|
-
}
|
|
1438
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.unlockAudioRepresentations(periodRef));
|
|
1439
|
+
}
|
|
1478
1440
|
/**
|
|
1479
1441
|
* Get minimum seek-able position.
|
|
1480
1442
|
* @returns {number}
|
|
1481
1443
|
*/
|
|
1482
|
-
|
|
1444
|
+
getMinimumPosition() {
|
|
1483
1445
|
if (this._priv_contentInfos === null) {
|
|
1484
1446
|
return null;
|
|
1485
1447
|
}
|
|
1486
1448
|
if (this._priv_contentInfos.isDirectFile) {
|
|
1487
1449
|
return 0;
|
|
1488
1450
|
}
|
|
1489
|
-
|
|
1451
|
+
const { manifest } = this._priv_contentInfos;
|
|
1490
1452
|
if (manifest !== null) {
|
|
1491
1453
|
return manifest.getMinimumSafePosition();
|
|
1492
1454
|
}
|
|
1493
1455
|
return null;
|
|
1494
|
-
}
|
|
1456
|
+
}
|
|
1495
1457
|
/**
|
|
1496
1458
|
* Get maximum seek-able position.
|
|
1497
1459
|
* @returns {number}
|
|
1498
1460
|
*/
|
|
1499
|
-
|
|
1461
|
+
getMaximumPosition() {
|
|
1500
1462
|
if (this._priv_contentInfos === null) {
|
|
1501
1463
|
return null;
|
|
1502
1464
|
}
|
|
1503
|
-
|
|
1465
|
+
const { isDirectFile, manifest } = this._priv_contentInfos;
|
|
1504
1466
|
if (isDirectFile) {
|
|
1505
1467
|
if (this.videoElement === null) {
|
|
1506
1468
|
throw new Error("Disposed player");
|
|
@@ -1514,7 +1476,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
1514
1476
|
return manifest.getMaximumSafePosition();
|
|
1515
1477
|
}
|
|
1516
1478
|
return null;
|
|
1517
|
-
}
|
|
1479
|
+
}
|
|
1518
1480
|
// ---- Undocumented Private methods. ----
|
|
1519
1481
|
//
|
|
1520
1482
|
// Those methods are just here either to allow some tools relying on the
|
|
@@ -1529,17 +1491,17 @@ var Player = /** @class */ (function (_super) {
|
|
|
1529
1491
|
* @param {string} bufferType
|
|
1530
1492
|
* @returns {Array.<Object>|null}
|
|
1531
1493
|
*/
|
|
1532
|
-
|
|
1494
|
+
__priv_getSegmentBufferContent(bufferType) {
|
|
1533
1495
|
if (this._priv_contentInfos === null ||
|
|
1534
1496
|
this._priv_contentInfos.segmentBuffersStore === null) {
|
|
1535
1497
|
return null;
|
|
1536
1498
|
}
|
|
1537
|
-
|
|
1499
|
+
const segmentBufferStatus = this._priv_contentInfos
|
|
1538
1500
|
.segmentBuffersStore.getStatus(bufferType);
|
|
1539
1501
|
return segmentBufferStatus.type === "initialized" ?
|
|
1540
1502
|
segmentBufferStatus.value.getInventory() :
|
|
1541
1503
|
null;
|
|
1542
|
-
}
|
|
1504
|
+
}
|
|
1543
1505
|
/**
|
|
1544
1506
|
* /!\ For tools use only! Do not touch!
|
|
1545
1507
|
*
|
|
@@ -1548,46 +1510,45 @@ var Player = /** @class */ (function (_super) {
|
|
|
1548
1510
|
* @returns {Manifest|null} - The current Manifest (`null` when not known).
|
|
1549
1511
|
*/
|
|
1550
1512
|
// TODO remove the need for that public method
|
|
1551
|
-
|
|
1513
|
+
__priv_getManifest() {
|
|
1552
1514
|
if (this._priv_contentInfos === null) {
|
|
1553
1515
|
return null;
|
|
1554
1516
|
}
|
|
1555
1517
|
return this._priv_contentInfos.manifest;
|
|
1556
|
-
}
|
|
1518
|
+
}
|
|
1557
1519
|
// TODO remove the need for that public method
|
|
1558
|
-
|
|
1520
|
+
__priv_getCurrentAdaptation() {
|
|
1559
1521
|
if (this._priv_contentInfos === null) {
|
|
1560
1522
|
return null;
|
|
1561
1523
|
}
|
|
1562
|
-
|
|
1524
|
+
const { currentPeriod, activeAdaptations } = this._priv_contentInfos;
|
|
1563
1525
|
if (currentPeriod === null ||
|
|
1564
1526
|
activeAdaptations === null ||
|
|
1565
|
-
|
|
1527
|
+
(0, is_null_or_undefined_1.default)(activeAdaptations[currentPeriod.id])) {
|
|
1566
1528
|
return null;
|
|
1567
1529
|
}
|
|
1568
1530
|
return activeAdaptations[currentPeriod.id];
|
|
1569
|
-
}
|
|
1531
|
+
}
|
|
1570
1532
|
// TODO remove the need for that public method
|
|
1571
|
-
|
|
1533
|
+
__priv_getCurrentRepresentations() {
|
|
1572
1534
|
if (this._priv_contentInfos === null) {
|
|
1573
1535
|
return null;
|
|
1574
1536
|
}
|
|
1575
|
-
|
|
1537
|
+
const { currentPeriod, activeRepresentations } = this._priv_contentInfos;
|
|
1576
1538
|
if (currentPeriod === null ||
|
|
1577
1539
|
activeRepresentations === null ||
|
|
1578
|
-
|
|
1540
|
+
(0, is_null_or_undefined_1.default)(activeRepresentations[currentPeriod.id])) {
|
|
1579
1541
|
return null;
|
|
1580
1542
|
}
|
|
1581
1543
|
return activeRepresentations[currentPeriod.id];
|
|
1582
|
-
}
|
|
1544
|
+
}
|
|
1583
1545
|
// ---- Private methods ----
|
|
1584
1546
|
/**
|
|
1585
1547
|
* Reset all state properties relative to a playing content.
|
|
1586
1548
|
*/
|
|
1587
|
-
|
|
1588
|
-
var _this = this;
|
|
1549
|
+
_priv_cleanUpCurrentContentState() {
|
|
1589
1550
|
var _a, _b, _c, _d;
|
|
1590
|
-
|
|
1551
|
+
log_1.default.debug("Locking `contentLock` to clean-up the current content.");
|
|
1591
1552
|
// lock playback of new contents while cleaning up is pending
|
|
1592
1553
|
this._priv_contentLock.setValue(true);
|
|
1593
1554
|
(_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -1595,18 +1556,18 @@ var Player = /** @class */ (function (_super) {
|
|
|
1595
1556
|
this._priv_contentInfos = null;
|
|
1596
1557
|
this._priv_contentEventsMemory = {};
|
|
1597
1558
|
// DRM-related clean-up
|
|
1598
|
-
|
|
1599
|
-
if (
|
|
1600
|
-
|
|
1601
|
-
|
|
1559
|
+
const freeUpContentLock = () => {
|
|
1560
|
+
if (this.videoElement !== null) { // If not disposed
|
|
1561
|
+
log_1.default.debug("Unlocking `contentLock`. Next content can begin.");
|
|
1562
|
+
this._priv_contentLock.setValue(false);
|
|
1602
1563
|
}
|
|
1603
1564
|
};
|
|
1604
|
-
if (!
|
|
1605
|
-
clearOnStop(this.videoElement).then(
|
|
1606
|
-
|
|
1565
|
+
if (!(0, is_null_or_undefined_1.default)(this.videoElement)) {
|
|
1566
|
+
(0, decrypt_1.clearOnStop)(this.videoElement).then(() => {
|
|
1567
|
+
log_1.default.debug("API: DRM session cleaned-up with success!");
|
|
1607
1568
|
freeUpContentLock();
|
|
1608
|
-
},
|
|
1609
|
-
|
|
1569
|
+
}, (err) => {
|
|
1570
|
+
log_1.default.error("API: An error arised when trying to clean-up the DRM session:" +
|
|
1610
1571
|
(err instanceof Error ? err.toString() :
|
|
1611
1572
|
"Unknown Error"));
|
|
1612
1573
|
freeUpContentLock();
|
|
@@ -1615,95 +1576,93 @@ var Player = /** @class */ (function (_super) {
|
|
|
1615
1576
|
else {
|
|
1616
1577
|
freeUpContentLock();
|
|
1617
1578
|
}
|
|
1618
|
-
}
|
|
1579
|
+
}
|
|
1619
1580
|
/**
|
|
1620
1581
|
* Triggered when the Manifest has been loaded for the current content.
|
|
1621
1582
|
* Initialize various private properties and emit initial event.
|
|
1622
1583
|
* @param {Object} contentInfos
|
|
1623
1584
|
* @param {Object} manifest
|
|
1624
1585
|
*/
|
|
1625
|
-
|
|
1626
|
-
var _this = this;
|
|
1586
|
+
_priv_onManifestReady(contentInfos, manifest) {
|
|
1627
1587
|
var _a;
|
|
1628
1588
|
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1629
1589
|
return; // Event for another content
|
|
1630
1590
|
}
|
|
1631
1591
|
contentInfos.manifest = manifest;
|
|
1632
1592
|
this._priv_reloadingMetadata.manifest = manifest;
|
|
1633
|
-
|
|
1593
|
+
const tracksStore = new tracks_store_1.default({
|
|
1634
1594
|
preferTrickModeTracks: this._priv_preferTrickModeTracks,
|
|
1635
1595
|
defaultAudioTrackSwitchingMode: contentInfos.defaultAudioTrackSwitchingMode,
|
|
1636
1596
|
});
|
|
1637
1597
|
contentInfos.tracksStore = tracksStore;
|
|
1638
|
-
tracksStore.addEventListener("newAvailablePeriods",
|
|
1639
|
-
|
|
1598
|
+
tracksStore.addEventListener("newAvailablePeriods", (p) => {
|
|
1599
|
+
this.trigger("newAvailablePeriods", p);
|
|
1640
1600
|
});
|
|
1641
|
-
tracksStore.addEventListener("brokenRepresentationsLock",
|
|
1642
|
-
|
|
1601
|
+
tracksStore.addEventListener("brokenRepresentationsLock", (e) => {
|
|
1602
|
+
this.trigger("brokenRepresentationsLock", e);
|
|
1643
1603
|
});
|
|
1644
|
-
tracksStore.addEventListener("trackUpdate",
|
|
1604
|
+
tracksStore.addEventListener("trackUpdate", (e) => {
|
|
1645
1605
|
var _a, _b;
|
|
1646
|
-
|
|
1647
|
-
|
|
1606
|
+
this.trigger("trackUpdate", e);
|
|
1607
|
+
const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
|
|
1648
1608
|
if (e.reason === "no-playable-representation" &&
|
|
1649
1609
|
e.period.id === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id)) {
|
|
1650
|
-
|
|
1610
|
+
this._priv_onAvailableTracksMayHaveChanged(e.trackType);
|
|
1651
1611
|
}
|
|
1652
1612
|
});
|
|
1653
|
-
contentInfos.tracksStore.addEventListener("warning",
|
|
1654
|
-
|
|
1613
|
+
contentInfos.tracksStore.addEventListener("warning", (err) => {
|
|
1614
|
+
this.trigger("warning", err);
|
|
1655
1615
|
});
|
|
1656
|
-
contentInfos.tracksStore.addEventListener("error",
|
|
1657
|
-
|
|
1616
|
+
contentInfos.tracksStore.addEventListener("error", (err) => {
|
|
1617
|
+
this._priv_onFatalError(err, contentInfos);
|
|
1658
1618
|
});
|
|
1659
1619
|
contentInfos.tracksStore.updatePeriodList(manifest);
|
|
1660
|
-
manifest.addEventListener("manifestUpdate",
|
|
1620
|
+
manifest.addEventListener("manifestUpdate", (updates) => {
|
|
1661
1621
|
var _a, _b, _c;
|
|
1662
1622
|
// Update the tracks chosen if it changed
|
|
1663
|
-
if (!
|
|
1623
|
+
if (!(0, is_null_or_undefined_1.default)(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
|
|
1664
1624
|
contentInfos.tracksStore.updatePeriodList(manifest);
|
|
1665
1625
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
if (currentPeriod === undefined ||
|
|
1626
|
+
const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
|
|
1627
|
+
const currTracksStore = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
|
|
1628
|
+
if (currentPeriod === undefined || (0, is_null_or_undefined_1.default)(currTracksStore)) {
|
|
1669
1629
|
return;
|
|
1670
1630
|
}
|
|
1671
|
-
for (
|
|
1672
|
-
var update = _d[_i];
|
|
1631
|
+
for (const update of updates.updatedPeriods) {
|
|
1673
1632
|
if (update.period.id === currentPeriod.id) {
|
|
1674
1633
|
if (update.result.addedAdaptations.length > 0 ||
|
|
1675
1634
|
update.result.removedAdaptations.length > 0) {
|
|
1676
1635
|
// We might have new (or less) tracks, send events just to be sure
|
|
1677
|
-
|
|
1636
|
+
const periodRef = currTracksStore.getPeriodObjectFromPeriod(currentPeriod);
|
|
1678
1637
|
if (periodRef === undefined) {
|
|
1679
1638
|
return;
|
|
1680
1639
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1640
|
+
this._priv_onAvailableTracksMayHaveChanged("audio");
|
|
1641
|
+
this._priv_onAvailableTracksMayHaveChanged("text");
|
|
1642
|
+
this._priv_onAvailableTracksMayHaveChanged("video");
|
|
1684
1643
|
}
|
|
1685
1644
|
}
|
|
1686
1645
|
return;
|
|
1687
1646
|
}
|
|
1688
1647
|
}, contentInfos.currentContentCanceller.signal);
|
|
1689
|
-
manifest.addEventListener("decipherabilityUpdate",
|
|
1648
|
+
manifest.addEventListener("decipherabilityUpdate", (elts) => {
|
|
1690
1649
|
/**
|
|
1691
1650
|
* Array of tuples only including once the Period/Track combination, and
|
|
1692
1651
|
* only when it concerns the currently-selected track.
|
|
1693
1652
|
*/
|
|
1694
|
-
|
|
1653
|
+
const periodsAndTrackTypes = elts.reduce((acc, elt) => {
|
|
1695
1654
|
var _a, _b, _c;
|
|
1696
|
-
|
|
1697
|
-
x[1] === elt.adaptation.type
|
|
1655
|
+
const isFound = (0, array_find_1.default)(acc, (x) => x[0].id === elt.period.id &&
|
|
1656
|
+
x[1] === elt.adaptation.type) === undefined;
|
|
1698
1657
|
if (!isFound) {
|
|
1699
1658
|
// Only consider the currently-selected tracks.
|
|
1700
1659
|
// NOTE: Maybe there's room for optimizations? Unclear.
|
|
1701
|
-
|
|
1660
|
+
const tStore = contentInfos.tracksStore;
|
|
1702
1661
|
if (tStore === null) {
|
|
1703
1662
|
return acc;
|
|
1704
1663
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1664
|
+
let isCurrent = false;
|
|
1665
|
+
const periodRef = tStore.getPeriodObjectFromPeriod(elt.period);
|
|
1707
1666
|
if (periodRef === undefined) {
|
|
1708
1667
|
return acc;
|
|
1709
1668
|
}
|
|
@@ -1727,12 +1686,11 @@ var Player = /** @class */ (function (_super) {
|
|
|
1727
1686
|
}
|
|
1728
1687
|
return acc;
|
|
1729
1688
|
}, []);
|
|
1730
|
-
for (
|
|
1731
|
-
|
|
1732
|
-
_this._priv_triggerEventIfNotStopped("representationListUpdate", { period: period, trackType: trackType, reason: "decipherability-update" }, contentInfos.currentContentCanceller.signal);
|
|
1689
|
+
for (const [period, trackType] of periodsAndTrackTypes) {
|
|
1690
|
+
this._priv_triggerEventIfNotStopped("representationListUpdate", { period, trackType, reason: "decipherability-update" }, contentInfos.currentContentCanceller.signal);
|
|
1733
1691
|
}
|
|
1734
1692
|
}, contentInfos.currentContentCanceller.signal);
|
|
1735
|
-
}
|
|
1693
|
+
}
|
|
1736
1694
|
/**
|
|
1737
1695
|
* Triggered each times the current Period Changed.
|
|
1738
1696
|
* Store and emit initial state for the Period.
|
|
@@ -1740,14 +1698,13 @@ var Player = /** @class */ (function (_super) {
|
|
|
1740
1698
|
* @param {Object} contentInfos
|
|
1741
1699
|
* @param {Object} periodInfo
|
|
1742
1700
|
*/
|
|
1743
|
-
|
|
1744
|
-
var _b, _c, _d, _e, _f
|
|
1745
|
-
|
|
1746
|
-
if (contentInfos.contentId !== ((_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.contentId)) {
|
|
1701
|
+
_priv_onActivePeriodChanged(contentInfos, { period }) {
|
|
1702
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1703
|
+
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1747
1704
|
return; // Event for another content
|
|
1748
1705
|
}
|
|
1749
1706
|
contentInfos.currentPeriod = period;
|
|
1750
|
-
|
|
1707
|
+
const cancelSignal = contentInfos.currentContentCanceller.signal;
|
|
1751
1708
|
if (this._priv_contentEventsMemory.periodChange !== period) {
|
|
1752
1709
|
this._priv_contentEventsMemory.periodChange = period;
|
|
1753
1710
|
this._priv_triggerEventIfNotStopped("periodChange", { start: period.start,
|
|
@@ -1757,16 +1714,16 @@ var Player = /** @class */ (function (_super) {
|
|
|
1757
1714
|
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", this.getAvailableAudioTracks(), cancelSignal);
|
|
1758
1715
|
this._priv_triggerEventIfNotStopped("availableTextTracksChange", this.getAvailableTextTracks(), cancelSignal);
|
|
1759
1716
|
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", this.getAvailableVideoTracks(), cancelSignal);
|
|
1760
|
-
|
|
1717
|
+
const tracksStore = (_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.tracksStore;
|
|
1761
1718
|
// Emit initial events for the Period
|
|
1762
|
-
if (!
|
|
1763
|
-
|
|
1719
|
+
if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
|
|
1720
|
+
const periodRef = tracksStore.getPeriodObjectFromPeriod(period);
|
|
1764
1721
|
if (periodRef) {
|
|
1765
|
-
|
|
1722
|
+
const audioTrack = tracksStore.getChosenAudioTrack(periodRef);
|
|
1766
1723
|
this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
|
|
1767
|
-
|
|
1724
|
+
const textTrack = tracksStore.getChosenTextTrack(periodRef);
|
|
1768
1725
|
this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
|
|
1769
|
-
|
|
1726
|
+
const videoTrack = tracksStore.getChosenVideoTrack(periodRef);
|
|
1770
1727
|
this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
|
|
1771
1728
|
}
|
|
1772
1729
|
}
|
|
@@ -1775,30 +1732,30 @@ var Player = /** @class */ (function (_super) {
|
|
|
1775
1732
|
this._priv_triggerEventIfNotStopped("textTrackChange", null, cancelSignal);
|
|
1776
1733
|
this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
|
|
1777
1734
|
}
|
|
1778
|
-
|
|
1735
|
+
const audioRepresentation = (_d = (_c = this.__priv_getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c.audio) !== null && _d !== void 0 ? _d : null;
|
|
1779
1736
|
this._priv_triggerEventIfNotStopped("audioRepresentationChange", audioRepresentation, cancelSignal);
|
|
1780
|
-
|
|
1737
|
+
const videoRepresentation = (_f = (_e = this.__priv_getCurrentRepresentations()) === null || _e === void 0 ? void 0 : _e.video) !== null && _f !== void 0 ? _f : null;
|
|
1781
1738
|
this._priv_triggerEventIfNotStopped("videoRepresentationChange", videoRepresentation, cancelSignal);
|
|
1782
|
-
}
|
|
1739
|
+
}
|
|
1783
1740
|
/**
|
|
1784
1741
|
* Triggered each times a new "PeriodStream" is ready.
|
|
1785
1742
|
* Choose the right Adaptation for the Period and emit it.
|
|
1786
1743
|
* @param {Object} contentInfos
|
|
1787
1744
|
* @param {Object} value
|
|
1788
1745
|
*/
|
|
1789
|
-
|
|
1746
|
+
_priv_onPeriodStreamReady(contentInfos, value) {
|
|
1790
1747
|
var _a;
|
|
1791
1748
|
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1792
1749
|
return; // Event for another content
|
|
1793
1750
|
}
|
|
1794
|
-
|
|
1795
|
-
|
|
1751
|
+
const { type, manifest, period, adaptationRef } = value;
|
|
1752
|
+
const tracksStore = contentInfos.tracksStore;
|
|
1796
1753
|
switch (type) {
|
|
1797
1754
|
case "video":
|
|
1798
1755
|
case "audio":
|
|
1799
1756
|
case "text":
|
|
1800
|
-
if (
|
|
1801
|
-
|
|
1757
|
+
if ((0, is_null_or_undefined_1.default)(tracksStore)) {
|
|
1758
|
+
log_1.default.error(`API: TracksStore not instanciated for a new ${type} period`);
|
|
1802
1759
|
adaptationRef.setValue(null);
|
|
1803
1760
|
}
|
|
1804
1761
|
else {
|
|
@@ -1806,50 +1763,50 @@ var Player = /** @class */ (function (_super) {
|
|
|
1806
1763
|
}
|
|
1807
1764
|
break;
|
|
1808
1765
|
default:
|
|
1809
|
-
|
|
1766
|
+
(0, assert_unreachable_1.default)(type);
|
|
1810
1767
|
}
|
|
1811
|
-
}
|
|
1768
|
+
}
|
|
1812
1769
|
/**
|
|
1813
1770
|
* Triggered each times we "remove" a PeriodStream.
|
|
1814
1771
|
* @param {Object} contentInfos
|
|
1815
1772
|
* @param {Object} value
|
|
1816
1773
|
*/
|
|
1817
|
-
|
|
1774
|
+
_priv_onPeriodStreamCleared(contentInfos, value) {
|
|
1818
1775
|
var _a;
|
|
1819
1776
|
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1820
1777
|
return; // Event for another content
|
|
1821
1778
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1779
|
+
const { type, period } = value;
|
|
1780
|
+
const tracksStore = contentInfos.tracksStore;
|
|
1824
1781
|
// Clean-up track choices from TracksStore
|
|
1825
1782
|
switch (type) {
|
|
1826
1783
|
case "audio":
|
|
1827
1784
|
case "text":
|
|
1828
1785
|
case "video":
|
|
1829
|
-
if (!
|
|
1786
|
+
if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
|
|
1830
1787
|
tracksStore.removeTrackReference(type, period);
|
|
1831
1788
|
}
|
|
1832
1789
|
break;
|
|
1833
1790
|
}
|
|
1834
1791
|
// Clean-up stored Representation and Adaptation information
|
|
1835
|
-
|
|
1836
|
-
if (!
|
|
1837
|
-
!
|
|
1838
|
-
|
|
1792
|
+
const { activeAdaptations, activeRepresentations } = contentInfos;
|
|
1793
|
+
if (!(0, is_null_or_undefined_1.default)(activeAdaptations) &&
|
|
1794
|
+
!(0, is_null_or_undefined_1.default)(activeAdaptations[period.id])) {
|
|
1795
|
+
const activePeriodAdaptations = activeAdaptations[period.id];
|
|
1839
1796
|
delete activePeriodAdaptations[type];
|
|
1840
1797
|
if (Object.keys(activePeriodAdaptations).length === 0) {
|
|
1841
1798
|
delete activeAdaptations[period.id];
|
|
1842
1799
|
}
|
|
1843
1800
|
}
|
|
1844
|
-
if (!
|
|
1845
|
-
!
|
|
1846
|
-
|
|
1801
|
+
if (!(0, is_null_or_undefined_1.default)(activeRepresentations) &&
|
|
1802
|
+
!(0, is_null_or_undefined_1.default)(activeRepresentations[period.id])) {
|
|
1803
|
+
const activePeriodRepresentations = activeRepresentations[period.id];
|
|
1847
1804
|
delete activePeriodRepresentations[type];
|
|
1848
1805
|
if (Object.keys(activePeriodRepresentations).length === 0) {
|
|
1849
1806
|
delete activeRepresentations[period.id];
|
|
1850
1807
|
}
|
|
1851
1808
|
}
|
|
1852
|
-
}
|
|
1809
|
+
}
|
|
1853
1810
|
/**
|
|
1854
1811
|
* Triggered each times a new Adaptation is considered for the current
|
|
1855
1812
|
* content.
|
|
@@ -1857,50 +1814,48 @@ var Player = /** @class */ (function (_super) {
|
|
|
1857
1814
|
* @param {Object} contentInfos
|
|
1858
1815
|
* @param {Object} value
|
|
1859
1816
|
*/
|
|
1860
|
-
|
|
1861
|
-
var
|
|
1862
|
-
|
|
1863
|
-
var type = _a.type, adaptation = _a.adaptation, period = _a.period;
|
|
1864
|
-
if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
|
|
1817
|
+
_priv_onAdaptationChange(contentInfos, { type, adaptation, period }) {
|
|
1818
|
+
var _a;
|
|
1819
|
+
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1865
1820
|
return; // Event for another content
|
|
1866
1821
|
}
|
|
1867
1822
|
// lazily create contentInfos.activeAdaptations
|
|
1868
1823
|
if (contentInfos.activeAdaptations === null) {
|
|
1869
1824
|
contentInfos.activeAdaptations = {};
|
|
1870
1825
|
}
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
if (
|
|
1874
|
-
activeAdaptations[period.id] =
|
|
1826
|
+
const { activeAdaptations, currentPeriod } = contentInfos;
|
|
1827
|
+
const activePeriodAdaptations = activeAdaptations[period.id];
|
|
1828
|
+
if ((0, is_null_or_undefined_1.default)(activePeriodAdaptations)) {
|
|
1829
|
+
activeAdaptations[period.id] = { [type]: adaptation };
|
|
1875
1830
|
}
|
|
1876
1831
|
else {
|
|
1877
1832
|
activePeriodAdaptations[type] = adaptation;
|
|
1878
1833
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1834
|
+
const { tracksStore } = contentInfos;
|
|
1835
|
+
const cancelSignal = contentInfos.currentContentCanceller.signal;
|
|
1881
1836
|
if (tracksStore !== null &&
|
|
1882
|
-
currentPeriod !== null && !
|
|
1837
|
+
currentPeriod !== null && !(0, is_null_or_undefined_1.default)(period) &&
|
|
1883
1838
|
period.id === currentPeriod.id) {
|
|
1884
|
-
|
|
1839
|
+
const periodRef = tracksStore.getPeriodObjectFromPeriod(period);
|
|
1885
1840
|
if (periodRef === undefined) {
|
|
1886
1841
|
return;
|
|
1887
1842
|
}
|
|
1888
1843
|
switch (type) {
|
|
1889
1844
|
case "audio":
|
|
1890
|
-
|
|
1845
|
+
const audioTrack = tracksStore.getChosenAudioTrack(periodRef);
|
|
1891
1846
|
this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
|
|
1892
1847
|
break;
|
|
1893
1848
|
case "text":
|
|
1894
|
-
|
|
1849
|
+
const textTrack = tracksStore.getChosenTextTrack(periodRef);
|
|
1895
1850
|
this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
|
|
1896
1851
|
break;
|
|
1897
1852
|
case "video":
|
|
1898
|
-
|
|
1853
|
+
const videoTrack = tracksStore.getChosenVideoTrack(periodRef);
|
|
1899
1854
|
this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
|
|
1900
1855
|
break;
|
|
1901
1856
|
}
|
|
1902
1857
|
}
|
|
1903
|
-
}
|
|
1858
|
+
}
|
|
1904
1859
|
/**
|
|
1905
1860
|
* Triggered each times a new Representation is considered during playback.
|
|
1906
1861
|
*
|
|
@@ -1909,29 +1864,27 @@ var Player = /** @class */ (function (_super) {
|
|
|
1909
1864
|
* @param {Object} contentInfos
|
|
1910
1865
|
* @param {Object} obj
|
|
1911
1866
|
*/
|
|
1912
|
-
|
|
1913
|
-
var
|
|
1914
|
-
|
|
1915
|
-
var type = _a.type, period = _a.period, representation = _a.representation;
|
|
1916
|
-
if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
|
|
1867
|
+
_priv_onRepresentationChange(contentInfos, { type, period, representation }) {
|
|
1868
|
+
var _a;
|
|
1869
|
+
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1917
1870
|
return; // Event for another content
|
|
1918
1871
|
}
|
|
1919
1872
|
// lazily create contentInfos.activeRepresentations
|
|
1920
1873
|
if (contentInfos.activeRepresentations === null) {
|
|
1921
1874
|
contentInfos.activeRepresentations = {};
|
|
1922
1875
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (
|
|
1926
|
-
activeRepresentations[period.id] =
|
|
1876
|
+
const { activeRepresentations, currentPeriod } = contentInfos;
|
|
1877
|
+
const activePeriodRepresentations = activeRepresentations[period.id];
|
|
1878
|
+
if ((0, is_null_or_undefined_1.default)(activePeriodRepresentations)) {
|
|
1879
|
+
activeRepresentations[period.id] = { [type]: representation };
|
|
1927
1880
|
}
|
|
1928
1881
|
else {
|
|
1929
1882
|
activePeriodRepresentations[type] = representation;
|
|
1930
1883
|
}
|
|
1931
|
-
if (!
|
|
1884
|
+
if (!(0, is_null_or_undefined_1.default)(period) &&
|
|
1932
1885
|
currentPeriod !== null &&
|
|
1933
1886
|
currentPeriod.id === period.id) {
|
|
1934
|
-
|
|
1887
|
+
const cancelSignal = this._priv_contentInfos.currentContentCanceller.signal;
|
|
1935
1888
|
if (type === "video") {
|
|
1936
1889
|
this._priv_triggerEventIfNotStopped("videoRepresentationChange", representation, cancelSignal);
|
|
1937
1890
|
}
|
|
@@ -1939,7 +1892,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
1939
1892
|
this._priv_triggerEventIfNotStopped("audioRepresentationChange", representation, cancelSignal);
|
|
1940
1893
|
}
|
|
1941
1894
|
}
|
|
1942
|
-
}
|
|
1895
|
+
}
|
|
1943
1896
|
/**
|
|
1944
1897
|
* Triggered each time a bitrate estimate is calculated.
|
|
1945
1898
|
*
|
|
@@ -1947,15 +1900,14 @@ var Player = /** @class */ (function (_super) {
|
|
|
1947
1900
|
*
|
|
1948
1901
|
* @param {Object} value
|
|
1949
1902
|
*/
|
|
1950
|
-
|
|
1951
|
-
var type = _a.type, bitrate = _a.bitrate;
|
|
1903
|
+
_priv_onBitrateEstimateChange({ type, bitrate, }) {
|
|
1952
1904
|
if (bitrate !== undefined) {
|
|
1953
1905
|
this._priv_bitrateInfos.lastBitrates[type] = bitrate;
|
|
1954
1906
|
}
|
|
1955
1907
|
// !!! undocumented API :O !!!
|
|
1956
1908
|
/* eslint-disable-next-line */
|
|
1957
|
-
this.trigger("__priv_bitrateEstimateChange", { type
|
|
1958
|
-
}
|
|
1909
|
+
this.trigger("__priv_bitrateEstimateChange", { type, bitrate });
|
|
1910
|
+
}
|
|
1959
1911
|
/**
|
|
1960
1912
|
* Triggered each time the player state updates.
|
|
1961
1913
|
*
|
|
@@ -1963,13 +1915,13 @@ var Player = /** @class */ (function (_super) {
|
|
|
1963
1915
|
*
|
|
1964
1916
|
* @param {string} newState
|
|
1965
1917
|
*/
|
|
1966
|
-
|
|
1918
|
+
_priv_setPlayerState(newState) {
|
|
1967
1919
|
if (this.state !== newState) {
|
|
1968
1920
|
this.state = newState;
|
|
1969
|
-
|
|
1921
|
+
log_1.default.info("API: playerStateChange event", newState);
|
|
1970
1922
|
this.trigger("playerStateChange", newState);
|
|
1971
1923
|
}
|
|
1972
|
-
}
|
|
1924
|
+
}
|
|
1973
1925
|
/**
|
|
1974
1926
|
* Triggered each time a playback observation.
|
|
1975
1927
|
*
|
|
@@ -1978,22 +1930,22 @@ var Player = /** @class */ (function (_super) {
|
|
|
1978
1930
|
* @param {Object} contentInfos
|
|
1979
1931
|
* @param {Object} observation
|
|
1980
1932
|
*/
|
|
1981
|
-
|
|
1933
|
+
_priv_triggerPositionUpdate(contentInfos, observation) {
|
|
1982
1934
|
var _a, _b;
|
|
1983
1935
|
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
1984
1936
|
return; // Event for another content
|
|
1985
1937
|
}
|
|
1986
|
-
|
|
1987
|
-
if ((!isDirectFile && manifest === null) ||
|
|
1938
|
+
const { isDirectFile, manifest } = contentInfos;
|
|
1939
|
+
if ((!isDirectFile && manifest === null) || (0, is_null_or_undefined_1.default)(observation)) {
|
|
1988
1940
|
return;
|
|
1989
1941
|
}
|
|
1990
|
-
|
|
1942
|
+
const maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() :
|
|
1991
1943
|
undefined;
|
|
1992
|
-
|
|
1944
|
+
const positionData = {
|
|
1993
1945
|
position: observation.position,
|
|
1994
1946
|
duration: observation.duration,
|
|
1995
1947
|
playbackRate: observation.playbackRate,
|
|
1996
|
-
maximumPosition
|
|
1948
|
+
maximumPosition,
|
|
1997
1949
|
// TODO bufferGap may be undefined
|
|
1998
1950
|
bufferGap: observation.bufferGap === undefined ||
|
|
1999
1951
|
!isFinite(observation.bufferGap) ?
|
|
@@ -2003,41 +1955,40 @@ var Player = /** @class */ (function (_super) {
|
|
|
2003
1955
|
if (manifest !== null &&
|
|
2004
1956
|
manifest.isLive &&
|
|
2005
1957
|
observation.position > 0) {
|
|
2006
|
-
|
|
1958
|
+
const ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
|
|
2007
1959
|
positionData.wallClockTime = observation.position + ast;
|
|
2008
|
-
|
|
1960
|
+
const livePosition = manifest.getLivePosition();
|
|
2009
1961
|
if (livePosition !== undefined) {
|
|
2010
1962
|
positionData.liveGap = livePosition - observation.position;
|
|
2011
1963
|
}
|
|
2012
1964
|
}
|
|
2013
1965
|
else if (isDirectFile && this.videoElement !== null) {
|
|
2014
|
-
|
|
1966
|
+
const startDate = (0, compat_1.getStartDate)(this.videoElement);
|
|
2015
1967
|
if (startDate !== undefined) {
|
|
2016
1968
|
positionData.wallClockTime = startDate + observation.position;
|
|
2017
1969
|
}
|
|
2018
1970
|
}
|
|
2019
1971
|
this.trigger("positionUpdate", positionData);
|
|
2020
|
-
}
|
|
1972
|
+
}
|
|
2021
1973
|
/**
|
|
2022
1974
|
* @param {string} evt
|
|
2023
1975
|
* @param {*} arg
|
|
2024
1976
|
* @param {Object} currentContentCancelSignal
|
|
2025
1977
|
*/
|
|
2026
|
-
|
|
1978
|
+
_priv_triggerEventIfNotStopped(evt, arg, currentContentCancelSignal) {
|
|
2027
1979
|
if (!currentContentCancelSignal.isCancelled()) {
|
|
2028
1980
|
this.trigger(evt, arg);
|
|
2029
1981
|
}
|
|
2030
|
-
}
|
|
1982
|
+
}
|
|
2031
1983
|
/**
|
|
2032
1984
|
* @param {Object} cancelSignal
|
|
2033
1985
|
* @returns {Object}
|
|
2034
1986
|
*/
|
|
2035
|
-
|
|
2036
|
-
var _this = this;
|
|
1987
|
+
_priv_initializeMediaElementTracksStore(cancelSignal) {
|
|
2037
1988
|
var _a, _b, _c;
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
1989
|
+
(0, assert_1.default)(features_1.default.directfile !== null, "Initializing `MediaElementTracksStore` without Directfile feature");
|
|
1990
|
+
(0, assert_1.default)(this.videoElement !== null, "Initializing `MediaElementTracksStore` on a disposed RxPlayer");
|
|
1991
|
+
const mediaElementTracksStore = new features_1.default.directfile.mediaElementTracksStore(this.videoElement);
|
|
2041
1992
|
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", mediaElementTracksStore.getAvailableAudioTracks(), cancelSignal);
|
|
2042
1993
|
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", mediaElementTracksStore.getAvailableVideoTracks(), cancelSignal);
|
|
2043
1994
|
this._priv_triggerEventIfNotStopped("availableTextTracksChange", mediaElementTracksStore.getAvailableTextTracks(), cancelSignal);
|
|
@@ -2045,52 +1996,40 @@ var Player = /** @class */ (function (_super) {
|
|
|
2045
1996
|
this._priv_triggerEventIfNotStopped("textTrackChange", (_b = mediaElementTracksStore.getChosenTextTrack()) !== null && _b !== void 0 ? _b : null, cancelSignal);
|
|
2046
1997
|
this._priv_triggerEventIfNotStopped("videoTrackChange", (_c = mediaElementTracksStore.getChosenVideoTrack()) !== null && _c !== void 0 ? _c : null, cancelSignal);
|
|
2047
1998
|
mediaElementTracksStore
|
|
2048
|
-
.addEventListener("availableVideoTracksChange",
|
|
2049
|
-
return _this.trigger("availableVideoTracksChange", val);
|
|
2050
|
-
});
|
|
1999
|
+
.addEventListener("availableVideoTracksChange", (val) => this.trigger("availableVideoTracksChange", val));
|
|
2051
2000
|
mediaElementTracksStore
|
|
2052
|
-
.addEventListener("availableAudioTracksChange",
|
|
2053
|
-
return _this.trigger("availableAudioTracksChange", val);
|
|
2054
|
-
});
|
|
2001
|
+
.addEventListener("availableAudioTracksChange", (val) => this.trigger("availableAudioTracksChange", val));
|
|
2055
2002
|
mediaElementTracksStore
|
|
2056
|
-
.addEventListener("availableTextTracksChange",
|
|
2057
|
-
return _this.trigger("availableTextTracksChange", val);
|
|
2058
|
-
});
|
|
2003
|
+
.addEventListener("availableTextTracksChange", (val) => this.trigger("availableTextTracksChange", val));
|
|
2059
2004
|
mediaElementTracksStore
|
|
2060
|
-
.addEventListener("audioTrackChange",
|
|
2061
|
-
return _this.trigger("audioTrackChange", val);
|
|
2062
|
-
});
|
|
2005
|
+
.addEventListener("audioTrackChange", (val) => this.trigger("audioTrackChange", val));
|
|
2063
2006
|
mediaElementTracksStore
|
|
2064
|
-
.addEventListener("videoTrackChange",
|
|
2065
|
-
return _this.trigger("videoTrackChange", val);
|
|
2066
|
-
});
|
|
2007
|
+
.addEventListener("videoTrackChange", (val) => this.trigger("videoTrackChange", val));
|
|
2067
2008
|
mediaElementTracksStore
|
|
2068
|
-
.addEventListener("textTrackChange",
|
|
2069
|
-
return _this.trigger("textTrackChange", val);
|
|
2070
|
-
});
|
|
2009
|
+
.addEventListener("textTrackChange", (val) => this.trigger("textTrackChange", val));
|
|
2071
2010
|
return mediaElementTracksStore;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2011
|
+
}
|
|
2012
|
+
_priv_callTracksStoreGetterSetter(periodId, defaultValue, cb) {
|
|
2074
2013
|
var _a, _b;
|
|
2075
2014
|
if (this._priv_contentInfos === null ||
|
|
2076
2015
|
this._priv_contentInfos.tracksStore === null) {
|
|
2077
|
-
|
|
2016
|
+
log_1.default.warn("API: Trying to call track API too soon");
|
|
2078
2017
|
return defaultValue;
|
|
2079
2018
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2019
|
+
const { tracksStore } = this._priv_contentInfos;
|
|
2020
|
+
const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
|
|
2021
|
+
const wantedPeriodId = periodId !== null && periodId !== void 0 ? periodId : currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id;
|
|
2083
2022
|
if (wantedPeriodId === undefined) {
|
|
2084
2023
|
return defaultValue;
|
|
2085
2024
|
}
|
|
2086
|
-
|
|
2025
|
+
const periodRef = wantedPeriodId === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id) ?
|
|
2087
2026
|
tracksStore.getPeriodObjectFromPeriod(currentPeriod) :
|
|
2088
2027
|
tracksStore.getPeriodObjectFromId(wantedPeriodId);
|
|
2089
2028
|
if (periodRef === undefined) {
|
|
2090
2029
|
return defaultValue;
|
|
2091
2030
|
}
|
|
2092
2031
|
return cb(tracksStore, periodRef);
|
|
2093
|
-
}
|
|
2032
|
+
}
|
|
2094
2033
|
/**
|
|
2095
2034
|
* Method to call when some event lead to a high for possibility that the
|
|
2096
2035
|
* available tracks for the given type have changed.
|
|
@@ -2101,37 +2040,37 @@ var Player = /** @class */ (function (_super) {
|
|
|
2101
2040
|
* @param {Object|undefined} [oPeriodRef] - optional period object used by the
|
|
2102
2041
|
* `tracksStore` API, allows to optimize the method by bypassing this step.
|
|
2103
2042
|
*/
|
|
2104
|
-
|
|
2105
|
-
|
|
2043
|
+
_priv_onAvailableTracksMayHaveChanged(trackType, oPeriodRef) {
|
|
2044
|
+
const contentInfos = this._priv_contentInfos;
|
|
2106
2045
|
if (contentInfos === null) {
|
|
2107
2046
|
return;
|
|
2108
2047
|
}
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
if (
|
|
2048
|
+
const { currentPeriod, tracksStore, currentContentCanceller } = contentInfos;
|
|
2049
|
+
const cancelSignal = currentContentCanceller.signal;
|
|
2050
|
+
if ((0, is_null_or_undefined_1.default)(currentPeriod) || tracksStore === null) {
|
|
2112
2051
|
return;
|
|
2113
2052
|
}
|
|
2114
|
-
|
|
2053
|
+
const periodRef = oPeriodRef !== null && oPeriodRef !== void 0 ? oPeriodRef : tracksStore.getPeriodObjectFromPeriod(currentPeriod);
|
|
2115
2054
|
if (periodRef === undefined) {
|
|
2116
2055
|
return;
|
|
2117
2056
|
}
|
|
2118
2057
|
switch (trackType) {
|
|
2119
2058
|
case "video":
|
|
2120
|
-
|
|
2059
|
+
const videoTracks = tracksStore.getAvailableVideoTracks(periodRef);
|
|
2121
2060
|
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", videoTracks !== null && videoTracks !== void 0 ? videoTracks : [], cancelSignal);
|
|
2122
2061
|
break;
|
|
2123
2062
|
case "audio":
|
|
2124
|
-
|
|
2063
|
+
const audioTracks = tracksStore.getAvailableAudioTracks(periodRef);
|
|
2125
2064
|
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", audioTracks !== null && audioTracks !== void 0 ? audioTracks : [], cancelSignal);
|
|
2126
2065
|
break;
|
|
2127
2066
|
case "text":
|
|
2128
|
-
|
|
2067
|
+
const textTracks = tracksStore.getAvailableTextTracks(periodRef);
|
|
2129
2068
|
this._priv_triggerEventIfNotStopped("availableTextTracksChange", textTracks !== null && textTracks !== void 0 ? textTracks : [], cancelSignal);
|
|
2130
2069
|
break;
|
|
2131
2070
|
default:
|
|
2132
|
-
|
|
2071
|
+
(0, assert_unreachable_1.default)(trackType);
|
|
2133
2072
|
}
|
|
2134
|
-
}
|
|
2073
|
+
}
|
|
2135
2074
|
/**
|
|
2136
2075
|
* Method to call when a fatal error lead to the stopping of the current
|
|
2137
2076
|
* content.
|
|
@@ -2140,8 +2079,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
2140
2079
|
* @param {Object} contentInfos - The `IPublicApiContentInfos` object linked
|
|
2141
2080
|
* to the content for which the error was received.
|
|
2142
2081
|
*/
|
|
2143
|
-
|
|
2144
|
-
|
|
2082
|
+
_priv_onFatalError(err, contentInfos) {
|
|
2083
|
+
const formattedError = (0, errors_1.formatError)(err, {
|
|
2145
2084
|
defaultCode: "NONE",
|
|
2146
2085
|
defaultReason: "An unknown error stopped content playback.",
|
|
2147
2086
|
});
|
|
@@ -2149,7 +2088,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2149
2088
|
contentInfos.currentContentCanceller.cancel();
|
|
2150
2089
|
this._priv_cleanUpCurrentContentState();
|
|
2151
2090
|
this._priv_currentError = formattedError;
|
|
2152
|
-
|
|
2091
|
+
log_1.default.error("API: The player stopped because of an error", formattedError);
|
|
2153
2092
|
this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
2154
2093
|
// TODO This condition is here because the eventual callback called when the
|
|
2155
2094
|
// player state is updated can launch a new content, thus the error will not
|
|
@@ -2158,8 +2097,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2158
2097
|
if (this._priv_currentError === formattedError) {
|
|
2159
2098
|
this.trigger("error", formattedError);
|
|
2160
2099
|
}
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
export default Player;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
Player.version = /* PLAYER_VERSION */ "4.0.0-beta.3";
|
|
2103
|
+
exports.default = Player;
|