rx-player 3.26.2 → 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/.github/workflows/perfs.yml +22 -0
- package/CHANGELOG.md +33 -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 +27 -24
- 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/buffer_based_chooser.d.ts +28 -6
- package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
- package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
- package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
- package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
- package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
- package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
- 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.d.ts +6 -0
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +22 -4
- 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/api/track_choice_manager.d.ts +6 -6
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -51
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +30 -75
- 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 +120 -242
- 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.d.ts +4 -4
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +3 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +6 -2
- 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 +1 -1
- package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +3 -3
- package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +5 -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.d.ts +4 -4
- 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/are_same_stream_events.d.ts +4 -4
- package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
- package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
- 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.d.ts +3 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
- 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 +5 -6
- 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/errors/request_error.js +3 -1
- 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.d.ts +2 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +2 -4
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.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/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
- 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/adaptation.d.ts +2 -2
- package/dist/_esm5.processed/manifest/adaptation.js +3 -1
- package/dist/_esm5.processed/manifest/manifest.d.ts +10 -23
- package/dist/_esm5.processed/manifest/manifest.js +10 -74
- package/dist/_esm5.processed/manifest/period.d.ts +3 -3
- package/dist/_esm5.processed/manifest/representation.d.ts +37 -5
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
- package/dist/_esm5.processed/manifest/types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +20 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +109 -96
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
- package/dist/_esm5.processed/public_types.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +4 -1
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
- package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
- package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
- package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
- 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/manifest_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
- package/dist/_esm5.processed/transports/smooth/pipelines.js +69 -11
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/types.d.ts +58 -30
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
- package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
- package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
- package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
- 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.d.ts +4 -5
- package/dist/_esm5.processed/utils/request/fetch.js +8 -6
- package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
- package/dist/_esm5.processed/utils/request/xhr.js +3 -2
- package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
- 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 +5242 -3190
- 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 +33 -36
- package/scripts/build/templates/experimental/index.d.ts +16 -0
- package/scripts/build/templates/experimental/index.js +16 -0
- package/scripts/doc-generator/generate_header_html.js +6 -7
- package/scripts/doc-generator/generate_page_html.js +3 -4
- package/scripts/doc-generator/generate_page_list_html.js +4 -5
- package/scripts/doc-generator/generate_sidebar_html.js +4 -7
- package/scripts/doc-generator/utils.js +0 -11
- package/scripts/generate_demo_list.js +3 -3
- package/scripts/generate_documentation_list.js +3 -3
- package/scripts/launch_static_server.js +127 -67
- package/scripts/run_standalone_demo.js +1 -0
- package/scripts/start_demo_web_server.js +1 -0
- package/sonar-project.properties +1 -1
- package/src/README.md +6 -6
- package/src/compat/__tests__/fullscreen.test.ts +7 -7
- package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
- 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/ie11_media_keys.ts +1 -1
- package/src/compat/eme/custom_media_keys/index.ts +28 -41
- 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/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
- package/src/core/abr/bandwidth_estimator.ts +4 -4
- package/src/core/abr/buffer_based_chooser.ts +85 -20
- package/src/core/abr/network_analyzer.ts +6 -7
- package/src/core/abr/pending_requests_store.ts +3 -5
- package/src/core/abr/representation_estimator.ts +6 -3
- 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/media_element_track_choice_manager.ts +22 -3
- 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 +152 -112
- package/src/core/api/track_choice_manager.ts +10 -9
- 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 +36 -103
- 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 +126 -134
- 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 +129 -259
- 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 +9 -9
- package/src/core/fetchers/segment/segment_fetcher.ts +10 -7
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
- package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
- 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 +19 -22
- package/src/core/init/initialize_media_source.ts +43 -106
- package/src/core/init/link_drm_and_content.ts +176 -0
- package/src/core/init/manifest_update_scheduler.ts +12 -10
- package/src/core/init/stall_avoider.ts +6 -5
- package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
- package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
- package/src/core/init/stream_events_emitter/types.ts +2 -2
- 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 +6 -7
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -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 +5 -7
- 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/errors/request_error.ts +4 -1
- 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 +5 -7
- 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/api/index.ts +1 -1
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
- 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/adaptation.ts +6 -4
- package/src/manifest/manifest.ts +16 -86
- package/src/manifest/period.ts +3 -3
- package/src/manifest/representation.ts +38 -5
- package/src/manifest/representation_index/types.ts +18 -18
- package/src/manifest/types.ts +3 -3
- package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
- package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
- package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
- package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
- package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
- package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
- package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
- package/src/parsers/manifest/dash/common/indexes/template.ts +18 -18
- package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +51 -23
- package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +167 -134
- package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -10
- package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
- package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
- package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
- package/src/parsers/manifest/dash/parsers_types.ts +3 -3
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
- package/src/parsers/manifest/smooth/create_parser.ts +24 -21
- package/src/parsers/manifest/smooth/representation_index.ts +14 -14
- package/src/parsers/manifest/types.ts +28 -28
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
- package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
- package/src/parsers/manifest/utils/index_helpers.ts +2 -2
- package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
- package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
- package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
- package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
- package/src/public_types.ts +5 -1
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
- package/src/transports/dash/image_pipelines.ts +4 -1
- package/src/transports/dash/init_segment_loader.ts +1 -1
- package/src/transports/dash/manifest_parser.ts +1 -1
- package/src/transports/dash/segment_loader.ts +7 -7
- package/src/transports/dash/segment_parser.ts +8 -1
- package/src/transports/dash/text_loader.ts +2 -2
- package/src/transports/dash/text_parser.ts +11 -1
- package/src/transports/local/segment_loader.ts +4 -4
- package/src/transports/local/segment_parser.ts +4 -0
- package/src/transports/local/text_parser.ts +8 -0
- package/src/transports/metaplaylist/manifest_loader.ts +1 -1
- package/src/transports/metaplaylist/pipelines.ts +1 -1
- package/src/transports/smooth/pipelines.ts +29 -16
- package/src/transports/smooth/segment_loader.ts +8 -8
- package/src/transports/types.ts +59 -30
- package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
- package/src/transports/utils/generate_manifest_loader.ts +1 -1
- package/src/utils/__tests__/deep_merge.test.ts +48 -0
- package/src/utils/__tests__/flat_map.test.ts +12 -7
- package/src/utils/cancellable_sleep.ts +1 -1
- package/src/utils/cast_to_observable.ts +1 -2
- package/src/utils/deep_merge.ts +46 -0
- package/src/utils/reference.ts +116 -23
- package/src/utils/request/fetch.ts +17 -15
- package/src/utils/request/xhr.ts +11 -8
- package/src/utils/rx-from_cancellable_promise.ts +8 -4
- package/src/utils/task_canceller.ts +6 -4
- package/tsconfig.json +1 -2
- package/tsconfig.modules.json +1 -2
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
- 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 -243
- 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/abr/get_estimate_from_buffer_levels.ts +0 -85
- 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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import log from "
|
|
16
|
+
import log from "../../../log";
|
|
17
17
|
/**
|
|
18
18
|
* Remove old information from a PersistentSessionsStore so that it respects the
|
|
19
19
|
* given `limit` as a maximum size. This can be used to prevent its size from
|
|
@@ -35,6 +35,6 @@ export default function cleanOldStoredPersistentInfo(persistentSessionsStore, li
|
|
|
35
35
|
}
|
|
36
36
|
var numberOfPersistentSessions = persistentSessionsStore.getLength();
|
|
37
37
|
var toDelete = numberOfPersistentSessions - limit;
|
|
38
|
-
log.info("
|
|
38
|
+
log.info("DRM: Too many stored persistent sessions, removing some.", numberOfPersistentSessions, toDelete);
|
|
39
39
|
persistentSessionsStore.deleteOldSessions(toDelete);
|
|
40
40
|
}
|
|
File without changes
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import startsWith from "
|
|
16
|
+
import startsWith from "../../../utils/starts_with";
|
|
17
17
|
/**
|
|
18
18
|
* @param {string} keySystem
|
|
19
19
|
* @returns {string|undefined}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 { IInitDataValue } from "../types";
|
|
17
|
+
/**
|
|
18
|
+
* Wrap initialization data values and reformat it so it becomes easier to check
|
|
19
|
+
* compatibility with other `InitDataValuesContainer`.
|
|
20
|
+
* @class InitDataValuesContainer
|
|
21
|
+
*/
|
|
22
|
+
export default class InitDataValuesContainer {
|
|
23
|
+
private readonly _innerValues;
|
|
24
|
+
private _lazyFormattedValues;
|
|
25
|
+
/**
|
|
26
|
+
* Construct a new `InitDataValuesContainer`.
|
|
27
|
+
* Note that the data is not formatted right away.
|
|
28
|
+
* It is only really formatted lazily the first time we need it.
|
|
29
|
+
*
|
|
30
|
+
* @param {Array.<Object>} initDataValues
|
|
31
|
+
*/
|
|
32
|
+
constructor(initDataValues: IInitDataValue[]);
|
|
33
|
+
/**
|
|
34
|
+
* Construct data that should be given to the `generateRequest` EME API.
|
|
35
|
+
* @returns {Uint8Array}
|
|
36
|
+
*/
|
|
37
|
+
constructRequestData(): Uint8Array;
|
|
38
|
+
/**
|
|
39
|
+
* Returns `true` if the given `InitDataValuesContainer` seems to be
|
|
40
|
+
* "compatible" with the one stored in this instance.
|
|
41
|
+
* Returns `false` if not.
|
|
42
|
+
*
|
|
43
|
+
* By "compatible" we mean that it will generate the same key request.
|
|
44
|
+
* @param {InitDataValuesContainer | Object} initDataValues
|
|
45
|
+
* @returns {boolean}
|
|
46
|
+
*/
|
|
47
|
+
isCompatibleWith(initDataValues: InitDataValuesContainer | IFormattedInitDataValue[]): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Return the stored initialization data values, with added niceties:
|
|
50
|
+
* - they are sorted always the same way for similar
|
|
51
|
+
* `InitDataValuesContainer`
|
|
52
|
+
* - each value is associated to its hash, which is always done with the
|
|
53
|
+
* same hashing function than for all other InitDataValuesContainer).
|
|
54
|
+
*
|
|
55
|
+
* The main point being to be able to compare much faster multiple
|
|
56
|
+
* `InitDataValuesContainer`, though that data can also be used in any
|
|
57
|
+
* other way.
|
|
58
|
+
* @returns {Array.<Object>}
|
|
59
|
+
*/
|
|
60
|
+
getFormattedValues(): IFormattedInitDataValue[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Formatted initialization data value, so it is faster to compare to others.
|
|
64
|
+
*/
|
|
65
|
+
export interface IFormattedInitDataValue {
|
|
66
|
+
systemId: string | undefined;
|
|
67
|
+
hash: number;
|
|
68
|
+
data: Uint8Array;
|
|
69
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { concat } from "../../../utils/byte_parsing";
|
|
17
|
+
import hashBuffer from "../../../utils/hash_buffer";
|
|
18
|
+
import areInitializationValuesCompatible from "./are_init_values_compatible";
|
|
19
|
+
/**
|
|
20
|
+
* Wrap initialization data values and reformat it so it becomes easier to check
|
|
21
|
+
* compatibility with other `InitDataValuesContainer`.
|
|
22
|
+
* @class InitDataValuesContainer
|
|
23
|
+
*/
|
|
24
|
+
var InitDataValuesContainer = /** @class */ (function () {
|
|
25
|
+
/**
|
|
26
|
+
* Construct a new `InitDataValuesContainer`.
|
|
27
|
+
* Note that the data is not formatted right away.
|
|
28
|
+
* It is only really formatted lazily the first time we need it.
|
|
29
|
+
*
|
|
30
|
+
* @param {Array.<Object>} initDataValues
|
|
31
|
+
*/
|
|
32
|
+
function InitDataValuesContainer(initDataValues) {
|
|
33
|
+
this._innerValues = initDataValues;
|
|
34
|
+
this._lazyFormattedValues = null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Construct data that should be given to the `generateRequest` EME API.
|
|
38
|
+
* @returns {Uint8Array}
|
|
39
|
+
*/
|
|
40
|
+
InitDataValuesContainer.prototype.constructRequestData = function () {
|
|
41
|
+
// `generateKeyRequest` awaits a single Uint8Array containing all
|
|
42
|
+
// initialization data.
|
|
43
|
+
return concat.apply(void 0, this._innerValues.map(function (i) { return i.data; }));
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Returns `true` if the given `InitDataValuesContainer` seems to be
|
|
47
|
+
* "compatible" with the one stored in this instance.
|
|
48
|
+
* Returns `false` if not.
|
|
49
|
+
*
|
|
50
|
+
* By "compatible" we mean that it will generate the same key request.
|
|
51
|
+
* @param {InitDataValuesContainer | Object} initDataValues
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
InitDataValuesContainer.prototype.isCompatibleWith = function (initDataValues) {
|
|
55
|
+
var formatted = initDataValues instanceof InitDataValuesContainer ?
|
|
56
|
+
initDataValues.getFormattedValues() :
|
|
57
|
+
initDataValues;
|
|
58
|
+
return areInitializationValuesCompatible(this.getFormattedValues(), formatted);
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Return the stored initialization data values, with added niceties:
|
|
62
|
+
* - they are sorted always the same way for similar
|
|
63
|
+
* `InitDataValuesContainer`
|
|
64
|
+
* - each value is associated to its hash, which is always done with the
|
|
65
|
+
* same hashing function than for all other InitDataValuesContainer).
|
|
66
|
+
*
|
|
67
|
+
* The main point being to be able to compare much faster multiple
|
|
68
|
+
* `InitDataValuesContainer`, though that data can also be used in any
|
|
69
|
+
* other way.
|
|
70
|
+
* @returns {Array.<Object>}
|
|
71
|
+
*/
|
|
72
|
+
InitDataValuesContainer.prototype.getFormattedValues = function () {
|
|
73
|
+
if (this._lazyFormattedValues === null) {
|
|
74
|
+
this._lazyFormattedValues = formatInitDataValues(this._innerValues);
|
|
75
|
+
}
|
|
76
|
+
return this._lazyFormattedValues;
|
|
77
|
+
};
|
|
78
|
+
return InitDataValuesContainer;
|
|
79
|
+
}());
|
|
80
|
+
export default InitDataValuesContainer;
|
|
81
|
+
/**
|
|
82
|
+
* Format given initializationData's values so they are faster to compare:
|
|
83
|
+
* - sort them by systemId
|
|
84
|
+
* - add hash for each initialization data encountered.
|
|
85
|
+
* @param {Array.<Object>} initialValues
|
|
86
|
+
* @returns {Array.<Object>}
|
|
87
|
+
*/
|
|
88
|
+
function formatInitDataValues(initialValues) {
|
|
89
|
+
return initialValues.slice()
|
|
90
|
+
.sort(function (a, b) { return a.systemId === b.systemId ? 0 :
|
|
91
|
+
a.systemId === undefined ? 1 :
|
|
92
|
+
b.systemId === undefined ? -1 :
|
|
93
|
+
a.systemId < b.systemId ? -1 :
|
|
94
|
+
1; })
|
|
95
|
+
.map(function (_a) {
|
|
96
|
+
var systemId = _a.systemId, data = _a.data;
|
|
97
|
+
return ({ systemId: systemId, data: data, hash: hashBuffer(data) });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -18,7 +18,6 @@ import { ICustomMediaKeySession } from "../../../compat";
|
|
|
18
18
|
* If all key statuses attached to session are valid (either not
|
|
19
19
|
* "expired" or "internal-error"), return true.
|
|
20
20
|
* If not, return false.
|
|
21
|
-
* @param {Uint8Array} initData
|
|
22
21
|
* @param {MediaKeySession} loadedSession
|
|
23
22
|
* @returns {MediaKeySession}
|
|
24
23
|
*/
|
|
@@ -19,7 +19,6 @@ import arrayIncludes from "../../../utils/array_includes";
|
|
|
19
19
|
* If all key statuses attached to session are valid (either not
|
|
20
20
|
* "expired" or "internal-error"), return true.
|
|
21
21
|
* If not, return false.
|
|
22
|
-
* @param {Uint8Array} initData
|
|
23
22
|
* @param {MediaKeySession} loadedSession
|
|
24
23
|
* @returns {MediaKeySession}
|
|
25
24
|
*/
|
|
@@ -33,18 +32,18 @@ export default function isSessionUsable(loadedSession) {
|
|
|
33
32
|
keyStatuses.push(keyStatus);
|
|
34
33
|
});
|
|
35
34
|
if (keyStatuses.length <= 0) {
|
|
36
|
-
log.debug("
|
|
35
|
+
log.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses", loadedSession.sessionId);
|
|
37
36
|
return false;
|
|
38
37
|
}
|
|
39
38
|
if (arrayIncludes(keyStatuses, "expired")) {
|
|
40
|
-
log.debug("
|
|
39
|
+
log.debug("DRM: isSessionUsable: MediaKeySession given has an expired key", loadedSession.sessionId);
|
|
41
40
|
return false;
|
|
42
41
|
}
|
|
43
42
|
if (arrayIncludes(keyStatuses, "internal-error")) {
|
|
44
|
-
log.debug("
|
|
43
|
+
log.debug("DRM: isSessionUsable: MediaKeySession given has a key with an " +
|
|
45
44
|
"internal-error", loadedSession.sessionId);
|
|
46
45
|
return false;
|
|
47
46
|
}
|
|
48
|
-
log.debug("
|
|
47
|
+
log.debug("DRM: isSessionUsable: MediaKeySession is usable", loadedSession.sessionId);
|
|
49
48
|
return true;
|
|
50
49
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Returns `true` if both given key id appear to be equal.
|
|
18
|
+
* @param {Uint8Array} keyId1
|
|
19
|
+
* @param {Uint8Array} keyId2
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
export declare function areKeyIdsEqual(keyId1: Uint8Array, keyId2: Uint8Array): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Uint8Array} wantedKeyId
|
|
25
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
export declare function isKeyIdContainedIn(wantedKeyId: Uint8Array, keyIdsArr: Uint8Array[]): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Returns `true` if all key ids in `wantedKeyIds` are present in the
|
|
31
|
+
* `keyIdsArr` array.
|
|
32
|
+
* @param {Array.<Uint8Array>} wantedKeyIds
|
|
33
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export declare function areAllKeyIdsContainedIn(wantedKeyIds: Uint8Array[], keyIdsArr: Uint8Array[]): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns `true` if at least one key id in `wantedKeyIds` is present in the
|
|
39
|
+
* `keyIdsArr` array.
|
|
40
|
+
* @param {Array.<Uint8Array>} wantedKeyIds
|
|
41
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
export declare function areSomeKeyIdsContainedIn(wantedKeyIds: Uint8Array[], keyIdsArr: Uint8Array[]): boolean;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 areArraysOfNumbersEqual from "../../../utils/are_arrays_of_numbers_equal";
|
|
17
|
+
/**
|
|
18
|
+
* Returns `true` if both given key id appear to be equal.
|
|
19
|
+
* @param {Uint8Array} keyId1
|
|
20
|
+
* @param {Uint8Array} keyId2
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
export function areKeyIdsEqual(keyId1, keyId2) {
|
|
24
|
+
return keyId1 === keyId2 || areArraysOfNumbersEqual(keyId1, keyId2);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @param {Uint8Array} wantedKeyId
|
|
28
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
export function isKeyIdContainedIn(wantedKeyId, keyIdsArr) {
|
|
32
|
+
return keyIdsArr.some(function (k) { return areKeyIdsEqual(k, wantedKeyId); });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns `true` if all key ids in `wantedKeyIds` are present in the
|
|
36
|
+
* `keyIdsArr` array.
|
|
37
|
+
* @param {Array.<Uint8Array>} wantedKeyIds
|
|
38
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export function areAllKeyIdsContainedIn(wantedKeyIds, keyIdsArr) {
|
|
42
|
+
var _loop_1 = function (keyId) {
|
|
43
|
+
var found = keyIdsArr.some(function (k) { return areKeyIdsEqual(k, keyId); });
|
|
44
|
+
if (!found) {
|
|
45
|
+
return { value: false };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
for (var _i = 0, wantedKeyIds_1 = wantedKeyIds; _i < wantedKeyIds_1.length; _i++) {
|
|
49
|
+
var keyId = wantedKeyIds_1[_i];
|
|
50
|
+
var state_1 = _loop_1(keyId);
|
|
51
|
+
if (typeof state_1 === "object")
|
|
52
|
+
return state_1.value;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns `true` if at least one key id in `wantedKeyIds` is present in the
|
|
58
|
+
* `keyIdsArr` array.
|
|
59
|
+
* @param {Array.<Uint8Array>} wantedKeyIds
|
|
60
|
+
* @param {Array.<Uint8Array>} keyIdsArr
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
export function areSomeKeyIdsContainedIn(wantedKeyIds, keyIdsArr) {
|
|
64
|
+
var _loop_2 = function (keyId) {
|
|
65
|
+
var found = keyIdsArr.some(function (k) { return areKeyIdsEqual(k, keyId); });
|
|
66
|
+
if (found) {
|
|
67
|
+
return { value: true };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
for (var _i = 0, wantedKeyIds_2 = wantedKeyIds; _i < wantedKeyIds_2.length; _i++) {
|
|
71
|
+
var keyId = wantedKeyIds_2[_i];
|
|
72
|
+
var state_2 = _loop_2(keyId);
|
|
73
|
+
if (typeof state_2 === "object")
|
|
74
|
+
return state_2.value;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { IProcessedProtectionData } from "../types";
|
|
17
|
+
/**
|
|
18
|
+
* Class storing key-related information linked to a created `MediaKeySession`.
|
|
19
|
+
*
|
|
20
|
+
* This class allows to regroup one or multiple key ids and can be linked to a
|
|
21
|
+
* single MediaKeySession so you can know which key that MediaKeySession
|
|
22
|
+
* handles.
|
|
23
|
+
*
|
|
24
|
+
* The main use case behind the complexities of this `KeySessionRecord` is to
|
|
25
|
+
* better handle the `singleLicensePer` RxPlayer option, which allows the
|
|
26
|
+
* recuperation of a license containing multiple keys, even if only one of
|
|
27
|
+
* those keys was asked for (which in turn allows to reduce the number of
|
|
28
|
+
* requests and to improve performance).
|
|
29
|
+
* Here, the `KeySessionRecord` will regroup all those key's id and can be
|
|
30
|
+
* linked to the corresponding MediaKeySession.
|
|
31
|
+
* That way, you can later check if another encrypted content is compatible with
|
|
32
|
+
* that session through the `KeySessionRecord`'s `isCompatibleWith` method.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```js
|
|
36
|
+
* const record = new KeySessionRecord(initData);
|
|
37
|
+
*
|
|
38
|
+
* // Create a MediaKeySession linked to that initialization data and fetch the
|
|
39
|
+
* // license
|
|
40
|
+
* // ...
|
|
41
|
+
*
|
|
42
|
+
* // Once the license has been loaded to the MediaKeySession linked to that
|
|
43
|
+
- // initialization data, associate the license's key Ids with the latter.
|
|
44
|
+
* record.associateKeyIds(someKeyIds);
|
|
45
|
+
*
|
|
46
|
+
* // Function called when new initialization data is encountered
|
|
47
|
+
* function onNewInitializationData(newInitializationData) {
|
|
48
|
+
* if (record.isCompatibleWith(newInitializationData)) {
|
|
49
|
+
* console.log("This initialization data should already be handled, ignored.");
|
|
50
|
+
* } else {
|
|
51
|
+
* console.log("This initialization data is not handled yet.";
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
* @class KeySessionRecord
|
|
56
|
+
*/
|
|
57
|
+
export default class KeySessionRecord {
|
|
58
|
+
private readonly _initializationData;
|
|
59
|
+
private _keyIds;
|
|
60
|
+
/**
|
|
61
|
+
* Create a new `KeySessionRecord`, linked to its corresponding initialization
|
|
62
|
+
* data,
|
|
63
|
+
* @param {Object} initializationData
|
|
64
|
+
*/
|
|
65
|
+
constructor(initializationData: IProcessedProtectionData);
|
|
66
|
+
/**
|
|
67
|
+
* Associate supplementary key ids to this `KeySessionRecord` so it becomes
|
|
68
|
+
* "compatible" to them.
|
|
69
|
+
*
|
|
70
|
+
* After this call, new initialization data linked to subsets of those key
|
|
71
|
+
* ids will be considered compatible to this `KeySessionRecord` (calls to
|
|
72
|
+
* `isCompatibleWith` with the corresponding initialization data will return
|
|
73
|
+
* `true`).
|
|
74
|
+
* @param {Array.<Uint8Array>} keyIds
|
|
75
|
+
*/
|
|
76
|
+
associateKeyIds(keyIds: Uint8Array[] | IterableIterator<Uint8Array>): void;
|
|
77
|
+
/**
|
|
78
|
+
* @param {Uint8Array} keyId
|
|
79
|
+
* @returns {boolean}
|
|
80
|
+
*/
|
|
81
|
+
isAssociatedWithKeyId(keyId: Uint8Array): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @returns {Array.<Uint8Array>}
|
|
84
|
+
*/
|
|
85
|
+
getAssociatedKeyIds(): Uint8Array[];
|
|
86
|
+
/**
|
|
87
|
+
* Check if that `KeySessionRecord` is compatible to the initialization data
|
|
88
|
+
* given.
|
|
89
|
+
*
|
|
90
|
+
* If it returns `true`, it means that this `KeySessionRecord` is already
|
|
91
|
+
* linked to that initialization data's key. As such, if that
|
|
92
|
+
* `KeySessionRecord` is already associated to an active MediaKeySession for
|
|
93
|
+
* example, the content linked to that initialization data should already be
|
|
94
|
+
* handled.
|
|
95
|
+
*
|
|
96
|
+
* If it returns `false`, it means that this `KeySessionRecord` has no
|
|
97
|
+
* relation with the given initialization data.
|
|
98
|
+
*
|
|
99
|
+
* @param {Object} initializationData
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
*/
|
|
102
|
+
isCompatibleWith(initializationData: IProcessedProtectionData): boolean;
|
|
103
|
+
private _checkInitializationDataCompatibility;
|
|
104
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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 { areKeyIdsEqual, areAllKeyIdsContainedIn, } from "./key_id_comparison";
|
|
17
|
+
/**
|
|
18
|
+
* Class storing key-related information linked to a created `MediaKeySession`.
|
|
19
|
+
*
|
|
20
|
+
* This class allows to regroup one or multiple key ids and can be linked to a
|
|
21
|
+
* single MediaKeySession so you can know which key that MediaKeySession
|
|
22
|
+
* handles.
|
|
23
|
+
*
|
|
24
|
+
* The main use case behind the complexities of this `KeySessionRecord` is to
|
|
25
|
+
* better handle the `singleLicensePer` RxPlayer option, which allows the
|
|
26
|
+
* recuperation of a license containing multiple keys, even if only one of
|
|
27
|
+
* those keys was asked for (which in turn allows to reduce the number of
|
|
28
|
+
* requests and to improve performance).
|
|
29
|
+
* Here, the `KeySessionRecord` will regroup all those key's id and can be
|
|
30
|
+
* linked to the corresponding MediaKeySession.
|
|
31
|
+
* That way, you can later check if another encrypted content is compatible with
|
|
32
|
+
* that session through the `KeySessionRecord`'s `isCompatibleWith` method.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```js
|
|
36
|
+
* const record = new KeySessionRecord(initData);
|
|
37
|
+
*
|
|
38
|
+
* // Create a MediaKeySession linked to that initialization data and fetch the
|
|
39
|
+
* // license
|
|
40
|
+
* // ...
|
|
41
|
+
*
|
|
42
|
+
* // Once the license has been loaded to the MediaKeySession linked to that
|
|
43
|
+
- // initialization data, associate the license's key Ids with the latter.
|
|
44
|
+
* record.associateKeyIds(someKeyIds);
|
|
45
|
+
*
|
|
46
|
+
* // Function called when new initialization data is encountered
|
|
47
|
+
* function onNewInitializationData(newInitializationData) {
|
|
48
|
+
* if (record.isCompatibleWith(newInitializationData)) {
|
|
49
|
+
* console.log("This initialization data should already be handled, ignored.");
|
|
50
|
+
* } else {
|
|
51
|
+
* console.log("This initialization data is not handled yet.";
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
* @class KeySessionRecord
|
|
56
|
+
*/
|
|
57
|
+
var KeySessionRecord = /** @class */ (function () {
|
|
58
|
+
/**
|
|
59
|
+
* Create a new `KeySessionRecord`, linked to its corresponding initialization
|
|
60
|
+
* data,
|
|
61
|
+
* @param {Object} initializationData
|
|
62
|
+
*/
|
|
63
|
+
function KeySessionRecord(initializationData) {
|
|
64
|
+
this._initializationData = initializationData;
|
|
65
|
+
this._keyIds = null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Associate supplementary key ids to this `KeySessionRecord` so it becomes
|
|
69
|
+
* "compatible" to them.
|
|
70
|
+
*
|
|
71
|
+
* After this call, new initialization data linked to subsets of those key
|
|
72
|
+
* ids will be considered compatible to this `KeySessionRecord` (calls to
|
|
73
|
+
* `isCompatibleWith` with the corresponding initialization data will return
|
|
74
|
+
* `true`).
|
|
75
|
+
* @param {Array.<Uint8Array>} keyIds
|
|
76
|
+
*/
|
|
77
|
+
KeySessionRecord.prototype.associateKeyIds = function (keyIds) {
|
|
78
|
+
if (this._keyIds === null) {
|
|
79
|
+
this._keyIds = [];
|
|
80
|
+
}
|
|
81
|
+
var keyIdsArr = Array.from(keyIds);
|
|
82
|
+
for (var _i = 0, keyIdsArr_1 = keyIdsArr; _i < keyIdsArr_1.length; _i++) {
|
|
83
|
+
var keyId = keyIdsArr_1[_i];
|
|
84
|
+
if (!this.isAssociatedWithKeyId(keyId)) {
|
|
85
|
+
this._keyIds.push(keyId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* @param {Uint8Array} keyId
|
|
91
|
+
* @returns {boolean}
|
|
92
|
+
*/
|
|
93
|
+
KeySessionRecord.prototype.isAssociatedWithKeyId = function (keyId) {
|
|
94
|
+
if (this._keyIds === null) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
for (var _i = 0, _a = this._keyIds; _i < _a.length; _i++) {
|
|
98
|
+
var storedKeyId = _a[_i];
|
|
99
|
+
if (areKeyIdsEqual(storedKeyId, keyId)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* @returns {Array.<Uint8Array>}
|
|
107
|
+
*/
|
|
108
|
+
KeySessionRecord.prototype.getAssociatedKeyIds = function () {
|
|
109
|
+
if (this._keyIds === null) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return this._keyIds;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Check if that `KeySessionRecord` is compatible to the initialization data
|
|
116
|
+
* given.
|
|
117
|
+
*
|
|
118
|
+
* If it returns `true`, it means that this `KeySessionRecord` is already
|
|
119
|
+
* linked to that initialization data's key. As such, if that
|
|
120
|
+
* `KeySessionRecord` is already associated to an active MediaKeySession for
|
|
121
|
+
* example, the content linked to that initialization data should already be
|
|
122
|
+
* handled.
|
|
123
|
+
*
|
|
124
|
+
* If it returns `false`, it means that this `KeySessionRecord` has no
|
|
125
|
+
* relation with the given initialization data.
|
|
126
|
+
*
|
|
127
|
+
* @param {Object} initializationData
|
|
128
|
+
* @returns {boolean}
|
|
129
|
+
*/
|
|
130
|
+
KeySessionRecord.prototype.isCompatibleWith = function (initializationData) {
|
|
131
|
+
var keyIds = initializationData.keyIds;
|
|
132
|
+
if (keyIds !== undefined) {
|
|
133
|
+
if (this._keyIds !== null && areAllKeyIdsContainedIn(keyIds, this._keyIds)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (this._initializationData.keyIds !== undefined) {
|
|
137
|
+
return areAllKeyIdsContainedIn(keyIds, this._initializationData.keyIds);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return this._checkInitializationDataCompatibility(initializationData);
|
|
141
|
+
};
|
|
142
|
+
KeySessionRecord.prototype._checkInitializationDataCompatibility = function (initializationData) {
|
|
143
|
+
if (initializationData.keyIds !== undefined &&
|
|
144
|
+
this._initializationData.keyIds !== undefined) {
|
|
145
|
+
return areAllKeyIdsContainedIn(initializationData.keyIds, this._initializationData.keyIds);
|
|
146
|
+
}
|
|
147
|
+
if (this._initializationData.type !== initializationData.type) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return this._initializationData.values
|
|
151
|
+
.isCompatibleWith(initializationData.values);
|
|
152
|
+
};
|
|
153
|
+
return KeySessionRecord;
|
|
154
|
+
}());
|
|
155
|
+
export default KeySessionRecord;
|