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
package/.eslintrc.js
CHANGED
|
@@ -350,10 +350,6 @@ module.exports = {
|
|
|
350
350
|
"property": "substr",
|
|
351
351
|
"message": "Please use `substring` instead.",
|
|
352
352
|
},
|
|
353
|
-
{
|
|
354
|
-
"object": "Promise",
|
|
355
|
-
"message": "Not available in IE11, use promise ponyfill instead",
|
|
356
|
-
}
|
|
357
353
|
],
|
|
358
354
|
"quote-props": [
|
|
359
355
|
"error",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.
|
|
3
|
+
## v3.27.0-dev.2022032100 (2022-03-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add a `maxVideoBufferSize` constructor option and `{get,set}MaxVideoBufferSize` methods to limit the size of loaded video data buffered at the same time [#1041, #1054]
|
|
8
|
+
- DRM: Add a `"periods"` mode to the `keySystems[].singleLicensePer` `loadVideo` option, allowing to obtain decryption license for groups of Periods allowing a compromise between optimization, features and compatibility [#1028, #1061]
|
|
9
|
+
- Add a `"reload"` `audioTrackSwitchingMode` to work-around rare compatibility issues when switching audio tracks [#1089]
|
|
4
10
|
|
|
5
11
|
### Bug fixes
|
|
6
12
|
|
|
7
13
|
- subtitles: Fix rare issue where subtitles could be skipped due to a rounding error [#1064]
|
|
8
14
|
- DASH: fix issue where the wrong segments would be requested on $Number$-based MPD with a SegmentTimeline older than the `timeShiftBufferDepth` [#1052, #1060]
|
|
9
15
|
- directfile: disable all audio tracks before enabling one to work-around Safari issue on MacOS Monterey [#1067]
|
|
16
|
+
- avoid performing a small seek when changing the audio track [#1080]
|
|
17
|
+
- api: allow switching to RELOADING state synchronously after LOADED [#1083]
|
|
18
|
+
- Safari Mobile: Improve decryption support on Safari mobile by relying on the vendored `WebKitMediaKeys` API [#1072]
|
|
10
19
|
- avoid unnecessary warning logs when loading some initialization segments [#1049]
|
|
11
20
|
- TypeScript: Add forgotten TypeScript types in the exposed segment and manifest loader APIs [#1057]
|
|
21
|
+
- DRM: Avoid decryption issues when a license is persisted in a `singleLicensePer` `"init-data"` mode but loaded in a `"content"` mode [#1031, #1042]
|
|
12
22
|
|
|
13
23
|
### Other improvements
|
|
14
24
|
|
|
15
25
|
- DASH: always consider that the non-last Period is finished when it contains SegmentTimeline elements [#1047]
|
|
16
26
|
- add better buffer cleaning logic on a browser's `QuotaExceededError` to better handle memory limitations [#1065]
|
|
17
|
-
-
|
|
27
|
+
- DASH: Prioritize selectionPriority attribute over a "main" Role when ordering AdaptationSets [#1082]
|
|
28
|
+
- directfile/Safari: use the `getStartDate` method in `getWallClockTime` when available to obtain true offseted times when playing HLS contents on Safari [#1055]
|
|
29
|
+
- DRM: Improve DRM Session caches performance when `singleLicensePer` is set to `"content"`
|
|
30
|
+
- TypeScript: Add IBitrateEstimate, IPositionUpdate and IPlayerState types to the exported types [#1084]
|
|
31
|
+
- Remove dependency on pinkie's promise ponyfill [#1058, #1090]
|
|
18
32
|
- tests: add performance tests, to better catch and avoid performance regressions [#1053, #1062]
|
|
33
|
+
- DRM: Refactor DRM logic for better maintainability. DRM-linked logs are now prefixed by `DRM:` instead of `EME:` like previously [#1042]
|
|
19
34
|
|
|
20
35
|
|
|
21
36
|
## v3.26.2 (2022-01-11)
|
package/FILES.md
CHANGED
|
@@ -25,7 +25,7 @@ a single directory or subdirectory, in alphabetical order.
|
|
|
25
25
|
- [src/core/abr/: The adaptive bitrate code](#core-abr)
|
|
26
26
|
- [src/core/api/: The API definition](#core-api)
|
|
27
27
|
- [src/core/stream/: Load the right segments](#core-stream)
|
|
28
|
-
- [src/core/
|
|
28
|
+
- [src/core/decrypt/: Decryption management](#core-decrypt)
|
|
29
29
|
- [src/core/fetchers/: The fetchers](#core-fetchers)
|
|
30
30
|
- [src/core/segment_buffers/: The Media buffers](#core-sb)
|
|
31
31
|
- [src/core/init/: Media streaming logic](#core-init)
|
|
@@ -240,10 +240,11 @@ The code there calculate which segments should be downloaded, ask for their
|
|
|
240
240
|
download and push the segments into the `SegmentBuffers`.
|
|
241
241
|
|
|
242
242
|
|
|
243
|
-
<a name="core-
|
|
244
|
-
### src/core/
|
|
243
|
+
<a name="core-decrypt"></a>
|
|
244
|
+
### src/core/decrypt/: Decryption management ###################################
|
|
245
245
|
|
|
246
|
-
Defines functions allowing to handle encrypted contents through the EME
|
|
246
|
+
Defines functions allowing to handle encrypted contents through the EME browser
|
|
247
|
+
APIs.
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
<a name="core-fetchers"></a>
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.27.0-dev.2022032100
|
|
@@ -19,6 +19,8 @@ declare const isEdgeChromium: boolean;
|
|
|
19
19
|
declare const isFirefox: boolean;
|
|
20
20
|
declare const isSamsungBrowser: boolean;
|
|
21
21
|
declare const isTizen: boolean;
|
|
22
|
-
|
|
22
|
+
/** `true` on Safari on a PC platform (i.e. not iPhone / iPad etc.) */
|
|
23
|
+
declare const isSafariDesktop: boolean;
|
|
24
|
+
/** `true` on Safari on an iPhone, iPad & iPod platform */
|
|
23
25
|
declare const isSafariMobile: boolean;
|
|
24
|
-
export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox,
|
|
26
|
+
export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, };
|
|
@@ -34,10 +34,12 @@ var isSamsungBrowser = !isNode &&
|
|
|
34
34
|
/SamsungBrowser/.test(navigator.userAgent);
|
|
35
35
|
var isTizen = !isNode &&
|
|
36
36
|
/Tizen/.test(navigator.userAgent);
|
|
37
|
-
|
|
37
|
+
/** `true` on Safari on a PC platform (i.e. not iPhone / iPad etc.) */
|
|
38
|
+
var isSafariDesktop = !isNode && (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") >= 0 ||
|
|
38
39
|
((_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) ===
|
|
39
40
|
"[object SafariRemoteNotification]");
|
|
41
|
+
/** `true` on Safari on an iPhone, iPad & iPod platform */
|
|
40
42
|
var isSafariMobile = !isNode &&
|
|
41
43
|
typeof navigator.platform === "string" &&
|
|
42
44
|
/iPad|iPhone|iPod/.test(navigator.platform);
|
|
43
|
-
export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox,
|
|
45
|
+
export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, };
|
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Observable } from "rxjs";
|
|
17
16
|
import { ICustomMediaKeySession } from "./custom_media_keys";
|
|
18
17
|
/**
|
|
19
|
-
* Close
|
|
20
|
-
*
|
|
18
|
+
* Close the given `MediaKeySession` and returns a Promise resolving when the
|
|
19
|
+
* session is closed.
|
|
20
|
+
* This promise does not reject, even if we're unable to close the
|
|
21
|
+
* `MediaKeySession`.
|
|
22
|
+
*
|
|
23
|
+
* Note that there is a lot of browser issues linked to the impossibility to
|
|
24
|
+
* either close a MediaKeySession or to know if a MediaKeySession was closed.
|
|
25
|
+
* Due to this, the returned Promise might take some time before resolving on
|
|
26
|
+
* some devices.
|
|
21
27
|
* @param {MediaKeySession|Object} session
|
|
22
|
-
* @returns {
|
|
28
|
+
* @returns {Promise.<undefined>}
|
|
23
29
|
*/
|
|
24
|
-
export default function closeSession
|
|
30
|
+
export default function closeSession(session: MediaKeySession | ICustomMediaKeySession): Promise<void>;
|
|
@@ -13,43 +13,150 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (_) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import log from "../../log";
|
|
53
|
+
import cancellableSleep from "../../utils/cancellable_sleep";
|
|
54
|
+
import TaskCanceller, { CancellationError, } from "../../utils/task_canceller";
|
|
18
55
|
/**
|
|
19
|
-
* Close
|
|
20
|
-
*
|
|
56
|
+
* Close the given `MediaKeySession` and returns a Promise resolving when the
|
|
57
|
+
* session is closed.
|
|
58
|
+
* This promise does not reject, even if we're unable to close the
|
|
59
|
+
* `MediaKeySession`.
|
|
60
|
+
*
|
|
61
|
+
* Note that there is a lot of browser issues linked to the impossibility to
|
|
62
|
+
* either close a MediaKeySession or to know if a MediaKeySession was closed.
|
|
63
|
+
* Due to this, the returned Promise might take some time before resolving on
|
|
64
|
+
* some devices.
|
|
21
65
|
* @param {MediaKeySession|Object} session
|
|
22
|
-
* @returns {
|
|
66
|
+
* @returns {Promise.<undefined>}
|
|
23
67
|
*/
|
|
24
|
-
export default function closeSession
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
export default function closeSession(session) {
|
|
69
|
+
var timeoutCanceller = new TaskCanceller();
|
|
70
|
+
return Promise.race([
|
|
71
|
+
session.close()
|
|
72
|
+
.then(function () { timeoutCanceller.cancel(); }),
|
|
73
|
+
// The `closed` promise may resolve, even if `close()` result has not
|
|
74
|
+
// (seen at some point on Firefox).
|
|
75
|
+
session.closed
|
|
76
|
+
.then(function () { timeoutCanceller.cancel(); }),
|
|
77
|
+
waitTimeoutAndCheck(),
|
|
78
|
+
]);
|
|
79
|
+
/**
|
|
80
|
+
* If the session is not closed after 1000ms, try to communicate with the
|
|
81
|
+
* MediaKeySession and check if an error is returned.
|
|
82
|
+
* This is needed because on some browsers with poor EME implementation,
|
|
83
|
+
* knowing when a MediaKeySession is closed is actually a hard task.
|
|
84
|
+
*
|
|
85
|
+
* The returned Promise will never reject.
|
|
86
|
+
* @returns {Promise.<undefined>}
|
|
87
|
+
*/
|
|
88
|
+
function waitTimeoutAndCheck() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
var err_1, message;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
_a.trys.push([0, 3, , 4]);
|
|
95
|
+
return [4 /*yield*/, cancellableSleep(1000, timeoutCanceller.signal)];
|
|
96
|
+
case 1:
|
|
97
|
+
_a.sent();
|
|
98
|
+
return [4 /*yield*/, tryUpdatingSession()];
|
|
99
|
+
case 2:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [3 /*break*/, 4];
|
|
102
|
+
case 3:
|
|
103
|
+
err_1 = _a.sent();
|
|
104
|
+
if (err_1 instanceof CancellationError) { // cancelled == session closed
|
|
105
|
+
return [2 /*return*/];
|
|
106
|
+
}
|
|
107
|
+
message = err_1 instanceof Error ?
|
|
108
|
+
err_1.message :
|
|
109
|
+
"Unknown error made it impossible to close the session";
|
|
110
|
+
log.error("DRM: ".concat(message));
|
|
111
|
+
return [3 /*break*/, 4];
|
|
112
|
+
case 4: return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Try to update `MediaKeySession` and check its error if it failed.
|
|
119
|
+
* If we still don't know whether it closed yet, wait a second
|
|
120
|
+
* timeout then quit.
|
|
121
|
+
*
|
|
122
|
+
* The returned Promise resolves if the `MediaKeySession` seems closed and
|
|
123
|
+
* rejects if we couldn't know or it doesn't.
|
|
124
|
+
* @returns {Promise.<undefined>}
|
|
125
|
+
*/
|
|
126
|
+
function tryUpdatingSession() {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var err_2;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
_a.trys.push([0, 2, , 4]);
|
|
133
|
+
return [4 /*yield*/, session.update(new Uint8Array(1))];
|
|
134
|
+
case 1:
|
|
135
|
+
_a.sent();
|
|
136
|
+
return [3 /*break*/, 4];
|
|
137
|
+
case 2:
|
|
138
|
+
err_2 = _a.sent();
|
|
139
|
+
if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
// The caught error can tell if session is closed
|
|
143
|
+
// (Chrome may throw this error)
|
|
144
|
+
// I know... Checking the error message is not the best practice ever.
|
|
145
|
+
if (err_2 instanceof Error &&
|
|
146
|
+
err_2.message === "The session is already closed.") {
|
|
147
|
+
return [2 /*return*/];
|
|
148
|
+
}
|
|
149
|
+
return [4 /*yield*/, cancellableSleep(1000, timeoutCanceller.signal)];
|
|
150
|
+
case 3:
|
|
151
|
+
_a.sent();
|
|
152
|
+
return [3 /*break*/, 4];
|
|
153
|
+
case 4:
|
|
154
|
+
if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
|
|
155
|
+
return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
throw new Error("Compat: Couldn't know if session is closed");
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
55
162
|
}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { ICustomMediaKeys } from "./custom_media_keys";
|
|
2
17
|
export interface ICustomMediaKeySystemAccess {
|
|
3
18
|
readonly keySystem: string;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015 CANAL+ Group
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import PPromise from "../../utils/promise";
|
|
17
1
|
/**
|
|
18
2
|
* Simple implementation of the MediaKeySystemAccess EME API.
|
|
19
3
|
*
|
|
@@ -50,7 +34,7 @@ var CustomMediaKeySystemAccess = /** @class */ (function () {
|
|
|
50
34
|
*/
|
|
51
35
|
CustomMediaKeySystemAccess.prototype.createMediaKeys = function () {
|
|
52
36
|
var _this = this;
|
|
53
|
-
return new
|
|
37
|
+
return new Promise(function (res) { return res(_this._mediaKeys); });
|
|
54
38
|
};
|
|
55
39
|
/**
|
|
56
40
|
* @returns {Object} - Configuration accepted for this MediaKeySystemAccess.
|
|
@@ -30,7 +30,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
30
30
|
})();
|
|
31
31
|
import { merge as observableMerge, Subject, takeUntil, } from "rxjs";
|
|
32
32
|
import EventEmitter from "../../../utils/event_emitter";
|
|
33
|
-
import PPromise from "../../../utils/promise";
|
|
34
33
|
import * as events from "../../event_listeners";
|
|
35
34
|
import { MSMediaKeysConstructor, } from "./ms_media_keys_constructor";
|
|
36
35
|
var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
@@ -41,11 +40,11 @@ var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
|
41
40
|
_this.keyStatuses = new Map();
|
|
42
41
|
_this._mk = mk;
|
|
43
42
|
_this._closeSession$ = new Subject();
|
|
44
|
-
_this.closed = new
|
|
43
|
+
_this.closed = new Promise(function (resolve) {
|
|
45
44
|
_this._closeSession$.subscribe(resolve);
|
|
46
45
|
});
|
|
47
46
|
_this.update = function (license) {
|
|
48
|
-
return new
|
|
47
|
+
return new Promise(function (resolve, reject) {
|
|
49
48
|
if (_this._ss === undefined) {
|
|
50
49
|
return reject("MediaKeySession not set.");
|
|
51
50
|
}
|
|
@@ -61,7 +60,7 @@ var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
|
61
60
|
}
|
|
62
61
|
IE11MediaKeySession.prototype.generateRequest = function (_initDataType, initData) {
|
|
63
62
|
var _this = this;
|
|
64
|
-
return new
|
|
63
|
+
return new Promise(function (resolve) {
|
|
65
64
|
var initDataU8 = initData instanceof Uint8Array ? initData :
|
|
66
65
|
initData instanceof ArrayBuffer ? new Uint8Array(initData) :
|
|
67
66
|
new Uint8Array(initData.buffer);
|
|
@@ -73,7 +72,7 @@ var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
|
73
72
|
};
|
|
74
73
|
IE11MediaKeySession.prototype.close = function () {
|
|
75
74
|
var _this = this;
|
|
76
|
-
return new
|
|
75
|
+
return new Promise(function (resolve) {
|
|
77
76
|
if (_this._ss != null) {
|
|
78
77
|
_this._ss.close();
|
|
79
78
|
_this._ss = undefined;
|
|
@@ -84,10 +83,10 @@ var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
|
84
83
|
});
|
|
85
84
|
};
|
|
86
85
|
IE11MediaKeySession.prototype.load = function () {
|
|
87
|
-
return
|
|
86
|
+
return Promise.resolve(false);
|
|
88
87
|
};
|
|
89
88
|
IE11MediaKeySession.prototype.remove = function () {
|
|
90
|
-
return
|
|
89
|
+
return Promise.resolve();
|
|
91
90
|
};
|
|
92
91
|
Object.defineProperty(IE11MediaKeySession.prototype, "sessionId", {
|
|
93
92
|
get: function () {
|
|
@@ -13,18 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Observable } from "rxjs";
|
|
17
16
|
import CustomMediaKeySystemAccess from "./../custom_key_system_access";
|
|
18
17
|
import { ICustomMediaKeys, ICustomMediaKeySession } from "./types";
|
|
19
18
|
/** Generic implementation of the navigator.requestMediaKeySystemAccess API. */
|
|
20
|
-
declare type ICompatRequestMediaKeySystemAccessFn = (keyType: string, config: MediaKeySystemConfiguration[]) =>
|
|
21
|
-
declare let requestMediaKeySystemAccess:
|
|
19
|
+
declare type ICompatRequestMediaKeySystemAccessFn = (keyType: string, config: MediaKeySystemConfiguration[]) => Promise<MediaKeySystemAccess | CustomMediaKeySystemAccess>;
|
|
20
|
+
declare let requestMediaKeySystemAccess: ICompatRequestMediaKeySystemAccessFn | null;
|
|
22
21
|
/**
|
|
23
22
|
* Set the given MediaKeys on the given HTMLMediaElement.
|
|
24
23
|
* Emits null when done then complete.
|
|
25
24
|
* @param {HTMLMediaElement} elt
|
|
26
25
|
* @param {Object} mediaKeys
|
|
27
|
-
* @returns {Observable}
|
|
28
26
|
*/
|
|
29
|
-
declare
|
|
27
|
+
declare let setMediaKeys: ((elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => unknown);
|
|
30
28
|
export { requestMediaKeySystemAccess, setMediaKeys, ICustomMediaKeys, ICustomMediaKeySession, };
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { defer as observableDefer, of as observableOf, throwError as observableThrow, } from "rxjs";
|
|
17
16
|
import { MediaError } from "../../../errors";
|
|
18
17
|
import assert from "../../../utils/assert";
|
|
19
|
-
import castToObservable from "../../../utils/cast_to_observable";
|
|
20
18
|
import { isIE11 } from "../../browser_detection";
|
|
21
19
|
import isNode from "../../is_node";
|
|
22
20
|
import shouldFavourCustomSafariEME from "../../should_favour_custom_safari_EME";
|
|
@@ -27,7 +25,13 @@ import getOldKitWebKitMediaKeyCallbacks, { isOldWebkitMediaElement, } from "./ol
|
|
|
27
25
|
import getWebKitMediaKeysCallbacks from "./webkit_media_keys";
|
|
28
26
|
import { WebKitMediaKeysConstructor } from "./webkit_media_keys_constructor";
|
|
29
27
|
var requestMediaKeySystemAccess = null;
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Set the given MediaKeys on the given HTMLMediaElement.
|
|
30
|
+
* Emits null when done then complete.
|
|
31
|
+
* @param {HTMLMediaElement} elt
|
|
32
|
+
* @param {Object} mediaKeys
|
|
33
|
+
*/
|
|
34
|
+
var setMediaKeys = function defaultSetMediaKeys(mediaElement, mediaKeys) {
|
|
31
35
|
var elt = mediaElement;
|
|
32
36
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
33
37
|
if (typeof elt.setMediaKeys === "function") {
|
|
@@ -58,8 +62,12 @@ var _setMediaKeys = function defaultSetMediaKeys(mediaElement, mediaKeys) {
|
|
|
58
62
|
*/
|
|
59
63
|
if (isNode ||
|
|
60
64
|
(navigator.requestMediaKeySystemAccess != null && !shouldFavourCustomSafariEME())) {
|
|
61
|
-
requestMediaKeySystemAccess = function (
|
|
62
|
-
|
|
65
|
+
requestMediaKeySystemAccess = function () {
|
|
66
|
+
var args = [];
|
|
67
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
68
|
+
args[_i] = arguments[_i];
|
|
69
|
+
}
|
|
70
|
+
return navigator.requestMediaKeySystemAccess.apply(navigator, args);
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
73
|
else {
|
|
@@ -70,26 +78,26 @@ else {
|
|
|
70
78
|
var callbacks = getOldKitWebKitMediaKeyCallbacks();
|
|
71
79
|
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
72
80
|
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
73
|
-
|
|
81
|
+
setMediaKeys = callbacks.setMediaKeys;
|
|
74
82
|
// This is for WebKit with prefixed EME api
|
|
75
83
|
}
|
|
76
84
|
else if (WebKitMediaKeysConstructor !== undefined) {
|
|
77
85
|
var callbacks = getWebKitMediaKeysCallbacks();
|
|
78
86
|
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
79
87
|
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
80
|
-
|
|
88
|
+
setMediaKeys = callbacks.setMediaKeys;
|
|
81
89
|
}
|
|
82
90
|
else if (isIE11 && MSMediaKeysConstructor !== undefined) {
|
|
83
91
|
var callbacks = getIE11MediaKeysCallbacks();
|
|
84
92
|
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
85
93
|
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
86
|
-
|
|
94
|
+
setMediaKeys = callbacks.setMediaKeys;
|
|
87
95
|
}
|
|
88
96
|
else if (MozMediaKeysConstructor !== undefined) {
|
|
89
97
|
var callbacks = getMozMediaKeysCallbacks();
|
|
90
98
|
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
91
99
|
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
92
|
-
|
|
100
|
+
setMediaKeys = callbacks.setMediaKeys;
|
|
93
101
|
}
|
|
94
102
|
else {
|
|
95
103
|
var MK_1 = window.MediaKeys;
|
|
@@ -117,7 +125,7 @@ else {
|
|
|
117
125
|
}
|
|
118
126
|
requestMediaKeySystemAccess = function (keyType, keySystemConfigurations) {
|
|
119
127
|
if (!isTypeSupported_1(keyType)) {
|
|
120
|
-
return
|
|
128
|
+
return Promise.reject(new Error("Unsupported key type"));
|
|
121
129
|
}
|
|
122
130
|
for (var i = 0; i < keySystemConfigurations.length; i++) {
|
|
123
131
|
var keySystemConfiguration = keySystemConfigurations[i];
|
|
@@ -142,20 +150,10 @@ else {
|
|
|
142
150
|
}
|
|
143
151
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
144
152
|
var customMediaKeys = createCustomMediaKeys_1(keyType);
|
|
145
|
-
return
|
|
153
|
+
return Promise.resolve(new CustomMediaKeySystemAccess(keyType, customMediaKeys, keySystemConfigurationResponse));
|
|
146
154
|
}
|
|
147
155
|
}
|
|
148
|
-
return
|
|
156
|
+
return Promise.reject(new Error("Unsupported configuration"));
|
|
149
157
|
};
|
|
150
158
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Set the given MediaKeys on the given HTMLMediaElement.
|
|
153
|
-
* Emits null when done then complete.
|
|
154
|
-
* @param {HTMLMediaElement} elt
|
|
155
|
-
* @param {Object} mediaKeys
|
|
156
|
-
* @returns {Observable}
|
|
157
|
-
*/
|
|
158
|
-
function setMediaKeys(elt, mediaKeys) {
|
|
159
|
-
return observableDefer(function () { return castToObservable(_setMediaKeys(elt, mediaKeys)); });
|
|
160
|
-
}
|
|
161
159
|
export { requestMediaKeySystemAccess, setMediaKeys, };
|