rx-player 3.31.1-dev.2023070500 → 3.32.0-dev.2023092900
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 +24 -1
- package/CONTRIBUTING.md +27 -13
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +9 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +6 -27
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +1 -154
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.js +9 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +9 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/types.d.ts +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.d.ts +2 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +10 -6
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.d.ts +78 -0
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +198 -0
- package/dist/_esm5.processed/compat/eme/index.d.ts +5 -3
- package/dist/_esm5.processed/compat/eme/index.js +3 -3
- package/dist/_esm5.processed/compat/event_listeners.d.ts +13 -5
- package/dist/_esm5.processed/compat/event_listeners.js +8 -14
- package/dist/_esm5.processed/compat/index.d.ts +1 -3
- package/dist/_esm5.processed/compat/index.js +1 -3
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.d.ts +7 -0
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +9 -0
- package/dist/_esm5.processed/compat/on_height_width_change.js +2 -2
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +40 -34
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +17 -1
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +26 -8
- package/dist/_esm5.processed/core/api/option_utils.d.ts +1 -1
- package/dist/_esm5.processed/core/api/option_utils.js +12 -8
- package/dist/_esm5.processed/core/api/playback_observer.js +2 -2
- package/dist/_esm5.processed/core/api/public_api.d.ts +6 -0
- package/dist/_esm5.processed/core/api/public_api.js +28 -20
- package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +1 -2
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +2 -2
- package/dist/_esm5.processed/core/api/utils.js +2 -2
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +3 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +21 -14
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.d.ts +8 -2
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +17 -6
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +9 -67
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +52 -76
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/create_session.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +11 -4
- package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +2 -2
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +18 -15
- package/dist/_esm5.processed/core/decrypt/get_media_keys.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +1 -1
- package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
- package/dist/_esm5.processed/core/decrypt/index.js +2 -2
- package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +1 -1
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/types.d.ts +61 -0
- package/dist/_esm5.processed/core/decrypt/types.js +40 -1
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +0 -13
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +2 -19
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +3 -2
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.d.ts +2 -1
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +1 -2
- package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.d.ts +1 -1
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +5 -6
- package/dist/_esm5.processed/core/init/index.d.ts +1 -4
- package/dist/_esm5.processed/core/init/index.js +1 -3
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +41 -14
- package/dist/_esm5.processed/core/init/types.d.ts +2 -2
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +4 -1
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.d.ts +9 -4
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +16 -10
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +1 -0
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -2
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +6 -6
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.d.ts +3 -3
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +28 -36
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +12 -7
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +18 -2
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +31 -9
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +99 -56
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -7
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +40 -41
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +8 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +12 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +10 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +15 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +8 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +12 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +11 -4
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +1 -0
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +14 -19
- package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +13 -7
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +2 -2
- package/dist/_esm5.processed/core/stream/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +1 -6
- package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +15 -29
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +12 -8
- package/dist/_esm5.processed/core/stream/period/period_stream.js +20 -26
- package/dist/_esm5.processed/core/stream/period/types.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +18 -4
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +28 -15
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.d.ts +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +2 -2
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +3 -2
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +2 -6
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +2 -3
- package/dist/_esm5.processed/errors/request_error.js +15 -1
- package/dist/_esm5.processed/experimental/features/dash_wasm.js +3 -0
- package/dist/_esm5.processed/experimental/features/index.d.ts +0 -1
- package/dist/_esm5.processed/experimental/features/index.js +0 -1
- package/dist/_esm5.processed/experimental/features/local.js +3 -0
- package/dist/_esm5.processed/experimental/features/metaplaylist.js +3 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +8 -7
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +17 -9
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +4 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +5 -4
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +4 -3
- package/dist/_esm5.processed/features/features_object.js +2 -1
- package/dist/_esm5.processed/features/initialize_features.d.ts +1 -3
- package/dist/_esm5.processed/features/initialize_features.js +10 -4
- package/dist/_esm5.processed/features/list/bif_parser.js +2 -0
- package/dist/_esm5.processed/features/list/dash.js +3 -0
- package/dist/_esm5.processed/features/list/directfile.js +5 -2
- package/dist/_esm5.processed/features/list/eme.js +1 -1
- package/dist/_esm5.processed/features/list/html_sami_parser.js +2 -0
- package/dist/_esm5.processed/features/list/html_srt_parser.js +2 -0
- package/dist/_esm5.processed/features/list/html_text_buffer.js +2 -2
- package/dist/_esm5.processed/features/list/html_ttml_parser.js +2 -0
- package/dist/_esm5.processed/features/list/html_vtt_parser.js +2 -0
- package/dist/_esm5.processed/features/list/native_sami_parser.js +3 -0
- package/dist/_esm5.processed/features/list/native_srt_parser.js +3 -0
- package/dist/_esm5.processed/features/list/native_text_buffer.js +3 -2
- package/dist/_esm5.processed/features/list/native_ttml_parser.js +3 -0
- package/dist/_esm5.processed/features/list/native_vtt_parser.js +3 -0
- package/dist/_esm5.processed/features/list/smooth.js +3 -0
- package/dist/_esm5.processed/features/types.d.ts +83 -5
- package/dist/_esm5.processed/index.d.ts +0 -6
- package/dist/_esm5.processed/index.js +2 -1
- package/dist/_esm5.processed/manifest/manifest.js +1 -2
- package/dist/_esm5.processed/manifest/representation.d.ts +34 -1
- package/dist/_esm5.processed/manifest/representation.js +8 -2
- package/dist/_esm5.processed/manifest/utils.js +1 -3
- package/dist/_esm5.processed/minimal.d.ts +1 -17
- package/dist/_esm5.processed/minimal.js +3 -35
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +4 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +7 -0
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +8 -0
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +1 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +10 -0
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +1 -0
- package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +1 -0
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +2 -0
- package/dist/_esm5.processed/public_types.d.ts +3 -1
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +1 -1
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.d.ts +0 -3
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +0 -3
- package/dist/_esm5.processed/utils/are_arrays_of_numbers_equal.js +3 -0
- package/dist/_esm5.processed/utils/assert.js +2 -1
- package/dist/_esm5.processed/utils/deep_merge.d.ts +2 -5
- package/dist/_esm5.processed/utils/reference.d.ts +78 -37
- package/dist/_esm5.processed/utils/reference.js +237 -153
- package/dist/_esm5.processed/utils/wrapInPromise.d.ts +7 -0
- package/dist/_esm5.processed/utils/wrapInPromise.js +22 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +42294 -41851
- package/dist/rx-player.min.js +1 -1
- package/package.json +36 -36
- package/scripts/list-npm-scripts.js +146 -38
- package/sonar-project.properties +1 -1
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +11 -8
- package/src/compat/eme/custom_media_keys/index.ts +8 -184
- package/src/compat/eme/custom_media_keys/moz_media_keys_constructor.ts +13 -7
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +11 -8
- package/src/compat/eme/custom_media_keys/types.ts +1 -1
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +15 -11
- package/src/compat/eme/eme-api-implementation.ts +318 -0
- package/src/compat/eme/index.ts +8 -6
- package/src/compat/event_listeners.ts +12 -20
- package/src/compat/index.ts +0 -24
- package/src/compat/is_debug_mode_enabled.ts +12 -0
- package/src/compat/on_height_width_change.ts +2 -2
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +242 -99
- package/src/core/adaptive/adaptive_representation_selector.ts +52 -49
- package/src/core/adaptive/buffer_based_chooser.ts +36 -9
- package/src/core/adaptive/utils/pending_requests_store.ts +2 -2
- package/src/core/api/option_utils.ts +6 -1
- package/src/core/api/playback_observer.ts +3 -3
- package/src/core/api/public_api.ts +53 -40
- package/src/core/api/tracks_management/track_choice_manager.ts +5 -5
- package/src/core/api/utils.ts +3 -3
- package/src/core/decrypt/__tests__/__global__/get_license.test.ts +3 -3
- package/src/core/decrypt/__tests__/__global__/init_data.test.ts +24 -14
- package/src/core/decrypt/__tests__/__global__/media_key_system_access.test.ts +76 -48
- package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +19 -13
- package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +15 -12
- package/src/core/decrypt/__tests__/__global__/utils.ts +39 -24
- package/src/core/decrypt/attach_media_keys.ts +33 -8
- package/src/core/decrypt/clear_on_stop.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +213 -262
- package/src/core/decrypt/create_or_load_session.ts +1 -1
- package/src/core/decrypt/create_session.ts +1 -1
- package/src/core/decrypt/dispose_decryption_resources.ts +19 -4
- package/src/core/decrypt/find_key_system.ts +25 -20
- package/src/core/decrypt/get_media_keys.ts +2 -2
- package/src/core/decrypt/index.ts +1 -6
- package/src/core/decrypt/session_events_listener.ts +3 -4
- package/src/core/decrypt/set_server_certificate.ts +1 -1
- package/src/core/decrypt/types.ts +69 -0
- package/src/core/decrypt/utils/check_key_statuses.ts +1 -1
- package/src/core/decrypt/utils/is_session_usable.ts +1 -1
- package/src/core/decrypt/utils/key_id_comparison.ts +2 -27
- package/src/core/decrypt/utils/key_session_record.ts +3 -5
- package/src/core/decrypt/utils/loaded_sessions_store.ts +2 -2
- package/src/core/decrypt/utils/media_keys_infos_store.ts +4 -1
- package/src/core/decrypt/utils/persistent_sessions_store.ts +2 -5
- package/src/core/decrypt/utils/server_certificate_store.ts +1 -1
- package/src/core/init/directfile_content_initializer.ts +10 -6
- package/src/core/init/index.ts +6 -7
- package/src/core/init/media_source_content_initializer.ts +56 -24
- package/src/core/init/types.ts +2 -2
- package/src/core/init/utils/__tests__/refresh_scheduled_events_list.test.ts +22 -8
- package/src/core/init/utils/create_media_source.ts +4 -1
- package/src/core/init/utils/create_stream_playback_observer.ts +24 -14
- package/src/core/init/utils/end_of_stream.ts +1 -0
- package/src/core/init/utils/get_loaded_reference.ts +2 -2
- package/src/core/init/utils/initial_seek_and_play.ts +7 -7
- package/src/core/init/utils/initialize_content_decryption.ts +32 -39
- package/src/core/init/utils/media_source_duration_updater.ts +13 -9
- package/src/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.ts +7 -4
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +113 -73
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +66 -57
- package/src/core/segment_buffers/implementations/image/image_segment_buffer.ts +16 -0
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +33 -17
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +1 -1
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +18 -2
- package/src/core/segment_buffers/implementations/types.ts +16 -4
- package/src/core/segment_buffers/implementations/utils/manual_time_ranges.ts +2 -2
- package/src/core/segment_buffers/inventory/segment_inventory.ts +1 -0
- package/src/core/stream/adaptation/adaptation_stream.ts +17 -25
- package/src/core/stream/adaptation/types.ts +13 -7
- package/src/core/stream/adaptation/utils/create_representation_estimator.ts +2 -2
- package/src/core/stream/index.ts +2 -0
- package/src/core/stream/orchestrator/get_time_ranges_for_content.ts +1 -6
- package/src/core/stream/orchestrator/index.ts +2 -0
- package/src/core/stream/orchestrator/stream_orchestrator.ts +26 -37
- package/src/core/stream/period/period_stream.ts +27 -29
- package/src/core/stream/period/types.ts +2 -2
- package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +10 -1
- package/src/core/stream/representation/representation_stream.ts +42 -24
- package/src/core/stream/representation/utils/downloading_queue.ts +4 -5
- package/src/core/stream/representation/utils/push_init_segment.ts +4 -5
- package/src/core/stream/representation/utils/push_media_segment.ts +3 -3
- package/src/errors/__tests__/network_error.test.ts +10 -9
- package/src/errors/__tests__/request_error.test.ts +6 -4
- package/src/errors/request_error.ts +16 -1
- package/src/experimental/features/__tests__/dash_wasm.test.ts +4 -12
- package/src/experimental/features/__tests__/debug_element.test.ts +7 -21
- package/src/experimental/features/__tests__/local.test.ts +14 -23
- package/src/experimental/features/__tests__/metaplaylist.test.ts +14 -21
- package/src/experimental/features/dash_wasm.ts +3 -0
- package/src/experimental/features/index.ts +0 -1
- package/src/experimental/features/local.ts +3 -0
- package/src/experimental/features/metaplaylist.ts +3 -0
- package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +10 -7
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +17 -6
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +10 -9
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +26 -18
- package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -4
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +7 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +5 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +4 -3
- package/src/features/__tests__/initialize_features.test.ts +182 -3
- package/src/features/features_object.ts +2 -1
- package/src/features/initialize_features.ts +35 -28
- package/src/features/list/__tests__/bif_parser.test.ts +5 -11
- package/src/features/list/__tests__/dash.test.ts +15 -15
- package/src/features/list/__tests__/directfile.test.ts +7 -16
- package/src/features/list/__tests__/eme.test.ts +4 -12
- package/src/features/list/__tests__/html_sami_parser.test.ts +9 -14
- package/src/features/list/__tests__/html_srt_parser.test.ts +5 -10
- package/src/features/list/__tests__/html_text_buffer.test.ts +10 -19
- package/src/features/list/__tests__/html_ttml_parser.test.ts +5 -10
- package/src/features/list/__tests__/html_vtt_parser.test.ts +5 -10
- package/src/features/list/__tests__/image_buffer.test.ts +2 -9
- package/src/features/list/__tests__/native_sami_parser.test.ts +9 -14
- package/src/features/list/__tests__/native_srt_parser.test.ts +5 -10
- package/src/features/list/__tests__/native_text_buffer.test.ts +5 -13
- package/src/features/list/__tests__/native_ttml_parser.test.ts +5 -10
- package/src/features/list/__tests__/native_vtt_parser.test.ts +5 -10
- package/src/features/list/__tests__/smooth.test.ts +10 -10
- package/src/features/list/bif_parser.ts +2 -0
- package/src/features/list/dash.ts +3 -0
- package/src/features/list/directfile.ts +5 -3
- package/src/features/list/eme.ts +1 -1
- package/src/features/list/html_sami_parser.ts +2 -0
- package/src/features/list/html_srt_parser.ts +2 -0
- package/src/features/list/html_text_buffer.ts +2 -2
- package/src/features/list/html_ttml_parser.ts +2 -0
- package/src/features/list/html_vtt_parser.ts +2 -0
- package/src/features/list/native_sami_parser.ts +3 -0
- package/src/features/list/native_srt_parser.ts +3 -0
- package/src/features/list/native_text_buffer.ts +3 -2
- package/src/features/list/native_ttml_parser.ts +3 -0
- package/src/features/list/native_vtt_parser.ts +3 -0
- package/src/features/list/smooth.ts +3 -0
- package/src/features/types.ts +88 -15
- package/src/index.ts +3 -2
- package/src/manifest/__tests__/manifest.test.ts +7 -7
- package/src/manifest/representation.ts +46 -3
- package/src/manifest/utils.ts +1 -3
- package/src/minimal.ts +4 -18
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +1 -0
- package/src/parsers/manifest/dash/common/parse_representations.ts +10 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +7 -0
- package/src/parsers/manifest/dash/node_parser_types.ts +1 -0
- package/src/parsers/manifest/dash/wasm-parser/Cargo.lock +2 -2
- package/src/parsers/manifest/dash/wasm-parser/Cargo.toml +1 -1
- package/src/parsers/manifest/dash/wasm-parser/rs/errors.rs +3 -3
- package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +37 -67
- package/src/parsers/manifest/dash/wasm-parser/rs/lib.rs +7 -7
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +94 -105
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/mod.rs +119 -109
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/s_element.rs +24 -26
- package/src/parsers/manifest/dash/wasm-parser/rs/reader.rs +2 -2
- package/src/parsers/manifest/dash/wasm-parser/rs/reportable.rs +42 -18
- package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +29 -29
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +1 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +12 -0
- package/src/parsers/manifest/local/parse_local_manifest.ts +1 -0
- package/src/parsers/manifest/local/types.ts +2 -0
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +1 -0
- package/src/parsers/manifest/smooth/create_parser.ts +1 -1
- package/src/parsers/manifest/types.ts +2 -0
- package/src/public_types.ts +7 -1
- package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
- package/src/transports/dash/manifest_parser.ts +4 -3
- package/src/transports/smooth/segment_loader.ts +1 -1
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +4 -4
- package/src/transports/utils/get_isobmff_timing_infos.ts +0 -3
- package/src/typings/globals.d.ts +0 -2
- package/src/utils/are_arrays_of_numbers_equal.ts +5 -1
- package/src/utils/assert.ts +4 -1
- package/src/utils/deep_merge.ts +2 -2
- package/src/utils/reference.ts +235 -237
- package/src/utils/request/xhr.ts +1 -1
- package/src/utils/wrapInPromise.ts +24 -0
- package/appveyor.yml +0 -24
- package/dist/_esm5.processed/compat/has_eme_apis.d.ts +0 -21
- package/dist/_esm5.processed/compat/has_eme_apis.js +0 -24
- package/src/compat/__tests__/has_eme_apis.test.ts +0 -56
- package/src/compat/has_eme_apis.ts +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.
|
|
3
|
+
## v3.32.0-dev.2023092900 (2023-09-29)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- DASH: add optional `isSpatialAudio` boolean property to Representation returned by `getAvailableAudioTracks`, `getAudioTrack`, corresponding events, and `trackInfo` optional property of `MediaError` objects to signal Dolby Atmos techology [#1275]
|
|
8
|
+
- `LOCAL`: add `isSpatialAudio` property to Representation of the experiment `"local"` transport (used for offline playback) [#1275]
|
|
9
|
+
- `addFeatures` static method is now available on all RxPlayer builds. It was previously only in the minimal (`rx-player/minimal` import path) [#1287]
|
|
10
|
+
- The `NATIVE_TEXT_BUFFER`, `HTML_TEXT_BUFFER` and `IMAGE_BUFFER` features are now totally optional [#1287, #1293]
|
|
4
11
|
|
|
5
12
|
### Bug fixes
|
|
6
13
|
|
|
14
|
+
- Fix `setVideoBitrate` and `setAudioBitrate` API which may have led to a higher quality than wanted in the default `"seamless"` `manualBitrateSwitchingMode` if our buffer-based adaptive logic decided to [#1267, #1271]
|
|
7
15
|
- On the PlayStation 5, only switch to the `"LOADED"` state once the HTMLMediaElement's `readyState` of `4` has been reached, as it seems to switch to `3` too soon there [#1257]
|
|
16
|
+
- DASH: Fix potential track duplication if more than two `AdaptationSet` have an `adaptation-set-switching` `<SupplementalProperty>` between one another [#1279]
|
|
17
|
+
- DASH-WASM: availabilityTimeOffset is actually a floating number [#1278]
|
|
8
18
|
|
|
9
19
|
### Other improvements
|
|
10
20
|
|
|
11
21
|
- Do not load the last text segment if the current position goes after it as it is unnecessary [#1256]
|
|
22
|
+
- Implement better `NetworkError` messages [#1274]
|
|
12
23
|
- Set a better error message for when no `keySystems` option is set when playing an encrypted content
|
|
24
|
+
- Fix very small memory leak when reloading a content [#1286]
|
|
25
|
+
- TTML: put saner values for extent and origins when weird ones are found
|
|
26
|
+
- Re-check for segments to load immediately after the manifest has been refreshed [#1282]
|
|
27
|
+
- When "fallbacking" an undecipherable Representation, now empty the whole buffer if we can't make out where content was in the buffer [#1283]
|
|
28
|
+
- DRM: Reload when playback is unexpectedly frozen with encrypted but only decipherable data in the buffer [#1236]
|
|
29
|
+
- Improve segment start detection in buffer when there's unknown data buffered before it [#1284]
|
|
30
|
+
- DRM: Selection of alternative EME API like those used on IE11 or Safari has been refactored to facilitate future developments [#1261]
|
|
31
|
+
|
|
32
|
+
### Deprecated
|
|
33
|
+
|
|
34
|
+
- Deprecate the `manifestUpdateUrl` `loadVideo` option as it doesn't seem used anymore [#1288]
|
|
35
|
+
- Deprecate the `NATIVE_TEXT_BUFFER`, `HTML_TEXT_BUFFER` and `IMAGE_BUFFER` features as they are now unneeded [#1287, #1293]
|
|
13
36
|
|
|
14
37
|
|
|
15
38
|
## v3.31.0 (2023-06-14)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -12,23 +12,39 @@ Those have to follow the conventions defined below.
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Important code concepts
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
enough we can still admit that going blind into the codebase can be hard at
|
|
19
|
-
first as this is a pretty big technical project on a specific matter.
|
|
17
|
+
### Code documentation
|
|
20
18
|
|
|
21
|
-
We
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
We try to put `README.md` files inside every significant directories inside
|
|
20
|
+
`/src` to provide a global architecture documentation of that directory
|
|
21
|
+
specifically.
|
|
22
|
+
|
|
23
|
+
You can try to start understanding a piece of RxPlayer code by navigating
|
|
24
|
+
to that file. Understand that the documented behavior may be out of date
|
|
25
|
+
(in which case you're welcome to update it or open an issue) though even in
|
|
26
|
+
that case, it is a good starting point to understand the directory's role.
|
|
27
|
+
Likewise, don't forget to update it if a change you made to the code
|
|
28
|
+
necessitates a documentation change.
|
|
25
29
|
|
|
26
30
|
Also, for a more exhaustive approach to the documentation of the project's file
|
|
27
31
|
organization, you can look at [`FILES.md`](./FILES.md).
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
### When renaming or deleting functions, classes or variables
|
|
34
|
+
|
|
35
|
+
When Refactoring/Renaming, make sure to grep any of the renamed class / function
|
|
36
|
+
/ variable's name as they may also be referenced in documentation and code
|
|
37
|
+
comments. Same thing for a directory or file name.
|
|
38
|
+
|
|
39
|
+
If the name is hard to grep (e.g. the name is too generic and thus has too many
|
|
40
|
+
false positives), you can generally reduce the area to comments in the same file
|
|
41
|
+
and documentation files in the same directory.
|
|
42
|
+
|
|
43
|
+
### `features` object
|
|
44
|
+
|
|
45
|
+
Some files should not be imported directly but only be accessed by going through
|
|
46
|
+
the `features` object exported at `/src/features`. This is to reduce bundle size
|
|
47
|
+
when an application doesn't need all of the RxPlayer's features.
|
|
32
48
|
|
|
33
49
|
|
|
34
50
|
|
|
@@ -53,8 +69,6 @@ directory) by calling `npm run lint:tests`.
|
|
|
53
69
|
|
|
54
70
|
### Types
|
|
55
71
|
|
|
56
|
-
#### General TypeScript rules
|
|
57
|
-
|
|
58
72
|
We try to be as strict as possible with types:
|
|
59
73
|
|
|
60
74
|
- the `any` type should be avoided
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.32.0-dev.2023092900
|
|
@@ -19,13 +19,13 @@ declare class IE11CustomMediaKeys implements ICustomMediaKeys {
|
|
|
19
19
|
private _videoElement?;
|
|
20
20
|
private _mediaKeys?;
|
|
21
21
|
constructor(keyType: string);
|
|
22
|
-
_setVideo(videoElement: HTMLMediaElement):
|
|
22
|
+
_setVideo(videoElement: HTMLMediaElement): Promise<unknown>;
|
|
23
23
|
createSession(): ICustomMediaKeySession;
|
|
24
24
|
setServerCertificate(): Promise<void>;
|
|
25
25
|
}
|
|
26
26
|
export default function getIE11MediaKeysCallbacks(): {
|
|
27
27
|
isTypeSupported: (keyType: string) => boolean;
|
|
28
28
|
createCustomMediaKeys: (keyType: string) => IE11CustomMediaKeys;
|
|
29
|
-
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) =>
|
|
29
|
+
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => Promise<unknown>;
|
|
30
30
|
};
|
|
31
31
|
export { MSMediaKeysConstructor };
|
|
@@ -30,6 +30,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
30
30
|
})();
|
|
31
31
|
import EventEmitter from "../../../utils/event_emitter";
|
|
32
32
|
import TaskCanceller from "../../../utils/task_canceller";
|
|
33
|
+
import wrapInPromise from "../../../utils/wrapInPromise";
|
|
33
34
|
import * as events from "../../event_listeners";
|
|
34
35
|
import { MSMediaKeysConstructor, } from "./ms_media_keys_constructor";
|
|
35
36
|
var IE11MediaKeySession = /** @class */ (function (_super) {
|
|
@@ -115,10 +116,13 @@ var IE11CustomMediaKeys = /** @class */ (function () {
|
|
|
115
116
|
this._mediaKeys = new MSMediaKeysConstructor(keyType);
|
|
116
117
|
}
|
|
117
118
|
IE11CustomMediaKeys.prototype._setVideo = function (videoElement) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
var _this = this;
|
|
120
|
+
return wrapInPromise(function () {
|
|
121
|
+
_this._videoElement = videoElement;
|
|
122
|
+
if (_this._videoElement.msSetMediaKeys !== undefined) {
|
|
123
|
+
_this._videoElement.msSetMediaKeys(_this._mediaKeys);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
122
126
|
};
|
|
123
127
|
IE11CustomMediaKeys.prototype.createSession = function ( /* sessionType */) {
|
|
124
128
|
if (this._videoElement === undefined || this._mediaKeys === undefined) {
|
|
@@ -149,7 +153,7 @@ export default function getIE11MediaKeysCallbacks() {
|
|
|
149
153
|
// msSetMediaKeys only accepts native MSMediaKeys as argument.
|
|
150
154
|
// Calling it with null or undefined will raise an exception.
|
|
151
155
|
// There is no way to unset the mediakeys in that case, so return here.
|
|
152
|
-
return;
|
|
156
|
+
return Promise.resolve(undefined);
|
|
153
157
|
}
|
|
154
158
|
if (!(mediaKeys instanceof IE11CustomMediaKeys)) {
|
|
155
159
|
throw new Error("Custom setMediaKeys is supposed to be called " +
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 CustomMediaKeySystemAccess from "./../custom_key_system_access";
|
|
1
|
+
import getIE11MediaKeysCallbacks, { MSMediaKeysConstructor } from "./ie11_media_keys";
|
|
2
|
+
import getMozMediaKeysCallbacks, { MozMediaKeysConstructor } from "./moz_media_keys_constructor";
|
|
3
|
+
import getOldKitWebKitMediaKeyCallbacks, { isOldWebkitMediaElement } from "./old_webkit_media_keys";
|
|
17
4
|
import { ICustomMediaKeys, ICustomMediaKeySession } from "./types";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Set the given MediaKeys on the given HTMLMediaElement.
|
|
23
|
-
* Emits null when done then complete.
|
|
24
|
-
* @param {HTMLMediaElement} elt
|
|
25
|
-
* @param {Object} mediaKeys
|
|
26
|
-
*/
|
|
27
|
-
declare let setMediaKeys: ((elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => unknown);
|
|
28
|
-
export { requestMediaKeySystemAccess, setMediaKeys, ICustomMediaKeys, ICustomMediaKeySession, };
|
|
5
|
+
import getWebKitMediaKeysCallbacks from "./webkit_media_keys";
|
|
6
|
+
import { WebKitMediaKeysConstructor } from "./webkit_media_keys_constructor";
|
|
7
|
+
export { getIE11MediaKeysCallbacks, MSMediaKeysConstructor, getMozMediaKeysCallbacks, MozMediaKeysConstructor, getOldKitWebKitMediaKeyCallbacks, isOldWebkitMediaElement, ICustomMediaKeys, ICustomMediaKeySession, getWebKitMediaKeysCallbacks, WebKitMediaKeysConstructor, };
|
|
@@ -1,159 +1,6 @@
|
|
|
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 { MediaError } from "../../../errors";
|
|
17
|
-
import assert from "../../../utils/assert";
|
|
18
|
-
import { isIE11 } from "../../browser_detection";
|
|
19
|
-
import isNode from "../../is_node";
|
|
20
|
-
import shouldFavourCustomSafariEME from "../../should_favour_custom_safari_EME";
|
|
21
|
-
import CustomMediaKeySystemAccess from "./../custom_key_system_access";
|
|
22
1
|
import getIE11MediaKeysCallbacks, { MSMediaKeysConstructor, } from "./ie11_media_keys";
|
|
23
2
|
import getMozMediaKeysCallbacks, { MozMediaKeysConstructor, } from "./moz_media_keys_constructor";
|
|
24
3
|
import getOldKitWebKitMediaKeyCallbacks, { isOldWebkitMediaElement, } from "./old_webkit_media_keys";
|
|
25
4
|
import getWebKitMediaKeysCallbacks from "./webkit_media_keys";
|
|
26
5
|
import { WebKitMediaKeysConstructor } from "./webkit_media_keys_constructor";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Set the given MediaKeys on the given HTMLMediaElement.
|
|
30
|
-
* Emits null when done then complete.
|
|
31
|
-
* @param {HTMLMediaElement} elt
|
|
32
|
-
* @param {Object} mediaKeys
|
|
33
|
-
*/
|
|
34
|
-
var setMediaKeys = function defaultSetMediaKeys(mediaElement, mediaKeys) {
|
|
35
|
-
var elt = mediaElement;
|
|
36
|
-
/* eslint-disable @typescript-eslint/unbound-method */
|
|
37
|
-
if (typeof elt.setMediaKeys === "function") {
|
|
38
|
-
return elt.setMediaKeys(mediaKeys);
|
|
39
|
-
}
|
|
40
|
-
/* eslint-enable @typescript-eslint/unbound-method */
|
|
41
|
-
// If we get in the following code, it means that no compat case has been
|
|
42
|
-
// found and no standard setMediaKeys API exists. This case is particulary
|
|
43
|
-
// rare. We will try to call each API with native media keys.
|
|
44
|
-
if (typeof elt.webkitSetMediaKeys === "function") {
|
|
45
|
-
return elt.webkitSetMediaKeys(mediaKeys);
|
|
46
|
-
}
|
|
47
|
-
if (typeof elt.mozSetMediaKeys === "function") {
|
|
48
|
-
return elt.mozSetMediaKeys(mediaKeys);
|
|
49
|
-
}
|
|
50
|
-
if (typeof elt.msSetMediaKeys === "function" && mediaKeys !== null) {
|
|
51
|
-
return elt.msSetMediaKeys(mediaKeys);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Since Safari 12.1, EME APIs are available without webkit prefix.
|
|
56
|
-
* However, it seems that since fairplay CDM implementation within the browser is not
|
|
57
|
-
* standard with EME w3c current spec, the requestMediaKeySystemAccess API doesn't resolve
|
|
58
|
-
* positively, even if the drm (fairplay in most cases) is supported.
|
|
59
|
-
*
|
|
60
|
-
* Therefore, we prefer not to use requestMediaKeySystemAccess on Safari when webkit API
|
|
61
|
-
* is available.
|
|
62
|
-
*/
|
|
63
|
-
if (isNode ||
|
|
64
|
-
(navigator.requestMediaKeySystemAccess != null && !shouldFavourCustomSafariEME())) {
|
|
65
|
-
requestMediaKeySystemAccess = function () {
|
|
66
|
-
var args = [];
|
|
67
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
68
|
-
args[_i] = arguments[_i];
|
|
69
|
-
}
|
|
70
|
-
return navigator.requestMediaKeySystemAccess.apply(navigator, args);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
var isTypeSupported_1;
|
|
75
|
-
var createCustomMediaKeys_1;
|
|
76
|
-
// This is for Chrome with unprefixed EME api
|
|
77
|
-
if (isOldWebkitMediaElement(HTMLVideoElement.prototype)) {
|
|
78
|
-
var callbacks = getOldKitWebKitMediaKeyCallbacks();
|
|
79
|
-
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
80
|
-
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
81
|
-
setMediaKeys = callbacks.setMediaKeys;
|
|
82
|
-
// This is for WebKit with prefixed EME api
|
|
83
|
-
}
|
|
84
|
-
else if (WebKitMediaKeysConstructor !== undefined) {
|
|
85
|
-
var callbacks = getWebKitMediaKeysCallbacks();
|
|
86
|
-
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
87
|
-
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
88
|
-
setMediaKeys = callbacks.setMediaKeys;
|
|
89
|
-
}
|
|
90
|
-
else if (isIE11 && MSMediaKeysConstructor !== undefined) {
|
|
91
|
-
var callbacks = getIE11MediaKeysCallbacks();
|
|
92
|
-
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
93
|
-
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
94
|
-
setMediaKeys = callbacks.setMediaKeys;
|
|
95
|
-
}
|
|
96
|
-
else if (MozMediaKeysConstructor !== undefined) {
|
|
97
|
-
var callbacks = getMozMediaKeysCallbacks();
|
|
98
|
-
isTypeSupported_1 = callbacks.isTypeSupported;
|
|
99
|
-
createCustomMediaKeys_1 = callbacks.createCustomMediaKeys;
|
|
100
|
-
setMediaKeys = callbacks.setMediaKeys;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
var MK_1 = window.MediaKeys;
|
|
104
|
-
var checkForStandardMediaKeys_1 = function () {
|
|
105
|
-
if (MK_1 === undefined) {
|
|
106
|
-
throw new MediaError("MEDIA_KEYS_NOT_SUPPORTED", "No `MediaKeys` implementation found " +
|
|
107
|
-
"in the current browser.");
|
|
108
|
-
}
|
|
109
|
-
if (typeof MK_1.isTypeSupported === "undefined") {
|
|
110
|
-
var message = "This browser seems to be unable to play encrypted contents " +
|
|
111
|
-
"currently. Note: Some browsers do not allow decryption " +
|
|
112
|
-
"in some situations, like when not using HTTPS.";
|
|
113
|
-
throw new Error(message);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
isTypeSupported_1 = function (keyType) {
|
|
117
|
-
checkForStandardMediaKeys_1();
|
|
118
|
-
assert(typeof MK_1.isTypeSupported === "function");
|
|
119
|
-
return MK_1.isTypeSupported(keyType);
|
|
120
|
-
};
|
|
121
|
-
createCustomMediaKeys_1 = function (keyType) {
|
|
122
|
-
checkForStandardMediaKeys_1();
|
|
123
|
-
return new MK_1(keyType);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
requestMediaKeySystemAccess = function (keyType, keySystemConfigurations) {
|
|
127
|
-
if (!isTypeSupported_1(keyType)) {
|
|
128
|
-
return Promise.reject(new Error("Unsupported key type"));
|
|
129
|
-
}
|
|
130
|
-
for (var i = 0; i < keySystemConfigurations.length; i++) {
|
|
131
|
-
var keySystemConfiguration = keySystemConfigurations[i];
|
|
132
|
-
var videoCapabilities = keySystemConfiguration.videoCapabilities, audioCapabilities = keySystemConfiguration.audioCapabilities, initDataTypes = keySystemConfiguration.initDataTypes, distinctiveIdentifier = keySystemConfiguration.distinctiveIdentifier;
|
|
133
|
-
var supported = true;
|
|
134
|
-
supported = supported &&
|
|
135
|
-
(initDataTypes == null ||
|
|
136
|
-
initDataTypes.some(function (idt) { return idt === "cenc"; }));
|
|
137
|
-
supported = supported && (distinctiveIdentifier !== "required");
|
|
138
|
-
if (supported) {
|
|
139
|
-
var keySystemConfigurationResponse = {
|
|
140
|
-
initDataTypes: ["cenc"],
|
|
141
|
-
distinctiveIdentifier: "not-allowed",
|
|
142
|
-
persistentState: "required",
|
|
143
|
-
sessionTypes: ["temporary", "persistent-license"],
|
|
144
|
-
};
|
|
145
|
-
if (videoCapabilities !== undefined) {
|
|
146
|
-
keySystemConfigurationResponse.videoCapabilities = videoCapabilities;
|
|
147
|
-
}
|
|
148
|
-
if (audioCapabilities !== undefined) {
|
|
149
|
-
keySystemConfigurationResponse.audioCapabilities = audioCapabilities;
|
|
150
|
-
}
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
152
|
-
var customMediaKeys = createCustomMediaKeys_1(keyType);
|
|
153
|
-
return Promise.resolve(new CustomMediaKeySystemAccess(keyType, customMediaKeys, keySystemConfigurationResponse));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return Promise.reject(new Error("Unsupported configuration"));
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
export { requestMediaKeySystemAccess, setMediaKeys, };
|
|
6
|
+
export { getIE11MediaKeysCallbacks, MSMediaKeysConstructor, getMozMediaKeysCallbacks, MozMediaKeysConstructor, getOldKitWebKitMediaKeyCallbacks, isOldWebkitMediaElement, getWebKitMediaKeysCallbacks, WebKitMediaKeysConstructor, };
|
|
@@ -23,5 +23,5 @@ export { MozMediaKeysConstructor };
|
|
|
23
23
|
export default function getMozMediaKeysCallbacks(): {
|
|
24
24
|
isTypeSupported: (keyType: string) => boolean;
|
|
25
25
|
createCustomMediaKeys: (keyType: string) => ICustomMediaKeys;
|
|
26
|
-
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) =>
|
|
26
|
+
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => Promise<unknown>;
|
|
27
27
|
};
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import wrapInPromise from "../../../utils/wrapInPromise";
|
|
16
17
|
import isNode from "../../is_node";
|
|
17
18
|
var MozMediaKeysConstructor;
|
|
18
19
|
if (!isNode) {
|
|
@@ -45,11 +46,14 @@ export default function getMozMediaKeysCallbacks() {
|
|
|
45
46
|
return new MozMediaKeysConstructor(keyType);
|
|
46
47
|
};
|
|
47
48
|
var setMediaKeys = function (mediaElement, mediaKeys) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
return wrapInPromise(function () {
|
|
50
|
+
var elt = mediaElement;
|
|
51
|
+
if (elt.mozSetMediaKeys === undefined ||
|
|
52
|
+
typeof elt.mozSetMediaKeys !== "function") {
|
|
53
|
+
throw new Error("Can't set video on MozMediaKeys.");
|
|
54
|
+
}
|
|
55
|
+
return elt.mozSetMediaKeys(mediaKeys);
|
|
56
|
+
});
|
|
53
57
|
};
|
|
54
58
|
return {
|
|
55
59
|
isTypeSupported: isTypeSupported,
|
|
@@ -29,13 +29,13 @@ declare class OldWebKitCustomMediaKeys implements ICustomMediaKeys {
|
|
|
29
29
|
private readonly _keySystem;
|
|
30
30
|
private _videoElement?;
|
|
31
31
|
constructor(keySystem: string);
|
|
32
|
-
_setVideo(videoElement: IOldWebkitHTMLMediaElement | HTMLMediaElement):
|
|
32
|
+
_setVideo(videoElement: IOldWebkitHTMLMediaElement | HTMLMediaElement): Promise<unknown>;
|
|
33
33
|
createSession(): ICustomMediaKeySession;
|
|
34
34
|
setServerCertificate(): Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
export default function getOldWebKitMediaKeysCallbacks(): {
|
|
37
37
|
isTypeSupported: (keyType: string) => boolean;
|
|
38
38
|
createCustomMediaKeys: (keyType: string) => OldWebKitCustomMediaKeys;
|
|
39
|
-
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) =>
|
|
39
|
+
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => Promise<unknown>;
|
|
40
40
|
};
|
|
41
41
|
export {};
|
|
@@ -32,6 +32,7 @@ import { base64ToBytes } from "../../../utils/base64";
|
|
|
32
32
|
import EventEmitter from "../../../utils/event_emitter";
|
|
33
33
|
import noop from "../../../utils/noop";
|
|
34
34
|
import { utf8ToStr } from "../../../utils/string_parsing";
|
|
35
|
+
import wrapInPromise from "../../../utils/wrapInPromise";
|
|
35
36
|
/**
|
|
36
37
|
* Returns true if the given media element has old webkit methods
|
|
37
38
|
* corresponding to the IOldWebkitHTMLMediaElement interface.
|
|
@@ -138,10 +139,13 @@ var OldWebKitCustomMediaKeys = /** @class */ (function () {
|
|
|
138
139
|
this._keySystem = keySystem;
|
|
139
140
|
}
|
|
140
141
|
OldWebKitCustomMediaKeys.prototype._setVideo = function (videoElement) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
var _this = this;
|
|
143
|
+
return wrapInPromise(function () {
|
|
144
|
+
if (!isOldWebkitMediaElement(videoElement)) {
|
|
145
|
+
throw new Error("Video not attached to the MediaKeys");
|
|
146
|
+
}
|
|
147
|
+
_this._videoElement = videoElement;
|
|
148
|
+
});
|
|
145
149
|
};
|
|
146
150
|
OldWebKitCustomMediaKeys.prototype.createSession = function ( /* sessionType */) {
|
|
147
151
|
if (this._videoElement == null) {
|
|
@@ -172,7 +176,7 @@ export default function getOldWebKitMediaKeysCallbacks() {
|
|
|
172
176
|
var createCustomMediaKeys = function (keyType) { return new OldWebKitCustomMediaKeys(keyType); };
|
|
173
177
|
var setMediaKeys = function (elt, mediaKeys) {
|
|
174
178
|
if (mediaKeys === null) {
|
|
175
|
-
return;
|
|
179
|
+
return Promise.resolve(undefined);
|
|
176
180
|
}
|
|
177
181
|
if (!(mediaKeys instanceof OldWebKitCustomMediaKeys)) {
|
|
178
182
|
throw new Error("Custom setMediaKeys is supposed to be called " +
|
|
@@ -28,7 +28,7 @@ export interface ICustomMediaKeySession extends IEventEmitter<IMediaKeySessionEv
|
|
|
28
28
|
remove(): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
export interface ICustomMediaKeys {
|
|
31
|
-
_setVideo: (vid: HTMLMediaElement) =>
|
|
31
|
+
_setVideo: (vid: HTMLMediaElement) => Promise<unknown>;
|
|
32
32
|
createSession(sessionType?: MediaKeySessionType): ICustomMediaKeySession;
|
|
33
33
|
setServerCertificate(setServerCertificate: BufferSource): Promise<void>;
|
|
34
34
|
}
|
|
@@ -25,13 +25,13 @@ declare class WebKitCustomMediaKeys implements ICustomWebKitMediaKeys {
|
|
|
25
25
|
private _serverCertificate?;
|
|
26
26
|
private _keyType;
|
|
27
27
|
constructor(keyType: string);
|
|
28
|
-
_setVideo(videoElement: HTMLMediaElement):
|
|
28
|
+
_setVideo(videoElement: HTMLMediaElement): Promise<unknown>;
|
|
29
29
|
createSession(): ICustomMediaKeySession;
|
|
30
30
|
setServerCertificate(serverCertificate: Uint8Array): Promise<void>;
|
|
31
31
|
}
|
|
32
32
|
export default function getWebKitMediaKeysCallbacks(): {
|
|
33
33
|
isTypeSupported: (keyType: string) => boolean;
|
|
34
34
|
createCustomMediaKeys: (keyType: string) => WebKitCustomMediaKeys;
|
|
35
|
-
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) =>
|
|
35
|
+
setMediaKeys: (elt: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => Promise<unknown>;
|
|
36
36
|
};
|
|
37
37
|
export {};
|
|
@@ -30,6 +30,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
30
30
|
})();
|
|
31
31
|
import EventEmitter from "../../../utils/event_emitter";
|
|
32
32
|
import noop from "../../../utils/noop";
|
|
33
|
+
import startsWith from "../../../utils/starts_with";
|
|
34
|
+
import wrapInPromise from "../../../utils/wrapInPromise";
|
|
33
35
|
import getWebKitFairplayInitData from "../get_webkit_fairplay_initdata";
|
|
34
36
|
import { WebKitMediaKeysConstructor, } from "./webkit_media_keys_constructor";
|
|
35
37
|
/**
|
|
@@ -38,21 +40,23 @@ import { WebKitMediaKeysConstructor, } from "./webkit_media_keys_constructor";
|
|
|
38
40
|
* @returns {boolean}
|
|
39
41
|
*/
|
|
40
42
|
function isFairplayKeyType(keyType) {
|
|
41
|
-
return keyType
|
|
42
|
-
keyType === "com.apple.fps.2_0";
|
|
43
|
+
return startsWith(keyType, "com.apple.fps");
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Set media keys on video element using native HTMLMediaElement
|
|
46
47
|
* setMediaKeys from WebKit.
|
|
47
48
|
* @param {HTMLMediaElement} videoElement
|
|
48
49
|
* @param {Object|null} mediaKeys
|
|
50
|
+
* @returns {Promise}
|
|
49
51
|
*/
|
|
50
52
|
function setWebKitMediaKeys(videoElement, mediaKeys) {
|
|
51
53
|
var elt = videoElement;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
return wrapInPromise(function () {
|
|
55
|
+
if (elt.webkitSetMediaKeys === undefined) {
|
|
56
|
+
throw new Error("No webKitMediaKeys API.");
|
|
57
|
+
}
|
|
58
|
+
elt.webkitSetMediaKeys(mediaKeys);
|
|
59
|
+
});
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
58
62
|
* On Safari browsers (>= 9), there are specific webkit prefixed APIs for cyphered
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CancellationSignal } from "../../utils/task_canceller";
|
|
2
|
+
import { IEventTargetLike } from "../event_listeners";
|
|
3
|
+
import CustomMediaKeySystemAccess from "./custom_key_system_access";
|
|
4
|
+
import { ICustomMediaKeys } from "./custom_media_keys/types";
|
|
5
|
+
/**
|
|
6
|
+
* Automatically detect and set which EME implementation should be used in the
|
|
7
|
+
* current platform.
|
|
8
|
+
*
|
|
9
|
+
* You can call `getEmeApiImplementation` for a different implementation.
|
|
10
|
+
*/
|
|
11
|
+
declare const defaultEmeImplementation: IEmeApiImplementation;
|
|
12
|
+
export default defaultEmeImplementation;
|
|
13
|
+
/**
|
|
14
|
+
* Generic interface harmonizing the structure of the different EME API
|
|
15
|
+
* implementations the RxPlayer could use.
|
|
16
|
+
*/
|
|
17
|
+
export interface IEmeApiImplementation {
|
|
18
|
+
/**
|
|
19
|
+
* API implementing the `navigator.requestMediaKeySystemAccess` static method
|
|
20
|
+
* from EME.
|
|
21
|
+
* @param {string} keyType - Key system name, as a reverse domain name.
|
|
22
|
+
* @param {Array.<MediaKeySystemMediaCapability>} Wanted configurations, from
|
|
23
|
+
* the most wanted to the least.
|
|
24
|
+
* @returns {Promise}
|
|
25
|
+
*/
|
|
26
|
+
requestMediaKeySystemAccess: (keyType: string, config: MediaKeySystemConfiguration[]) => Promise<MediaKeySystemAccess | CustomMediaKeySystemAccess>;
|
|
27
|
+
/**
|
|
28
|
+
* API allowing to listen for `"encrypted"` events, presumably sent by the
|
|
29
|
+
* HTMLMediaElement on which encrypted content is pushed.
|
|
30
|
+
* @param {EventTarget} The element on which the event will be listened to.
|
|
31
|
+
* Generally it is the HTMLMediaElement.
|
|
32
|
+
* @param {Function} listener - The event listener on which that event's
|
|
33
|
+
* payload will be dispatched.
|
|
34
|
+
* @param {Object} cancelSignal - The event listener will be removed once that
|
|
35
|
+
* `CancellationSignal` emits.
|
|
36
|
+
*/
|
|
37
|
+
onEncrypted: (target: IEventTargetLike, listener: (evt: unknown) => void, cancelSignal: CancellationSignal) => void;
|
|
38
|
+
/**
|
|
39
|
+
* API allowing to attach a `MediaKeys` instance (or an `ICustomMediaKeys`) to
|
|
40
|
+
* the HTMLMediaElement so it can start decoding.
|
|
41
|
+
* @param {HTMLMediaElement} The HTMLMediaElement on which the content plays.
|
|
42
|
+
* @param {MediaKeys} mediaKeys - The MediaKeys instance to attach.
|
|
43
|
+
* @returns {Promise} - That promise resolves if the `MediaKeys` instance was
|
|
44
|
+
* attached to the `HTMLMediaElement` with success, or rejects on the opposite
|
|
45
|
+
* scenario.
|
|
46
|
+
*/
|
|
47
|
+
setMediaKeys: (mediaElement: HTMLMediaElement, mediaKeys: MediaKeys | ICustomMediaKeys | null) => Promise<unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* String describing the currently used EME implementation:
|
|
50
|
+
*
|
|
51
|
+
* - "standard": regular EME implementation
|
|
52
|
+
*
|
|
53
|
+
* - "webkit": The webkit-prefixed variant of the EME API
|
|
54
|
+
*
|
|
55
|
+
* - "older-webkit": An even older webkit-prefixed variant of the EME API
|
|
56
|
+
*
|
|
57
|
+
* - "ms": The ms-prefixed variant of the EME API
|
|
58
|
+
*
|
|
59
|
+
* - "moz": The moz-prefixed variant of the EME API
|
|
60
|
+
*
|
|
61
|
+
* - "unknown": An unidentified variant of the EME API
|
|
62
|
+
*/
|
|
63
|
+
implementation: "standard" | "webkit" | "older-webkit" | "ms" | "moz" | "unknown";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Union of all the different value the preferred EME API type can be set to:
|
|
67
|
+
*
|
|
68
|
+
* - "auto": The implementation will be chosen automatically based on what
|
|
69
|
+
* we've most confidence on on the current device.
|
|
70
|
+
*
|
|
71
|
+
* - "standard": If present, the standard EME API will be given precedence
|
|
72
|
+
* over custom and browser-specific ones.
|
|
73
|
+
*
|
|
74
|
+
* - "webkit": The webkit-prefixed variant of the EME API will be given
|
|
75
|
+
* precedence over any other one if present.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export type IPreferredEmeApiType = "auto" | "standard" | "webkit";
|