rx-player 3.26.3-dev.2022021400 → 3.27.0-dev.20220317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- 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 +144 -36
- 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 +21 -22
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +53 -34
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +43 -41
- 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 +68 -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 +3 -1
- package/dist/_esm5.processed/core/api/option_utils.js +19 -6
- 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 +72 -33
- 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 +104 -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 +41 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +866 -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 +174 -0
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +21 -0
- 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 +300 -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 +85 -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 +303 -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 +2 -2
- 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/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 +4 -2
- 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/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.js +1 -1
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -1
- 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 +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.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/smooth/create_parser.js +1 -0
- package/dist/_esm5.processed/public_types.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +3 -0
- package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
- package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
- 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/smooth/pipelines.js +68 -10
- package/dist/_esm5.processed/transports/types.d.ts +22 -0
- 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 +1 -1
- 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 +5002 -3033
- package/dist/rx-player.min.js +1 -1
- package/dummy +1 -0
- package/{dist/_esm5.processed/core/eme/dispose_eme.d.ts → experimental/index.d.ts} +1 -4
- package/{dist/_esm5.processed/core/eme/dispose_media_keys.d.ts → experimental/index.js} +1 -6
- package/package.json +32 -34
- package/scripts/build/templates/experimental/index.d.ts +16 -0
- package/scripts/build/templates/experimental/index.js +16 -0
- package/sonar-project.properties +1 -1
- package/src/README.md +6 -6
- 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 +90 -56
- package/src/compat/eme/custom_media_keys/index.ts +21 -38
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +63 -46
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +51 -49
- package/src/compat/eme/generate_key_request.ts +25 -33
- package/src/compat/eme/load_session.ts +29 -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 +17 -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 +37 -20
- package/src/core/api/playback_observer.ts +12 -8
- package/src/core/api/public_api.ts +151 -111
- 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 +49 -56
- package/src/core/decrypt/clear_on_stop.ts +48 -0
- package/src/core/decrypt/content_decryptor.ts +1158 -0
- package/src/core/decrypt/create_or_load_session.ts +130 -0
- package/src/core/decrypt/create_session.ts +175 -0
- package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
- package/src/core/{eme → decrypt}/find_key_system.ts +112 -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} +20 -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 +318 -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 +4 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
- 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 +42 -105
- 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/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 +1 -1
- package/src/core/stream/period/period_stream.ts +5 -2
- 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 +2 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +4 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.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/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 +5 -1
- package/src/transports/dash/image_pipelines.ts +3 -0
- package/src/transports/dash/segment_parser.ts +5 -0
- package/src/transports/dash/text_parser.ts +8 -0
- package/src/transports/local/segment_parser.ts +4 -0
- package/src/transports/local/text_parser.ts +8 -0
- package/src/transports/smooth/pipelines.ts +22 -9
- package/src/transports/types.ts +22 -0
- package/src/utils/__tests__/deep_merge.test.ts +48 -0
- 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 +2 -1
- package/src/utils/rx-from_cancellable_promise.ts +7 -2
- package/src/utils/task_canceller.ts +6 -4
- 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.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/transports/types.ts
CHANGED
|
@@ -722,6 +722,17 @@ export interface ISegmentParserParsedInitChunk<DataType> {
|
|
|
722
722
|
* protection initialization data to have been encountered.
|
|
723
723
|
*/
|
|
724
724
|
protectionDataUpdate : boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Size in bytes of `initializationData`.
|
|
727
|
+
* `undefined` if unknown.
|
|
728
|
+
*
|
|
729
|
+
* Note: In some cases, such as when `initializationData` is under a format
|
|
730
|
+
* whose size is difficult to estimate (e.g. a JavaScript object), the
|
|
731
|
+
* `initializationDataSize` may either be set to `undefined` or, if available,
|
|
732
|
+
* to a sensible estimate (e.g. when a JavaScript object wraps large binary
|
|
733
|
+
* data, `initializationDataSize` may refer to that binary data only).
|
|
734
|
+
*/
|
|
735
|
+
initializationDataSize : number | undefined;
|
|
725
736
|
}
|
|
726
737
|
|
|
727
738
|
/**
|
|
@@ -740,6 +751,17 @@ export interface ISegmentParserParsedMediaChunk<DataType> {
|
|
|
740
751
|
* `null` if unknown.
|
|
741
752
|
*/
|
|
742
753
|
chunkInfos : IChunkTimeInfo | null;
|
|
754
|
+
/**
|
|
755
|
+
* Size in bytes of `chunkData`.
|
|
756
|
+
* `undefined` if unknown.
|
|
757
|
+
*
|
|
758
|
+
* Note: In some cases, such as when `chunkData` is under a format whose size
|
|
759
|
+
* is difficult to estimate (e.g. a JavaScript object), the `chunkSize` may
|
|
760
|
+
* either be set to `undefined` or, if available, to a sensible estimate (e.g.
|
|
761
|
+
* when a JavaScript object wraps large binary data, `chunkSize` may refer to
|
|
762
|
+
* that binary data only).
|
|
763
|
+
*/
|
|
764
|
+
chunkSize : number | undefined;
|
|
743
765
|
/**
|
|
744
766
|
* time offset, in seconds, to add to the absolute timed data defined in
|
|
745
767
|
* `chunkData` to obtain the "real" wanted effective time.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import deepMerge from "../deep_merge";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
describe("utils - deep_merge", () => {
|
|
5
|
+
it("should return the first argument if no other arguments", () => {
|
|
6
|
+
const obj1 = { a: 1 };
|
|
7
|
+
expect(deepMerge(obj1)).toStrictEqual(obj1);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should concat if no common key is found", () => {
|
|
11
|
+
const obj1 = { a: 1 };
|
|
12
|
+
const obj2 = { b: 2 };
|
|
13
|
+
const result = { a: 1, b: 2 };
|
|
14
|
+
expect(deepMerge(obj1, obj2)).toStrictEqual(result);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should override the 1st object with the second", () => {
|
|
18
|
+
const obj1 = { a: 1 };
|
|
19
|
+
const obj2 = { a: 2 };
|
|
20
|
+
const result = { a: 2 };
|
|
21
|
+
expect(deepMerge(obj1, obj2)).toStrictEqual(result);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should return a deeply merged object", () => {
|
|
25
|
+
const obj1 = { a: { b: 1 } };
|
|
26
|
+
const obj2 = { a: { c: 2 } };
|
|
27
|
+
const result = { a: { b: 1, c: 2 } };
|
|
28
|
+
expect(deepMerge(obj1, obj2)).toStrictEqual(result);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should be able to merge multiple objects", () => {
|
|
32
|
+
const obj1 = { a: { b: 1 }, d: { e: 1 } };
|
|
33
|
+
const obj2 = { a: { c: 2 } };
|
|
34
|
+
const obj3 = { a: { f: 3 }, d: { g: 2 } };
|
|
35
|
+
const result = {
|
|
36
|
+
a: {
|
|
37
|
+
b: 1,
|
|
38
|
+
c: 2,
|
|
39
|
+
f: 3,
|
|
40
|
+
},
|
|
41
|
+
d: {
|
|
42
|
+
e: 1,
|
|
43
|
+
g: 2,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
expect(deepMerge(obj1, obj2, obj3)).toStrictEqual(result);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import objectAssign from "./object_assign";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if an item is an object
|
|
5
|
+
* @param item
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
*/
|
|
8
|
+
function isObject(item: unknown) : boolean {
|
|
9
|
+
return (item !== null
|
|
10
|
+
&& item !== undefined
|
|
11
|
+
&& !Array.isArray(item)
|
|
12
|
+
&& typeof item === "object");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type IDeepPartial<T> = {
|
|
16
|
+
[P in keyof T]?: IDeepPartial<T[P]> ;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type ISourcesArgument<T> = Array<IDeepPartial<T>|unknown>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Deeply merge nested objects
|
|
23
|
+
* @param target
|
|
24
|
+
* @param sources
|
|
25
|
+
* @returns output : merged object
|
|
26
|
+
*/
|
|
27
|
+
export default function deepMerge<T>(target: T, ...sources: ISourcesArgument<T>): T {
|
|
28
|
+
if (sources.length === 0) {
|
|
29
|
+
return target;
|
|
30
|
+
}
|
|
31
|
+
const source = sources.shift() as IDeepPartial<T>;
|
|
32
|
+
if (isObject(target) && isObject(source)) {
|
|
33
|
+
for (const key in source) {
|
|
34
|
+
if (isObject(source[key])) {
|
|
35
|
+
if (target[key] === undefined) {
|
|
36
|
+
objectAssign(target, { [key]: {} });
|
|
37
|
+
}
|
|
38
|
+
const newTarget = target[key];
|
|
39
|
+
deepMerge(newTarget, source[key] as IDeepPartial<typeof newTarget>);
|
|
40
|
+
} else {
|
|
41
|
+
objectAssign(target, { [key]: source[key] });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return deepMerge(target, ...sources);
|
|
46
|
+
}
|
package/src/utils/reference.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
Subscriber,
|
|
20
20
|
} from "rxjs";
|
|
21
21
|
import log from "../log";
|
|
22
|
+
import { CancellationSignal } from "./task_canceller";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* A value behind a shared reference, meaning that any update to its value from
|
|
@@ -62,6 +63,7 @@ export interface ISharedReference<T> {
|
|
|
62
63
|
|
|
63
64
|
/** Update the value of this shared reference. */
|
|
64
65
|
setValue(newVal : T) : void;
|
|
66
|
+
setValueIfChanged(newVal : T) : void;
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
69
|
* Returns an Observable which synchronously emits the current value (unless
|
|
@@ -72,6 +74,25 @@ export interface ISharedReference<T> {
|
|
|
72
74
|
*/
|
|
73
75
|
asObservable(skipCurrentValue? : boolean) : Observable<T>;
|
|
74
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Allows to register a callback to be called each time the value inside the
|
|
79
|
+
* reference is updated.
|
|
80
|
+
* @param {Function} cb - Callback to be called each time the reference is
|
|
81
|
+
* updated. Takes the new value im argument.
|
|
82
|
+
* @param {Object} [options]
|
|
83
|
+
* @param {Object} [options.clearSignal] - Allows to provide a
|
|
84
|
+
* CancellationSignal which will unregister the callback when it emits.
|
|
85
|
+
* @param {boolean} [options.emitCurrentValue] - If `true`, the callback will
|
|
86
|
+
* also be immediately called with the current value.
|
|
87
|
+
*/
|
|
88
|
+
onUpdate(
|
|
89
|
+
cb : (val : T) => void,
|
|
90
|
+
options? : {
|
|
91
|
+
clearSignal?: CancellationSignal;
|
|
92
|
+
emitCurrentValue?: boolean;
|
|
93
|
+
},
|
|
94
|
+
) : void;
|
|
95
|
+
|
|
75
96
|
/**
|
|
76
97
|
* Indicate that no new values will be emitted.
|
|
77
98
|
* Allows to automatically close all Observables generated from this shared
|
|
@@ -103,8 +124,23 @@ export interface ISharedReference<T> {
|
|
|
103
124
|
* the code that some logic is not supposed to update the referenced value.
|
|
104
125
|
*/
|
|
105
126
|
export interface IReadOnlySharedReference<T> {
|
|
127
|
+
/** Get the last value set on that reference. */
|
|
106
128
|
getValue() : T;
|
|
129
|
+
/**
|
|
130
|
+
* Returns an Observable notifying this reference's value each time it is
|
|
131
|
+
* updated.
|
|
132
|
+
*
|
|
133
|
+
* Also emit its current value on subscription unless its argument is set to
|
|
134
|
+
* `true`.
|
|
135
|
+
*/
|
|
107
136
|
asObservable(skipCurrentValue? : boolean) : Observable<T>;
|
|
137
|
+
onUpdate(
|
|
138
|
+
cb : (val : T) => void,
|
|
139
|
+
options? : {
|
|
140
|
+
clearSignal?: CancellationSignal;
|
|
141
|
+
emitCurrentValue?: boolean;
|
|
142
|
+
},
|
|
143
|
+
) : void;
|
|
108
144
|
}
|
|
109
145
|
|
|
110
146
|
/**
|
|
@@ -120,19 +156,23 @@ export function createSharedReference<T>(initialValue : T) : ISharedReference<T>
|
|
|
120
156
|
let value = initialValue;
|
|
121
157
|
|
|
122
158
|
/**
|
|
123
|
-
* List of currently subscribed
|
|
159
|
+
* List of currently subscribed listeners which listen to the referenced
|
|
124
160
|
* value's updates.
|
|
125
161
|
*
|
|
126
|
-
* Contains
|
|
127
|
-
* - `
|
|
128
|
-
*
|
|
129
|
-
*
|
|
162
|
+
* Contains three properties:
|
|
163
|
+
* - `trigger`: Function which will be called with the new reference's value
|
|
164
|
+
* once it changes
|
|
165
|
+
* - `complete`: Allows to clean-up the listener, will be called once the
|
|
166
|
+
* reference is finished.
|
|
167
|
+
* - `hasBeenCleared`: becomes `true` when the Observable becomes
|
|
168
|
+
* unsubscribed and thus when it is removed from the `cbs` array.
|
|
130
169
|
* Adding this property allows to detect when a previously-added
|
|
131
170
|
* Observable has since been unsubscribed e.g. as a side-effect during a
|
|
132
171
|
* function call.
|
|
133
172
|
*/
|
|
134
|
-
const
|
|
135
|
-
|
|
173
|
+
const cbs : Array<{ trigger : (a: T) => void;
|
|
174
|
+
complete : () => void;
|
|
175
|
+
hasBeenCleared : boolean; }> = [];
|
|
136
176
|
|
|
137
177
|
let isFinished = false;
|
|
138
178
|
|
|
@@ -160,14 +200,14 @@ export function createSharedReference<T>(initialValue : T) : ISharedReference<T>
|
|
|
160
200
|
}
|
|
161
201
|
value = newVal;
|
|
162
202
|
|
|
163
|
-
if (
|
|
203
|
+
if (cbs.length === 0) {
|
|
164
204
|
return;
|
|
165
205
|
}
|
|
166
|
-
const
|
|
167
|
-
for (const
|
|
206
|
+
const clonedCbs = cbs.slice();
|
|
207
|
+
for (const cbObj of clonedCbs) {
|
|
168
208
|
try {
|
|
169
|
-
if (!
|
|
170
|
-
|
|
209
|
+
if (!cbObj.hasBeenCleared) {
|
|
210
|
+
cbObj.trigger(newVal);
|
|
171
211
|
}
|
|
172
212
|
} catch (_) {
|
|
173
213
|
/* nothing */
|
|
@@ -175,6 +215,11 @@ export function createSharedReference<T>(initialValue : T) : ISharedReference<T>
|
|
|
175
215
|
}
|
|
176
216
|
},
|
|
177
217
|
|
|
218
|
+
setValueIfChanged(newVal : T) : void {
|
|
219
|
+
if (newVal !== value) {
|
|
220
|
+
this.setValue(newVal);
|
|
221
|
+
}
|
|
222
|
+
},
|
|
178
223
|
|
|
179
224
|
/**
|
|
180
225
|
* Returns an Observable which synchronously emits the current value (unless
|
|
@@ -192,24 +237,72 @@ export function createSharedReference<T>(initialValue : T) : ISharedReference<T>
|
|
|
192
237
|
obs.complete();
|
|
193
238
|
return undefined;
|
|
194
239
|
}
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
240
|
+
const cbObj = { trigger: obs.next.bind(obs),
|
|
241
|
+
complete: obs.complete.bind(obs),
|
|
242
|
+
hasBeenCleared: false };
|
|
243
|
+
cbs.push(cbObj);
|
|
198
244
|
return () => {
|
|
199
245
|
/**
|
|
200
246
|
* Code in here can still be running while this is happening.
|
|
201
|
-
* Set `
|
|
247
|
+
* Set `hasBeenCleared` to `true` to avoid still using the
|
|
202
248
|
* `subscriber` from this object.
|
|
203
249
|
*/
|
|
204
|
-
|
|
205
|
-
const indexOf =
|
|
250
|
+
cbObj.hasBeenCleared = true;
|
|
251
|
+
const indexOf = cbs.indexOf(cbObj);
|
|
206
252
|
if (indexOf >= 0) {
|
|
207
|
-
|
|
253
|
+
cbs.splice(indexOf, 1);
|
|
208
254
|
}
|
|
209
255
|
};
|
|
210
256
|
});
|
|
211
257
|
},
|
|
212
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Allows to register a callback to be called each time the value inside the
|
|
261
|
+
* reference is updated.
|
|
262
|
+
* @param {Function} cb - Callback to be called each time the reference is
|
|
263
|
+
* updated. Takes the new value im argument.
|
|
264
|
+
* @param {Object} [options]
|
|
265
|
+
* @param {Object} [options.clearSignal] - Allows to provide a
|
|
266
|
+
* CancellationSignal which will unregister the callback when it emits.
|
|
267
|
+
* @param {boolean} [options.emitCurrentValue] - If `true`, the callback will
|
|
268
|
+
* also be immediately called with the current value.
|
|
269
|
+
*/
|
|
270
|
+
onUpdate(
|
|
271
|
+
cb : (val : T) => void,
|
|
272
|
+
options? : {
|
|
273
|
+
clearSignal?: CancellationSignal;
|
|
274
|
+
emitCurrentValue?: boolean;
|
|
275
|
+
}
|
|
276
|
+
) : void {
|
|
277
|
+
if (options?.emitCurrentValue === true) {
|
|
278
|
+
cb(value);
|
|
279
|
+
}
|
|
280
|
+
if (isFinished) {
|
|
281
|
+
return ;
|
|
282
|
+
}
|
|
283
|
+
const cbObj = { trigger: cb,
|
|
284
|
+
complete: unlisten,
|
|
285
|
+
hasBeenCleared: false };
|
|
286
|
+
cbs.push(cbObj);
|
|
287
|
+
if (options?.clearSignal === undefined) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
options.clearSignal.register(unlisten);
|
|
291
|
+
|
|
292
|
+
function unlisten() : void {
|
|
293
|
+
/**
|
|
294
|
+
* Code in here can still be running while this is happening.
|
|
295
|
+
* Set `hasBeenCleared` to `true` to avoid still using the
|
|
296
|
+
* `subscriber` from this object.
|
|
297
|
+
*/
|
|
298
|
+
cbObj.hasBeenCleared = true;
|
|
299
|
+
const indexOf = cbs.indexOf(cbObj);
|
|
300
|
+
if (indexOf >= 0) {
|
|
301
|
+
cbs.splice(indexOf, 1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
|
|
213
306
|
/**
|
|
214
307
|
* Indicate that no new values will be emitted.
|
|
215
308
|
* Allows to automatically close all Observables generated from this shared
|
|
@@ -217,11 +310,11 @@ export function createSharedReference<T>(initialValue : T) : ISharedReference<T>
|
|
|
217
310
|
*/
|
|
218
311
|
finish() : void {
|
|
219
312
|
isFinished = true;
|
|
220
|
-
const
|
|
221
|
-
for (const
|
|
313
|
+
const clonedCbs = cbs.slice();
|
|
314
|
+
for (const cbObj of clonedCbs) {
|
|
222
315
|
try {
|
|
223
|
-
if (!
|
|
224
|
-
|
|
316
|
+
if (!cbObj.hasBeenCleared) {
|
|
317
|
+
cbObj.complete();
|
|
225
318
|
}
|
|
226
319
|
} catch (_) {
|
|
227
320
|
/* nothing */
|
|
@@ -96,7 +96,6 @@ export interface IFetchOptions {
|
|
|
96
96
|
timeout? : number | undefined;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const { DEFAULT_REQUEST_TIMEOUT } = config;
|
|
100
99
|
|
|
101
100
|
type IHeadersConstructor = new() => Headers;
|
|
102
101
|
type IAbortControllerConstructor = new() => AbortController;
|
|
@@ -147,7 +146,7 @@ export default function fetchRequest(
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const requestTimeout = isNullOrUndefined(options.timeout) ?
|
|
150
|
-
DEFAULT_REQUEST_TIMEOUT :
|
|
149
|
+
config.getCurrent().DEFAULT_REQUEST_TIMEOUT :
|
|
151
150
|
options.timeout;
|
|
152
151
|
const timeout = window.setTimeout(() => {
|
|
153
152
|
timeouted = true;
|
package/src/utils/request/xhr.ts
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
CancellationSignal,
|
|
25
25
|
} from "../task_canceller";
|
|
26
26
|
|
|
27
|
-
const { DEFAULT_REQUEST_TIMEOUT } = config;
|
|
28
27
|
|
|
29
28
|
const DEFAULT_RESPONSE_TYPE : XMLHttpRequestResponseType = "json";
|
|
30
29
|
|
|
@@ -130,6 +129,8 @@ export default function request(
|
|
|
130
129
|
export default function request<T>(
|
|
131
130
|
options : IRequestOptions< XMLHttpRequestResponseType | null | undefined >
|
|
132
131
|
) : Promise<IRequestResponse< T, XMLHttpRequestResponseType >> {
|
|
132
|
+
|
|
133
|
+
const { DEFAULT_REQUEST_TIMEOUT } = config.getCurrent();
|
|
133
134
|
const requestOptions = {
|
|
134
135
|
url: options.url,
|
|
135
136
|
headers: options.headers,
|
|
@@ -44,23 +44,28 @@ export default function fromCancellablePromise<T>(
|
|
|
44
44
|
) : Observable<T> {
|
|
45
45
|
return new Observable((obs) => {
|
|
46
46
|
let isUnsubscribedFrom = false;
|
|
47
|
+
let isComplete = false;
|
|
47
48
|
fn().then(
|
|
48
49
|
(i) => {
|
|
49
50
|
if (isUnsubscribedFrom) {
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
53
|
+
isComplete = true;
|
|
52
54
|
obs.next(i);
|
|
53
55
|
obs.complete();
|
|
54
56
|
},
|
|
55
57
|
(err) => {
|
|
58
|
+
isComplete = true;
|
|
56
59
|
if (isUnsubscribedFrom) {
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
62
|
obs.error(err);
|
|
60
63
|
});
|
|
61
64
|
return () => {
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (!isComplete) {
|
|
66
|
+
isUnsubscribedFrom = true;
|
|
67
|
+
canceller.cancel();
|
|
68
|
+
}
|
|
64
69
|
};
|
|
65
70
|
});
|
|
66
71
|
}
|
|
@@ -153,14 +153,14 @@ export default class TaskCanceller {
|
|
|
153
153
|
* An optional CancellationError can be given in argument for when this
|
|
154
154
|
* cancellation is actually triggered as a chain reaction from a previous
|
|
155
155
|
* cancellation.
|
|
156
|
-
* @param {Error} [
|
|
156
|
+
* @param {Error} [srcError]
|
|
157
157
|
*/
|
|
158
|
-
public cancel(
|
|
158
|
+
public cancel(srcError? : CancellationError) : void {
|
|
159
159
|
if (this.isUsed) {
|
|
160
160
|
return ;
|
|
161
161
|
}
|
|
162
162
|
this.isUsed = true;
|
|
163
|
-
const cancellationError =
|
|
163
|
+
const cancellationError = srcError ?? new CancellationError();
|
|
164
164
|
this._trigger(cancellationError);
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -188,7 +188,9 @@ export class CancellationSignal {
|
|
|
188
188
|
*/
|
|
189
189
|
public isCancelled : boolean;
|
|
190
190
|
/**
|
|
191
|
-
* Error associated to the cancellation
|
|
191
|
+
* Error associated to the cancellation, only set if the `CancellationSignal`
|
|
192
|
+
* has been used (which means that the task has been cancelled).
|
|
193
|
+
*
|
|
192
194
|
* Can be used to notify to a caller that this task was aborted (for example
|
|
193
195
|
* by rejecting it through the Promise associated to that task).
|
|
194
196
|
*
|
|
@@ -1,57 +0,0 @@
|
|
|
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 { defer as observableDefer, mergeMap, tap, of as observableOf, } from "rxjs";
|
|
17
|
-
import { setMediaKeys, } from "../../compat";
|
|
18
|
-
import log from "../../log";
|
|
19
|
-
import MediaKeysInfosStore from "./media_keys_infos_store";
|
|
20
|
-
/**
|
|
21
|
-
* Dispose the media keys on media element.
|
|
22
|
-
* @param {Object} mediaElement
|
|
23
|
-
* @returns {Observable}
|
|
24
|
-
*/
|
|
25
|
-
export function disableMediaKeys(mediaElement) {
|
|
26
|
-
return observableDefer(function () {
|
|
27
|
-
MediaKeysInfosStore.setState(mediaElement, null);
|
|
28
|
-
return setMediaKeys(mediaElement, null);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Attach MediaKeys and its associated state to an HTMLMediaElement.
|
|
33
|
-
*
|
|
34
|
-
* /!\ Mutates heavily MediaKeysInfosStore
|
|
35
|
-
* @param {Object} mediaKeysInfos
|
|
36
|
-
* @param {HTMLMediaElement} mediaElement
|
|
37
|
-
* @returns {Observable}
|
|
38
|
-
*/
|
|
39
|
-
export default function attachMediaKeys(mediaElement, _a) {
|
|
40
|
-
var keySystemOptions = _a.keySystemOptions, loadedSessionsStore = _a.loadedSessionsStore, mediaKeySystemAccess = _a.mediaKeySystemAccess, mediaKeys = _a.mediaKeys;
|
|
41
|
-
return observableDefer(function () {
|
|
42
|
-
var previousState = MediaKeysInfosStore.getState(mediaElement);
|
|
43
|
-
var closeAllSessions$ = previousState !== null &&
|
|
44
|
-
previousState.loadedSessionsStore !== loadedSessionsStore ?
|
|
45
|
-
previousState.loadedSessionsStore.closeAllSessions() :
|
|
46
|
-
observableOf(null);
|
|
47
|
-
return closeAllSessions$.pipe(mergeMap(function () {
|
|
48
|
-
MediaKeysInfosStore.setState(mediaElement, { keySystemOptions: keySystemOptions, mediaKeySystemAccess: mediaKeySystemAccess, mediaKeys: mediaKeys, loadedSessionsStore: loadedSessionsStore });
|
|
49
|
-
if (mediaElement.mediaKeys === mediaKeys) {
|
|
50
|
-
return observableOf(null);
|
|
51
|
-
}
|
|
52
|
-
log.info("EME: Attaching MediaKeys to the media element");
|
|
53
|
-
return setMediaKeys(mediaElement, mediaKeys)
|
|
54
|
-
.pipe(tap(function () { log.info("EME: MediaKeys attached with success"); }));
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
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 { Observable } from "rxjs";
|
|
17
|
-
import { ICustomMediaKeySession } from "../../compat";
|
|
18
|
-
import { IInitializationDataInfo } from "./types";
|
|
19
|
-
import LoadedSessionsStore from "./utils/loaded_sessions_store";
|
|
20
|
-
/**
|
|
21
|
-
* Event emitted when an old MediaKeySession has been closed to respect the
|
|
22
|
-
* maximum limit of concurrent MediaKeySession active.
|
|
23
|
-
*/
|
|
24
|
-
export interface ICleanedOldSessionEvent {
|
|
25
|
-
type: "cleaned-old-session";
|
|
26
|
-
value: {
|
|
27
|
-
/** The MediaKeySession cleaned. */
|
|
28
|
-
mediaKeySession: MediaKeySession | ICustomMediaKeySession;
|
|
29
|
-
/** The type of MediaKeySession (e.g. "temporary"). */
|
|
30
|
-
sessionType: MediaKeySessionType;
|
|
31
|
-
/** Initialization data assiociated to this MediaKeySession. */
|
|
32
|
-
initializationData: IInitializationDataInfo;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Event emitted when we are beginning to close an old MediaKeySession to
|
|
37
|
-
* respect the maximum limit of concurrent MediaKeySession active.
|
|
38
|
-
*/
|
|
39
|
-
export interface ICleaningOldSessionEvent {
|
|
40
|
-
type: "cleaning-old-session";
|
|
41
|
-
value: {
|
|
42
|
-
/** The MediaKeySession that we are currently cleaning. */
|
|
43
|
-
mediaKeySession: MediaKeySession | ICustomMediaKeySession;
|
|
44
|
-
/** The type of MediaKeySession (e.g. "temporary"). */
|
|
45
|
-
sessionType: MediaKeySessionType;
|
|
46
|
-
/** Initialization data assiociated to this MediaKeySession. */
|
|
47
|
-
initializationData: IInitializationDataInfo;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Close sessions from the loadedSessionsStore to allow at maximum `limit`
|
|
52
|
-
* stored MediaKeySessions in it.
|
|
53
|
-
*
|
|
54
|
-
* Emit event when a MediaKeySession begin to be closed and another when the
|
|
55
|
-
* MediaKeySession is closed.
|
|
56
|
-
* @param {Object} loadedSessionsStore
|
|
57
|
-
* @returns {Observable}
|
|
58
|
-
*/
|
|
59
|
-
export default function cleanOldLoadedSessions(loadedSessionsStore: LoadedSessionsStore, limit: number): Observable<ICleaningOldSessionEvent | ICleanedOldSessionEvent>;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { defer as observableDefer, EMPTY, ignoreElements, } from "rxjs";
|
|
17
|
-
import { shouldUnsetMediaKeys } from "../../compat/";
|
|
18
|
-
import log from "../../log";
|
|
19
|
-
import disposeMediaKeys from "./dispose_media_keys";
|
|
20
|
-
import MediaKeysInfosStore from "./media_keys_infos_store";
|
|
21
|
-
/**
|
|
22
|
-
* Clear EME ressources that should be cleared when the current content stops
|
|
23
|
-
* its playback.
|
|
24
|
-
* @param {HTMLMediaElement} mediaElement
|
|
25
|
-
* @returns {Observable}
|
|
26
|
-
*/
|
|
27
|
-
export default function clearEMESession(mediaElement) {
|
|
28
|
-
return observableDefer(function () {
|
|
29
|
-
log.info("EME: Clearing-up EME session.");
|
|
30
|
-
if (shouldUnsetMediaKeys()) {
|
|
31
|
-
log.info("EME: disposing current MediaKeys.");
|
|
32
|
-
return disposeMediaKeys(mediaElement)
|
|
33
|
-
.pipe(ignoreElements());
|
|
34
|
-
}
|
|
35
|
-
var currentState = MediaKeysInfosStore.getState(mediaElement);
|
|
36
|
-
if (currentState !== null &&
|
|
37
|
-
currentState.keySystemOptions.closeSessionsOnStop === true) {
|
|
38
|
-
log.info("EME: closing all current sessions.");
|
|
39
|
-
return currentState.loadedSessionsStore.closeAllSessions()
|
|
40
|
-
// NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
|
|
41
|
-
// first type parameter as `any` instead of the perfectly fine `unknown`,
|
|
42
|
-
// leading to linter issues, as it forbids the usage of `any`.
|
|
43
|
-
// This is why we're disabling the eslint rule.
|
|
44
|
-
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
45
|
-
.pipe(ignoreElements());
|
|
46
|
-
}
|
|
47
|
-
log.info("EME: Nothing to clear. Returning right away. No state =", currentState === null);
|
|
48
|
-
return EMPTY;
|
|
49
|
-
});
|
|
50
|
-
}
|