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