rx-player 3.26.3-dev.2022021400 → 3.27.0-dev.2022032100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -4
- package/CHANGELOG.md +17 -2
- package/FILES.md +5 -4
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -2
- package/dist/_esm5.processed/compat/browser_detection.js +4 -2
- package/dist/_esm5.processed/compat/eme/close_session.d.ts +11 -5
- package/dist/_esm5.processed/compat/eme/close_session.js +143 -36
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.d.ts +15 -0
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +1 -17
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +6 -7
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +20 -22
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +58 -40
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +49 -48
- package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +2 -3
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +22 -26
- package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -2
- package/dist/_esm5.processed/compat/eme/load_session.js +67 -17
- package/dist/_esm5.processed/compat/event_listeners.js +2 -1
- package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
- package/dist/_esm5.processed/config.d.ts +166 -1080
- package/dist/_esm5.processed/config.js +17 -1119
- package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +4 -1
- package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
- package/dist/_esm5.processed/core/api/get_player_state.js +1 -1
- package/dist/_esm5.processed/core/api/index.d.ts +2 -1
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +2 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +6 -3
- package/dist/_esm5.processed/core/api/option_utils.js +21 -7
- package/dist/_esm5.processed/core/api/playback_observer.js +5 -1
- package/dist/_esm5.processed/core/api/public_api.d.ts +82 -71
- package/dist/_esm5.processed/core/api/public_api.js +73 -35
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -49
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +25 -65
- package/dist/_esm5.processed/core/{eme → decrypt}/attach_media_keys.d.ts +12 -12
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +103 -0
- package/dist/_esm5.processed/core/{eme/clear_eme_session.d.ts → decrypt/clear_on_stop.d.ts} +3 -4
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +40 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +865 -0
- package/dist/_esm5.processed/core/{eme/get_session.d.ts → decrypt/create_or_load_session.d.ts} +28 -26
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +124 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/create_session.d.ts +22 -19
- package/dist/_esm5.processed/core/decrypt/create_session.js +173 -0
- package/dist/_esm5.processed/core/{eme/dispose_media_keys.d.ts → decrypt/dispose_decryption_resources.d.ts} +4 -4
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +81 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/find_key_system.d.ts +11 -14
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +299 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.d.ts +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.js +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt}/get_media_keys.d.ts +13 -5
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +153 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/index.d.ts +5 -6
- package/dist/_esm5.processed/core/{eme → decrypt}/index.js +5 -5
- package/dist/_esm5.processed/core/{eme → decrypt}/init_media_keys.d.ts +6 -4
- package/dist/_esm5.processed/core/decrypt/init_media_keys.js +82 -0
- package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +77 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/session_events_listener.js +25 -24
- package/dist/_esm5.processed/core/{eme → decrypt}/set_server_certificate.d.ts +15 -6
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +141 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/types.d.ts +119 -241
- package/dist/_esm5.processed/core/{eme → decrypt}/types.js +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.d.ts +3 -3
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.js +5 -5
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.d.ts +2 -2
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.js +4 -3
- package/dist/_esm5.processed/core/{eme/utils/close_session.d.ts → decrypt/utils/clean_old_loaded_sessions.d.ts} +8 -7
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +84 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.d.ts +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.js +2 -2
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.d.ts +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.js +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +69 -0
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +99 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.d.ts +0 -1
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.js +4 -5
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +44 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +77 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +104 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +155 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +108 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +302 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.d.ts +4 -4
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.js +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.d.ts +8 -18
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.js +119 -97
- package/dist/_esm5.processed/core/{eme/utils/init_data_container.d.ts → decrypt/utils/serializable_bytes.d.ts} +8 -5
- package/dist/_esm5.processed/core/{eme/utils/init_data_container.js → decrypt/utils/serializable_bytes.js} +9 -9
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.d.ts +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.js +1 -1
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +3 -5
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
- package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +2 -3
- package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +6 -3
- package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -69
- package/dist/_esm5.processed/core/init/link_drm_and_content.d.ts +61 -0
- package/dist/_esm5.processed/core/init/link_drm_and_content.js +94 -0
- package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +2 -1
- package/dist/_esm5.processed/core/init/stall_avoider.js +1 -1
- package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
- package/dist/_esm5.processed/core/init/types.d.ts +2 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +17 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +22 -5
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -1
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +6 -3
- package/dist/_esm5.processed/core/stream/events_generators.d.ts +8 -3
- package/dist/_esm5.processed/core/stream/events_generators.js +3 -2
- package/dist/_esm5.processed/core/stream/index.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +2 -1
- package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +15 -11
- package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +6 -3
- package/dist/_esm5.processed/core/stream/period/index.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +5 -12
- package/dist/_esm5.processed/core/stream/period/period_stream.js +3 -3
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +2 -2
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +6 -1
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +12 -9
- package/dist/_esm5.processed/core/stream/representation/get_needed_segments.d.ts +19 -14
- package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +86 -10
- package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -3
- package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +6 -0
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +19 -8
- package/dist/_esm5.processed/core/stream/types.d.ts +1 -1
- package/dist/_esm5.processed/default_config.d.ts +1114 -0
- package/dist/_esm5.processed/default_config.js +1145 -0
- package/dist/_esm5.processed/experimental/index.d.ts +2 -0
- package/dist/_esm5.processed/experimental/index.js +2 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +1 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +6 -7
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +2 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +15 -0
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +3 -5
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +3 -5
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
- package/dist/_esm5.processed/features/features_object.js +1 -1
- package/dist/_esm5.processed/features/initialize_features.js +1 -1
- package/dist/_esm5.processed/features/list/eme.d.ts +3 -3
- package/dist/_esm5.processed/features/list/eme.js +5 -5
- package/dist/_esm5.processed/features/types.d.ts +3 -3
- package/dist/_esm5.processed/manifest/manifest.d.ts +1 -14
- package/dist/_esm5.processed/manifest/manifest.js +10 -74
- package/dist/_esm5.processed/manifest/representation.d.ts +35 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +87 -75
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +4 -5
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
- package/dist/_esm5.processed/public_types.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +1 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +4 -3
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +60 -11
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.js +3 -4
- package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
- package/dist/_esm5.processed/transports/dash/text_loader.js +1 -2
- package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -3
- package/dist/_esm5.processed/transports/local/segment_parser.js +4 -1
- package/dist/_esm5.processed/transports/local/text_parser.js +8 -2
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +2 -3
- package/dist/_esm5.processed/transports/smooth/pipelines.js +71 -14
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +3 -4
- package/dist/_esm5.processed/transports/types.d.ts +22 -0
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -2
- package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -2
- package/dist/_esm5.processed/utils/cast_to_observable.js +1 -3
- package/dist/_esm5.processed/utils/deep_merge.d.ts +12 -0
- package/dist/_esm5.processed/utils/deep_merge.js +53 -0
- package/dist/_esm5.processed/utils/reference.d.ts +29 -0
- package/dist/_esm5.processed/utils/reference.js +72 -24
- package/dist/_esm5.processed/utils/request/fetch.js +1 -2
- package/dist/_esm5.processed/utils/request/xhr.js +2 -3
- package/dist/_esm5.processed/utils/rx-from_cancellable_promise.js +7 -2
- package/dist/_esm5.processed/utils/task_canceller.d.ts +5 -3
- package/dist/_esm5.processed/utils/task_canceller.js +3 -3
- package/dist/rx-player.js +4936 -3340
- package/dist/rx-player.min.js +1 -1
- package/dummy +1 -0
- package/{dist/_esm5.processed/utils/promise.d.ts → experimental/index.d.ts} +1 -2
- package/{dist/_esm5.processed/utils/promise.js → experimental/index.js} +1 -3
- package/package.json +32 -35
- package/{src/typings/pinkie.d.ts → scripts/build/templates/experimental/index.d.ts} +1 -4
- package/scripts/build/templates/experimental/index.js +16 -0
- package/scripts/update-version +2 -2
- package/sonar-project.properties +1 -1
- package/src/README.md +6 -6
- package/src/compat/__tests__/play.test.ts +2 -4
- package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +45 -5
- package/src/compat/browser_detection.ts +4 -2
- package/src/compat/eme/close_session.ts +89 -56
- package/src/compat/eme/custom_key_system_access.ts +1 -2
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +6 -7
- package/src/compat/eme/custom_media_keys/index.ts +20 -38
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +68 -52
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +57 -56
- package/src/compat/eme/generate_key_request.ts +25 -33
- package/src/compat/eme/load_session.ts +28 -31
- package/src/compat/event_listeners.ts +2 -1
- package/src/compat/should_favour_custom_safari_EME.ts +5 -2
- package/src/config.ts +17 -1210
- package/src/core/README.md +1 -1
- package/src/core/abr/bandwidth_estimator.ts +4 -4
- package/src/core/abr/network_analyzer.ts +5 -6
- package/src/core/api/__tests__/get_player_state.test.ts +3 -3
- package/src/core/api/__tests__/option_utils.test.ts +29 -17
- package/src/core/api/get_player_state.ts +1 -1
- package/src/core/api/index.ts +3 -0
- package/src/core/api/option_utils.ts +42 -23
- package/src/core/api/playback_observer.ts +12 -8
- package/src/core/api/public_api.ts +152 -113
- package/src/core/decrypt/README.md +22 -0
- package/src/core/decrypt/__tests__/__global__/get_license.test.ts +418 -0
- package/src/core/decrypt/__tests__/__global__/init_data.test.ts +675 -0
- package/src/core/{eme → decrypt}/__tests__/__global__/media_key_system_access.test.ts +99 -92
- package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +156 -0
- package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +262 -0
- package/src/core/{eme → decrypt}/__tests__/__global__/utils.ts +31 -93
- package/src/core/{eme → decrypt}/attach_media_keys.ts +48 -56
- package/src/core/decrypt/clear_on_stop.ts +47 -0
- package/src/core/decrypt/content_decryptor.ts +1157 -0
- package/src/core/decrypt/create_or_load_session.ts +130 -0
- package/src/core/decrypt/create_session.ts +174 -0
- package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
- package/src/core/{eme → decrypt}/find_key_system.ts +111 -122
- package/src/core/{eme → decrypt}/get_current_key_system.ts +1 -1
- package/src/core/decrypt/get_media_keys.ts +145 -0
- package/src/core/{eme → decrypt}/index.ts +11 -8
- package/src/core/decrypt/init_media_keys.ts +51 -0
- package/src/core/{eme → decrypt}/session_events_listener.ts +93 -55
- package/src/core/decrypt/set_server_certificate.ts +104 -0
- package/src/core/{eme → decrypt}/types.ts +128 -258
- package/src/core/{eme → decrypt}/utils/__tests__/are_init_values_compatible.test.ts +1 -1
- package/src/core/{eme → decrypt/utils}/__tests__/clean_old_loaded_sessions.test.ts +29 -71
- package/src/core/{eme → decrypt/utils}/__tests__/clean_old_stored_persistent_info.test.ts +6 -6
- package/src/core/{eme → decrypt}/utils/are_init_values_compatible.ts +9 -9
- package/src/core/{eme → decrypt/utils}/check_key_statuses.ts +6 -5
- package/{dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js → src/core/decrypt/utils/clean_old_loaded_sessions.ts} +19 -20
- package/src/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.ts +3 -3
- package/src/core/{eme → decrypt/utils}/get_drm_system_id.ts +1 -1
- package/src/core/decrypt/utils/init_data_values_container.ts +119 -0
- package/src/core/{eme → decrypt}/utils/is_session_usable.ts +4 -5
- package/src/core/decrypt/utils/key_id_comparison.ts +82 -0
- package/src/core/decrypt/utils/key_session_record.ts +175 -0
- package/src/core/decrypt/utils/loaded_sessions_store.ts +317 -0
- package/src/core/{eme → decrypt/utils}/media_keys_infos_store.ts +4 -4
- package/src/core/{eme → decrypt}/utils/persistent_sessions_store.ts +122 -104
- package/src/core/{eme/utils/init_data_container.ts → decrypt/utils/serializable_bytes.ts} +8 -5
- package/src/core/{eme → decrypt/utils}/server_certificate_store.ts +2 -2
- package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -7
- package/src/core/fetchers/segment/segment_fetcher.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
- package/src/core/fetchers/utils/try_urls_with_backoff.ts +2 -3
- package/src/core/init/.initialize_media_source.ts.un~ +0 -0
- package/src/core/init/get_initial_time.ts +2 -1
- package/src/core/init/initialize_directfile.ts +17 -20
- package/src/core/init/initialize_media_source.ts +44 -106
- package/src/core/init/link_drm_and_content.ts +176 -0
- package/src/core/init/manifest_update_scheduler.ts +5 -3
- package/src/core/init/stall_avoider.ts +6 -5
- package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
- package/src/core/init/types.ts +1 -39
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +2 -1
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -4
- package/src/core/segment_buffers/inventory/segment_inventory.ts +42 -8
- package/src/core/stream/adaptation/adaptation_stream.ts +7 -1
- package/src/core/stream/events_generators.ts +9 -4
- package/src/core/stream/index.ts +1 -0
- package/src/core/stream/orchestrator/stream_orchestrator.ts +9 -4
- package/src/core/stream/period/create_empty_adaptation_stream.ts +2 -1
- package/src/core/stream/period/get_adaptation_switch_strategy.ts +25 -15
- package/src/core/stream/period/index.ts +1 -0
- package/src/core/stream/period/period_stream.ts +10 -16
- package/src/core/stream/representation/force_garbage_collection.ts +2 -2
- package/src/core/stream/representation/get_buffer_status.ts +28 -16
- package/src/core/stream/representation/get_needed_segments.ts +124 -28
- package/src/core/stream/representation/get_segment_priority.ts +1 -2
- package/src/core/stream/representation/push_media_segment.ts +3 -2
- package/src/core/stream/representation/representation_stream.ts +30 -7
- package/src/core/stream/types.ts +1 -1
- package/src/default_config.ts +1241 -0
- package/src/experimental/index.ts +5 -0
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +7 -7
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +9 -10
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/decodingInfos.test.ts +2 -4
- package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -3
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +3 -5
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +3 -5
- package/src/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +1 -2
- package/src/features/__tests__/initialize_features.test.ts +2 -2
- package/src/features/features_object.ts +1 -1
- package/src/features/initialize_features.ts +1 -1
- package/src/features/list/__tests__/eme.test.ts +5 -5
- package/src/features/list/eme.ts +5 -5
- package/src/features/types.ts +3 -10
- package/src/manifest/manifest.ts +6 -76
- package/src/manifest/representation.ts +36 -3
- package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
- package/src/parsers/manifest/dash/common/indexes/template.ts +1 -2
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +1 -1
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +109 -64
- package/src/parsers/manifest/dash/common/parse_mpd.ts +1 -2
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +4 -5
- package/src/parsers/manifest/smooth/create_parser.ts +1 -0
- package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
- package/src/public_types.ts +6 -1
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +1 -2
- package/src/transports/dash/image_pipelines.ts +15 -14
- package/src/transports/dash/init_segment_loader.ts +1 -2
- package/src/transports/dash/manifest_parser.ts +2 -3
- package/src/transports/dash/segment_loader.ts +4 -5
- package/src/transports/dash/segment_parser.ts +5 -0
- package/src/transports/dash/text_loader.ts +2 -3
- package/src/transports/dash/text_parser.ts +8 -0
- package/src/transports/local/segment_loader.ts +2 -3
- package/src/transports/local/segment_parser.ts +4 -0
- package/src/transports/local/text_parser.ts +8 -0
- package/src/transports/metaplaylist/pipelines.ts +2 -3
- package/src/transports/smooth/pipelines.ts +26 -14
- package/src/transports/smooth/segment_loader.ts +5 -6
- package/src/transports/types.ts +22 -0
- package/src/transports/utils/call_custom_manifest_loader.ts +1 -2
- package/src/utils/__tests__/deep_merge.test.ts +48 -0
- package/src/utils/cancellable_sleep.ts +1 -2
- package/src/utils/cast_to_observable.ts +0 -2
- package/src/utils/deep_merge.ts +46 -0
- package/src/utils/reference.ts +116 -23
- package/src/utils/request/fetch.ts +1 -2
- package/src/utils/request/xhr.ts +3 -3
- package/src/utils/rx-from_cancellable_promise.ts +7 -2
- package/src/utils/task_canceller.ts +6 -4
- package/tsconfig.json +0 -1
- package/tsconfig.modules.json +0 -1
- package/dist/_esm5.processed/core/eme/attach_media_keys.js +0 -57
- package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.d.ts +0 -59
- package/dist/_esm5.processed/core/eme/clear_eme_session.js +0 -50
- package/dist/_esm5.processed/core/eme/create_session.js +0 -126
- package/dist/_esm5.processed/core/eme/dispose_eme.d.ts +0 -19
- package/dist/_esm5.processed/core/eme/dispose_eme.js +0 -23
- package/dist/_esm5.processed/core/eme/dispose_media_keys.js +0 -36
- package/dist/_esm5.processed/core/eme/eme_manager.d.ts +0 -31
- package/dist/_esm5.processed/core/eme/eme_manager.js +0 -278
- package/dist/_esm5.processed/core/eme/find_key_system.js +0 -253
- package/dist/_esm5.processed/core/eme/get_media_keys.js +0 -85
- package/dist/_esm5.processed/core/eme/get_session.js +0 -68
- package/dist/_esm5.processed/core/eme/init_media_keys.js +0 -66
- package/dist/_esm5.processed/core/eme/session_events_listener.d.ts +0 -41
- package/dist/_esm5.processed/core/eme/set_server_certificate.js +0 -85
- package/dist/_esm5.processed/core/eme/utils/close_session.js +0 -81
- package/dist/_esm5.processed/core/eme/utils/init_data_store.d.ts +0 -115
- package/dist/_esm5.processed/core/eme/utils/init_data_store.js +0 -181
- package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.d.ts +0 -123
- package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +0 -173
- package/dist/_esm5.processed/core/init/create_eme_manager.d.ts +0 -34
- package/dist/_esm5.processed/core/init/create_eme_manager.js +0 -52
- package/src/core/eme/README.md +0 -26
- package/src/core/eme/__tests__/__global__/get_license.test.ts +0 -414
- package/src/core/eme/__tests__/__global__/init_data.test.ts +0 -908
- package/src/core/eme/__tests__/__global__/media_keys.test.ts +0 -266
- package/src/core/eme/__tests__/__global__/server_certificate.test.ts +0 -364
- package/src/core/eme/__tests__/init_media_keys.test.ts +0 -182
- package/src/core/eme/clean_old_loaded_sessions.ts +0 -96
- package/src/core/eme/clear_eme_session.ts +0 -62
- package/src/core/eme/create_session.ts +0 -187
- package/src/core/eme/dispose_eme.ts +0 -25
- package/src/core/eme/dispose_media_keys.ts +0 -46
- package/src/core/eme/eme_manager.ts +0 -387
- package/src/core/eme/get_media_keys.ts +0 -141
- package/src/core/eme/get_session.ts +0 -135
- package/src/core/eme/init_media_keys.ts +0 -106
- package/src/core/eme/set_server_certificate.ts +0 -115
- package/src/core/eme/utils/close_session.ts +0 -113
- package/src/core/eme/utils/init_data_store.ts +0 -234
- package/src/core/eme/utils/loaded_sessions_store.ts +0 -235
- package/src/core/init/create_eme_manager.ts +0 -95
- package/src/utils/__tests__/promise.test.ts +0 -23
- package/src/utils/promise.ts +0 -20
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import config from "../../../../../config";
|
|
18
18
|
|
|
19
|
-
const { DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR } = config;
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* In Javascript, numbers are encoded in a way that a floating number may be
|
|
@@ -36,7 +35,7 @@ export default function isPeriodFulfilled(
|
|
|
36
35
|
periodEnd: number
|
|
37
36
|
): boolean {
|
|
38
37
|
const scaledRoundingError =
|
|
39
|
-
DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
|
|
38
|
+
config.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR * timescale;
|
|
40
39
|
return (lastSegmentEnd + scaledRoundingError) >= periodEnd;
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -29,7 +29,6 @@ import {
|
|
|
29
29
|
createIndexURLs,
|
|
30
30
|
} from "./tokens";
|
|
31
31
|
|
|
32
|
-
const { MINIMUM_SEGMENT_SIZE } = config;
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Index property defined for a SegmentTemplate RepresentationIndex
|
|
@@ -533,7 +532,7 @@ export default class TemplateRepresentationIndex implements IRepresentationIndex
|
|
|
533
532
|
// segment that there actually is due to a very little difference between
|
|
534
533
|
// the period's duration and a multiple of a segment's duration.
|
|
535
534
|
// Check that we're within a good margin
|
|
536
|
-
const minimumDuration = MINIMUM_SEGMENT_SIZE * timescale;
|
|
535
|
+
const minimumDuration = config.getCurrent().MINIMUM_SEGMENT_SIZE * timescale;
|
|
537
536
|
if (maximumTime - regularLastSegmentStart > minimumDuration ||
|
|
538
537
|
numberIndexedToZero === 0)
|
|
539
538
|
{
|
|
@@ -47,7 +47,6 @@ import constructTimelineFromElements from "./construct_timeline_from_elements";
|
|
|
47
47
|
// eslint-disable-next-line max-len
|
|
48
48
|
import constructTimelineFromPreviousTimeline from "./construct_timeline_from_previous_timeline";
|
|
49
49
|
|
|
50
|
-
const { MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY } = config;
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* Index property defined for a SegmentTimeline RepresentationIndex
|
|
@@ -606,6 +605,7 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
606
605
|
const newElements = this._parseTimeline();
|
|
607
606
|
this._parseTimeline = null; // Free memory
|
|
608
607
|
|
|
608
|
+
const { MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY } = config.getCurrent();
|
|
609
609
|
if (this._unsafelyBaseOnPreviousIndex === null ||
|
|
610
610
|
newElements.length < MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY)
|
|
611
611
|
{
|
|
@@ -15,14 +15,18 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import log from "../../../../log";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
IAdaptationType,
|
|
20
|
+
Period,
|
|
21
|
+
SUPPORTED_ADAPTATIONS_TYPE,
|
|
22
|
+
} from "../../../../manifest";
|
|
19
23
|
import arrayFind from "../../../../utils/array_find";
|
|
24
|
+
import arrayFindIndex from "../../../../utils/array_find_index";
|
|
20
25
|
import arrayIncludes from "../../../../utils/array_includes";
|
|
21
26
|
import isNonEmptyString from "../../../../utils/is_non_empty_string";
|
|
22
27
|
import {
|
|
23
28
|
IParsedAdaptation,
|
|
24
29
|
IParsedAdaptations,
|
|
25
|
-
IParsedAdaptationType,
|
|
26
30
|
} from "../../types";
|
|
27
31
|
import {
|
|
28
32
|
IAdaptationSetIntermediateRepresentation,
|
|
@@ -235,30 +239,31 @@ export default function parseAdaptationSets(
|
|
|
235
239
|
adaptationsIR : IAdaptationSetIntermediateRepresentation[],
|
|
236
240
|
context : IAdaptationSetContext
|
|
237
241
|
): IParsedAdaptations {
|
|
238
|
-
const parsedAdaptations :
|
|
242
|
+
const parsedAdaptations : Record<
|
|
243
|
+
IAdaptationType,
|
|
244
|
+
Array<[ IParsedAdaptation,
|
|
245
|
+
IAdaptationSetOrderingData ]>
|
|
246
|
+
> = { video: [],
|
|
247
|
+
audio: [],
|
|
248
|
+
text: [],
|
|
249
|
+
image: [] };
|
|
239
250
|
const trickModeAdaptations: Array<{ adaptation: IParsedAdaptation;
|
|
240
251
|
trickModeAttachedAdaptationIds: string[]; }> = [];
|
|
241
252
|
const adaptationSwitchingInfos : IAdaptationSwitchingInfos = {};
|
|
253
|
+
|
|
242
254
|
const parsedAdaptationsIDs : string[] = [];
|
|
243
255
|
|
|
244
256
|
/**
|
|
245
|
-
* Index of the last parsed AdaptationSet with a Role set as "main" in
|
|
246
|
-
* `parsedAdaptations
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
257
|
+
* Index of the last parsed Video AdaptationSet with a Role set as "main" in
|
|
258
|
+
* `parsedAdaptations.video`.
|
|
259
|
+
* `-1` if not yet encountered.
|
|
260
|
+
* Used as we merge all main video AdaptationSet due to a comprehension of the
|
|
261
|
+
* DASH-IF IOP.
|
|
250
262
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// first sort AdaptationSets by absolute priority.
|
|
254
|
-
adaptationsIR.sort((a, b) => {
|
|
255
|
-
/* As of DASH-IF 4.3, `1` is the default value. */
|
|
256
|
-
const priority1 = a.attributes.selectionPriority ?? 1;
|
|
257
|
-
const priority2 = b.attributes.selectionPriority ?? 1;
|
|
258
|
-
return priority2 - priority1;
|
|
259
|
-
});
|
|
263
|
+
let lastMainVideoAdapIdx = -1;
|
|
260
264
|
|
|
261
|
-
for (
|
|
265
|
+
for (let adaptationIdx = 0; adaptationIdx < adaptationsIR.length; adaptationIdx++) {
|
|
266
|
+
const adaptation = adaptationsIR[adaptationIdx];
|
|
262
267
|
const adaptationChildren = adaptation.children;
|
|
263
268
|
const { essentialProperties,
|
|
264
269
|
roles } = adaptationChildren;
|
|
@@ -291,6 +296,7 @@ export default function parseAdaptationSets(
|
|
|
291
296
|
continue;
|
|
292
297
|
}
|
|
293
298
|
|
|
299
|
+
const priority = adaptation.attributes.selectionPriority ?? 1;
|
|
294
300
|
const originalID = adaptation.attributes.id;
|
|
295
301
|
let newID : string;
|
|
296
302
|
const adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
|
|
@@ -334,14 +340,11 @@ export default function parseAdaptationSets(
|
|
|
334
340
|
|
|
335
341
|
if (type === "video" &&
|
|
336
342
|
isMainAdaptation &&
|
|
337
|
-
|
|
338
|
-
parsedAdaptations.video.length >
|
|
339
|
-
lastMainAdaptationIndex.video !== undefined &&
|
|
343
|
+
lastMainVideoAdapIdx >= 0 &&
|
|
344
|
+
parsedAdaptations.video.length > lastMainVideoAdapIdx &&
|
|
340
345
|
!isTrickModeTrack)
|
|
341
346
|
{
|
|
342
|
-
|
|
343
|
-
// TODO remove that ugly custom logic?
|
|
344
|
-
const videoMainAdaptation = parsedAdaptations.video[lastMainAdaptationIndex.video];
|
|
347
|
+
const videoMainAdaptation = parsedAdaptations.video[lastMainVideoAdapIdx][0];
|
|
345
348
|
reprCtxt.unsafelyBaseOnPreviousAdaptation = context
|
|
346
349
|
.unsafelyBaseOnPreviousPeriod?.getAdaptation(videoMainAdaptation.id) ?? null;
|
|
347
350
|
const representations = parseRepresentations(representationsIR,
|
|
@@ -422,65 +425,56 @@ export default function parseAdaptationSets(
|
|
|
422
425
|
parsedAdaptationSet.isSignInterpreted = true;
|
|
423
426
|
}
|
|
424
427
|
|
|
425
|
-
const adaptationsOfTheSameType = parsedAdaptations[type];
|
|
426
428
|
if (trickModeAttachedAdaptationIds !== undefined) {
|
|
427
429
|
trickModeAdaptations.push({ adaptation: parsedAdaptationSet,
|
|
428
430
|
trickModeAttachedAdaptationIds });
|
|
429
|
-
} else if (adaptationsOfTheSameType === undefined) {
|
|
430
|
-
parsedAdaptations[type] = [parsedAdaptationSet];
|
|
431
|
-
if (isMainAdaptation) {
|
|
432
|
-
lastMainAdaptationIndex[type] = 0;
|
|
433
|
-
}
|
|
434
431
|
} else {
|
|
435
|
-
let mergedInto : IParsedAdaptation|null = null;
|
|
436
432
|
|
|
437
433
|
// look if we have to merge this into another Adaptation
|
|
434
|
+
let mergedIntoIdx = -1;
|
|
438
435
|
for (const id of adaptationSetSwitchingIDs) {
|
|
439
436
|
const switchingInfos = adaptationSwitchingInfos[id];
|
|
440
|
-
if (switchingInfos
|
|
437
|
+
if (switchingInfos !== undefined &&
|
|
441
438
|
switchingInfos.newID !== newID &&
|
|
442
439
|
arrayIncludes(switchingInfos.adaptationSetSwitchingIDs, originalID))
|
|
443
440
|
{
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
441
|
+
mergedIntoIdx = arrayFindIndex(parsedAdaptations[type],
|
|
442
|
+
(a) => a[0].id === id);
|
|
443
|
+
const mergedInto = parsedAdaptations[type][mergedIntoIdx];
|
|
444
|
+
if (mergedInto !== undefined &&
|
|
445
|
+
mergedInto[0].audioDescription ===
|
|
448
446
|
parsedAdaptationSet.audioDescription &&
|
|
449
|
-
|
|
447
|
+
mergedInto[0].closedCaption ===
|
|
450
448
|
parsedAdaptationSet.closedCaption &&
|
|
451
|
-
|
|
449
|
+
mergedInto[0].language === parsedAdaptationSet.language)
|
|
452
450
|
{
|
|
453
451
|
log.info("DASH Parser: merging \"switchable\" AdaptationSets",
|
|
454
452
|
originalID, id);
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
453
|
+
mergedInto[0].representations.push(...parsedAdaptationSet.representations);
|
|
454
|
+
if (type === "video" &&
|
|
455
|
+
isMainAdaptation &&
|
|
456
|
+
!mergedInto[1].isMainAdaptation)
|
|
457
|
+
{
|
|
458
|
+
lastMainVideoAdapIdx = Math.max(lastMainVideoAdapIdx, mergedIntoIdx);
|
|
459
|
+
}
|
|
460
|
+
mergedInto[1] = {
|
|
461
|
+
priority: Math.max(priority, mergedInto[1].priority),
|
|
462
|
+
isMainAdaptation: isMainAdaptation ||
|
|
463
|
+
mergedInto[1].isMainAdaptation,
|
|
464
|
+
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd),
|
|
465
|
+
};
|
|
458
466
|
}
|
|
459
467
|
}
|
|
460
468
|
}
|
|
461
469
|
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
470
|
-
} else {
|
|
471
|
-
const indexOf = adaptationsOfTheSameType.indexOf(mergedInto);
|
|
472
|
-
if (indexOf < 0) { // Weird, not found
|
|
473
|
-
adaptationsOfTheSameType.splice(newLastMainIdx, 0, parsedAdaptationSet);
|
|
474
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
475
|
-
} else if (oldLastMainIdx === undefined || indexOf > oldLastMainIdx) {
|
|
476
|
-
// Found but was not main
|
|
477
|
-
adaptationsOfTheSameType.splice(indexOf, 1);
|
|
478
|
-
adaptationsOfTheSameType.splice(newLastMainIdx, 0, mergedInto);
|
|
479
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
480
|
-
}
|
|
470
|
+
if (mergedIntoIdx < 0) {
|
|
471
|
+
parsedAdaptations[type].push([ parsedAdaptationSet,
|
|
472
|
+
{ priority,
|
|
473
|
+
isMainAdaptation,
|
|
474
|
+
indexInMpd: adaptationIdx }]);
|
|
475
|
+
if (type === "video" && isMainAdaptation) {
|
|
476
|
+
lastMainVideoAdapIdx = parsedAdaptations.video.length - 1;
|
|
481
477
|
}
|
|
482
|
-
} else if (mergedInto === null) {
|
|
483
|
-
adaptationsOfTheSameType.push(parsedAdaptationSet);
|
|
484
478
|
}
|
|
485
479
|
}
|
|
486
480
|
}
|
|
@@ -490,8 +484,59 @@ export default function parseAdaptationSets(
|
|
|
490
484
|
adaptationSetSwitchingIDs };
|
|
491
485
|
}
|
|
492
486
|
}
|
|
493
|
-
|
|
494
|
-
|
|
487
|
+
|
|
488
|
+
const adaptationsPerType = SUPPORTED_ADAPTATIONS_TYPE
|
|
489
|
+
.reduce((acc : IParsedAdaptations, adaptationType : IAdaptationType) => {
|
|
490
|
+
const adaptationsParsedForType = parsedAdaptations[adaptationType];
|
|
491
|
+
if (adaptationsParsedForType.length > 0) {
|
|
492
|
+
adaptationsParsedForType.sort(compareAdaptations);
|
|
493
|
+
acc[adaptationType] = adaptationsParsedForType
|
|
494
|
+
.map(([parsedAdaptation]) => parsedAdaptation);
|
|
495
|
+
}
|
|
496
|
+
return acc;
|
|
497
|
+
}, {});
|
|
498
|
+
parsedAdaptations.video.sort(compareAdaptations);
|
|
499
|
+
attachTrickModeTrack(adaptationsPerType, trickModeAdaptations);
|
|
500
|
+
return adaptationsPerType;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** Metadata allowing to order AdaptationSets between one another. */
|
|
504
|
+
interface IAdaptationSetOrderingData {
|
|
505
|
+
/**
|
|
506
|
+
* If `true`, this AdaptationSet is considered as a "main" one (e.g. it had a
|
|
507
|
+
* Role set to "main").
|
|
508
|
+
*/
|
|
509
|
+
isMainAdaptation : boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Set to the `selectionPriority` attribute of the corresponding AdaptationSet
|
|
512
|
+
* or to `1` by default.
|
|
513
|
+
*/
|
|
514
|
+
priority : number;
|
|
515
|
+
/** Index of this AdaptationSet in the original MPD, starting from `0`. */
|
|
516
|
+
indexInMpd : number;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Compare groups of parsed AdaptationSet, alongside some ordering metadata,
|
|
521
|
+
* allowing to easily sort them through JavaScript's `Array.prototype.sort`
|
|
522
|
+
* method.
|
|
523
|
+
* @param {Array.<Object>} a
|
|
524
|
+
* @param {Array.<Object>} b
|
|
525
|
+
* @returns {number}
|
|
526
|
+
*/
|
|
527
|
+
function compareAdaptations(
|
|
528
|
+
a : [IParsedAdaptation, IAdaptationSetOrderingData],
|
|
529
|
+
b : [IParsedAdaptation, IAdaptationSetOrderingData]
|
|
530
|
+
) : number {
|
|
531
|
+
const priorityDiff = b[1].priority - a[1].priority;
|
|
532
|
+
if (priorityDiff !== 0) {
|
|
533
|
+
return priorityDiff;
|
|
534
|
+
}
|
|
535
|
+
if (a[1].isMainAdaptation !== b[1].isMainAdaptation) {
|
|
536
|
+
return a[1].isMainAdaptation ? -1 :
|
|
537
|
+
1;
|
|
538
|
+
}
|
|
539
|
+
return a[1].indexInMpd - b[1].indexInMpd;
|
|
495
540
|
}
|
|
496
541
|
|
|
497
542
|
/** Context needed when calling `parseAdaptationSets`. */
|
|
@@ -37,7 +37,6 @@ import resolveBaseURLs, {
|
|
|
37
37
|
IResolvedBaseUrl,
|
|
38
38
|
} from "./resolve_base_urls";
|
|
39
39
|
|
|
40
|
-
const { DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 } = config;
|
|
41
40
|
|
|
42
41
|
/** Possible options for `parseMPD`. */
|
|
43
42
|
export interface IMPDParserArguments {
|
|
@@ -277,7 +276,7 @@ function parseCompleteIntermediateRepresentation(
|
|
|
277
276
|
rootAttributes.minimumUpdatePeriod >= 0)
|
|
278
277
|
{
|
|
279
278
|
lifetime = rootAttributes.minimumUpdatePeriod === 0 ?
|
|
280
|
-
DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 :
|
|
279
|
+
config.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 :
|
|
281
280
|
rootAttributes.minimumUpdatePeriod;
|
|
282
281
|
}
|
|
283
282
|
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import log from "../../../../../log";
|
|
18
18
|
import assertUnreachable from "../../../../../utils/assert_unreachable";
|
|
19
19
|
import noop from "../../../../../utils/noop";
|
|
20
|
-
import PPromise from "../../../../../utils/promise";
|
|
21
20
|
import parseMpdIr, {
|
|
22
21
|
IIrParserResponse,
|
|
23
22
|
ILoadedXlinkData,
|
|
@@ -136,15 +135,15 @@ export default class DashWasmParser {
|
|
|
136
135
|
*/
|
|
137
136
|
public waitForInitialization() : Promise<void> {
|
|
138
137
|
return this._initProm ??
|
|
139
|
-
|
|
138
|
+
Promise.reject("No initialization performed yet.");
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
public async initialize(opts : IDashWasmParserOptions) : Promise<void> {
|
|
143
142
|
if (this.status !== "uninitialized") {
|
|
144
|
-
return
|
|
143
|
+
return Promise.reject(new Error("DashWasmParser already initialized."));
|
|
145
144
|
} else if (!this.isCompatible()) {
|
|
146
145
|
this.status = "failure";
|
|
147
|
-
return
|
|
146
|
+
return Promise.reject(new Error("Target not compatible with WebAssembly."));
|
|
148
147
|
}
|
|
149
148
|
this.status = "initializing";
|
|
150
149
|
|
|
@@ -175,7 +174,7 @@ export default class DashWasmParser {
|
|
|
175
174
|
|
|
176
175
|
const streamingProm = typeof WebAssembly.instantiateStreaming === "function" ?
|
|
177
176
|
WebAssembly.instantiateStreaming(fetchedWasm, imports) :
|
|
178
|
-
|
|
177
|
+
Promise.reject("`WebAssembly.instantiateStreaming` API not available");
|
|
179
178
|
|
|
180
179
|
this._initProm = streamingProm
|
|
181
180
|
.catch(async (e) => {
|
package/src/public_types.ts
CHANGED
|
@@ -45,13 +45,18 @@ export {
|
|
|
45
45
|
ITextTrackPreference,
|
|
46
46
|
IVideoTrackPreference,
|
|
47
47
|
|
|
48
|
+
IBitrateEstimate,
|
|
49
|
+
IPositionUpdateItem as IPositionUpdate,
|
|
50
|
+
IPlayerState,
|
|
51
|
+
|
|
48
52
|
IStreamEvent,
|
|
49
53
|
IStreamEventData,
|
|
50
54
|
} from "./core/api";
|
|
51
55
|
export {
|
|
52
56
|
IPersistentSessionInfo,
|
|
53
57
|
IPersistentSessionStorage,
|
|
54
|
-
} from "./core/
|
|
58
|
+
} from "./core/decrypt";
|
|
59
|
+
export { IAudioTrackSwitchingMode } from "./core/stream";
|
|
55
60
|
export { ICustomError as IPlayerError } from "./errors";
|
|
56
61
|
export {
|
|
57
62
|
IExposedAdaptation as IAdaptation,
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "../../utils/promise";
|
|
18
17
|
import TaskCanceller, {
|
|
19
18
|
CancellationError,
|
|
20
19
|
} from "../../utils/task_canceller";
|
|
@@ -33,7 +32,7 @@ export default function addSegmentIntegrityChecks<T>(
|
|
|
33
32
|
segmentLoader : ISegmentLoader<T>
|
|
34
33
|
) : ISegmentLoader<T> {
|
|
35
34
|
return (url, content, initialCancelSignal, callbacks) => {
|
|
36
|
-
return new
|
|
35
|
+
return new Promise((res, rej) => {
|
|
37
36
|
const canceller = new TaskCanceller();
|
|
38
37
|
const unregisterCancelLstnr = initialCancelSignal
|
|
39
38
|
.register(function onCheckCancellation(err : CancellationError) {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import features from "../../features";
|
|
18
|
-
import PPromise from "../../utils/promise";
|
|
19
18
|
import request from "../../utils/request";
|
|
20
19
|
import takeFirstSet from "../../utils/take_first_set";
|
|
21
20
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
@@ -24,7 +23,6 @@ import {
|
|
|
24
23
|
ILoadedImageSegmentFormat,
|
|
25
24
|
ISegmentContext,
|
|
26
25
|
ISegmentLoaderCallbacks,
|
|
27
|
-
ISegmentLoaderResultChunkedComplete,
|
|
28
26
|
ISegmentLoaderResultSegmentCreated,
|
|
29
27
|
ISegmentLoaderResultSegmentLoaded,
|
|
30
28
|
ISegmentParserParsedInitChunk,
|
|
@@ -39,31 +37,31 @@ import {
|
|
|
39
37
|
* @param {Object} callbacks
|
|
40
38
|
* @returns {Promise}
|
|
41
39
|
*/
|
|
42
|
-
export function imageLoader(
|
|
40
|
+
export async function imageLoader(
|
|
43
41
|
url : string | null,
|
|
44
42
|
content : ISegmentContext,
|
|
45
43
|
cancelSignal : CancellationSignal,
|
|
46
44
|
callbacks : ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>
|
|
47
45
|
) : Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> |
|
|
48
|
-
ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat
|
|
49
|
-
ISegmentLoaderResultChunkedComplete>
|
|
46
|
+
ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>>
|
|
50
47
|
{
|
|
51
48
|
const { segment } = content;
|
|
52
49
|
if (segment.isInit || url === null) {
|
|
53
|
-
return
|
|
54
|
-
|
|
50
|
+
return { resultType: "segment-created",
|
|
51
|
+
resultData: null };
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
const data = await request({ url,
|
|
54
|
+
responseType: "arraybuffer",
|
|
55
|
+
onProgress: callbacks.onProgress,
|
|
56
|
+
cancelSignal });
|
|
57
|
+
return { resultType: "segment-loaded",
|
|
58
|
+
resultData: data };
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
/**
|
|
65
62
|
* Parses an image segment.
|
|
66
|
-
* @param {Object}
|
|
63
|
+
* @param {Object} loadedSegment
|
|
64
|
+
* @param {Object} content
|
|
67
65
|
* @returns {Object}
|
|
68
66
|
*/
|
|
69
67
|
export function imageParser(
|
|
@@ -78,6 +76,7 @@ export function imageParser(
|
|
|
78
76
|
if (content.segment.isInit) { // image init segment has no use
|
|
79
77
|
return { segmentType: "init",
|
|
80
78
|
initializationData: null,
|
|
79
|
+
initializationDataSize: 0,
|
|
81
80
|
protectionDataUpdate: false,
|
|
82
81
|
initTimescale: undefined };
|
|
83
82
|
}
|
|
@@ -92,6 +91,7 @@ export function imageParser(
|
|
|
92
91
|
if (data === null || features.imageParser === null) {
|
|
93
92
|
return { segmentType: "media",
|
|
94
93
|
chunkData: null,
|
|
94
|
+
chunkSize: 0,
|
|
95
95
|
chunkInfos: { duration: segment.duration,
|
|
96
96
|
time: segment.time },
|
|
97
97
|
chunkOffset,
|
|
@@ -107,6 +107,7 @@ export function imageParser(
|
|
|
107
107
|
end: Number.MAX_VALUE,
|
|
108
108
|
timescale: 1,
|
|
109
109
|
type: "bif" },
|
|
110
|
+
chunkSize: undefined,
|
|
110
111
|
chunkInfos: { time: 0,
|
|
111
112
|
duration: Number.MAX_VALUE },
|
|
112
113
|
chunkOffset,
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { ISegment } from "../../manifest";
|
|
18
18
|
import { concat } from "../../utils/byte_parsing";
|
|
19
|
-
import PPromise from "../../utils/promise";
|
|
20
19
|
import request from "../../utils/request";
|
|
21
20
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
22
21
|
import {
|
|
@@ -86,7 +85,7 @@ export default function initSegmentLoader(
|
|
|
86
85
|
cancelSignal,
|
|
87
86
|
onProgress: callbacks.onProgress });
|
|
88
87
|
|
|
89
|
-
return
|
|
88
|
+
return Promise.all([rangeRequest$, indexRequest$])
|
|
90
89
|
.then(([ initData, indexData ]) => {
|
|
91
90
|
const data = concat(new Uint8Array(initData.responseData),
|
|
92
91
|
new Uint8Array(indexData.responseData));
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
ILoadedResource,
|
|
24
24
|
} from "../../parsers/manifest/dash/parsers_types";
|
|
25
25
|
import objectAssign from "../../utils/object_assign";
|
|
26
|
-
import PPromise from "../../utils/promise";
|
|
27
26
|
import request from "../../utils/request";
|
|
28
27
|
import {
|
|
29
28
|
strToUtf8,
|
|
@@ -140,7 +139,7 @@ export default function generateManifestParser(
|
|
|
140
139
|
onWarnings(parserResponse.value.warnings);
|
|
141
140
|
}
|
|
142
141
|
if (cancelSignal.isCancelled) {
|
|
143
|
-
return
|
|
142
|
+
return Promise.reject(cancelSignal.cancellationError);
|
|
144
143
|
}
|
|
145
144
|
const manifest = new Manifest(parserResponse.value.parsed, options);
|
|
146
145
|
return { manifest, url };
|
|
@@ -192,7 +191,7 @@ export default function generateManifestParser(
|
|
|
192
191
|
});
|
|
193
192
|
});
|
|
194
193
|
|
|
195
|
-
return
|
|
194
|
+
return Promise.all(externalResources).then(loadedResources => {
|
|
196
195
|
if (value.format === "string") {
|
|
197
196
|
assertLoadedResourcesFormatString(loadedResources);
|
|
198
197
|
return processMpdParserResponse(value.continue(loadedResources));
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { CustomLoaderError } from "../../errors";
|
|
18
|
-
import PPromise from "../../utils/promise";
|
|
19
18
|
import request, {
|
|
20
19
|
fetchIsSupported,
|
|
21
20
|
} from "../../utils/request";
|
|
@@ -42,7 +41,7 @@ import lowLatencySegmentLoader from "./low_latency_segment_loader";
|
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* Segment loader triggered if there was no custom-defined one in the API.
|
|
45
|
-
* @param {string}
|
|
44
|
+
* @param {string} url
|
|
46
45
|
* @param {Object} content
|
|
47
46
|
* @param {boolean} lowLatencyMode
|
|
48
47
|
* @param {Object} callbacks
|
|
@@ -114,8 +113,8 @@ export default function generateSegmentLoader(
|
|
|
114
113
|
ISegmentLoaderResultChunkedComplete>
|
|
115
114
|
{
|
|
116
115
|
if (url == null) {
|
|
117
|
-
return
|
|
118
|
-
|
|
116
|
+
return Promise.resolve({ resultType: "segment-created",
|
|
117
|
+
resultData: null });
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
if (lowLatencyMode || customSegmentLoader === undefined) {
|
|
@@ -130,7 +129,7 @@ export default function generateSegmentLoader(
|
|
|
130
129
|
transport: "dash",
|
|
131
130
|
url };
|
|
132
131
|
|
|
133
|
-
return new
|
|
132
|
+
return new Promise((res, rej) => {
|
|
134
133
|
/** `true` when the custom segmentLoader should not be active anymore. */
|
|
135
134
|
let hasFinished = false;
|
|
136
135
|
|
|
@@ -64,11 +64,13 @@ export default function generateAudioVideoSegmentParser(
|
|
|
64
64
|
if (segment.isInit) {
|
|
65
65
|
return { segmentType: "init",
|
|
66
66
|
initializationData: null,
|
|
67
|
+
initializationDataSize: 0,
|
|
67
68
|
protectionDataUpdate: false,
|
|
68
69
|
initTimescale: undefined };
|
|
69
70
|
}
|
|
70
71
|
return { segmentType: "media",
|
|
71
72
|
chunkData: null,
|
|
73
|
+
chunkSize: 0,
|
|
72
74
|
chunkInfos: null,
|
|
73
75
|
chunkOffset: 0,
|
|
74
76
|
protectionDataUpdate: false,
|
|
@@ -115,6 +117,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
115
117
|
const { needsManifestRefresh, inbandEvents } = events;
|
|
116
118
|
return { segmentType: "media",
|
|
117
119
|
chunkData,
|
|
120
|
+
chunkSize: chunkData.length,
|
|
118
121
|
chunkInfos,
|
|
119
122
|
chunkOffset,
|
|
120
123
|
appendWindow,
|
|
@@ -127,6 +130,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
127
130
|
|
|
128
131
|
return { segmentType: "media",
|
|
129
132
|
chunkData,
|
|
133
|
+
chunkSize: chunkData.length,
|
|
130
134
|
chunkInfos,
|
|
131
135
|
chunkOffset,
|
|
132
136
|
protectionDataUpdate,
|
|
@@ -177,6 +181,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
177
181
|
|
|
178
182
|
return { segmentType: "init",
|
|
179
183
|
initializationData: chunkData,
|
|
184
|
+
initializationDataSize: chunkData.length,
|
|
180
185
|
protectionDataUpdate,
|
|
181
186
|
initTimescale: parsedTimescale };
|
|
182
187
|
};
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "../../utils/promise";
|
|
18
17
|
import request, {
|
|
19
18
|
fetchIsSupported,
|
|
20
19
|
} from "../../utils/request";
|
|
@@ -68,8 +67,8 @@ export default function generateTextTrackLoader(
|
|
|
68
67
|
const { range } = segment;
|
|
69
68
|
|
|
70
69
|
if (url === null) {
|
|
71
|
-
return
|
|
72
|
-
|
|
70
|
+
return Promise.resolve({ resultType: "segment-created",
|
|
71
|
+
resultData: null });
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
if (segment.isInit) {
|