rx-player 4.0.0-dev.2023111400 → 4.0.0-dev.2023120600
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 +11 -227
- package/FILES.md +1 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -3
- package/dist/_esm5.processed/compat/add_text_track.js +4 -7
- package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -7
- package/dist/_esm5.processed/compat/event_listeners.d.ts +2 -15
- package/dist/_esm5.processed/compat/event_listeners.js +2 -37
- package/dist/_esm5.processed/compat/index.d.ts +1 -3
- package/dist/_esm5.processed/compat/index.js +1 -3
- package/dist/_esm5.processed/config.d.ts +9 -21
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -58
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +14 -54
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +2 -8
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +2 -11
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +13 -32
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +12 -35
- package/dist/_esm5.processed/core/api/option_utils.js +41 -230
- package/dist/_esm5.processed/core/api/public_api.d.ts +91 -266
- package/dist/_esm5.processed/core/api/public_api.js +439 -805
- package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.d.ts +3 -2
- package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.js +3 -2
- package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +15 -75
- package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +74 -193
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +84 -0
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +158 -0
- package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +406 -0
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +932 -0
- package/dist/_esm5.processed/core/api/utils.d.ts +1 -0
- package/dist/_esm5.processed/core/api/utils.js +28 -11
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +83 -71
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +6 -5
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +10 -72
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +6 -4
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +1 -3
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +7 -26
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +3 -9
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +16 -9
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +1 -6
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +4 -41
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +1 -8
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -19
- package/dist/_esm5.processed/core/init/types.d.ts +5 -15
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +0 -15
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +183 -93
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
- package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +27 -13
- package/dist/_esm5.processed/core/stream/index.d.ts +2 -3
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +2 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -7
- package/dist/_esm5.processed/core/stream/period/period_stream.js +13 -12
- package/dist/_esm5.processed/core/stream/period/types.d.ts +5 -14
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +2 -4
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +10 -46
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +29 -23
- package/dist/_esm5.processed/core/stream/representation/types.d.ts +11 -1
- package/dist/_esm5.processed/default_config.d.ts +35 -98
- package/dist/_esm5.processed/default_config.js +36 -113
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +1 -3
- package/dist/_esm5.processed/errors/custom_loader_error.js +1 -3
- package/dist/_esm5.processed/errors/media_error.js +2 -2
- package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/network_error.js +0 -1
- package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
- package/dist/_esm5.processed/errors/request_error.js +2 -5
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
- package/dist/_esm5.processed/features/features_object.js +0 -2
- package/dist/_esm5.processed/features/list/directfile.js +2 -5
- package/dist/_esm5.processed/features/list/index.d.ts +0 -2
- package/dist/_esm5.processed/features/list/index.js +0 -2
- package/dist/_esm5.processed/features/types.d.ts +3 -27
- package/dist/_esm5.processed/manifest/adaptation.d.ts +9 -11
- package/dist/_esm5.processed/manifest/adaptation.js +41 -30
- package/dist/_esm5.processed/manifest/index.d.ts +3 -4
- package/dist/_esm5.processed/manifest/manifest.d.ts +5 -54
- package/dist/_esm5.processed/manifest/manifest.js +5 -110
- package/dist/_esm5.processed/manifest/period.d.ts +4 -5
- package/dist/_esm5.processed/manifest/representation.d.ts +10 -5
- package/dist/_esm5.processed/manifest/representation.js +15 -5
- package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
- package/dist/_esm5.processed/manifest/representation_index/static.d.ts +2 -0
- package/dist/_esm5.processed/manifest/representation_index/static.js +6 -0
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +42 -21
- package/dist/_esm5.processed/manifest/types.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +17 -31
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +26 -19
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +7 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +2 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +11 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +10 -6
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +3 -6
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +11 -17
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -83
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +53 -125
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
- package/dist/_esm5.processed/public_types.d.ts +396 -308
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +5 -4
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +5 -4
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
- package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +26 -20
- package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
- package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
- package/dist/_esm5.processed/transports/dash/text_parser.js +28 -33
- package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
- package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -52
- package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/smooth/is_mp4_embedded_track.d.ts} +5 -5
- package/dist/_esm5.processed/{features/list/image_buffer.d.ts → transports/smooth/is_mp4_embedded_track.js} +7 -6
- package/dist/_esm5.processed/transports/smooth/pipelines.js +33 -190
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +28 -22
- package/dist/_esm5.processed/transports/smooth/utils.d.ts +1 -26
- package/dist/_esm5.processed/transports/smooth/utils.js +1 -55
- package/dist/_esm5.processed/transports/types.d.ts +94 -89
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
- package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
- package/dist/_esm5.processed/utils/array_includes.d.ts +2 -1
- package/dist/_esm5.processed/utils/array_includes.js +30 -28
- package/dist/_esm5.processed/utils/request/xhr.js +5 -5
- package/dist/commonjs/compat/is_codec_supported.js +22 -1
- package/dist/commonjs/config.d.ts +1 -0
- package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
- package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
- package/dist/commonjs/core/api/option_utils.d.ts +2 -0
- package/dist/commonjs/core/api/option_utils.js +2 -3
- package/dist/commonjs/core/api/public_api.d.ts +9 -0
- package/dist/commonjs/core/api/public_api.js +34 -9
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/commonjs/core/init/directfile_content_initializer.js +24 -7
- package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/commonjs/core/init/media_source_content_initializer.js +4 -6
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +16 -17
- package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
- package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +3 -3
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/commonjs/default_config.d.ts +5 -0
- package/dist/commonjs/default_config.js +5 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
- package/dist/commonjs/manifest/representation_index/static.js +2 -2
- package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
- package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +7 -3
- package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/commonjs/public_types.d.ts +78 -34
- package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
- package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
- package/dist/commonjs/transports/dash/segment_loader.js +2 -1
- package/dist/commonjs/transports/dash/text_loader.js +2 -0
- package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
- package/dist/commonjs/transports/smooth/pipelines.js +4 -2
- package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
- package/dist/commonjs/transports/types.d.ts +12 -0
- package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
- package/dist/commonjs/utils/request/fetch.d.ts +6 -0
- package/dist/commonjs/utils/request/fetch.js +29 -8
- package/dist/commonjs/utils/request/xhr.d.ts +11 -5
- package/dist/commonjs/utils/request/xhr.js +29 -8
- package/dist/es2017/compat/is_codec_supported.js +22 -1
- package/dist/es2017/config.d.ts +1 -0
- package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
- package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
- package/dist/es2017/core/api/option_utils.d.ts +2 -0
- package/dist/es2017/core/api/option_utils.js +2 -3
- package/dist/es2017/core/api/public_api.d.ts +9 -0
- package/dist/es2017/core/api/public_api.js +33 -8
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/es2017/core/init/directfile_content_initializer.js +24 -7
- package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/es2017/core/init/media_source_content_initializer.js +4 -6
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +16 -15
- package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
- package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +3 -3
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/es2017/default_config.d.ts +5 -0
- package/dist/es2017/default_config.js +5 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
- package/dist/es2017/manifest/representation_index/static.js +2 -2
- package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +7 -3
- package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/es2017/public_types.d.ts +78 -34
- package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
- package/dist/es2017/transports/dash/manifest_parser.js +3 -0
- package/dist/es2017/transports/dash/segment_loader.js +1 -0
- package/dist/es2017/transports/dash/text_loader.js +2 -0
- package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
- package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
- package/dist/es2017/transports/smooth/pipelines.js +2 -0
- package/dist/es2017/transports/smooth/segment_loader.js +1 -0
- package/dist/es2017/transports/types.d.ts +12 -0
- package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
- package/dist/es2017/utils/request/fetch.d.ts +6 -0
- package/dist/es2017/utils/request/fetch.js +29 -8
- package/dist/es2017/utils/request/xhr.d.ts +11 -5
- package/dist/es2017/utils/request/xhr.js +30 -9
- package/dist/rx-player.js +723 -376
- package/dist/rx-player.min.js +1 -1
- package/package.json +3 -4
- package/scripts/update-version +2 -0
- package/sonar-project.properties +1 -1
- package/src/compat/is_codec_supported.ts +23 -1
- package/src/core/api/debug/buffer_graph.ts +2 -5
- package/src/core/api/debug/modules/general_info.ts +15 -10
- package/src/core/api/option_utils.ts +3 -3
- package/src/core/api/public_api.ts +35 -7
- package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
- package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
- package/src/core/fetchers/utils/schedule_request.ts +1 -1
- package/src/core/init/directfile_content_initializer.ts +23 -7
- package/src/core/init/media_source_content_initializer.ts +13 -7
- package/src/core/init/utils/content_time_boundaries_observer.ts +23 -22
- package/src/core/init/utils/get_initial_time.ts +25 -12
- package/src/core/stream/representation/utils/get_buffer_status.ts +3 -3
- package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
- package/src/default_config.ts +5 -0
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
- package/src/manifest/representation_index/static.ts +2 -2
- package/src/manifest/representation_index/types.ts +4 -4
- package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
- package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
- package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
- package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
- package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
- package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
- package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
- package/src/parsers/manifest/dash/common/parse_representations.ts +9 -3
- package/src/parsers/manifest/local/representation_index.ts +3 -3
- package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
- package/src/parsers/manifest/smooth/representation_index.ts +23 -9
- package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
- package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
- package/src/parsers/manifest/utils/index_helpers.ts +1 -1
- package/src/public_types.ts +79 -34
- package/src/transports/dash/init_segment_loader.ts +5 -0
- package/src/transports/dash/manifest_parser.ts +6 -0
- package/src/transports/dash/segment_loader.ts +1 -0
- package/src/transports/dash/text_loader.ts +2 -0
- package/src/transports/metaplaylist/manifest_loader.ts +1 -0
- package/src/transports/metaplaylist/pipelines.ts +4 -1
- package/src/transports/smooth/pipelines.ts +2 -0
- package/src/transports/smooth/segment_loader.ts +1 -0
- package/src/transports/types.ts +12 -0
- package/src/transports/utils/generate_manifest_loader.ts +3 -0
- package/src/utils/request/fetch.ts +35 -8
- package/src/utils/request/xhr.ts +45 -14
- package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
- package/dist/_esm5.processed/compat/fullscreen.js +0 -78
- package/dist/_esm5.processed/compat/is_offline.d.ts +0 -39
- package/dist/_esm5.processed/compat/is_offline.js +0 -43
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +0 -258
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +0 -989
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -75
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -133
- package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
- package/dist/_esm5.processed/features/list/bif_parser.js +0 -27
- package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -38
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -129
- package/dist/_esm5.processed/utils/list_to_map.js +0 -28
- package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
- package/dist/_esm5.processed/utils/simple_set.js +0 -57
- package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
- package/dist/_esm5.processed/utils/uniq.js +0 -43
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
- package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
- package/src/typings/object-assign.d.ts +0 -48
|
@@ -43,32 +43,32 @@ var __assign = (this && this.__assign) || function () {
|
|
|
43
43
|
* This file defines the public API for the RxPlayer.
|
|
44
44
|
* It also starts the different sub-parts of the player on various API calls.
|
|
45
45
|
*/
|
|
46
|
-
import { events,
|
|
46
|
+
import { events, getStartDate, } from "../../compat";
|
|
47
47
|
/* eslint-disable-next-line max-len */
|
|
48
48
|
import canRelyOnVideoVisibilityAndSize from "../../compat/can_rely_on_video_visibility_and_size";
|
|
49
49
|
import config from "../../config";
|
|
50
50
|
import { ErrorCodes, ErrorTypes, formatError, MediaError, } from "../../errors";
|
|
51
51
|
import features, { addFeatures, } from "../../features";
|
|
52
52
|
import log from "../../log";
|
|
53
|
-
import areArraysOfNumbersEqual from "../../utils/are_arrays_of_numbers_equal";
|
|
54
53
|
import arrayIncludes from "../../utils/array_includes";
|
|
55
54
|
import assert from "../../utils/assert";
|
|
55
|
+
import assertUnreachable from "../../utils/assert_unreachable";
|
|
56
56
|
import EventEmitter from "../../utils/event_emitter";
|
|
57
57
|
import idGenerator from "../../utils/id_generator";
|
|
58
58
|
import isNullOrUndefined from "../../utils/is_null_or_undefined";
|
|
59
59
|
import objectAssign from "../../utils/object_assign";
|
|
60
|
-
import { getLeftSizeOfRange
|
|
60
|
+
import { getLeftSizeOfRange } from "../../utils/ranges";
|
|
61
61
|
import SharedReference, { createMappedReference, } from "../../utils/reference";
|
|
62
62
|
import TaskCanceller from "../../utils/task_canceller";
|
|
63
63
|
import warnOnce from "../../utils/warn_once";
|
|
64
64
|
import { clearOnStop, disposeDecryptionResources, getKeySystemConfiguration, getCurrentKeySystem, } from "../decrypt";
|
|
65
65
|
import { checkReloadOptions, parseConstructorOptions, parseLoadVideoOptions, } from "./option_utils";
|
|
66
66
|
import PlaybackObserver from "./playback_observer";
|
|
67
|
-
import
|
|
67
|
+
import TracksStore from "./track_management/tracks_store";
|
|
68
68
|
import { constructPlayerStateReference, emitPlayPauseEvents, emitSeekEvents, isLoadedState, } from "./utils";
|
|
69
69
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
70
70
|
var generateContentId = idGenerator();
|
|
71
|
-
var
|
|
71
|
+
var getPictureOnPictureStateRef = events.getPictureOnPictureStateRef, getVideoVisibilityRef = events.getVideoVisibilityRef, getVideoWidthRef = events.getVideoWidthRef;
|
|
72
72
|
/**
|
|
73
73
|
* @class Player
|
|
74
74
|
* @extends EventEmitter
|
|
@@ -81,64 +81,19 @@ var Player = /** @class */ (function (_super) {
|
|
|
81
81
|
*/
|
|
82
82
|
function Player(options) {
|
|
83
83
|
if (options === void 0) { options = {}; }
|
|
84
|
-
var _a, _b;
|
|
85
84
|
var _this = _super.call(this) || this;
|
|
86
|
-
var
|
|
85
|
+
var _a = parseConstructorOptions(options), baseBandwidth = _a.baseBandwidth, limitVideoWidth = _a.limitVideoWidth, maxBufferAhead = _a.maxBufferAhead, maxBufferBehind = _a.maxBufferBehind, throttleVideoBitrateWhenHidden = _a.throttleVideoBitrateWhenHidden, videoElement = _a.videoElement, wantedBufferAhead = _a.wantedBufferAhead, maxVideoBufferSize = _a.maxVideoBufferSize;
|
|
87
86
|
var DEFAULT_UNMUTED_VOLUME = config.getCurrent().DEFAULT_UNMUTED_VOLUME;
|
|
88
87
|
// Workaround to support Firefox autoplay on FF 42.
|
|
89
88
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
90
89
|
videoElement.preload = "auto";
|
|
91
|
-
_this.version = /* PLAYER_VERSION */ "3.
|
|
90
|
+
_this.version = /* PLAYER_VERSION */ "3.32.1";
|
|
92
91
|
_this.log = log;
|
|
93
92
|
_this.state = "STOPPED";
|
|
94
93
|
_this.videoElement = videoElement;
|
|
95
94
|
var destroyCanceller = new TaskCanceller();
|
|
96
95
|
_this._destroyCanceller = destroyCanceller;
|
|
97
96
|
_this._priv_pictureInPictureRef = getPictureOnPictureStateRef(videoElement, destroyCanceller.signal);
|
|
98
|
-
/** @deprecated */
|
|
99
|
-
onFullscreenChange(videoElement, function () {
|
|
100
|
-
/* eslint-disable import/no-deprecated */
|
|
101
|
-
_this.trigger("fullscreenChange", _this.isFullscreen());
|
|
102
|
-
/* eslint-enable import/no-deprecated */
|
|
103
|
-
}, destroyCanceller.signal);
|
|
104
|
-
/** Store last known TextTrack array linked to the media element. */
|
|
105
|
-
var prevTextTracks = [];
|
|
106
|
-
for (var i = 0; i < ((_a = videoElement.textTracks) === null || _a === void 0 ? void 0 : _a.length); i++) {
|
|
107
|
-
var textTrack = (_b = videoElement.textTracks) === null || _b === void 0 ? void 0 : _b[i];
|
|
108
|
-
if (!isNullOrUndefined(textTrack)) {
|
|
109
|
-
prevTextTracks.push(textTrack);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/** Callback called when a TextTrack element is added or removed. */
|
|
113
|
-
var onTextTrackChanges = function (_evt) {
|
|
114
|
-
var evt = _evt;
|
|
115
|
-
var target = evt.target;
|
|
116
|
-
var textTrackArr = [];
|
|
117
|
-
for (var i = 0; i < target.length; i++) {
|
|
118
|
-
var textTrack = target[i];
|
|
119
|
-
textTrackArr.push(textTrack);
|
|
120
|
-
}
|
|
121
|
-
var oldTextTracks = prevTextTracks;
|
|
122
|
-
prevTextTracks = textTrackArr;
|
|
123
|
-
// We can have two consecutive textTrackChanges with the exact same
|
|
124
|
-
// payload when we perform multiple texttrack operations before the event
|
|
125
|
-
// loop is freed.
|
|
126
|
-
if (oldTextTracks.length !== textTrackArr.length) {
|
|
127
|
-
_this._priv_onNativeTextTracksNext(textTrackArr);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
for (var i = 0; i < oldTextTracks.length; i++) {
|
|
131
|
-
if (oldTextTracks[i] !== textTrackArr[i]) {
|
|
132
|
-
_this._priv_onNativeTextTracksNext(textTrackArr);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return;
|
|
137
|
-
};
|
|
138
|
-
if (!isNullOrUndefined(videoElement.textTracks)) {
|
|
139
|
-
onTextTrackAdded(videoElement.textTracks, onTextTrackChanges, destroyCanceller.signal);
|
|
140
|
-
onTextTrackRemoved(videoElement.textTracks, onTextTrackChanges, destroyCanceller.signal);
|
|
141
|
-
}
|
|
142
97
|
_this._priv_speed = new SharedReference(videoElement.playbackRate, _this._destroyCanceller.signal);
|
|
143
98
|
_this._priv_preferTrickModeTracks = false;
|
|
144
99
|
_this._priv_contentLock = new SharedReference(false, _this._destroyCanceller.signal);
|
|
@@ -149,27 +104,16 @@ var Player = /** @class */ (function (_super) {
|
|
|
149
104
|
maxVideoBufferSize: new SharedReference(maxVideoBufferSize, _this._destroyCanceller.signal),
|
|
150
105
|
};
|
|
151
106
|
_this._priv_bitrateInfos = {
|
|
152
|
-
lastBitrates: { audio:
|
|
153
|
-
video:
|
|
154
|
-
minAutoBitrates: { audio: new SharedReference(minAudioBitrate, _this._destroyCanceller.signal),
|
|
155
|
-
video: new SharedReference(minVideoBitrate, _this._destroyCanceller.signal) },
|
|
156
|
-
maxAutoBitrates: { audio: new SharedReference(maxAudioBitrate, _this._destroyCanceller.signal),
|
|
157
|
-
video: new SharedReference(maxVideoBitrate, _this._destroyCanceller.signal) },
|
|
158
|
-
manualBitrates: { audio: new SharedReference(-1, _this._destroyCanceller.signal),
|
|
159
|
-
video: new SharedReference(-1, _this._destroyCanceller.signal) },
|
|
107
|
+
lastBitrates: { audio: baseBandwidth,
|
|
108
|
+
video: baseBandwidth },
|
|
160
109
|
};
|
|
161
|
-
_this._priv_throttleWhenHidden = throttleWhenHidden;
|
|
162
110
|
_this._priv_throttleVideoBitrateWhenHidden = throttleVideoBitrateWhenHidden;
|
|
163
111
|
_this._priv_limitVideoWidth = limitVideoWidth;
|
|
164
112
|
_this._priv_mutedMemory = DEFAULT_UNMUTED_VOLUME;
|
|
165
113
|
_this._priv_currentError = null;
|
|
166
114
|
_this._priv_contentInfos = null;
|
|
167
115
|
_this._priv_contentEventsMemory = {};
|
|
168
|
-
_this._priv_stopAtEnd = stopAtEnd;
|
|
169
116
|
_this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
170
|
-
_this._priv_preferredAudioTracks = preferredAudioTracks;
|
|
171
|
-
_this._priv_preferredTextTracks = preferredTextTracks;
|
|
172
|
-
_this._priv_preferredVideoTracks = preferredVideoTracks;
|
|
173
117
|
_this._priv_reloadingMetadata = {};
|
|
174
118
|
_this._priv_lastAutoPlay = false;
|
|
175
119
|
return _this;
|
|
@@ -348,7 +292,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
348
292
|
*/
|
|
349
293
|
Player.prototype._priv_initializeContentPlayback = function (options) {
|
|
350
294
|
var _this = this;
|
|
351
|
-
var
|
|
295
|
+
var _a, _b, _c, _d;
|
|
296
|
+
var autoPlay = options.autoPlay, defaultAudioTrackSwitchingMode = options.defaultAudioTrackSwitchingMode, enableFastSwitching = options.enableFastSwitching, initialManifest = options.initialManifest, keySystems = options.keySystems, lowLatencyMode = options.lowLatencyMode, minimumManifestUpdateInterval = options.minimumManifestUpdateInterval, requestConfig = options.requestConfig, onCodecSwitch = options.onCodecSwitch, startAt = options.startAt, transport = options.transport, checkMediaSegmentIntegrity = options.checkMediaSegmentIntegrity, manifestLoader = options.manifestLoader, manifestUpdateUrl = options.manifestUpdateUrl, referenceDateTime = options.referenceDateTime, representationFilter = options.representationFilter, segmentLoader = options.segmentLoader, serverSyncInfos = options.serverSyncInfos, __priv_patchLastSegmentInSidx = options.__priv_patchLastSegmentInSidx, url = options.url;
|
|
352
297
|
// Perform multiple checks on the given options
|
|
353
298
|
if (this.videoElement === null) {
|
|
354
299
|
throw new Error("the attached video element is disposed");
|
|
@@ -358,7 +303,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
358
303
|
var currentContentCanceller = new TaskCanceller();
|
|
359
304
|
var videoElement = this.videoElement;
|
|
360
305
|
var initializer;
|
|
361
|
-
var
|
|
306
|
+
var mediaElementTracksStore = null;
|
|
362
307
|
if (!isDirectFile) {
|
|
363
308
|
var transportFn = features.transports[transport];
|
|
364
309
|
if (typeof transportFn !== "function") {
|
|
@@ -370,27 +315,13 @@ var Player = /** @class */ (function (_super) {
|
|
|
370
315
|
if (features.mediaSourceInit === null) {
|
|
371
316
|
throw new Error("MediaSource streaming not supported");
|
|
372
317
|
}
|
|
373
|
-
var transportPipelines = transportFn(
|
|
374
|
-
var offlineRetry = networkConfig.offlineRetry, segmentRetry = networkConfig.segmentRetry, manifestRetry = networkConfig.manifestRetry, manifestRequestTimeout = networkConfig.manifestRequestTimeout, segmentRequestTimeout = networkConfig.segmentRequestTimeout;
|
|
318
|
+
var transportPipelines = transportFn({ lowLatencyMode: lowLatencyMode, checkMediaSegmentIntegrity: checkMediaSegmentIntegrity, manifestLoader: manifestLoader, manifestUpdateUrl: manifestUpdateUrl, referenceDateTime: referenceDateTime, representationFilter: representationFilter, segmentLoader: segmentLoader, serverSyncInfos: serverSyncInfos, __priv_patchLastSegmentInSidx: __priv_patchLastSegmentInSidx });
|
|
375
319
|
/** Interface used to load and refresh the Manifest. */
|
|
376
|
-
var manifestRequestSettings = { lowLatencyMode: lowLatencyMode,
|
|
377
|
-
|
|
378
|
-
requestTimeout: manifestRequestTimeout, minimumManifestUpdateInterval: minimumManifestUpdateInterval, initialManifest: initialManifest };
|
|
320
|
+
var manifestRequestSettings = { lowLatencyMode: lowLatencyMode, maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
|
|
321
|
+
requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout, minimumManifestUpdateInterval: minimumManifestUpdateInterval, initialManifest: initialManifest };
|
|
379
322
|
var relyOnVideoVisibilityAndSize = canRelyOnVideoVisibilityAndSize();
|
|
380
|
-
var throttlers = {
|
|
381
|
-
throttleBitrate: {},
|
|
323
|
+
var throttlers = { throttleBitrate: {},
|
|
382
324
|
limitWidth: {} };
|
|
383
|
-
if (this._priv_throttleWhenHidden) {
|
|
384
|
-
if (!relyOnVideoVisibilityAndSize) {
|
|
385
|
-
log.warn("API: Can't apply throttleWhenHidden because " +
|
|
386
|
-
"browser can't be trusted for visibility.");
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
throttlers.throttle = {
|
|
390
|
-
video: createMappedReference(getPageActivityRef(currentContentCanceller.signal), function (isActive) { return isActive ? Infinity : 0; }, currentContentCanceller.signal),
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
325
|
if (this._priv_throttleVideoBitrateWhenHidden) {
|
|
395
326
|
if (!relyOnVideoVisibilityAndSize) {
|
|
396
327
|
log.warn("API: Can't apply throttleVideoBitrateWhenHidden because " +
|
|
@@ -417,21 +348,16 @@ var Player = /** @class */ (function (_super) {
|
|
|
417
348
|
var adaptiveOptions = {
|
|
418
349
|
initialBitrates: this._priv_bitrateInfos.lastBitrates,
|
|
419
350
|
lowLatencyMode: lowLatencyMode,
|
|
420
|
-
manualBitrates: this._priv_bitrateInfos.manualBitrates,
|
|
421
|
-
minAutoBitrates: this._priv_bitrateInfos.minAutoBitrates,
|
|
422
|
-
maxAutoBitrates: this._priv_bitrateInfos.maxAutoBitrates,
|
|
423
351
|
throttlers: throttlers,
|
|
424
352
|
};
|
|
425
353
|
/** Options used by the TextTrack SegmentBuffer. */
|
|
426
354
|
var textTrackOptions = options.textTrackMode === "native" ?
|
|
427
|
-
{ textTrackMode: "native"
|
|
428
|
-
hideNativeSubtitle: options.hideNativeSubtitle } :
|
|
355
|
+
{ textTrackMode: "native" } :
|
|
429
356
|
{ textTrackMode: "html",
|
|
430
357
|
textTrackElement: options.textTrackElement };
|
|
431
|
-
var bufferOptions = objectAssign({
|
|
432
|
-
var segmentRequestOptions = { lowLatencyMode: lowLatencyMode,
|
|
433
|
-
requestTimeout:
|
|
434
|
-
maxRetryOffline: offlineRetry };
|
|
358
|
+
var bufferOptions = objectAssign({ enableFastSwitching: enableFastSwitching, onCodecSwitch: onCodecSwitch }, this._priv_bufferOptions);
|
|
359
|
+
var segmentRequestOptions = { lowLatencyMode: lowLatencyMode, maxRetry: (_c = requestConfig.segment) === null || _c === void 0 ? void 0 : _c.maxRetry,
|
|
360
|
+
requestTimeout: (_d = requestConfig.segment) === null || _d === void 0 ? void 0 : _d.timeout };
|
|
435
361
|
initializer = new features.mediaSourceInit({
|
|
436
362
|
adaptiveOptions: adaptiveOptions,
|
|
437
363
|
autoPlay: autoPlay,
|
|
@@ -456,8 +382,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
456
382
|
else if (isNullOrUndefined(url)) {
|
|
457
383
|
throw new Error("No URL for a DirectFile content");
|
|
458
384
|
}
|
|
459
|
-
|
|
460
|
-
this.
|
|
385
|
+
mediaElementTracksStore =
|
|
386
|
+
this._priv_initializeMediaElementTracksStore(currentContentCanceller.signal);
|
|
461
387
|
if (currentContentCanceller.isUsed()) {
|
|
462
388
|
return;
|
|
463
389
|
}
|
|
@@ -468,18 +394,16 @@ var Player = /** @class */ (function (_super) {
|
|
|
468
394
|
contentId: generateContentId(),
|
|
469
395
|
originalUrl: url,
|
|
470
396
|
currentContentCanceller: currentContentCanceller,
|
|
397
|
+
defaultAudioTrackSwitchingMode: defaultAudioTrackSwitchingMode,
|
|
471
398
|
initializer: initializer,
|
|
472
399
|
isDirectFile: isDirectFile,
|
|
473
400
|
segmentBuffersStore: null,
|
|
474
|
-
thumbnails: null,
|
|
475
401
|
manifest: null,
|
|
476
402
|
currentPeriod: null,
|
|
477
403
|
activeAdaptations: null,
|
|
478
404
|
activeRepresentations: null,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
trackChoiceManager: null,
|
|
482
|
-
mediaElementTrackChoiceManager: mediaElementTrackChoiceManager,
|
|
405
|
+
tracksStore: null,
|
|
406
|
+
mediaElementTracksStore: mediaElementTracksStore,
|
|
483
407
|
};
|
|
484
408
|
// Bind events
|
|
485
409
|
initializer.addEventListener("error", function (error) {
|
|
@@ -511,8 +435,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
511
435
|
});
|
|
512
436
|
initializer.addEventListener("reloadingMediaSource", function (payload) {
|
|
513
437
|
contentInfos.segmentBuffersStore = null;
|
|
514
|
-
if (contentInfos.
|
|
515
|
-
contentInfos.
|
|
438
|
+
if (contentInfos.tracksStore !== null) {
|
|
439
|
+
contentInfos.tracksStore.resetPeriodObjects();
|
|
516
440
|
}
|
|
517
441
|
_this._priv_lastAutoPlay = payload.autoPlay;
|
|
518
442
|
});
|
|
@@ -525,9 +449,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
525
449
|
initializer.addEventListener("streamEventSkip", function (streamEventSkip) {
|
|
526
450
|
return _this.trigger("streamEventSkip", streamEventSkip);
|
|
527
451
|
});
|
|
528
|
-
initializer.addEventListener("decipherabilityUpdate", function (decipherabilityUpdate) {
|
|
529
|
-
return _this.trigger("decipherabilityUpdate", decipherabilityUpdate);
|
|
530
|
-
});
|
|
531
452
|
initializer.addEventListener("activePeriodChanged", function (periodInfo) {
|
|
532
453
|
return _this._priv_onActivePeriodChanged(contentInfos, periodInfo);
|
|
533
454
|
});
|
|
@@ -543,8 +464,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
543
464
|
initializer.addEventListener("adaptationChange", function (adaptationInfo) {
|
|
544
465
|
return _this._priv_onAdaptationChange(contentInfos, adaptationInfo);
|
|
545
466
|
});
|
|
546
|
-
initializer.addEventListener("
|
|
547
|
-
return _this.
|
|
467
|
+
initializer.addEventListener("bitrateEstimateChange", function (bitrateEstimateInfo) {
|
|
468
|
+
return _this._priv_onBitrateEstimateChange(bitrateEstimateInfo);
|
|
548
469
|
});
|
|
549
470
|
initializer.addEventListener("manifestReady", function (manifest) {
|
|
550
471
|
return _this._priv_onManifestReady(contentInfos, manifest);
|
|
@@ -552,21 +473,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
552
473
|
initializer.addEventListener("loaded", function (evt) {
|
|
553
474
|
contentInfos.segmentBuffersStore = evt.segmentBuffersStore;
|
|
554
475
|
});
|
|
555
|
-
initializer.addEventListener("addedSegment", function (evt) {
|
|
556
|
-
// Manage image tracks
|
|
557
|
-
// @deprecated
|
|
558
|
-
var content = evt.content, segmentData = evt.segmentData;
|
|
559
|
-
if (content.adaptation.type === "image") {
|
|
560
|
-
if (!isNullOrUndefined(segmentData) &&
|
|
561
|
-
segmentData.type === "bif") {
|
|
562
|
-
var imageData = segmentData.data;
|
|
563
|
-
/* eslint-disable import/no-deprecated */
|
|
564
|
-
contentInfos.thumbnails = imageData;
|
|
565
|
-
_this.trigger("imageTrackUpdate", { data: contentInfos.thumbnails });
|
|
566
|
-
/* eslint-enable import/no-deprecated */
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
476
|
// Now, that most events are linked, prepare the next content.
|
|
571
477
|
initializer.prepare();
|
|
572
478
|
// Now that the content is prepared, stop previous content and reset state
|
|
@@ -682,11 +588,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
682
588
|
seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
|
|
683
589
|
emitSeekEvents(videoElement, playbackObserver, function () { return _this.trigger("seeking", null); }, function () { return _this.trigger("seeked", null); }, seekEventsCanceller.signal);
|
|
684
590
|
}
|
|
685
|
-
// Previous call could have performed all kind of side-effects, thus,
|
|
686
|
-
// we re-check the current state associated to the RxPlayer
|
|
687
|
-
if (_this.state === "ENDED" /* PLAYER_STATES.ENDED */ && _this._priv_stopAtEnd) {
|
|
688
|
-
_this.stop();
|
|
689
|
-
}
|
|
690
591
|
}, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
|
|
691
592
|
// React to playback conditions change
|
|
692
593
|
playbackObserver.listen(function (observation) {
|
|
@@ -715,53 +616,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
715
616
|
Player.prototype.getError = function () {
|
|
716
617
|
return this._priv_currentError;
|
|
717
618
|
};
|
|
718
|
-
/**
|
|
719
|
-
* Returns manifest/playlist object.
|
|
720
|
-
* null if the player is STOPPED.
|
|
721
|
-
* @deprecated
|
|
722
|
-
* @returns {Manifest|null} - The current Manifest (`null` when not known).
|
|
723
|
-
*/
|
|
724
|
-
Player.prototype.getManifest = function () {
|
|
725
|
-
warnOnce("getManifest is deprecated." +
|
|
726
|
-
" Please open an issue if you used this API.");
|
|
727
|
-
if (this._priv_contentInfos === null) {
|
|
728
|
-
return null;
|
|
729
|
-
}
|
|
730
|
-
return this._priv_contentInfos.manifest;
|
|
731
|
-
};
|
|
732
|
-
/**
|
|
733
|
-
* Returns Adaptations (tracks) for every currently playing type
|
|
734
|
-
* (audio/video/text...).
|
|
735
|
-
* @deprecated
|
|
736
|
-
* @returns {Object|null} - The current Adaptation objects, per type (`null`
|
|
737
|
-
* when none is known for now.
|
|
738
|
-
*/
|
|
739
|
-
Player.prototype.getCurrentAdaptations = function () {
|
|
740
|
-
warnOnce("getCurrentAdaptations is deprecated." +
|
|
741
|
-
" Please open an issue if you used this API.");
|
|
742
|
-
if (this._priv_contentInfos === null) {
|
|
743
|
-
return null;
|
|
744
|
-
}
|
|
745
|
-
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
|
|
746
|
-
if (currentPeriod === null ||
|
|
747
|
-
activeAdaptations === null ||
|
|
748
|
-
isNullOrUndefined(activeAdaptations[currentPeriod.id])) {
|
|
749
|
-
return null;
|
|
750
|
-
}
|
|
751
|
-
return activeAdaptations[currentPeriod.id];
|
|
752
|
-
};
|
|
753
|
-
/**
|
|
754
|
-
* Returns representations (qualities) for every currently playing type
|
|
755
|
-
* (audio/video/text...).
|
|
756
|
-
* @deprecated
|
|
757
|
-
* @returns {Object|null} - The current Representation objects, per type
|
|
758
|
-
* (`null` when none is known for now.
|
|
759
|
-
*/
|
|
760
|
-
Player.prototype.getCurrentRepresentations = function () {
|
|
761
|
-
warnOnce("getCurrentRepresentations is deprecated." +
|
|
762
|
-
" Please open an issue if you used this API.");
|
|
763
|
-
return this._priv_getCurrentRepresentations();
|
|
764
|
-
};
|
|
765
619
|
/**
|
|
766
620
|
* Returns the media DOM element used by the player.
|
|
767
621
|
* You should not its HTML5 API directly and use the player's method instead,
|
|
@@ -772,26 +626,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
772
626
|
Player.prototype.getVideoElement = function () {
|
|
773
627
|
return this.videoElement;
|
|
774
628
|
};
|
|
775
|
-
/**
|
|
776
|
-
* If one returns the first native text-track element attached to the media element.
|
|
777
|
-
* @deprecated
|
|
778
|
-
* @returns {TextTrack} - The native TextTrack attached (`null` when none)
|
|
779
|
-
*/
|
|
780
|
-
Player.prototype.getNativeTextTrack = function () {
|
|
781
|
-
warnOnce("getNativeTextTrack is deprecated." +
|
|
782
|
-
" Please open an issue if you used this API.");
|
|
783
|
-
if (this.videoElement === null) {
|
|
784
|
-
throw new Error("Disposed player");
|
|
785
|
-
}
|
|
786
|
-
var videoElement = this.videoElement;
|
|
787
|
-
var textTracks = videoElement.textTracks;
|
|
788
|
-
if (textTracks.length > 0) {
|
|
789
|
-
return videoElement.textTracks[0];
|
|
790
|
-
}
|
|
791
|
-
else {
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
629
|
/**
|
|
796
630
|
* Returns the player's current state.
|
|
797
631
|
* @returns {string} - The current Player's state
|
|
@@ -859,21 +693,22 @@ var Player = /** @class */ (function (_super) {
|
|
|
859
693
|
return this._priv_preferTrickModeTracks;
|
|
860
694
|
};
|
|
861
695
|
/**
|
|
862
|
-
* Returns the
|
|
696
|
+
* Returns the URL(s) of the currently considered Manifest, or of the content for
|
|
863
697
|
* directfile content.
|
|
864
|
-
* @returns {string
|
|
865
|
-
* URL yet.
|
|
698
|
+
* @returns {Array.<string>|undefined} - Current URL. `undefined` if not known
|
|
699
|
+
* or no URL yet.
|
|
866
700
|
*/
|
|
867
|
-
Player.prototype.
|
|
701
|
+
Player.prototype.getContentUrls = function () {
|
|
868
702
|
if (this._priv_contentInfos === null) {
|
|
869
703
|
return undefined;
|
|
870
704
|
}
|
|
871
705
|
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest, originalUrl = _a.originalUrl;
|
|
872
706
|
if (isDirectFile) {
|
|
873
|
-
return originalUrl
|
|
707
|
+
return originalUrl === undefined ? undefined :
|
|
708
|
+
[originalUrl];
|
|
874
709
|
}
|
|
875
710
|
if (manifest !== null) {
|
|
876
|
-
return manifest.
|
|
711
|
+
return manifest.getUrls();
|
|
877
712
|
}
|
|
878
713
|
return undefined;
|
|
879
714
|
};
|
|
@@ -897,7 +732,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
897
732
|
* NaN if no video is playing.
|
|
898
733
|
* @returns {Number}
|
|
899
734
|
*/
|
|
900
|
-
Player.prototype.
|
|
735
|
+
Player.prototype.getMediaDuration = function () {
|
|
901
736
|
if (this.videoElement === null) {
|
|
902
737
|
throw new Error("Disposed player");
|
|
903
738
|
}
|
|
@@ -909,43 +744,13 @@ var Player = /** @class */ (function (_super) {
|
|
|
909
744
|
* - the current time
|
|
910
745
|
* @returns {Number}
|
|
911
746
|
*/
|
|
912
|
-
Player.prototype.
|
|
747
|
+
Player.prototype.getCurrentBufferGap = function () {
|
|
913
748
|
if (this.videoElement === null) {
|
|
914
749
|
throw new Error("Disposed player");
|
|
915
750
|
}
|
|
916
751
|
var videoElement = this.videoElement;
|
|
917
752
|
return getLeftSizeOfRange(videoElement.buffered, videoElement.currentTime);
|
|
918
753
|
};
|
|
919
|
-
/**
|
|
920
|
-
* Returns in seconds the difference between:
|
|
921
|
-
* - the end of the current contiguous loaded range.
|
|
922
|
-
* - the start of the current contiguous loaded range.
|
|
923
|
-
* @returns {Number}
|
|
924
|
-
*/
|
|
925
|
-
Player.prototype.getVideoLoadedTime = function () {
|
|
926
|
-
warnOnce("`getVideoLoadedTime` is deprecated and won't be present in the " +
|
|
927
|
-
"next major version");
|
|
928
|
-
if (this.videoElement === null) {
|
|
929
|
-
throw new Error("Disposed player");
|
|
930
|
-
}
|
|
931
|
-
var videoElement = this.videoElement;
|
|
932
|
-
return getSizeOfRange(videoElement.buffered, videoElement.currentTime);
|
|
933
|
-
};
|
|
934
|
-
/**
|
|
935
|
-
* Returns in seconds the difference between:
|
|
936
|
-
* - the current time.
|
|
937
|
-
* - the start of the current contiguous loaded range.
|
|
938
|
-
* @returns {Number}
|
|
939
|
-
*/
|
|
940
|
-
Player.prototype.getVideoPlayedTime = function () {
|
|
941
|
-
warnOnce("`getVideoPlayedTime` is deprecated and won't be present in the " +
|
|
942
|
-
"next major version");
|
|
943
|
-
if (this.videoElement === null) {
|
|
944
|
-
throw new Error("Disposed player");
|
|
945
|
-
}
|
|
946
|
-
var videoElement = this.videoElement;
|
|
947
|
-
return getPlayedSizeOfRange(videoElement.buffered, videoElement.currentTime);
|
|
948
|
-
};
|
|
949
754
|
/**
|
|
950
755
|
* Get the current position, in s, in wall-clock time.
|
|
951
756
|
* That is:
|
|
@@ -1079,115 +884,47 @@ var Player = /** @class */ (function (_super) {
|
|
|
1079
884
|
return;
|
|
1080
885
|
}
|
|
1081
886
|
this._priv_preferTrickModeTracks = preferTrickModeTracks;
|
|
1082
|
-
var
|
|
1083
|
-
if (!isNullOrUndefined(
|
|
1084
|
-
if (preferTrickModeTracks && !
|
|
1085
|
-
|
|
887
|
+
var tracksStore = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore;
|
|
888
|
+
if (!isNullOrUndefined(tracksStore)) {
|
|
889
|
+
if (preferTrickModeTracks && !tracksStore.isTrickModeEnabled()) {
|
|
890
|
+
tracksStore.enableVideoTrickModeTracks();
|
|
1086
891
|
}
|
|
1087
|
-
else if (!preferTrickModeTracks &&
|
|
1088
|
-
|
|
892
|
+
else if (!preferTrickModeTracks && tracksStore.isTrickModeEnabled()) {
|
|
893
|
+
tracksStore.disableVideoTrickModeTracks();
|
|
1089
894
|
}
|
|
1090
895
|
}
|
|
1091
896
|
};
|
|
1092
897
|
/**
|
|
1093
|
-
* Returns
|
|
1094
|
-
*
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
|
|
1101
|
-
if (currentPeriod === null || activeAdaptations === null) {
|
|
1102
|
-
return [];
|
|
1103
|
-
}
|
|
1104
|
-
var adaptations = activeAdaptations[currentPeriod.id];
|
|
1105
|
-
if (adaptations === undefined || isNullOrUndefined(adaptations.video)) {
|
|
1106
|
-
return [];
|
|
1107
|
-
}
|
|
1108
|
-
return adaptations.video.getAvailableBitrates();
|
|
1109
|
-
};
|
|
1110
|
-
/**
|
|
1111
|
-
* Returns all available bitrates for the current audio Adaptation.
|
|
1112
|
-
* @returns {Array.<Number>}
|
|
1113
|
-
*/
|
|
1114
|
-
Player.prototype.getAvailableAudioBitrates = function () {
|
|
1115
|
-
if (this._priv_contentInfos === null) {
|
|
1116
|
-
return [];
|
|
1117
|
-
}
|
|
1118
|
-
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
|
|
1119
|
-
if (currentPeriod === null || activeAdaptations === null) {
|
|
1120
|
-
return [];
|
|
1121
|
-
}
|
|
1122
|
-
var adaptations = activeAdaptations[currentPeriod.id];
|
|
1123
|
-
if (adaptations === undefined || isNullOrUndefined(adaptations.audio)) {
|
|
1124
|
-
return [];
|
|
1125
|
-
}
|
|
1126
|
-
return adaptations.audio.getAvailableBitrates();
|
|
1127
|
-
};
|
|
1128
|
-
/**
|
|
1129
|
-
* Returns the manual audio bitrate set. -1 if in AUTO mode.
|
|
1130
|
-
* @returns {Number}
|
|
1131
|
-
*/
|
|
1132
|
-
Player.prototype.getManualAudioBitrate = function () {
|
|
1133
|
-
return this._priv_bitrateInfos.manualBitrates.audio.getValue();
|
|
1134
|
-
};
|
|
1135
|
-
/**
|
|
1136
|
-
* Returns the manual video bitrate set. -1 if in AUTO mode.
|
|
1137
|
-
* @returns {Number}
|
|
1138
|
-
*/
|
|
1139
|
-
Player.prototype.getManualVideoBitrate = function () {
|
|
1140
|
-
return this._priv_bitrateInfos.manualBitrates.video.getValue();
|
|
1141
|
-
};
|
|
1142
|
-
/**
|
|
1143
|
-
* Returns currently considered bitrate for video segments.
|
|
1144
|
-
* @returns {Number|undefined}
|
|
898
|
+
* Returns video Representation currently considered for the current Period.
|
|
899
|
+
*
|
|
900
|
+
* Returns `null` if no video track is playing for the current Period.
|
|
901
|
+
*
|
|
902
|
+
* Returns `undefined` either when are not currently playing any Period or
|
|
903
|
+
* when we don't know which Representation is playing.
|
|
904
|
+
* @returns {Object|null|undefined}
|
|
1145
905
|
*/
|
|
1146
|
-
Player.prototype.
|
|
1147
|
-
var representations = this.
|
|
1148
|
-
if (representations === null
|
|
906
|
+
Player.prototype.getVideoRepresentation = function () {
|
|
907
|
+
var representations = this.__priv_getCurrentRepresentations();
|
|
908
|
+
if (representations === null) {
|
|
1149
909
|
return undefined;
|
|
1150
910
|
}
|
|
1151
|
-
return representations.video
|
|
911
|
+
return representations.video;
|
|
1152
912
|
};
|
|
1153
913
|
/**
|
|
1154
|
-
* Returns currently considered
|
|
1155
|
-
*
|
|
914
|
+
* Returns audio Representation currently considered for the current Period.
|
|
915
|
+
*
|
|
916
|
+
* Returns `null` if no audio track is playing for the current Period.
|
|
917
|
+
*
|
|
918
|
+
* Returns `undefined` either when are not currently playing any Period or
|
|
919
|
+
* when we don't know which Representation is playing.
|
|
920
|
+
* @returns {Object|null|undefined}
|
|
1156
921
|
*/
|
|
1157
|
-
Player.prototype.
|
|
1158
|
-
var representations = this.
|
|
1159
|
-
if (representations === null
|
|
922
|
+
Player.prototype.getAudioRepresentation = function () {
|
|
923
|
+
var representations = this.__priv_getCurrentRepresentations();
|
|
924
|
+
if (representations === null) {
|
|
1160
925
|
return undefined;
|
|
1161
926
|
}
|
|
1162
|
-
return representations.audio
|
|
1163
|
-
};
|
|
1164
|
-
/**
|
|
1165
|
-
* Returns minimum wanted video bitrate currently set.
|
|
1166
|
-
* @returns {Number}
|
|
1167
|
-
*/
|
|
1168
|
-
Player.prototype.getMinVideoBitrate = function () {
|
|
1169
|
-
return this._priv_bitrateInfos.minAutoBitrates.video.getValue();
|
|
1170
|
-
};
|
|
1171
|
-
/**
|
|
1172
|
-
* Returns minimum wanted audio bitrate currently set.
|
|
1173
|
-
* @returns {Number}
|
|
1174
|
-
*/
|
|
1175
|
-
Player.prototype.getMinAudioBitrate = function () {
|
|
1176
|
-
return this._priv_bitrateInfos.minAutoBitrates.audio.getValue();
|
|
1177
|
-
};
|
|
1178
|
-
/**
|
|
1179
|
-
* Returns maximum wanted video bitrate currently set.
|
|
1180
|
-
* @returns {Number}
|
|
1181
|
-
*/
|
|
1182
|
-
Player.prototype.getMaxVideoBitrate = function () {
|
|
1183
|
-
return this._priv_bitrateInfos.maxAutoBitrates.video.getValue();
|
|
1184
|
-
};
|
|
1185
|
-
/**
|
|
1186
|
-
* Returns maximum wanted audio bitrate currently set.
|
|
1187
|
-
* @returns {Number}
|
|
1188
|
-
*/
|
|
1189
|
-
Player.prototype.getMaxAudioBitrate = function () {
|
|
1190
|
-
return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();
|
|
927
|
+
return representations.audio;
|
|
1191
928
|
};
|
|
1192
929
|
/**
|
|
1193
930
|
* Play/Resume the current video.
|
|
@@ -1278,44 +1015,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
1278
1015
|
this.videoElement.currentTime = positionWanted;
|
|
1279
1016
|
return positionWanted;
|
|
1280
1017
|
};
|
|
1281
|
-
/**
|
|
1282
|
-
* Returns true if the media element is full screen.
|
|
1283
|
-
* @deprecated
|
|
1284
|
-
* @returns {Boolean}
|
|
1285
|
-
*/
|
|
1286
|
-
Player.prototype.isFullscreen = function () {
|
|
1287
|
-
warnOnce("isFullscreen is deprecated." +
|
|
1288
|
-
" Fullscreen management should now be managed by the application");
|
|
1289
|
-
return isFullscreen();
|
|
1290
|
-
};
|
|
1291
|
-
/**
|
|
1292
|
-
* Set/exit fullScreen.
|
|
1293
|
-
* @deprecated
|
|
1294
|
-
* @param {Boolean} [goFull=true] - if false, exit full screen.
|
|
1295
|
-
*/
|
|
1296
|
-
Player.prototype.setFullscreen = function (goFull) {
|
|
1297
|
-
if (goFull === void 0) { goFull = true; }
|
|
1298
|
-
warnOnce("setFullscreen is deprecated." +
|
|
1299
|
-
" Fullscreen management should now be managed by the application");
|
|
1300
|
-
if (this.videoElement === null) {
|
|
1301
|
-
throw new Error("Disposed player");
|
|
1302
|
-
}
|
|
1303
|
-
if (goFull) {
|
|
1304
|
-
requestFullscreen(this.videoElement);
|
|
1305
|
-
}
|
|
1306
|
-
else {
|
|
1307
|
-
exitFullscreen();
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
/**
|
|
1311
|
-
* Exit from full screen mode.
|
|
1312
|
-
* @deprecated
|
|
1313
|
-
*/
|
|
1314
|
-
Player.prototype.exitFullscreen = function () {
|
|
1315
|
-
warnOnce("exitFullscreen is deprecated." +
|
|
1316
|
-
" Fullscreen management should now be managed by the application");
|
|
1317
|
-
exitFullscreen();
|
|
1318
|
-
};
|
|
1319
1018
|
/**
|
|
1320
1019
|
* Returns the current player's audio volume on the media element.
|
|
1321
1020
|
* From 0 (no audio) to 1 (maximum volume).
|
|
@@ -1367,74 +1066,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
1367
1066
|
this._priv_mutedMemory);
|
|
1368
1067
|
}
|
|
1369
1068
|
};
|
|
1370
|
-
/**
|
|
1371
|
-
* Force the video bitrate to a given value. Act as a ceil.
|
|
1372
|
-
* -1 to set it on AUTO Mode
|
|
1373
|
-
* @param {Number} btr
|
|
1374
|
-
*/
|
|
1375
|
-
Player.prototype.setVideoBitrate = function (btr) {
|
|
1376
|
-
this._priv_bitrateInfos.manualBitrates.video.setValue(btr);
|
|
1377
|
-
};
|
|
1378
|
-
/**
|
|
1379
|
-
* Force the audio bitrate to a given value. Act as a ceil.
|
|
1380
|
-
* -1 to set it on AUTO Mode
|
|
1381
|
-
* @param {Number} btr
|
|
1382
|
-
*/
|
|
1383
|
-
Player.prototype.setAudioBitrate = function (btr) {
|
|
1384
|
-
this._priv_bitrateInfos.manualBitrates.audio.setValue(btr);
|
|
1385
|
-
};
|
|
1386
|
-
/**
|
|
1387
|
-
* Update the minimum video bitrate the user can switch to.
|
|
1388
|
-
* @param {Number} btr
|
|
1389
|
-
*/
|
|
1390
|
-
Player.prototype.setMinVideoBitrate = function (btr) {
|
|
1391
|
-
var maxVideoBitrate = this._priv_bitrateInfos.maxAutoBitrates.video.getValue();
|
|
1392
|
-
if (btr > maxVideoBitrate) {
|
|
1393
|
-
throw new Error("Invalid minimum video bitrate given. " +
|
|
1394
|
-
"Its value, \"".concat(btr, "\" is superior the current maximum ") +
|
|
1395
|
-
"video birate, \"".concat(maxVideoBitrate, "\"."));
|
|
1396
|
-
}
|
|
1397
|
-
this._priv_bitrateInfos.minAutoBitrates.video.setValue(btr);
|
|
1398
|
-
};
|
|
1399
|
-
/**
|
|
1400
|
-
* Update the minimum audio bitrate the user can switch to.
|
|
1401
|
-
* @param {Number} btr
|
|
1402
|
-
*/
|
|
1403
|
-
Player.prototype.setMinAudioBitrate = function (btr) {
|
|
1404
|
-
var maxAudioBitrate = this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();
|
|
1405
|
-
if (btr > maxAudioBitrate) {
|
|
1406
|
-
throw new Error("Invalid minimum audio bitrate given. " +
|
|
1407
|
-
"Its value, \"".concat(btr, "\" is superior the current maximum ") +
|
|
1408
|
-
"audio birate, \"".concat(maxAudioBitrate, "\"."));
|
|
1409
|
-
}
|
|
1410
|
-
this._priv_bitrateInfos.minAutoBitrates.audio.setValue(btr);
|
|
1411
|
-
};
|
|
1412
|
-
/**
|
|
1413
|
-
* Update the maximum video bitrate the user can switch to.
|
|
1414
|
-
* @param {Number} btr
|
|
1415
|
-
*/
|
|
1416
|
-
Player.prototype.setMaxVideoBitrate = function (btr) {
|
|
1417
|
-
var minVideoBitrate = this._priv_bitrateInfos.minAutoBitrates.video.getValue();
|
|
1418
|
-
if (btr < minVideoBitrate) {
|
|
1419
|
-
throw new Error("Invalid maximum video bitrate given. " +
|
|
1420
|
-
"Its value, \"".concat(btr, "\" is inferior the current minimum ") +
|
|
1421
|
-
"video birate, \"".concat(minVideoBitrate, "\"."));
|
|
1422
|
-
}
|
|
1423
|
-
this._priv_bitrateInfos.maxAutoBitrates.video.setValue(btr);
|
|
1424
|
-
};
|
|
1425
|
-
/**
|
|
1426
|
-
* Update the maximum audio bitrate the user can switch to.
|
|
1427
|
-
* @param {Number} btr
|
|
1428
|
-
*/
|
|
1429
|
-
Player.prototype.setMaxAudioBitrate = function (btr) {
|
|
1430
|
-
var minAudioBitrate = this._priv_bitrateInfos.minAutoBitrates.audio.getValue();
|
|
1431
|
-
if (btr < minAudioBitrate) {
|
|
1432
|
-
throw new Error("Invalid maximum audio bitrate given. " +
|
|
1433
|
-
"Its value, \"".concat(btr, "\" is inferior the current minimum ") +
|
|
1434
|
-
"audio birate, \"".concat(minAudioBitrate, "\"."));
|
|
1435
|
-
}
|
|
1436
|
-
this._priv_bitrateInfos.maxAutoBitrates.audio.setValue(btr);
|
|
1437
|
-
};
|
|
1438
1069
|
/**
|
|
1439
1070
|
* Set the max buffer size for the buffer behind the current position.
|
|
1440
1071
|
* Every buffer data before will be removed.
|
|
@@ -1509,6 +1140,14 @@ var Player = /** @class */ (function (_super) {
|
|
|
1509
1140
|
}
|
|
1510
1141
|
return getCurrentKeySystem(this.videoElement);
|
|
1511
1142
|
};
|
|
1143
|
+
Player.prototype.getCurrentPeriod = function () {
|
|
1144
|
+
var _a;
|
|
1145
|
+
var currentPeriod = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod;
|
|
1146
|
+
if (isNullOrUndefined(currentPeriod)) {
|
|
1147
|
+
return null;
|
|
1148
|
+
}
|
|
1149
|
+
return { id: currentPeriod.id, start: currentPeriod.start, end: currentPeriod.end };
|
|
1150
|
+
};
|
|
1512
1151
|
/**
|
|
1513
1152
|
* Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
|
|
1514
1153
|
* the `MediaKeySystemConfiguration` currently associated to the
|
|
@@ -1528,342 +1167,356 @@ var Player = /** @class */ (function (_super) {
|
|
|
1528
1167
|
return { keySystem: values[0], configuration: values[1] };
|
|
1529
1168
|
};
|
|
1530
1169
|
/**
|
|
1531
|
-
* Returns
|
|
1532
|
-
*
|
|
1170
|
+
* Returns the list of available Periods for which the current audio, video or
|
|
1171
|
+
* text track can now be changed.
|
|
1172
|
+
* @returns {Array.<Object>}
|
|
1533
1173
|
*/
|
|
1534
|
-
Player.prototype.
|
|
1535
|
-
var _a;
|
|
1174
|
+
Player.prototype.getAvailablePeriods = function () {
|
|
1536
1175
|
if (this._priv_contentInfos === null) {
|
|
1537
1176
|
return [];
|
|
1538
1177
|
}
|
|
1539
|
-
var
|
|
1178
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, tracksStore = _a.tracksStore;
|
|
1540
1179
|
if (isDirectFile) {
|
|
1541
|
-
return
|
|
1180
|
+
return [];
|
|
1542
1181
|
}
|
|
1543
|
-
if (
|
|
1182
|
+
if (tracksStore === null) {
|
|
1544
1183
|
return [];
|
|
1545
1184
|
}
|
|
1546
|
-
return
|
|
1185
|
+
return tracksStore.getAvailablePeriods().slice();
|
|
1547
1186
|
};
|
|
1548
1187
|
/**
|
|
1549
|
-
* Returns every available
|
|
1550
|
-
*
|
|
1188
|
+
* Returns every available audio tracks for a given Period - or the current
|
|
1189
|
+
* one if no `periodId` is given.
|
|
1190
|
+
* @param {string|undefined} [periodId]
|
|
1191
|
+
* @returns {Array.<Object>}
|
|
1551
1192
|
*/
|
|
1552
|
-
Player.prototype.
|
|
1193
|
+
Player.prototype.getAvailableAudioTracks = function (periodId) {
|
|
1553
1194
|
var _a;
|
|
1554
1195
|
if (this._priv_contentInfos === null) {
|
|
1555
1196
|
return [];
|
|
1556
1197
|
}
|
|
1557
|
-
var _b = this._priv_contentInfos,
|
|
1198
|
+
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
|
|
1558
1199
|
if (isDirectFile) {
|
|
1559
|
-
return (_a =
|
|
1200
|
+
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableAudioTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1560
1201
|
}
|
|
1561
|
-
|
|
1202
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableAudioTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1203
|
+
};
|
|
1204
|
+
/**
|
|
1205
|
+
* Returns every available text tracks for a given Period - or the current
|
|
1206
|
+
* one if no `periodId` is given.
|
|
1207
|
+
* @param {string|undefined} [periodId]
|
|
1208
|
+
* @returns {Array.<Object>}
|
|
1209
|
+
*/
|
|
1210
|
+
Player.prototype.getAvailableTextTracks = function (periodId) {
|
|
1211
|
+
var _a;
|
|
1212
|
+
if (this._priv_contentInfos === null) {
|
|
1562
1213
|
return [];
|
|
1563
1214
|
}
|
|
1564
|
-
|
|
1215
|
+
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
|
|
1216
|
+
if (isDirectFile) {
|
|
1217
|
+
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableTextTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1218
|
+
}
|
|
1219
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableTextTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1565
1220
|
};
|
|
1566
1221
|
/**
|
|
1567
1222
|
* Returns every available video tracks for the current Period.
|
|
1568
|
-
* @
|
|
1223
|
+
* @param {string|undefined} [periodId]
|
|
1224
|
+
* @returns {Array.<Object>}
|
|
1569
1225
|
*/
|
|
1570
|
-
Player.prototype.getAvailableVideoTracks = function () {
|
|
1226
|
+
Player.prototype.getAvailableVideoTracks = function (periodId) {
|
|
1571
1227
|
var _a;
|
|
1572
1228
|
if (this._priv_contentInfos === null) {
|
|
1573
1229
|
return [];
|
|
1574
1230
|
}
|
|
1575
|
-
var _b = this._priv_contentInfos,
|
|
1231
|
+
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
|
|
1576
1232
|
if (isDirectFile) {
|
|
1577
|
-
return (_a =
|
|
1233
|
+
return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableVideoTracks()) !== null && _a !== void 0 ? _a : [];
|
|
1578
1234
|
}
|
|
1579
|
-
|
|
1580
|
-
return [];
|
|
1581
|
-
}
|
|
1582
|
-
return trackChoiceManager.getAvailableVideoTracks(currentPeriod);
|
|
1235
|
+
return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableVideoTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
|
|
1583
1236
|
};
|
|
1584
1237
|
/**
|
|
1585
1238
|
* Returns currently chosen audio language for the current Period.
|
|
1586
|
-
* @
|
|
1239
|
+
* @param {string|undefined} [periodId]
|
|
1240
|
+
* @returns {Object|null|undefined}
|
|
1587
1241
|
*/
|
|
1588
|
-
Player.prototype.getAudioTrack = function () {
|
|
1242
|
+
Player.prototype.getAudioTrack = function (periodId) {
|
|
1589
1243
|
if (this._priv_contentInfos === null) {
|
|
1590
1244
|
return undefined;
|
|
1591
1245
|
}
|
|
1592
|
-
var _a = this._priv_contentInfos,
|
|
1246
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1593
1247
|
if (isDirectFile) {
|
|
1594
|
-
if (
|
|
1248
|
+
if (mediaElementTracksStore === null) {
|
|
1595
1249
|
return undefined;
|
|
1596
1250
|
}
|
|
1597
|
-
return
|
|
1251
|
+
return mediaElementTracksStore.getChosenAudioTrack();
|
|
1598
1252
|
}
|
|
1599
|
-
|
|
1600
|
-
return undefined;
|
|
1601
|
-
}
|
|
1602
|
-
return trackChoiceManager.getChosenAudioTrack(currentPeriod);
|
|
1253
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenAudioTrack(periodRef); });
|
|
1603
1254
|
};
|
|
1604
1255
|
/**
|
|
1605
1256
|
* Returns currently chosen subtitle for the current Period.
|
|
1606
|
-
* @
|
|
1257
|
+
* @param {string|undefined} [periodId]
|
|
1258
|
+
* @returns {Object|null|undefined}
|
|
1607
1259
|
*/
|
|
1608
|
-
Player.prototype.getTextTrack = function () {
|
|
1260
|
+
Player.prototype.getTextTrack = function (periodId) {
|
|
1609
1261
|
if (this._priv_contentInfos === null) {
|
|
1610
1262
|
return undefined;
|
|
1611
1263
|
}
|
|
1612
|
-
var _a = this._priv_contentInfos,
|
|
1264
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1613
1265
|
if (isDirectFile) {
|
|
1614
|
-
if (
|
|
1266
|
+
if (mediaElementTracksStore === null) {
|
|
1615
1267
|
return undefined;
|
|
1616
1268
|
}
|
|
1617
|
-
return
|
|
1618
|
-
}
|
|
1619
|
-
if (trackChoiceManager === null || currentPeriod === null) {
|
|
1620
|
-
return undefined;
|
|
1269
|
+
return mediaElementTracksStore.getChosenTextTrack();
|
|
1621
1270
|
}
|
|
1622
|
-
return
|
|
1271
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenTextTrack(periodRef); });
|
|
1623
1272
|
};
|
|
1624
1273
|
/**
|
|
1625
1274
|
* Returns currently chosen video track for the current Period.
|
|
1626
|
-
* @
|
|
1275
|
+
* @param {string|undefined} [periodId]
|
|
1276
|
+
* @returns {Object|null|undefined}
|
|
1627
1277
|
*/
|
|
1628
|
-
Player.prototype.getVideoTrack = function () {
|
|
1278
|
+
Player.prototype.getVideoTrack = function (periodId) {
|
|
1629
1279
|
if (this._priv_contentInfos === null) {
|
|
1630
1280
|
return undefined;
|
|
1631
1281
|
}
|
|
1632
|
-
var _a = this._priv_contentInfos,
|
|
1282
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1633
1283
|
if (isDirectFile) {
|
|
1634
|
-
if (
|
|
1284
|
+
if (mediaElementTracksStore === null) {
|
|
1635
1285
|
return undefined;
|
|
1636
1286
|
}
|
|
1637
|
-
return
|
|
1287
|
+
return mediaElementTracksStore.getChosenVideoTrack();
|
|
1638
1288
|
}
|
|
1639
|
-
|
|
1640
|
-
return undefined;
|
|
1641
|
-
}
|
|
1642
|
-
return trackChoiceManager.getChosenVideoTrack(currentPeriod);
|
|
1289
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenVideoTrack(periodRef); });
|
|
1643
1290
|
};
|
|
1644
1291
|
/**
|
|
1645
1292
|
* Update the audio language for the current Period.
|
|
1646
|
-
* @param {string}
|
|
1647
|
-
* @throws Error - the current content has no
|
|
1293
|
+
* @param {string | object} arg
|
|
1294
|
+
* @throws Error - the current content has no TracksStore.
|
|
1648
1295
|
* @throws Error - the given id is linked to no audio track.
|
|
1649
1296
|
*/
|
|
1650
|
-
Player.prototype.setAudioTrack = function (
|
|
1297
|
+
Player.prototype.setAudioTrack = function (arg) {
|
|
1298
|
+
var _a;
|
|
1651
1299
|
if (this._priv_contentInfos === null) {
|
|
1652
1300
|
throw new Error("No content loaded");
|
|
1653
1301
|
}
|
|
1654
|
-
var
|
|
1302
|
+
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
|
|
1655
1303
|
if (isDirectFile) {
|
|
1656
1304
|
try {
|
|
1657
|
-
|
|
1305
|
+
var audioId = typeof arg === "string" ? arg :
|
|
1306
|
+
arg.trackId;
|
|
1307
|
+
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setAudioTrackById(audioId);
|
|
1658
1308
|
return;
|
|
1659
1309
|
}
|
|
1660
1310
|
catch (e) {
|
|
1661
1311
|
throw new Error("player: unknown audio track");
|
|
1662
1312
|
}
|
|
1663
1313
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1314
|
+
var periodId;
|
|
1315
|
+
var trackId;
|
|
1316
|
+
var switchingMode;
|
|
1317
|
+
var reprsToLock = null;
|
|
1318
|
+
if (typeof arg === "string") {
|
|
1319
|
+
trackId = arg;
|
|
1666
1320
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1321
|
+
else {
|
|
1322
|
+
trackId = arg.trackId;
|
|
1323
|
+
periodId = arg.periodId;
|
|
1324
|
+
switchingMode = arg.switchingMode;
|
|
1325
|
+
reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
|
|
1672
1326
|
}
|
|
1327
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
|
|
1328
|
+
return tcm.setAudioTrack(periodRef, trackId, switchingMode, reprsToLock);
|
|
1329
|
+
});
|
|
1673
1330
|
};
|
|
1674
1331
|
/**
|
|
1675
1332
|
* Update the text language for the current Period.
|
|
1676
|
-
* @param {string}
|
|
1677
|
-
* @throws Error - the current content has no
|
|
1333
|
+
* @param {string | Object} arg
|
|
1334
|
+
* @throws Error - the current content has no TracksStore.
|
|
1678
1335
|
* @throws Error - the given id is linked to no text track.
|
|
1679
1336
|
*/
|
|
1680
|
-
Player.prototype.setTextTrack = function (
|
|
1337
|
+
Player.prototype.setTextTrack = function (arg) {
|
|
1681
1338
|
if (this._priv_contentInfos === null) {
|
|
1682
1339
|
throw new Error("No content loaded");
|
|
1683
1340
|
}
|
|
1684
|
-
var _a = this._priv_contentInfos,
|
|
1341
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1685
1342
|
if (isDirectFile) {
|
|
1686
1343
|
try {
|
|
1687
|
-
|
|
1344
|
+
var textId = typeof arg === "string" ? arg :
|
|
1345
|
+
arg.trackId;
|
|
1346
|
+
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setTextTrackById(textId);
|
|
1688
1347
|
return;
|
|
1689
1348
|
}
|
|
1690
1349
|
catch (e) {
|
|
1691
1350
|
throw new Error("player: unknown text track");
|
|
1692
1351
|
}
|
|
1693
1352
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1353
|
+
var periodId;
|
|
1354
|
+
var trackId;
|
|
1355
|
+
if (typeof arg === "string") {
|
|
1356
|
+
trackId = arg;
|
|
1696
1357
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
catch (e) {
|
|
1701
|
-
throw new Error("player: unknown text track");
|
|
1358
|
+
else {
|
|
1359
|
+
trackId = arg.trackId;
|
|
1360
|
+
periodId = arg.periodId;
|
|
1702
1361
|
}
|
|
1362
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.setTextTrack(periodRef, trackId); });
|
|
1703
1363
|
};
|
|
1704
1364
|
/**
|
|
1705
1365
|
* Disable subtitles for the current content.
|
|
1366
|
+
* @param {string|undefined} [periodId]
|
|
1706
1367
|
*/
|
|
1707
|
-
Player.prototype.disableTextTrack = function () {
|
|
1368
|
+
Player.prototype.disableTextTrack = function (periodId) {
|
|
1708
1369
|
if (this._priv_contentInfos === null) {
|
|
1709
1370
|
return;
|
|
1710
1371
|
}
|
|
1711
|
-
var _a = this._priv_contentInfos,
|
|
1372
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1712
1373
|
if (isDirectFile) {
|
|
1713
|
-
|
|
1374
|
+
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.disableTextTrack();
|
|
1714
1375
|
return;
|
|
1715
1376
|
}
|
|
1716
|
-
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
return trackChoiceManager.disableTextTrack(currentPeriod);
|
|
1377
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.disableTrack(periodRef, "text"); });
|
|
1720
1378
|
};
|
|
1721
1379
|
/**
|
|
1722
1380
|
* Update the video track for the current Period.
|
|
1723
|
-
* @param {string}
|
|
1724
|
-
* @throws Error - the current content has no
|
|
1381
|
+
* @param {string | Object} arg
|
|
1382
|
+
* @throws Error - the current content has no TracksStore.
|
|
1725
1383
|
* @throws Error - the given id is linked to no video track.
|
|
1726
1384
|
*/
|
|
1727
|
-
Player.prototype.setVideoTrack = function (
|
|
1385
|
+
Player.prototype.setVideoTrack = function (arg) {
|
|
1386
|
+
var _a;
|
|
1728
1387
|
if (this._priv_contentInfos === null) {
|
|
1729
1388
|
throw new Error("No content loaded");
|
|
1730
1389
|
}
|
|
1731
|
-
var
|
|
1390
|
+
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
|
|
1732
1391
|
if (isDirectFile) {
|
|
1733
1392
|
try {
|
|
1734
|
-
|
|
1393
|
+
var videoId = typeof arg === "string" ? arg :
|
|
1394
|
+
arg.trackId;
|
|
1395
|
+
mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setVideoTrackById(videoId);
|
|
1735
1396
|
return;
|
|
1736
1397
|
}
|
|
1737
1398
|
catch (e) {
|
|
1738
1399
|
throw new Error("player: unknown video track");
|
|
1739
1400
|
}
|
|
1740
1401
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1402
|
+
var periodId;
|
|
1403
|
+
var trackId;
|
|
1404
|
+
var switchingMode;
|
|
1405
|
+
var reprsToLock = null;
|
|
1406
|
+
if (typeof arg === "string") {
|
|
1407
|
+
trackId = arg;
|
|
1743
1408
|
}
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1409
|
+
else {
|
|
1410
|
+
trackId = arg.trackId;
|
|
1411
|
+
periodId = arg.periodId;
|
|
1412
|
+
switchingMode = arg.switchingMode;
|
|
1413
|
+
reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
|
|
1749
1414
|
}
|
|
1415
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
|
|
1416
|
+
return tcm.setVideoTrack(periodRef, trackId, switchingMode, reprsToLock);
|
|
1417
|
+
});
|
|
1750
1418
|
};
|
|
1751
1419
|
/**
|
|
1752
1420
|
* Disable video track for the current content.
|
|
1421
|
+
* @param {string|undefined} [periodId]
|
|
1753
1422
|
*/
|
|
1754
|
-
Player.prototype.disableVideoTrack = function () {
|
|
1423
|
+
Player.prototype.disableVideoTrack = function (periodId) {
|
|
1755
1424
|
if (this._priv_contentInfos === null) {
|
|
1756
1425
|
return;
|
|
1757
1426
|
}
|
|
1758
|
-
var _a = this._priv_contentInfos,
|
|
1759
|
-
if (isDirectFile &&
|
|
1760
|
-
return
|
|
1427
|
+
var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
|
|
1428
|
+
if (isDirectFile && mediaElementTracksStore !== null) {
|
|
1429
|
+
return mediaElementTracksStore.disableVideoTrack();
|
|
1761
1430
|
}
|
|
1762
|
-
|
|
1763
|
-
return;
|
|
1764
|
-
}
|
|
1765
|
-
return trackChoiceManager.disableVideoTrack(currentPeriod);
|
|
1766
|
-
};
|
|
1767
|
-
/**
|
|
1768
|
-
* Returns the current list of preferred audio tracks, in preference order.
|
|
1769
|
-
* @returns {Array.<Object>}
|
|
1770
|
-
*/
|
|
1771
|
-
Player.prototype.getPreferredAudioTracks = function () {
|
|
1772
|
-
return this._priv_preferredAudioTracks;
|
|
1431
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.disableTrack(periodRef, "video"); });
|
|
1773
1432
|
};
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
/**
|
|
1782
|
-
* Returns the current list of preferred text tracks, in preference order.
|
|
1783
|
-
* @returns {Array.<Object>}
|
|
1784
|
-
*/
|
|
1785
|
-
Player.prototype.getPreferredVideoTracks = function () {
|
|
1786
|
-
return this._priv_preferredVideoTracks;
|
|
1787
|
-
};
|
|
1788
|
-
/**
|
|
1789
|
-
* Set the list of preferred audio tracks, in preference order.
|
|
1790
|
-
* @param {Array.<Object>} tracks
|
|
1791
|
-
* @param {boolean} shouldApply - `true` if those preferences should be
|
|
1792
|
-
* applied on the currently loaded Period. `false` if it should only
|
|
1793
|
-
* be applied to new content.
|
|
1794
|
-
*/
|
|
1795
|
-
Player.prototype.setPreferredAudioTracks = function (tracks, shouldApply) {
|
|
1796
|
-
if (shouldApply === void 0) { shouldApply = false; }
|
|
1797
|
-
if (!Array.isArray(tracks)) {
|
|
1798
|
-
throw new Error("Invalid `setPreferredAudioTracks` argument. " +
|
|
1799
|
-
"Should have been an Array.");
|
|
1433
|
+
Player.prototype.lockVideoRepresentations = function (arg) {
|
|
1434
|
+
if (this._priv_contentInfos === null) {
|
|
1435
|
+
throw new Error("No content loaded");
|
|
1436
|
+
}
|
|
1437
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1438
|
+
if (isDirectFile) {
|
|
1439
|
+
throw new Error("Cannot lock video Representations in directfile mode.");
|
|
1800
1440
|
}
|
|
1801
|
-
|
|
1802
|
-
var
|
|
1803
|
-
|
|
1804
|
-
|
|
1441
|
+
var repsId;
|
|
1442
|
+
var periodId;
|
|
1443
|
+
var switchingMode;
|
|
1444
|
+
if (Array.isArray(arg)) {
|
|
1445
|
+
repsId = arg;
|
|
1446
|
+
periodId = undefined;
|
|
1805
1447
|
}
|
|
1806
|
-
else
|
|
1807
|
-
|
|
1448
|
+
else {
|
|
1449
|
+
repsId = arg.representations;
|
|
1450
|
+
periodId = arg.periodId;
|
|
1451
|
+
switchingMode = arg.switchingMode;
|
|
1808
1452
|
}
|
|
1453
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
|
|
1454
|
+
return tcm.lockVideoRepresentations(periodRef, { representations: repsId, switchingMode: switchingMode });
|
|
1455
|
+
});
|
|
1809
1456
|
};
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
* @param {boolean} shouldApply - `true` if those preferences should be
|
|
1814
|
-
* applied on the currently loaded Periods. `false` if it should only
|
|
1815
|
-
* be applied to new content.
|
|
1816
|
-
*/
|
|
1817
|
-
Player.prototype.setPreferredTextTracks = function (tracks, shouldApply) {
|
|
1818
|
-
if (shouldApply === void 0) { shouldApply = false; }
|
|
1819
|
-
if (!Array.isArray(tracks)) {
|
|
1820
|
-
throw new Error("Invalid `setPreferredTextTracks` argument. " +
|
|
1821
|
-
"Should have been an Array.");
|
|
1457
|
+
Player.prototype.lockAudioRepresentations = function (arg) {
|
|
1458
|
+
if (this._priv_contentInfos === null) {
|
|
1459
|
+
throw new Error("No content loaded");
|
|
1822
1460
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.trackChoiceManager.setPreferredTextTracks(tracks, shouldApply);
|
|
1461
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1462
|
+
if (isDirectFile) {
|
|
1463
|
+
throw new Error("Cannot lock audio Representations in directfile mode.");
|
|
1827
1464
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1465
|
+
var repsId;
|
|
1466
|
+
var periodId;
|
|
1467
|
+
var switchingMode;
|
|
1468
|
+
if (Array.isArray(arg)) {
|
|
1469
|
+
repsId = arg;
|
|
1470
|
+
periodId = undefined;
|
|
1830
1471
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
* @param {boolean} shouldApply - `true` if those preferences should be
|
|
1836
|
-
* applied on the currently loaded Period. `false` if it should only
|
|
1837
|
-
* be applied to new content.
|
|
1838
|
-
*/
|
|
1839
|
-
Player.prototype.setPreferredVideoTracks = function (tracks, shouldApply) {
|
|
1840
|
-
if (shouldApply === void 0) { shouldApply = false; }
|
|
1841
|
-
if (!Array.isArray(tracks)) {
|
|
1842
|
-
throw new Error("Invalid `setPreferredVideoTracks` argument. " +
|
|
1843
|
-
"Should have been an Array.");
|
|
1472
|
+
else {
|
|
1473
|
+
repsId = arg.representations;
|
|
1474
|
+
periodId = arg.periodId;
|
|
1475
|
+
switchingMode = arg.switchingMode;
|
|
1844
1476
|
}
|
|
1845
|
-
this.
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1477
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
|
|
1478
|
+
return tcm.lockAudioRepresentations(periodRef, { representations: repsId, switchingMode: switchingMode });
|
|
1479
|
+
});
|
|
1480
|
+
};
|
|
1481
|
+
Player.prototype.getLockedVideoRepresentations = function (periodId) {
|
|
1482
|
+
if (this._priv_contentInfos === null) {
|
|
1483
|
+
return null;
|
|
1849
1484
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1485
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1486
|
+
if (isDirectFile) {
|
|
1487
|
+
return null;
|
|
1852
1488
|
}
|
|
1489
|
+
return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) { return tcm.getLockedVideoRepresentations(periodRef); });
|
|
1853
1490
|
};
|
|
1854
|
-
|
|
1855
|
-
* @returns {Array.<Object>|null}
|
|
1856
|
-
* @deprecated
|
|
1857
|
-
*/
|
|
1858
|
-
Player.prototype.getImageTrackData = function () {
|
|
1859
|
-
warnOnce("`getImageTrackData` is deprecated." +
|
|
1860
|
-
"Please use the `parseBifThumbnails` tool instead.");
|
|
1491
|
+
Player.prototype.getLockedAudioRepresentations = function (periodId) {
|
|
1861
1492
|
if (this._priv_contentInfos === null) {
|
|
1862
1493
|
return null;
|
|
1863
1494
|
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1495
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1496
|
+
if (isDirectFile) {
|
|
1497
|
+
return null;
|
|
1498
|
+
}
|
|
1499
|
+
return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) { return tcm.getLockedAudioRepresentations(periodRef); });
|
|
1500
|
+
};
|
|
1501
|
+
Player.prototype.unlockVideoRepresentations = function (periodId) {
|
|
1502
|
+
if (this._priv_contentInfos === null) {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1506
|
+
if (isDirectFile) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.unlockVideoRepresentations(periodRef); });
|
|
1510
|
+
};
|
|
1511
|
+
Player.prototype.unlockAudioRepresentations = function (periodId) {
|
|
1512
|
+
if (this._priv_contentInfos === null) {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
var isDirectFile = this._priv_contentInfos.isDirectFile;
|
|
1516
|
+
if (isDirectFile) {
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.unlockAudioRepresentations(periodRef); });
|
|
1867
1520
|
};
|
|
1868
1521
|
/**
|
|
1869
1522
|
* Get minimum seek-able position.
|
|
@@ -1905,6 +1558,12 @@ var Player = /** @class */ (function (_super) {
|
|
|
1905
1558
|
}
|
|
1906
1559
|
return null;
|
|
1907
1560
|
};
|
|
1561
|
+
// ---- Undocumented Private methods. ----
|
|
1562
|
+
//
|
|
1563
|
+
// Those methods are just here either to allow some tools relying on the
|
|
1564
|
+
// RxPlayer instance to work or to improve the RxPlayer's demo.
|
|
1565
|
+
//
|
|
1566
|
+
// They should not be used by any external code.
|
|
1908
1567
|
/**
|
|
1909
1568
|
* /!\ For demo use only! Do not touch!
|
|
1910
1569
|
*
|
|
@@ -1920,20 +1579,64 @@ var Player = /** @class */ (function (_super) {
|
|
|
1920
1579
|
}
|
|
1921
1580
|
var segmentBufferStatus = this._priv_contentInfos
|
|
1922
1581
|
.segmentBuffersStore.getStatus(bufferType);
|
|
1923
|
-
|
|
1924
|
-
segmentBufferStatus.value.
|
|
1925
|
-
|
|
1582
|
+
if (segmentBufferStatus.type === "initialized") {
|
|
1583
|
+
segmentBufferStatus.value.synchronizeInventory();
|
|
1584
|
+
return segmentBufferStatus.value.getInventory();
|
|
1585
|
+
}
|
|
1586
|
+
return null;
|
|
1587
|
+
};
|
|
1588
|
+
/**
|
|
1589
|
+
* /!\ For tools use only! Do not touch!
|
|
1590
|
+
*
|
|
1591
|
+
* Returns manifest/playlist object.
|
|
1592
|
+
* null if the player is STOPPED.
|
|
1593
|
+
* @returns {Manifest|null} - The current Manifest (`null` when not known).
|
|
1594
|
+
*/
|
|
1595
|
+
// TODO remove the need for that public method
|
|
1596
|
+
Player.prototype.__priv_getManifest = function () {
|
|
1597
|
+
if (this._priv_contentInfos === null) {
|
|
1598
|
+
return null;
|
|
1599
|
+
}
|
|
1600
|
+
return this._priv_contentInfos.manifest;
|
|
1601
|
+
};
|
|
1602
|
+
// TODO remove the need for that public method
|
|
1603
|
+
Player.prototype.__priv_getCurrentAdaptation = function () {
|
|
1604
|
+
if (this._priv_contentInfos === null) {
|
|
1605
|
+
return null;
|
|
1606
|
+
}
|
|
1607
|
+
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
|
|
1608
|
+
if (currentPeriod === null ||
|
|
1609
|
+
activeAdaptations === null ||
|
|
1610
|
+
isNullOrUndefined(activeAdaptations[currentPeriod.id])) {
|
|
1611
|
+
return null;
|
|
1612
|
+
}
|
|
1613
|
+
return activeAdaptations[currentPeriod.id];
|
|
1614
|
+
};
|
|
1615
|
+
// TODO remove the need for that public method
|
|
1616
|
+
Player.prototype.__priv_getCurrentRepresentations = function () {
|
|
1617
|
+
if (this._priv_contentInfos === null) {
|
|
1618
|
+
return null;
|
|
1619
|
+
}
|
|
1620
|
+
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeRepresentations = _a.activeRepresentations;
|
|
1621
|
+
if (currentPeriod === null ||
|
|
1622
|
+
activeRepresentations === null ||
|
|
1623
|
+
isNullOrUndefined(activeRepresentations[currentPeriod.id])) {
|
|
1624
|
+
return null;
|
|
1625
|
+
}
|
|
1626
|
+
return activeRepresentations[currentPeriod.id];
|
|
1926
1627
|
};
|
|
1628
|
+
// ---- Private methods ----
|
|
1927
1629
|
/**
|
|
1928
1630
|
* Reset all state properties relative to a playing content.
|
|
1929
1631
|
*/
|
|
1930
1632
|
Player.prototype._priv_cleanUpCurrentContentState = function () {
|
|
1931
1633
|
var _this = this;
|
|
1932
|
-
var _a, _b;
|
|
1634
|
+
var _a, _b, _c, _d;
|
|
1933
1635
|
log.debug("Locking `contentLock` to clean-up the current content.");
|
|
1934
1636
|
// lock playback of new contents while cleaning up is pending
|
|
1935
1637
|
this._priv_contentLock.setValue(true);
|
|
1936
|
-
(_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.
|
|
1638
|
+
(_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
1639
|
+
(_d = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.mediaElementTracksStore) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
1937
1640
|
this._priv_contentInfos = null;
|
|
1938
1641
|
this._priv_contentEventsMemory = {};
|
|
1939
1642
|
// DRM-related clean-up
|
|
@@ -1973,29 +1676,29 @@ var Player = /** @class */ (function (_super) {
|
|
|
1973
1676
|
contentInfos.manifest = manifest;
|
|
1974
1677
|
var cancelSignal = contentInfos.currentContentCanceller.signal;
|
|
1975
1678
|
this._priv_reloadingMetadata.manifest = manifest;
|
|
1976
|
-
|
|
1977
|
-
contentInfos.trackChoiceManager = new TrackChoiceManager({
|
|
1679
|
+
contentInfos.tracksStore = new TracksStore({
|
|
1978
1680
|
preferTrickModeTracks: this._priv_preferTrickModeTracks,
|
|
1681
|
+
defaultAudioTrackSwitchingMode: contentInfos.defaultAudioTrackSwitchingMode,
|
|
1682
|
+
});
|
|
1683
|
+
contentInfos.tracksStore.addEventListener("newAvailablePeriods", function (p) {
|
|
1684
|
+
_this.trigger("newAvailablePeriods", p);
|
|
1979
1685
|
});
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
contentInfos.
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
contentInfos.trackChoiceManager.setPreferredTextTracks(preferredTextTracks, true);
|
|
1988
|
-
contentInfos.trackChoiceManager
|
|
1989
|
-
.setPreferredVideoTracks(this._priv_preferredVideoTracks, true);
|
|
1686
|
+
contentInfos.tracksStore.addEventListener("brokenRepresentationsLock", function (e) {
|
|
1687
|
+
_this.trigger("brokenRepresentationsLock", e);
|
|
1688
|
+
});
|
|
1689
|
+
contentInfos.tracksStore.addEventListener("trackUpdate", function (e) {
|
|
1690
|
+
_this.trigger("trackUpdate", e);
|
|
1691
|
+
});
|
|
1692
|
+
contentInfos.tracksStore.updatePeriodList(manifest);
|
|
1990
1693
|
manifest.addEventListener("manifestUpdate", function (updates) {
|
|
1991
1694
|
var _a, _b, _c;
|
|
1992
1695
|
// Update the tracks chosen if it changed
|
|
1993
|
-
if (contentInfos
|
|
1994
|
-
contentInfos.
|
|
1696
|
+
if (!isNullOrUndefined(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
|
|
1697
|
+
contentInfos.tracksStore.updatePeriodList(manifest);
|
|
1995
1698
|
}
|
|
1996
1699
|
var currentPeriod = (_b = (_a = _this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
|
|
1997
|
-
var
|
|
1998
|
-
if (currentPeriod === undefined || isNullOrUndefined(
|
|
1700
|
+
var tracksStore = (_c = _this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
|
|
1701
|
+
if (currentPeriod === undefined || isNullOrUndefined(tracksStore)) {
|
|
1999
1702
|
return;
|
|
2000
1703
|
}
|
|
2001
1704
|
for (var _i = 0, _d = updates.updatedPeriods; _i < _d.length; _i++) {
|
|
@@ -2004,11 +1707,15 @@ var Player = /** @class */ (function (_super) {
|
|
|
2004
1707
|
if (update.result.addedAdaptations.length > 0 ||
|
|
2005
1708
|
update.result.removedAdaptations.length > 0) {
|
|
2006
1709
|
// We might have new (or less) tracks, send events just to be sure
|
|
2007
|
-
var
|
|
1710
|
+
var periodRef = tracksStore.getPeriodObjectFromPeriod(currentPeriod);
|
|
1711
|
+
if (periodRef === undefined) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
var audioTracks = tracksStore.getAvailableAudioTracks(periodRef);
|
|
2008
1715
|
_this._priv_triggerEventIfNotStopped("availableAudioTracksChange", audioTracks !== null && audioTracks !== void 0 ? audioTracks : [], cancelSignal);
|
|
2009
|
-
var textTracks =
|
|
1716
|
+
var textTracks = tracksStore.getAvailableTextTracks(periodRef);
|
|
2010
1717
|
_this._priv_triggerEventIfNotStopped("availableTextTracksChange", textTracks !== null && textTracks !== void 0 ? textTracks : [], cancelSignal);
|
|
2011
|
-
var videoTracks =
|
|
1718
|
+
var videoTracks = tracksStore.getAvailableVideoTracks(periodRef);
|
|
2012
1719
|
_this._priv_triggerEventIfNotStopped("availableVideoTracksChange", videoTracks !== null && videoTracks !== void 0 ? videoTracks : [], cancelSignal);
|
|
2013
1720
|
}
|
|
2014
1721
|
}
|
|
@@ -2024,7 +1731,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2024
1731
|
* @param {Object} periodInfo
|
|
2025
1732
|
*/
|
|
2026
1733
|
Player.prototype._priv_onActivePeriodChanged = function (contentInfos, _a) {
|
|
2027
|
-
var _b, _c, _d, _e, _f, _g
|
|
1734
|
+
var _b, _c, _d, _e, _f, _g;
|
|
2028
1735
|
var period = _a.period;
|
|
2029
1736
|
if (contentInfos.contentId !== ((_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.contentId)) {
|
|
2030
1737
|
return; // Event for another content
|
|
@@ -2033,41 +1740,35 @@ var Player = /** @class */ (function (_super) {
|
|
|
2033
1740
|
var cancelSignal = contentInfos.currentContentCanceller.signal;
|
|
2034
1741
|
if (this._priv_contentEventsMemory.periodChange !== period) {
|
|
2035
1742
|
this._priv_contentEventsMemory.periodChange = period;
|
|
2036
|
-
this._priv_triggerEventIfNotStopped("periodChange", period,
|
|
1743
|
+
this._priv_triggerEventIfNotStopped("periodChange", { start: period.start,
|
|
1744
|
+
end: period.end,
|
|
1745
|
+
id: period.id }, cancelSignal);
|
|
2037
1746
|
}
|
|
2038
1747
|
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", this.getAvailableAudioTracks(), cancelSignal);
|
|
2039
1748
|
this._priv_triggerEventIfNotStopped("availableTextTracksChange", this.getAvailableTextTracks(), cancelSignal);
|
|
2040
1749
|
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", this.getAvailableVideoTracks(), cancelSignal);
|
|
2041
|
-
var
|
|
2042
|
-
// Emit
|
|
2043
|
-
if (!isNullOrUndefined(
|
|
2044
|
-
var
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
1750
|
+
var tracksStore = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
|
|
1751
|
+
// Emit initial events for the Period
|
|
1752
|
+
if (!isNullOrUndefined(tracksStore)) {
|
|
1753
|
+
var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
|
|
1754
|
+
if (periodRef) {
|
|
1755
|
+
var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
|
|
1756
|
+
this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
|
|
1757
|
+
var textTrack = tracksStore.getChosenTextTrack(periodRef);
|
|
1758
|
+
this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
|
|
1759
|
+
var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
|
|
1760
|
+
this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
|
|
1761
|
+
}
|
|
2050
1762
|
}
|
|
2051
1763
|
else {
|
|
2052
1764
|
this._priv_triggerEventIfNotStopped("audioTrackChange", null, cancelSignal);
|
|
2053
1765
|
this._priv_triggerEventIfNotStopped("textTrackChange", null, cancelSignal);
|
|
2054
1766
|
this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
|
|
2055
1767
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange", this.getAvailableVideoBitrates(), cancelSignal);
|
|
2061
|
-
if (contentInfos.currentContentCanceller.isUsed()) {
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
2064
|
-
var audioBitrate = (_f = (_e = (_d = this._priv_getCurrentRepresentations()) === null || _d === void 0 ? void 0 : _d.audio) === null || _e === void 0 ? void 0 : _e.bitrate) !== null && _f !== void 0 ? _f : -1;
|
|
2065
|
-
this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange", audioBitrate, cancelSignal);
|
|
2066
|
-
if (contentInfos.currentContentCanceller.isUsed()) {
|
|
2067
|
-
return;
|
|
2068
|
-
}
|
|
2069
|
-
var videoBitrate = (_j = (_h = (_g = this._priv_getCurrentRepresentations()) === null || _g === void 0 ? void 0 : _g.video) === null || _h === void 0 ? void 0 : _h.bitrate) !== null && _j !== void 0 ? _j : -1;
|
|
2070
|
-
this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange", videoBitrate, cancelSignal);
|
|
1768
|
+
var audioRepresentation = (_e = (_d = this.__priv_getCurrentRepresentations()) === null || _d === void 0 ? void 0 : _d.audio) !== null && _e !== void 0 ? _e : null;
|
|
1769
|
+
this._priv_triggerEventIfNotStopped("audioRepresentationChange", audioRepresentation, cancelSignal);
|
|
1770
|
+
var videoRepresentation = (_g = (_f = this.__priv_getCurrentRepresentations()) === null || _f === void 0 ? void 0 : _f.video) !== null && _g !== void 0 ? _g : null;
|
|
1771
|
+
this._priv_triggerEventIfNotStopped("videoRepresentationChange", videoRepresentation, cancelSignal);
|
|
2071
1772
|
};
|
|
2072
1773
|
/**
|
|
2073
1774
|
* Triggered each times a new "PeriodStream" is ready.
|
|
@@ -2080,48 +1781,22 @@ var Player = /** @class */ (function (_super) {
|
|
|
2080
1781
|
if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
|
|
2081
1782
|
return; // Event for another content
|
|
2082
1783
|
}
|
|
2083
|
-
var type = value.type, period = value.period, adaptationRef = value.adaptationRef;
|
|
2084
|
-
var
|
|
1784
|
+
var type = value.type, manifest = value.manifest, period = value.period, adaptationRef = value.adaptationRef;
|
|
1785
|
+
var tracksStore = contentInfos.tracksStore;
|
|
2085
1786
|
switch (type) {
|
|
2086
1787
|
case "video":
|
|
2087
|
-
if (isNullOrUndefined(trackChoiceManager)) {
|
|
2088
|
-
log.error("API: TrackChoiceManager not instanciated for a new video period");
|
|
2089
|
-
adaptationRef.setValue(null);
|
|
2090
|
-
}
|
|
2091
|
-
else {
|
|
2092
|
-
trackChoiceManager.addPeriod(type, period, adaptationRef);
|
|
2093
|
-
trackChoiceManager.setInitialVideoTrack(period);
|
|
2094
|
-
}
|
|
2095
|
-
break;
|
|
2096
1788
|
case "audio":
|
|
2097
|
-
if (isNullOrUndefined(trackChoiceManager)) {
|
|
2098
|
-
log.error("API: TrackChoiceManager not instanciated for a new ".concat(type, " period"));
|
|
2099
|
-
adaptationRef.setValue(null);
|
|
2100
|
-
}
|
|
2101
|
-
else {
|
|
2102
|
-
trackChoiceManager.addPeriod(type, period, adaptationRef);
|
|
2103
|
-
trackChoiceManager.setInitialAudioTrack(period);
|
|
2104
|
-
}
|
|
2105
|
-
break;
|
|
2106
1789
|
case "text":
|
|
2107
|
-
if (isNullOrUndefined(
|
|
2108
|
-
log.error("API:
|
|
1790
|
+
if (isNullOrUndefined(tracksStore)) {
|
|
1791
|
+
log.error("API: TracksStore not instanciated for a new ".concat(type, " period"));
|
|
2109
1792
|
adaptationRef.setValue(null);
|
|
2110
1793
|
}
|
|
2111
1794
|
else {
|
|
2112
|
-
|
|
2113
|
-
trackChoiceManager.setInitialTextTrack(period);
|
|
1795
|
+
tracksStore.addTrackReference(type, manifest, period, adaptationRef);
|
|
2114
1796
|
}
|
|
2115
1797
|
break;
|
|
2116
1798
|
default:
|
|
2117
|
-
|
|
2118
|
-
if (!isNullOrUndefined(adaptations) && adaptations.length > 0) {
|
|
2119
|
-
adaptationRef.setValue(adaptations[0]);
|
|
2120
|
-
}
|
|
2121
|
-
else {
|
|
2122
|
-
adaptationRef.setValue(null);
|
|
2123
|
-
}
|
|
2124
|
-
break;
|
|
1799
|
+
assertUnreachable(type);
|
|
2125
1800
|
}
|
|
2126
1801
|
};
|
|
2127
1802
|
/**
|
|
@@ -2135,14 +1810,14 @@ var Player = /** @class */ (function (_super) {
|
|
|
2135
1810
|
return; // Event for another content
|
|
2136
1811
|
}
|
|
2137
1812
|
var type = value.type, period = value.period;
|
|
2138
|
-
var
|
|
2139
|
-
// Clean-up track
|
|
1813
|
+
var tracksStore = contentInfos.tracksStore;
|
|
1814
|
+
// Clean-up track choices from TracksStore
|
|
2140
1815
|
switch (type) {
|
|
2141
1816
|
case "audio":
|
|
2142
1817
|
case "text":
|
|
2143
1818
|
case "video":
|
|
2144
|
-
if (!isNullOrUndefined(
|
|
2145
|
-
|
|
1819
|
+
if (!isNullOrUndefined(tracksStore)) {
|
|
1820
|
+
tracksStore.removeTrackReference(type, period);
|
|
2146
1821
|
}
|
|
2147
1822
|
break;
|
|
2148
1823
|
}
|
|
@@ -2191,27 +1866,27 @@ var Player = /** @class */ (function (_super) {
|
|
|
2191
1866
|
else {
|
|
2192
1867
|
activePeriodAdaptations[type] = adaptation;
|
|
2193
1868
|
}
|
|
2194
|
-
var
|
|
1869
|
+
var tracksStore = contentInfos.tracksStore;
|
|
2195
1870
|
var cancelSignal = contentInfos.currentContentCanceller.signal;
|
|
2196
|
-
if (
|
|
1871
|
+
if (tracksStore !== null &&
|
|
2197
1872
|
currentPeriod !== null && !isNullOrUndefined(period) &&
|
|
2198
1873
|
period.id === currentPeriod.id) {
|
|
1874
|
+
var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
|
|
1875
|
+
if (periodRef === undefined) {
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
2199
1878
|
switch (type) {
|
|
2200
1879
|
case "audio":
|
|
2201
|
-
var audioTrack =
|
|
1880
|
+
var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
|
|
2202
1881
|
this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
|
|
2203
|
-
var availableAudioBitrates = this.getAvailableAudioBitrates();
|
|
2204
|
-
this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange", availableAudioBitrates, cancelSignal);
|
|
2205
1882
|
break;
|
|
2206
1883
|
case "text":
|
|
2207
|
-
var textTrack =
|
|
1884
|
+
var textTrack = tracksStore.getChosenTextTrack(periodRef);
|
|
2208
1885
|
this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
|
|
2209
1886
|
break;
|
|
2210
1887
|
case "video":
|
|
2211
|
-
var videoTrack =
|
|
1888
|
+
var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
|
|
2212
1889
|
this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
|
|
2213
|
-
var availableVideoBitrates = this.getAvailableVideoBitrates();
|
|
2214
|
-
this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange", availableVideoBitrates, cancelSignal);
|
|
2215
1890
|
break;
|
|
2216
1891
|
}
|
|
2217
1892
|
}
|
|
@@ -2226,7 +1901,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2226
1901
|
*/
|
|
2227
1902
|
Player.prototype._priv_onRepresentationChange = function (contentInfos, _a) {
|
|
2228
1903
|
var _b;
|
|
2229
|
-
var _c
|
|
1904
|
+
var _c;
|
|
2230
1905
|
var type = _a.type, period = _a.period, representation = _a.representation;
|
|
2231
1906
|
if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
|
|
2232
1907
|
return; // Event for another content
|
|
@@ -2243,16 +1918,15 @@ var Player = /** @class */ (function (_super) {
|
|
|
2243
1918
|
else {
|
|
2244
1919
|
activePeriodRepresentations[type] = representation;
|
|
2245
1920
|
}
|
|
2246
|
-
var bitrate = (_d = representation === null || representation === void 0 ? void 0 : representation.bitrate) !== null && _d !== void 0 ? _d : -1;
|
|
2247
1921
|
if (!isNullOrUndefined(period) &&
|
|
2248
1922
|
currentPeriod !== null &&
|
|
2249
1923
|
currentPeriod.id === period.id) {
|
|
2250
1924
|
var cancelSignal = this._priv_contentInfos.currentContentCanceller.signal;
|
|
2251
1925
|
if (type === "video") {
|
|
2252
|
-
this.
|
|
1926
|
+
this._priv_triggerEventIfNotStopped("videoRepresentationChange", representation, cancelSignal);
|
|
2253
1927
|
}
|
|
2254
1928
|
else if (type === "audio") {
|
|
2255
|
-
this.
|
|
1929
|
+
this._priv_triggerEventIfNotStopped("audioRepresentationChange", representation, cancelSignal);
|
|
2256
1930
|
}
|
|
2257
1931
|
}
|
|
2258
1932
|
};
|
|
@@ -2263,22 +1937,14 @@ var Player = /** @class */ (function (_super) {
|
|
|
2263
1937
|
*
|
|
2264
1938
|
* @param {Object} value
|
|
2265
1939
|
*/
|
|
2266
|
-
Player.prototype.
|
|
1940
|
+
Player.prototype._priv_onBitrateEstimateChange = function (_a) {
|
|
2267
1941
|
var type = _a.type, bitrate = _a.bitrate;
|
|
2268
1942
|
if (bitrate !== undefined) {
|
|
2269
1943
|
this._priv_bitrateInfos.lastBitrates[type] = bitrate;
|
|
2270
1944
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
* Triggered each time a textTrack is added to the video DOM Element.
|
|
2275
|
-
*
|
|
2276
|
-
* Trigger the right Player Event.
|
|
2277
|
-
*
|
|
2278
|
-
* @param {Array.<TextTrackElement>} tracks
|
|
2279
|
-
*/
|
|
2280
|
-
Player.prototype._priv_onNativeTextTracksNext = function (tracks) {
|
|
2281
|
-
this.trigger("nativeTextTracksChange", tracks);
|
|
1945
|
+
// !!! undocumented API :O !!!
|
|
1946
|
+
/* eslint-disable-next-line */
|
|
1947
|
+
this.trigger("__priv_bitrateEstimateChange", { type: type, bitrate: bitrate });
|
|
2282
1948
|
};
|
|
2283
1949
|
/**
|
|
2284
1950
|
* Triggered each time the player state updates.
|
|
@@ -2317,7 +1983,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2317
1983
|
position: observation.position,
|
|
2318
1984
|
duration: observation.duration,
|
|
2319
1985
|
playbackRate: observation.playbackRate,
|
|
2320
|
-
|
|
1986
|
+
maximumPosition: maximumPosition,
|
|
2321
1987
|
// TODO bufferGap may be undefined
|
|
2322
1988
|
bufferGap: observation.bufferGap === undefined ||
|
|
2323
1989
|
!isFinite(observation.bufferGap) ?
|
|
@@ -2342,47 +2008,6 @@ var Player = /** @class */ (function (_super) {
|
|
|
2342
2008
|
}
|
|
2343
2009
|
this.trigger("positionUpdate", positionData);
|
|
2344
2010
|
};
|
|
2345
|
-
/**
|
|
2346
|
-
* Trigger one of the "availableBitratesChange" event only if it changed from
|
|
2347
|
-
* the previously stored value.
|
|
2348
|
-
* @param {string} event
|
|
2349
|
-
* @param {Array.<number>} newVal
|
|
2350
|
-
* @param {Object} currentContentCancelSignal
|
|
2351
|
-
*/
|
|
2352
|
-
Player.prototype._priv_triggerAvailableBitratesChangeEvent = function (event, newVal, currentContentCancelSignal) {
|
|
2353
|
-
var prevVal = this._priv_contentEventsMemory[event];
|
|
2354
|
-
if (!currentContentCancelSignal.isCancelled() &&
|
|
2355
|
-
(prevVal === undefined || !areArraysOfNumbersEqual(newVal, prevVal))) {
|
|
2356
|
-
this._priv_contentEventsMemory[event] = newVal;
|
|
2357
|
-
this.trigger(event, newVal);
|
|
2358
|
-
}
|
|
2359
|
-
};
|
|
2360
|
-
/**
|
|
2361
|
-
* Trigger one of the "bitrateChange" event only if it changed from the
|
|
2362
|
-
* previously stored value.
|
|
2363
|
-
* @param {string} event
|
|
2364
|
-
* @param {number} newVal
|
|
2365
|
-
* @param {Object} currentContentCancelSignal
|
|
2366
|
-
*/
|
|
2367
|
-
Player.prototype._priv_triggerCurrentBitrateChangeEvent = function (event, newVal, currentContentCancelSignal) {
|
|
2368
|
-
if (!currentContentCancelSignal.isCancelled() &&
|
|
2369
|
-
newVal !== this._priv_contentEventsMemory[event]) {
|
|
2370
|
-
this._priv_contentEventsMemory[event] = newVal;
|
|
2371
|
-
this.trigger(event, newVal);
|
|
2372
|
-
}
|
|
2373
|
-
};
|
|
2374
|
-
Player.prototype._priv_getCurrentRepresentations = function () {
|
|
2375
|
-
if (this._priv_contentInfos === null) {
|
|
2376
|
-
return null;
|
|
2377
|
-
}
|
|
2378
|
-
var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeRepresentations = _a.activeRepresentations;
|
|
2379
|
-
if (currentPeriod === null ||
|
|
2380
|
-
activeRepresentations === null ||
|
|
2381
|
-
isNullOrUndefined(activeRepresentations[currentPeriod.id])) {
|
|
2382
|
-
return null;
|
|
2383
|
-
}
|
|
2384
|
-
return activeRepresentations[currentPeriod.id];
|
|
2385
|
-
};
|
|
2386
2011
|
/**
|
|
2387
2012
|
* @param {string} evt
|
|
2388
2013
|
* @param {*} arg
|
|
@@ -2394,60 +2019,69 @@ var Player = /** @class */ (function (_super) {
|
|
|
2394
2019
|
}
|
|
2395
2020
|
};
|
|
2396
2021
|
/**
|
|
2397
|
-
* @param {Object} defaultAudioTrack
|
|
2398
|
-
* @param {Object} defaultTextTrack
|
|
2399
2022
|
* @param {Object} cancelSignal
|
|
2400
2023
|
* @returns {Object}
|
|
2401
2024
|
*/
|
|
2402
|
-
Player.prototype.
|
|
2025
|
+
Player.prototype._priv_initializeMediaElementTracksStore = function (cancelSignal) {
|
|
2403
2026
|
var _this = this;
|
|
2404
2027
|
var _a, _b, _c;
|
|
2405
|
-
assert(features.directfile !== null, "Initializing `
|
|
2406
|
-
assert(this.videoElement !== null, "Initializing `
|
|
2407
|
-
var
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
mediaElementTrackChoiceManager.setPreferredTextTracks(preferredTextTracks, true);
|
|
2416
|
-
mediaElementTrackChoiceManager
|
|
2417
|
-
.setPreferredVideoTracks(this._priv_preferredVideoTracks, true);
|
|
2418
|
-
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", mediaElementTrackChoiceManager.getAvailableAudioTracks(), cancelSignal);
|
|
2419
|
-
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", mediaElementTrackChoiceManager.getAvailableVideoTracks(), cancelSignal);
|
|
2420
|
-
this._priv_triggerEventIfNotStopped("availableTextTracksChange", mediaElementTrackChoiceManager.getAvailableTextTracks(), cancelSignal);
|
|
2421
|
-
this._priv_triggerEventIfNotStopped("audioTrackChange", (_a = mediaElementTrackChoiceManager.getChosenAudioTrack()) !== null && _a !== void 0 ? _a : null, cancelSignal);
|
|
2422
|
-
this._priv_triggerEventIfNotStopped("textTrackChange", (_b = mediaElementTrackChoiceManager.getChosenTextTrack()) !== null && _b !== void 0 ? _b : null, cancelSignal);
|
|
2423
|
-
this._priv_triggerEventIfNotStopped("videoTrackChange", (_c = mediaElementTrackChoiceManager.getChosenVideoTrack()) !== null && _c !== void 0 ? _c : null, cancelSignal);
|
|
2424
|
-
mediaElementTrackChoiceManager
|
|
2028
|
+
assert(features.directfile !== null, "Initializing `MediaElementTracksStore` without Directfile feature");
|
|
2029
|
+
assert(this.videoElement !== null, "Initializing `MediaElementTracksStore` on a disposed RxPlayer");
|
|
2030
|
+
var mediaElementTracksStore = new features.directfile.mediaElementTracksStore(this.videoElement);
|
|
2031
|
+
this._priv_triggerEventIfNotStopped("availableAudioTracksChange", mediaElementTracksStore.getAvailableAudioTracks(), cancelSignal);
|
|
2032
|
+
this._priv_triggerEventIfNotStopped("availableVideoTracksChange", mediaElementTracksStore.getAvailableVideoTracks(), cancelSignal);
|
|
2033
|
+
this._priv_triggerEventIfNotStopped("availableTextTracksChange", mediaElementTracksStore.getAvailableTextTracks(), cancelSignal);
|
|
2034
|
+
this._priv_triggerEventIfNotStopped("audioTrackChange", (_a = mediaElementTracksStore.getChosenAudioTrack()) !== null && _a !== void 0 ? _a : null, cancelSignal);
|
|
2035
|
+
this._priv_triggerEventIfNotStopped("textTrackChange", (_b = mediaElementTracksStore.getChosenTextTrack()) !== null && _b !== void 0 ? _b : null, cancelSignal);
|
|
2036
|
+
this._priv_triggerEventIfNotStopped("videoTrackChange", (_c = mediaElementTracksStore.getChosenVideoTrack()) !== null && _c !== void 0 ? _c : null, cancelSignal);
|
|
2037
|
+
mediaElementTracksStore
|
|
2425
2038
|
.addEventListener("availableVideoTracksChange", function (val) {
|
|
2426
2039
|
return _this.trigger("availableVideoTracksChange", val);
|
|
2427
2040
|
});
|
|
2428
|
-
|
|
2041
|
+
mediaElementTracksStore
|
|
2429
2042
|
.addEventListener("availableAudioTracksChange", function (val) {
|
|
2430
2043
|
return _this.trigger("availableAudioTracksChange", val);
|
|
2431
2044
|
});
|
|
2432
|
-
|
|
2045
|
+
mediaElementTracksStore
|
|
2433
2046
|
.addEventListener("availableTextTracksChange", function (val) {
|
|
2434
2047
|
return _this.trigger("availableTextTracksChange", val);
|
|
2435
2048
|
});
|
|
2436
|
-
|
|
2049
|
+
mediaElementTracksStore
|
|
2437
2050
|
.addEventListener("audioTrackChange", function (val) {
|
|
2438
2051
|
return _this.trigger("audioTrackChange", val);
|
|
2439
2052
|
});
|
|
2440
|
-
|
|
2053
|
+
mediaElementTracksStore
|
|
2441
2054
|
.addEventListener("videoTrackChange", function (val) {
|
|
2442
2055
|
return _this.trigger("videoTrackChange", val);
|
|
2443
2056
|
});
|
|
2444
|
-
|
|
2057
|
+
mediaElementTracksStore
|
|
2445
2058
|
.addEventListener("textTrackChange", function (val) {
|
|
2446
2059
|
return _this.trigger("textTrackChange", val);
|
|
2447
2060
|
});
|
|
2448
|
-
return
|
|
2061
|
+
return mediaElementTracksStore;
|
|
2062
|
+
};
|
|
2063
|
+
Player.prototype._priv_callTracksStoreGetterSetter = function (periodId, defaultValue, cb) {
|
|
2064
|
+
var _a, _b;
|
|
2065
|
+
if (this._priv_contentInfos === null ||
|
|
2066
|
+
this._priv_contentInfos.tracksStore === null) {
|
|
2067
|
+
log.warn("API: Trying to call track API too soon");
|
|
2068
|
+
return defaultValue;
|
|
2069
|
+
}
|
|
2070
|
+
var tracksStore = this._priv_contentInfos.tracksStore;
|
|
2071
|
+
var currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
|
|
2072
|
+
var wantedPeriodId = periodId !== null && periodId !== void 0 ? periodId : currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id;
|
|
2073
|
+
if (wantedPeriodId === undefined) {
|
|
2074
|
+
return defaultValue;
|
|
2075
|
+
}
|
|
2076
|
+
var periodRef = wantedPeriodId === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id) ?
|
|
2077
|
+
tracksStore.getPeriodObjectFromPeriod(currentPeriod) :
|
|
2078
|
+
tracksStore.getPeriodObjectFromId(wantedPeriodId);
|
|
2079
|
+
if (periodRef === undefined) {
|
|
2080
|
+
return defaultValue;
|
|
2081
|
+
}
|
|
2082
|
+
return cb(tracksStore, periodRef);
|
|
2449
2083
|
};
|
|
2450
2084
|
return Player;
|
|
2451
2085
|
}(EventEmitter));
|
|
2452
|
-
Player.version = /* PLAYER_VERSION */ "3.
|
|
2086
|
+
Player.version = /* PLAYER_VERSION */ "3.32.1";
|
|
2453
2087
|
export default Player;
|