rx-player 3.26.3-dev.2022021400 → 3.27.0-dev.20220317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- package/FILES.md +5 -4
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -2
- package/dist/_esm5.processed/compat/browser_detection.js +4 -2
- package/dist/_esm5.processed/compat/eme/close_session.d.ts +11 -5
- package/dist/_esm5.processed/compat/eme/close_session.js +144 -36
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -5
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +21 -22
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +53 -34
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +43 -41
- package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +2 -3
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +22 -26
- package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -2
- package/dist/_esm5.processed/compat/eme/load_session.js +68 -17
- package/dist/_esm5.processed/compat/event_listeners.js +2 -1
- package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
- package/dist/_esm5.processed/config.d.ts +166 -1080
- package/dist/_esm5.processed/config.js +17 -1119
- package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +4 -1
- package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
- package/dist/_esm5.processed/core/api/get_player_state.js +1 -1
- package/dist/_esm5.processed/core/api/index.d.ts +2 -1
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +2 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -1
- package/dist/_esm5.processed/core/api/option_utils.js +19 -6
- package/dist/_esm5.processed/core/api/playback_observer.js +5 -1
- package/dist/_esm5.processed/core/api/public_api.d.ts +82 -71
- package/dist/_esm5.processed/core/api/public_api.js +72 -33
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -49
- package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +25 -65
- package/dist/_esm5.processed/core/{eme → decrypt}/attach_media_keys.d.ts +12 -12
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +104 -0
- package/dist/_esm5.processed/core/{eme/clear_eme_session.d.ts → decrypt/clear_on_stop.d.ts} +3 -4
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +41 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +866 -0
- package/dist/_esm5.processed/core/{eme/get_session.d.ts → decrypt/create_or_load_session.d.ts} +28 -26
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +124 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/create_session.d.ts +22 -19
- package/dist/_esm5.processed/core/decrypt/create_session.js +174 -0
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +21 -0
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +81 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/find_key_system.d.ts +11 -14
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +300 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.d.ts +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.js +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt}/get_media_keys.d.ts +13 -5
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +153 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/index.d.ts +5 -6
- package/dist/_esm5.processed/core/{eme → decrypt}/index.js +5 -5
- package/dist/_esm5.processed/core/{eme → decrypt}/init_media_keys.d.ts +6 -4
- package/dist/_esm5.processed/core/decrypt/init_media_keys.js +82 -0
- package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +77 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/session_events_listener.js +25 -24
- package/dist/_esm5.processed/core/{eme → decrypt}/set_server_certificate.d.ts +15 -6
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +141 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/types.d.ts +119 -241
- package/dist/_esm5.processed/core/{eme → decrypt}/types.js +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.d.ts +3 -3
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.js +5 -5
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.d.ts +2 -2
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.js +4 -3
- package/dist/_esm5.processed/core/{eme/utils/close_session.d.ts → decrypt/utils/clean_old_loaded_sessions.d.ts} +8 -7
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +85 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.d.ts +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.js +2 -2
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.d.ts +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.js +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +69 -0
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +99 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.d.ts +0 -1
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.js +4 -5
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +44 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +77 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +104 -0
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +155 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +108 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +303 -0
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.d.ts +4 -4
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.js +0 -0
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.d.ts +8 -18
- package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.js +119 -97
- package/dist/_esm5.processed/core/{eme/utils/init_data_container.d.ts → decrypt/utils/serializable_bytes.d.ts} +8 -5
- package/dist/_esm5.processed/core/{eme/utils/init_data_container.js → decrypt/utils/serializable_bytes.js} +9 -9
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.d.ts +1 -1
- package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.js +1 -1
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
- package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +4 -2
- package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -69
- package/dist/_esm5.processed/core/init/link_drm_and_content.d.ts +61 -0
- package/dist/_esm5.processed/core/init/link_drm_and_content.js +94 -0
- package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +2 -1
- package/dist/_esm5.processed/core/init/stall_avoider.js +1 -1
- package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
- package/dist/_esm5.processed/core/init/types.d.ts +2 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +17 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +22 -5
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -1
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +6 -3
- package/dist/_esm5.processed/core/stream/events_generators.d.ts +8 -3
- package/dist/_esm5.processed/core/stream/events_generators.js +3 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +2 -1
- package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +1 -1
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -1
- package/dist/_esm5.processed/core/stream/period/period_stream.js +3 -3
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +2 -2
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +6 -1
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +12 -9
- package/dist/_esm5.processed/core/stream/representation/get_needed_segments.d.ts +19 -14
- package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +86 -10
- package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -3
- package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +6 -0
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +19 -8
- package/dist/_esm5.processed/core/stream/types.d.ts +1 -1
- package/dist/_esm5.processed/default_config.d.ts +1114 -0
- package/dist/_esm5.processed/default_config.js +1145 -0
- package/dist/_esm5.processed/experimental/index.d.ts +2 -0
- package/dist/_esm5.processed/experimental/index.js +2 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +1 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +1 -2
- package/dist/_esm5.processed/features/features_object.js +1 -1
- package/dist/_esm5.processed/features/initialize_features.js +1 -1
- package/dist/_esm5.processed/features/list/eme.d.ts +3 -3
- package/dist/_esm5.processed/features/list/eme.js +5 -5
- package/dist/_esm5.processed/features/types.d.ts +3 -3
- package/dist/_esm5.processed/manifest/manifest.d.ts +1 -14
- package/dist/_esm5.processed/manifest/manifest.js +10 -74
- package/dist/_esm5.processed/manifest/representation.d.ts +35 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +87 -75
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
- package/dist/_esm5.processed/public_types.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +3 -0
- package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
- package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
- package/dist/_esm5.processed/transports/local/segment_parser.js +4 -1
- package/dist/_esm5.processed/transports/local/text_parser.js +8 -2
- package/dist/_esm5.processed/transports/smooth/pipelines.js +68 -10
- package/dist/_esm5.processed/transports/types.d.ts +22 -0
- package/dist/_esm5.processed/utils/deep_merge.d.ts +12 -0
- package/dist/_esm5.processed/utils/deep_merge.js +53 -0
- package/dist/_esm5.processed/utils/reference.d.ts +29 -0
- package/dist/_esm5.processed/utils/reference.js +72 -24
- package/dist/_esm5.processed/utils/request/fetch.js +1 -2
- package/dist/_esm5.processed/utils/request/xhr.js +1 -1
- package/dist/_esm5.processed/utils/rx-from_cancellable_promise.js +7 -2
- package/dist/_esm5.processed/utils/task_canceller.d.ts +5 -3
- package/dist/_esm5.processed/utils/task_canceller.js +3 -3
- package/dist/rx-player.js +5002 -3033
- package/dist/rx-player.min.js +1 -1
- package/dummy +1 -0
- package/{dist/_esm5.processed/core/eme/dispose_eme.d.ts → experimental/index.d.ts} +1 -4
- package/{dist/_esm5.processed/core/eme/dispose_media_keys.d.ts → experimental/index.js} +1 -6
- package/package.json +32 -34
- package/scripts/build/templates/experimental/index.d.ts +16 -0
- package/scripts/build/templates/experimental/index.js +16 -0
- package/sonar-project.properties +1 -1
- package/src/README.md +6 -6
- package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +45 -5
- package/src/compat/browser_detection.ts +4 -2
- package/src/compat/eme/close_session.ts +90 -56
- package/src/compat/eme/custom_media_keys/index.ts +21 -38
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +63 -46
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +51 -49
- package/src/compat/eme/generate_key_request.ts +25 -33
- package/src/compat/eme/load_session.ts +29 -31
- package/src/compat/event_listeners.ts +2 -1
- package/src/compat/should_favour_custom_safari_EME.ts +5 -2
- package/src/config.ts +17 -1210
- package/src/core/README.md +1 -1
- package/src/core/abr/bandwidth_estimator.ts +4 -4
- package/src/core/abr/network_analyzer.ts +5 -6
- package/src/core/api/__tests__/get_player_state.test.ts +3 -3
- package/src/core/api/__tests__/option_utils.test.ts +17 -17
- package/src/core/api/get_player_state.ts +1 -1
- package/src/core/api/index.ts +3 -0
- package/src/core/api/option_utils.ts +37 -20
- package/src/core/api/playback_observer.ts +12 -8
- package/src/core/api/public_api.ts +151 -111
- package/src/core/decrypt/README.md +22 -0
- package/src/core/decrypt/__tests__/__global__/get_license.test.ts +418 -0
- package/src/core/decrypt/__tests__/__global__/init_data.test.ts +675 -0
- package/src/core/{eme → decrypt}/__tests__/__global__/media_key_system_access.test.ts +99 -92
- package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +156 -0
- package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +262 -0
- package/src/core/{eme → decrypt}/__tests__/__global__/utils.ts +31 -93
- package/src/core/{eme → decrypt}/attach_media_keys.ts +49 -56
- package/src/core/decrypt/clear_on_stop.ts +48 -0
- package/src/core/decrypt/content_decryptor.ts +1158 -0
- package/src/core/decrypt/create_or_load_session.ts +130 -0
- package/src/core/decrypt/create_session.ts +175 -0
- package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
- package/src/core/{eme → decrypt}/find_key_system.ts +112 -122
- package/src/core/{eme → decrypt}/get_current_key_system.ts +1 -1
- package/src/core/decrypt/get_media_keys.ts +145 -0
- package/src/core/{eme → decrypt}/index.ts +11 -8
- package/src/core/decrypt/init_media_keys.ts +51 -0
- package/src/core/{eme → decrypt}/session_events_listener.ts +93 -55
- package/src/core/decrypt/set_server_certificate.ts +104 -0
- package/src/core/{eme → decrypt}/types.ts +128 -258
- package/src/core/{eme → decrypt}/utils/__tests__/are_init_values_compatible.test.ts +1 -1
- package/src/core/{eme → decrypt/utils}/__tests__/clean_old_loaded_sessions.test.ts +29 -71
- package/src/core/{eme → decrypt/utils}/__tests__/clean_old_stored_persistent_info.test.ts +6 -6
- package/src/core/{eme → decrypt}/utils/are_init_values_compatible.ts +9 -9
- package/src/core/{eme → decrypt/utils}/check_key_statuses.ts +6 -5
- package/{dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js → src/core/decrypt/utils/clean_old_loaded_sessions.ts} +20 -20
- package/src/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.ts +3 -3
- package/src/core/{eme → decrypt/utils}/get_drm_system_id.ts +1 -1
- package/src/core/decrypt/utils/init_data_values_container.ts +119 -0
- package/src/core/{eme → decrypt}/utils/is_session_usable.ts +4 -5
- package/src/core/decrypt/utils/key_id_comparison.ts +82 -0
- package/src/core/decrypt/utils/key_session_record.ts +175 -0
- package/src/core/decrypt/utils/loaded_sessions_store.ts +318 -0
- package/src/core/{eme → decrypt/utils}/media_keys_infos_store.ts +4 -4
- package/src/core/{eme → decrypt}/utils/persistent_sessions_store.ts +122 -104
- package/src/core/{eme/utils/init_data_container.ts → decrypt/utils/serializable_bytes.ts} +8 -5
- package/src/core/{eme → decrypt/utils}/server_certificate_store.ts +2 -2
- package/src/core/fetchers/manifest/manifest_fetcher.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
- package/src/core/init/.initialize_media_source.ts.un~ +0 -0
- package/src/core/init/get_initial_time.ts +2 -1
- package/src/core/init/initialize_directfile.ts +17 -20
- package/src/core/init/initialize_media_source.ts +42 -105
- package/src/core/init/link_drm_and_content.ts +176 -0
- package/src/core/init/manifest_update_scheduler.ts +5 -3
- package/src/core/init/stall_avoider.ts +6 -5
- package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
- package/src/core/init/types.ts +1 -39
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +2 -1
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -4
- package/src/core/segment_buffers/inventory/segment_inventory.ts +42 -8
- package/src/core/stream/adaptation/adaptation_stream.ts +7 -1
- package/src/core/stream/events_generators.ts +9 -4
- package/src/core/stream/orchestrator/stream_orchestrator.ts +9 -4
- package/src/core/stream/period/create_empty_adaptation_stream.ts +2 -1
- package/src/core/stream/period/get_adaptation_switch_strategy.ts +1 -1
- package/src/core/stream/period/period_stream.ts +5 -2
- package/src/core/stream/representation/force_garbage_collection.ts +2 -2
- package/src/core/stream/representation/get_buffer_status.ts +28 -16
- package/src/core/stream/representation/get_needed_segments.ts +124 -28
- package/src/core/stream/representation/get_segment_priority.ts +1 -2
- package/src/core/stream/representation/push_media_segment.ts +3 -2
- package/src/core/stream/representation/representation_stream.ts +30 -7
- package/src/core/stream/types.ts +1 -1
- package/src/default_config.ts +1241 -0
- package/src/experimental/index.ts +5 -0
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +2 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +4 -4
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +1 -2
- package/src/features/__tests__/initialize_features.test.ts +2 -2
- package/src/features/features_object.ts +1 -1
- package/src/features/initialize_features.ts +1 -1
- package/src/features/list/__tests__/eme.test.ts +5 -5
- package/src/features/list/eme.ts +5 -5
- package/src/features/types.ts +3 -10
- package/src/manifest/manifest.ts +6 -76
- package/src/manifest/representation.ts +36 -3
- package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
- package/src/parsers/manifest/dash/common/indexes/template.ts +1 -2
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +1 -1
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +109 -64
- package/src/parsers/manifest/dash/common/parse_mpd.ts +1 -2
- package/src/parsers/manifest/smooth/create_parser.ts +1 -0
- package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
- package/src/public_types.ts +5 -1
- package/src/transports/dash/image_pipelines.ts +3 -0
- package/src/transports/dash/segment_parser.ts +5 -0
- package/src/transports/dash/text_parser.ts +8 -0
- package/src/transports/local/segment_parser.ts +4 -0
- package/src/transports/local/text_parser.ts +8 -0
- package/src/transports/smooth/pipelines.ts +22 -9
- package/src/transports/types.ts +22 -0
- package/src/utils/__tests__/deep_merge.test.ts +48 -0
- package/src/utils/deep_merge.ts +46 -0
- package/src/utils/reference.ts +116 -23
- package/src/utils/request/fetch.ts +1 -2
- package/src/utils/request/xhr.ts +2 -1
- package/src/utils/rx-from_cancellable_promise.ts +7 -2
- package/src/utils/task_canceller.ts +6 -4
- package/dist/_esm5.processed/core/eme/attach_media_keys.js +0 -57
- package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.d.ts +0 -59
- package/dist/_esm5.processed/core/eme/clear_eme_session.js +0 -50
- package/dist/_esm5.processed/core/eme/create_session.js +0 -126
- package/dist/_esm5.processed/core/eme/dispose_eme.js +0 -23
- package/dist/_esm5.processed/core/eme/dispose_media_keys.js +0 -36
- package/dist/_esm5.processed/core/eme/eme_manager.d.ts +0 -31
- package/dist/_esm5.processed/core/eme/eme_manager.js +0 -278
- package/dist/_esm5.processed/core/eme/find_key_system.js +0 -253
- package/dist/_esm5.processed/core/eme/get_media_keys.js +0 -85
- package/dist/_esm5.processed/core/eme/get_session.js +0 -68
- package/dist/_esm5.processed/core/eme/init_media_keys.js +0 -66
- package/dist/_esm5.processed/core/eme/session_events_listener.d.ts +0 -41
- package/dist/_esm5.processed/core/eme/set_server_certificate.js +0 -85
- package/dist/_esm5.processed/core/eme/utils/close_session.js +0 -81
- package/dist/_esm5.processed/core/eme/utils/init_data_store.d.ts +0 -115
- package/dist/_esm5.processed/core/eme/utils/init_data_store.js +0 -181
- package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.d.ts +0 -123
- package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +0 -173
- package/dist/_esm5.processed/core/init/create_eme_manager.d.ts +0 -34
- package/dist/_esm5.processed/core/init/create_eme_manager.js +0 -52
- package/src/core/eme/README.md +0 -26
- package/src/core/eme/__tests__/__global__/get_license.test.ts +0 -414
- package/src/core/eme/__tests__/__global__/init_data.test.ts +0 -908
- package/src/core/eme/__tests__/__global__/media_keys.test.ts +0 -266
- package/src/core/eme/__tests__/__global__/server_certificate.test.ts +0 -364
- package/src/core/eme/__tests__/init_media_keys.test.ts +0 -182
- package/src/core/eme/clean_old_loaded_sessions.ts +0 -96
- package/src/core/eme/clear_eme_session.ts +0 -62
- package/src/core/eme/create_session.ts +0 -187
- package/src/core/eme/dispose_eme.ts +0 -25
- package/src/core/eme/dispose_media_keys.ts +0 -46
- package/src/core/eme/eme_manager.ts +0 -387
- package/src/core/eme/get_media_keys.ts +0 -141
- package/src/core/eme/get_session.ts +0 -135
- package/src/core/eme/init_media_keys.ts +0 -106
- package/src/core/eme/set_server_certificate.ts +0 -115
- package/src/core/eme/utils/close_session.ts +0 -113
- package/src/core/eme/utils/init_data_store.ts +0 -234
- package/src/core/eme/utils/loaded_sessions_store.ts +0 -235
- package/src/core/init/create_eme_manager.ts +0 -95
|
@@ -15,14 +15,18 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import log from "../../../../log";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
IAdaptationType,
|
|
20
|
+
Period,
|
|
21
|
+
SUPPORTED_ADAPTATIONS_TYPE,
|
|
22
|
+
} from "../../../../manifest";
|
|
19
23
|
import arrayFind from "../../../../utils/array_find";
|
|
24
|
+
import arrayFindIndex from "../../../../utils/array_find_index";
|
|
20
25
|
import arrayIncludes from "../../../../utils/array_includes";
|
|
21
26
|
import isNonEmptyString from "../../../../utils/is_non_empty_string";
|
|
22
27
|
import {
|
|
23
28
|
IParsedAdaptation,
|
|
24
29
|
IParsedAdaptations,
|
|
25
|
-
IParsedAdaptationType,
|
|
26
30
|
} from "../../types";
|
|
27
31
|
import {
|
|
28
32
|
IAdaptationSetIntermediateRepresentation,
|
|
@@ -235,30 +239,31 @@ export default function parseAdaptationSets(
|
|
|
235
239
|
adaptationsIR : IAdaptationSetIntermediateRepresentation[],
|
|
236
240
|
context : IAdaptationSetContext
|
|
237
241
|
): IParsedAdaptations {
|
|
238
|
-
const parsedAdaptations :
|
|
242
|
+
const parsedAdaptations : Record<
|
|
243
|
+
IAdaptationType,
|
|
244
|
+
Array<[ IParsedAdaptation,
|
|
245
|
+
IAdaptationSetOrderingData ]>
|
|
246
|
+
> = { video: [],
|
|
247
|
+
audio: [],
|
|
248
|
+
text: [],
|
|
249
|
+
image: [] };
|
|
239
250
|
const trickModeAdaptations: Array<{ adaptation: IParsedAdaptation;
|
|
240
251
|
trickModeAttachedAdaptationIds: string[]; }> = [];
|
|
241
252
|
const adaptationSwitchingInfos : IAdaptationSwitchingInfos = {};
|
|
253
|
+
|
|
242
254
|
const parsedAdaptationsIDs : string[] = [];
|
|
243
255
|
|
|
244
256
|
/**
|
|
245
|
-
* Index of the last parsed AdaptationSet with a Role set as "main" in
|
|
246
|
-
* `parsedAdaptations
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
257
|
+
* Index of the last parsed Video AdaptationSet with a Role set as "main" in
|
|
258
|
+
* `parsedAdaptations.video`.
|
|
259
|
+
* `-1` if not yet encountered.
|
|
260
|
+
* Used as we merge all main video AdaptationSet due to a comprehension of the
|
|
261
|
+
* DASH-IF IOP.
|
|
250
262
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// first sort AdaptationSets by absolute priority.
|
|
254
|
-
adaptationsIR.sort((a, b) => {
|
|
255
|
-
/* As of DASH-IF 4.3, `1` is the default value. */
|
|
256
|
-
const priority1 = a.attributes.selectionPriority ?? 1;
|
|
257
|
-
const priority2 = b.attributes.selectionPriority ?? 1;
|
|
258
|
-
return priority2 - priority1;
|
|
259
|
-
});
|
|
263
|
+
let lastMainVideoAdapIdx = -1;
|
|
260
264
|
|
|
261
|
-
for (
|
|
265
|
+
for (let adaptationIdx = 0; adaptationIdx < adaptationsIR.length; adaptationIdx++) {
|
|
266
|
+
const adaptation = adaptationsIR[adaptationIdx];
|
|
262
267
|
const adaptationChildren = adaptation.children;
|
|
263
268
|
const { essentialProperties,
|
|
264
269
|
roles } = adaptationChildren;
|
|
@@ -291,6 +296,7 @@ export default function parseAdaptationSets(
|
|
|
291
296
|
continue;
|
|
292
297
|
}
|
|
293
298
|
|
|
299
|
+
const priority = adaptation.attributes.selectionPriority ?? 1;
|
|
294
300
|
const originalID = adaptation.attributes.id;
|
|
295
301
|
let newID : string;
|
|
296
302
|
const adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
|
|
@@ -334,14 +340,11 @@ export default function parseAdaptationSets(
|
|
|
334
340
|
|
|
335
341
|
if (type === "video" &&
|
|
336
342
|
isMainAdaptation &&
|
|
337
|
-
|
|
338
|
-
parsedAdaptations.video.length >
|
|
339
|
-
lastMainAdaptationIndex.video !== undefined &&
|
|
343
|
+
lastMainVideoAdapIdx >= 0 &&
|
|
344
|
+
parsedAdaptations.video.length > lastMainVideoAdapIdx &&
|
|
340
345
|
!isTrickModeTrack)
|
|
341
346
|
{
|
|
342
|
-
|
|
343
|
-
// TODO remove that ugly custom logic?
|
|
344
|
-
const videoMainAdaptation = parsedAdaptations.video[lastMainAdaptationIndex.video];
|
|
347
|
+
const videoMainAdaptation = parsedAdaptations.video[lastMainVideoAdapIdx][0];
|
|
345
348
|
reprCtxt.unsafelyBaseOnPreviousAdaptation = context
|
|
346
349
|
.unsafelyBaseOnPreviousPeriod?.getAdaptation(videoMainAdaptation.id) ?? null;
|
|
347
350
|
const representations = parseRepresentations(representationsIR,
|
|
@@ -422,65 +425,56 @@ export default function parseAdaptationSets(
|
|
|
422
425
|
parsedAdaptationSet.isSignInterpreted = true;
|
|
423
426
|
}
|
|
424
427
|
|
|
425
|
-
const adaptationsOfTheSameType = parsedAdaptations[type];
|
|
426
428
|
if (trickModeAttachedAdaptationIds !== undefined) {
|
|
427
429
|
trickModeAdaptations.push({ adaptation: parsedAdaptationSet,
|
|
428
430
|
trickModeAttachedAdaptationIds });
|
|
429
|
-
} else if (adaptationsOfTheSameType === undefined) {
|
|
430
|
-
parsedAdaptations[type] = [parsedAdaptationSet];
|
|
431
|
-
if (isMainAdaptation) {
|
|
432
|
-
lastMainAdaptationIndex[type] = 0;
|
|
433
|
-
}
|
|
434
431
|
} else {
|
|
435
|
-
let mergedInto : IParsedAdaptation|null = null;
|
|
436
432
|
|
|
437
433
|
// look if we have to merge this into another Adaptation
|
|
434
|
+
let mergedIntoIdx = -1;
|
|
438
435
|
for (const id of adaptationSetSwitchingIDs) {
|
|
439
436
|
const switchingInfos = adaptationSwitchingInfos[id];
|
|
440
|
-
if (switchingInfos
|
|
437
|
+
if (switchingInfos !== undefined &&
|
|
441
438
|
switchingInfos.newID !== newID &&
|
|
442
439
|
arrayIncludes(switchingInfos.adaptationSetSwitchingIDs, originalID))
|
|
443
440
|
{
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
441
|
+
mergedIntoIdx = arrayFindIndex(parsedAdaptations[type],
|
|
442
|
+
(a) => a[0].id === id);
|
|
443
|
+
const mergedInto = parsedAdaptations[type][mergedIntoIdx];
|
|
444
|
+
if (mergedInto !== undefined &&
|
|
445
|
+
mergedInto[0].audioDescription ===
|
|
448
446
|
parsedAdaptationSet.audioDescription &&
|
|
449
|
-
|
|
447
|
+
mergedInto[0].closedCaption ===
|
|
450
448
|
parsedAdaptationSet.closedCaption &&
|
|
451
|
-
|
|
449
|
+
mergedInto[0].language === parsedAdaptationSet.language)
|
|
452
450
|
{
|
|
453
451
|
log.info("DASH Parser: merging \"switchable\" AdaptationSets",
|
|
454
452
|
originalID, id);
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
453
|
+
mergedInto[0].representations.push(...parsedAdaptationSet.representations);
|
|
454
|
+
if (type === "video" &&
|
|
455
|
+
isMainAdaptation &&
|
|
456
|
+
!mergedInto[1].isMainAdaptation)
|
|
457
|
+
{
|
|
458
|
+
lastMainVideoAdapIdx = Math.max(lastMainVideoAdapIdx, mergedIntoIdx);
|
|
459
|
+
}
|
|
460
|
+
mergedInto[1] = {
|
|
461
|
+
priority: Math.max(priority, mergedInto[1].priority),
|
|
462
|
+
isMainAdaptation: isMainAdaptation ||
|
|
463
|
+
mergedInto[1].isMainAdaptation,
|
|
464
|
+
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd),
|
|
465
|
+
};
|
|
458
466
|
}
|
|
459
467
|
}
|
|
460
468
|
}
|
|
461
469
|
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
470
|
-
} else {
|
|
471
|
-
const indexOf = adaptationsOfTheSameType.indexOf(mergedInto);
|
|
472
|
-
if (indexOf < 0) { // Weird, not found
|
|
473
|
-
adaptationsOfTheSameType.splice(newLastMainIdx, 0, parsedAdaptationSet);
|
|
474
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
475
|
-
} else if (oldLastMainIdx === undefined || indexOf > oldLastMainIdx) {
|
|
476
|
-
// Found but was not main
|
|
477
|
-
adaptationsOfTheSameType.splice(indexOf, 1);
|
|
478
|
-
adaptationsOfTheSameType.splice(newLastMainIdx, 0, mergedInto);
|
|
479
|
-
lastMainAdaptationIndex[type] = newLastMainIdx;
|
|
480
|
-
}
|
|
470
|
+
if (mergedIntoIdx < 0) {
|
|
471
|
+
parsedAdaptations[type].push([ parsedAdaptationSet,
|
|
472
|
+
{ priority,
|
|
473
|
+
isMainAdaptation,
|
|
474
|
+
indexInMpd: adaptationIdx }]);
|
|
475
|
+
if (type === "video" && isMainAdaptation) {
|
|
476
|
+
lastMainVideoAdapIdx = parsedAdaptations.video.length - 1;
|
|
481
477
|
}
|
|
482
|
-
} else if (mergedInto === null) {
|
|
483
|
-
adaptationsOfTheSameType.push(parsedAdaptationSet);
|
|
484
478
|
}
|
|
485
479
|
}
|
|
486
480
|
}
|
|
@@ -490,8 +484,59 @@ export default function parseAdaptationSets(
|
|
|
490
484
|
adaptationSetSwitchingIDs };
|
|
491
485
|
}
|
|
492
486
|
}
|
|
493
|
-
|
|
494
|
-
|
|
487
|
+
|
|
488
|
+
const adaptationsPerType = SUPPORTED_ADAPTATIONS_TYPE
|
|
489
|
+
.reduce((acc : IParsedAdaptations, adaptationType : IAdaptationType) => {
|
|
490
|
+
const adaptationsParsedForType = parsedAdaptations[adaptationType];
|
|
491
|
+
if (adaptationsParsedForType.length > 0) {
|
|
492
|
+
adaptationsParsedForType.sort(compareAdaptations);
|
|
493
|
+
acc[adaptationType] = adaptationsParsedForType
|
|
494
|
+
.map(([parsedAdaptation]) => parsedAdaptation);
|
|
495
|
+
}
|
|
496
|
+
return acc;
|
|
497
|
+
}, {});
|
|
498
|
+
parsedAdaptations.video.sort(compareAdaptations);
|
|
499
|
+
attachTrickModeTrack(adaptationsPerType, trickModeAdaptations);
|
|
500
|
+
return adaptationsPerType;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** Metadata allowing to order AdaptationSets between one another. */
|
|
504
|
+
interface IAdaptationSetOrderingData {
|
|
505
|
+
/**
|
|
506
|
+
* If `true`, this AdaptationSet is considered as a "main" one (e.g. it had a
|
|
507
|
+
* Role set to "main").
|
|
508
|
+
*/
|
|
509
|
+
isMainAdaptation : boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Set to the `selectionPriority` attribute of the corresponding AdaptationSet
|
|
512
|
+
* or to `1` by default.
|
|
513
|
+
*/
|
|
514
|
+
priority : number;
|
|
515
|
+
/** Index of this AdaptationSet in the original MPD, starting from `0`. */
|
|
516
|
+
indexInMpd : number;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Compare groups of parsed AdaptationSet, alongside some ordering metadata,
|
|
521
|
+
* allowing to easily sort them through JavaScript's `Array.prototype.sort`
|
|
522
|
+
* method.
|
|
523
|
+
* @param {Array.<Object>} a
|
|
524
|
+
* @param {Array.<Object>} b
|
|
525
|
+
* @returns {number}
|
|
526
|
+
*/
|
|
527
|
+
function compareAdaptations(
|
|
528
|
+
a : [IParsedAdaptation, IAdaptationSetOrderingData],
|
|
529
|
+
b : [IParsedAdaptation, IAdaptationSetOrderingData]
|
|
530
|
+
) : number {
|
|
531
|
+
const priorityDiff = b[1].priority - a[1].priority;
|
|
532
|
+
if (priorityDiff !== 0) {
|
|
533
|
+
return priorityDiff;
|
|
534
|
+
}
|
|
535
|
+
if (a[1].isMainAdaptation !== b[1].isMainAdaptation) {
|
|
536
|
+
return a[1].isMainAdaptation ? -1 :
|
|
537
|
+
1;
|
|
538
|
+
}
|
|
539
|
+
return a[1].indexInMpd - b[1].indexInMpd;
|
|
495
540
|
}
|
|
496
541
|
|
|
497
542
|
/** Context needed when calling `parseAdaptationSets`. */
|
|
@@ -37,7 +37,6 @@ import resolveBaseURLs, {
|
|
|
37
37
|
IResolvedBaseUrl,
|
|
38
38
|
} from "./resolve_base_urls";
|
|
39
39
|
|
|
40
|
-
const { DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 } = config;
|
|
41
40
|
|
|
42
41
|
/** Possible options for `parseMPD`. */
|
|
43
42
|
export interface IMPDParserArguments {
|
|
@@ -277,7 +276,7 @@ function parseCompleteIntermediateRepresentation(
|
|
|
277
276
|
rootAttributes.minimumUpdatePeriod >= 0)
|
|
278
277
|
{
|
|
279
278
|
lifetime = rootAttributes.minimumUpdatePeriod === 0 ?
|
|
280
|
-
DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 :
|
|
279
|
+
config.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0 :
|
|
281
280
|
rootAttributes.minimumUpdatePeriod;
|
|
282
281
|
}
|
|
283
282
|
|
package/src/public_types.ts
CHANGED
|
@@ -45,13 +45,17 @@ export {
|
|
|
45
45
|
ITextTrackPreference,
|
|
46
46
|
IVideoTrackPreference,
|
|
47
47
|
|
|
48
|
+
IBitrateEstimate,
|
|
49
|
+
IPositionUpdateItem as IPositionUpdate,
|
|
50
|
+
IPlayerState,
|
|
51
|
+
|
|
48
52
|
IStreamEvent,
|
|
49
53
|
IStreamEventData,
|
|
50
54
|
} from "./core/api";
|
|
51
55
|
export {
|
|
52
56
|
IPersistentSessionInfo,
|
|
53
57
|
IPersistentSessionStorage,
|
|
54
|
-
} from "./core/
|
|
58
|
+
} from "./core/decrypt";
|
|
55
59
|
export { ICustomError as IPlayerError } from "./errors";
|
|
56
60
|
export {
|
|
57
61
|
IExposedAdaptation as IAdaptation,
|
|
@@ -78,6 +78,7 @@ export function imageParser(
|
|
|
78
78
|
if (content.segment.isInit) { // image init segment has no use
|
|
79
79
|
return { segmentType: "init",
|
|
80
80
|
initializationData: null,
|
|
81
|
+
initializationDataSize: 0,
|
|
81
82
|
protectionDataUpdate: false,
|
|
82
83
|
initTimescale: undefined };
|
|
83
84
|
}
|
|
@@ -92,6 +93,7 @@ export function imageParser(
|
|
|
92
93
|
if (data === null || features.imageParser === null) {
|
|
93
94
|
return { segmentType: "media",
|
|
94
95
|
chunkData: null,
|
|
96
|
+
chunkSize: 0,
|
|
95
97
|
chunkInfos: { duration: segment.duration,
|
|
96
98
|
time: segment.time },
|
|
97
99
|
chunkOffset,
|
|
@@ -107,6 +109,7 @@ export function imageParser(
|
|
|
107
109
|
end: Number.MAX_VALUE,
|
|
108
110
|
timescale: 1,
|
|
109
111
|
type: "bif" },
|
|
112
|
+
chunkSize: undefined,
|
|
110
113
|
chunkInfos: { time: 0,
|
|
111
114
|
duration: Number.MAX_VALUE },
|
|
112
115
|
chunkOffset,
|
|
@@ -64,11 +64,13 @@ export default function generateAudioVideoSegmentParser(
|
|
|
64
64
|
if (segment.isInit) {
|
|
65
65
|
return { segmentType: "init",
|
|
66
66
|
initializationData: null,
|
|
67
|
+
initializationDataSize: 0,
|
|
67
68
|
protectionDataUpdate: false,
|
|
68
69
|
initTimescale: undefined };
|
|
69
70
|
}
|
|
70
71
|
return { segmentType: "media",
|
|
71
72
|
chunkData: null,
|
|
73
|
+
chunkSize: 0,
|
|
72
74
|
chunkInfos: null,
|
|
73
75
|
chunkOffset: 0,
|
|
74
76
|
protectionDataUpdate: false,
|
|
@@ -115,6 +117,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
115
117
|
const { needsManifestRefresh, inbandEvents } = events;
|
|
116
118
|
return { segmentType: "media",
|
|
117
119
|
chunkData,
|
|
120
|
+
chunkSize: chunkData.length,
|
|
118
121
|
chunkInfos,
|
|
119
122
|
chunkOffset,
|
|
120
123
|
appendWindow,
|
|
@@ -127,6 +130,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
127
130
|
|
|
128
131
|
return { segmentType: "media",
|
|
129
132
|
chunkData,
|
|
133
|
+
chunkSize: chunkData.length,
|
|
130
134
|
chunkInfos,
|
|
131
135
|
chunkOffset,
|
|
132
136
|
protectionDataUpdate,
|
|
@@ -177,6 +181,7 @@ export default function generateAudioVideoSegmentParser(
|
|
|
177
181
|
|
|
178
182
|
return { segmentType: "init",
|
|
179
183
|
initializationData: chunkData,
|
|
184
|
+
initializationDataSize: chunkData.length,
|
|
180
185
|
protectionDataUpdate,
|
|
181
186
|
initTimescale: parsedTimescale };
|
|
182
187
|
};
|
|
@@ -102,6 +102,7 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
102
102
|
}
|
|
103
103
|
return { segmentType: "init",
|
|
104
104
|
initializationData: null,
|
|
105
|
+
initializationDataSize: 0,
|
|
105
106
|
protectionDataUpdate: false,
|
|
106
107
|
initTimescale: mdhdTimescale };
|
|
107
108
|
}
|
|
@@ -116,6 +117,7 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
116
117
|
const chunkOffset = takeFirstSet<number>(segment.timestampOffset, 0);
|
|
117
118
|
return { segmentType: "media",
|
|
118
119
|
chunkData,
|
|
120
|
+
chunkSize: chunkBytes.length,
|
|
119
121
|
chunkInfos,
|
|
120
122
|
chunkOffset,
|
|
121
123
|
protectionDataUpdate: false,
|
|
@@ -144,21 +146,25 @@ function parsePlainTextTrack(
|
|
|
144
146
|
if (segment.isInit) {
|
|
145
147
|
return { segmentType: "init",
|
|
146
148
|
initializationData: null,
|
|
149
|
+
initializationDataSize: 0,
|
|
147
150
|
protectionDataUpdate: false,
|
|
148
151
|
initTimescale: undefined };
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
let textTrackData : string;
|
|
155
|
+
let chunkSize : number | undefined;
|
|
152
156
|
if (typeof data !== "string") {
|
|
153
157
|
const bytesData = data instanceof Uint8Array ? data :
|
|
154
158
|
new Uint8Array(data);
|
|
155
159
|
textTrackData = utf8ToStr(bytesData);
|
|
160
|
+
chunkSize = bytesData.length;
|
|
156
161
|
} else {
|
|
157
162
|
textTrackData = data;
|
|
158
163
|
}
|
|
159
164
|
const chunkData = getPlainTextTrackData(content, textTrackData, isChunked);
|
|
160
165
|
return { segmentType: "media",
|
|
161
166
|
chunkData,
|
|
167
|
+
chunkSize,
|
|
162
168
|
chunkInfos: null,
|
|
163
169
|
chunkOffset: timestampOffset,
|
|
164
170
|
protectionDataUpdate: false,
|
|
@@ -196,11 +202,13 @@ export default function generateTextTrackParser(
|
|
|
196
202
|
// No data, just return an empty placeholder object
|
|
197
203
|
return segment.isInit ? { segmentType: "init",
|
|
198
204
|
initializationData: null,
|
|
205
|
+
initializationDataSize: 0,
|
|
199
206
|
protectionDataUpdate: false,
|
|
200
207
|
initTimescale: undefined } :
|
|
201
208
|
|
|
202
209
|
{ segmentType: "media",
|
|
203
210
|
chunkData: null,
|
|
211
|
+
chunkSize: 0,
|
|
204
212
|
chunkInfos: null,
|
|
205
213
|
chunkOffset: segment.timestampOffset ?? 0,
|
|
206
214
|
protectionDataUpdate: false,
|
|
@@ -44,11 +44,13 @@ export default function segmentParser(
|
|
|
44
44
|
if (segment.isInit) {
|
|
45
45
|
return { segmentType: "init",
|
|
46
46
|
initializationData: null,
|
|
47
|
+
initializationDataSize: 0,
|
|
47
48
|
protectionDataUpdate: false,
|
|
48
49
|
initTimescale: undefined };
|
|
49
50
|
}
|
|
50
51
|
return { segmentType: "media",
|
|
51
52
|
chunkData: null,
|
|
53
|
+
chunkSize: 0,
|
|
52
54
|
chunkInfos: null,
|
|
53
55
|
chunkOffset: 0,
|
|
54
56
|
protectionDataUpdate: false,
|
|
@@ -74,6 +76,7 @@ export default function segmentParser(
|
|
|
74
76
|
getMDHDTimescale(chunkData);
|
|
75
77
|
return { segmentType: "init",
|
|
76
78
|
initializationData: chunkData,
|
|
79
|
+
initializationDataSize: 0,
|
|
77
80
|
initTimescale: timescale ?? undefined,
|
|
78
81
|
protectionDataUpdate };
|
|
79
82
|
}
|
|
@@ -86,6 +89,7 @@ export default function segmentParser(
|
|
|
86
89
|
const chunkOffset = takeFirstSet<number>(segment.timestampOffset, 0);
|
|
87
90
|
return { segmentType: "media",
|
|
88
91
|
chunkData,
|
|
92
|
+
chunkSize: chunkData.length,
|
|
89
93
|
chunkInfos,
|
|
90
94
|
chunkOffset,
|
|
91
95
|
protectionDataUpdate: false,
|
|
@@ -66,6 +66,7 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
66
66
|
const mdhdTimescale = getMDHDTimescale(chunkBytes);
|
|
67
67
|
return { segmentType: "init",
|
|
68
68
|
initializationData: null,
|
|
69
|
+
initializationDataSize: 0,
|
|
69
70
|
initTimescale: mdhdTimescale,
|
|
70
71
|
protectionDataUpdate: false };
|
|
71
72
|
}
|
|
@@ -80,6 +81,7 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
80
81
|
const chunkOffset = takeFirstSet<number>(segment.timestampOffset, 0);
|
|
81
82
|
return { segmentType: "media",
|
|
82
83
|
chunkData,
|
|
84
|
+
chunkSize: chunkBytes.length,
|
|
83
85
|
chunkInfos,
|
|
84
86
|
chunkOffset,
|
|
85
87
|
protectionDataUpdate: false,
|
|
@@ -107,15 +109,18 @@ function parsePlainTextTrack(
|
|
|
107
109
|
if (segment.isInit) {
|
|
108
110
|
return { segmentType: "init",
|
|
109
111
|
initializationData: null,
|
|
112
|
+
initializationDataSize: 0,
|
|
110
113
|
initTimescale: undefined,
|
|
111
114
|
protectionDataUpdate: false };
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
let textTrackData : string;
|
|
118
|
+
let chunkSize : number | undefined;
|
|
115
119
|
if (typeof data !== "string") {
|
|
116
120
|
const bytesData = data instanceof Uint8Array ? data :
|
|
117
121
|
new Uint8Array(data);
|
|
118
122
|
textTrackData = utf8ToStr(bytesData);
|
|
123
|
+
chunkSize = bytesData.length;
|
|
119
124
|
} else {
|
|
120
125
|
textTrackData = data;
|
|
121
126
|
}
|
|
@@ -123,6 +128,7 @@ function parsePlainTextTrack(
|
|
|
123
128
|
const chunkOffset = takeFirstSet<number>(segment.timestampOffset, 0);
|
|
124
129
|
return { segmentType: "media",
|
|
125
130
|
chunkData,
|
|
131
|
+
chunkSize,
|
|
126
132
|
chunkInfos: null,
|
|
127
133
|
chunkOffset,
|
|
128
134
|
protectionDataUpdate: false,
|
|
@@ -152,12 +158,14 @@ export default function textTrackParser(
|
|
|
152
158
|
if (segment.isInit) {
|
|
153
159
|
return { segmentType: "init",
|
|
154
160
|
initializationData: null,
|
|
161
|
+
initializationDataSize: 0,
|
|
155
162
|
protectionDataUpdate: false,
|
|
156
163
|
initTimescale: undefined };
|
|
157
164
|
}
|
|
158
165
|
const chunkOffset = segment.timestampOffset ?? 0;
|
|
159
166
|
return { segmentType: "media",
|
|
160
167
|
chunkData: null,
|
|
168
|
+
chunkSize: 0,
|
|
161
169
|
chunkInfos: null,
|
|
162
170
|
chunkOffset,
|
|
163
171
|
protectionDataUpdate: false,
|
|
@@ -198,6 +198,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
198
198
|
if (segment.isInit) {
|
|
199
199
|
return { segmentType: "init",
|
|
200
200
|
initializationData: null,
|
|
201
|
+
initializationDataSize: 0,
|
|
201
202
|
protectionDataUpdate: false,
|
|
202
203
|
initTimescale: undefined };
|
|
203
204
|
}
|
|
@@ -205,6 +206,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
205
206
|
chunkData: null,
|
|
206
207
|
chunkInfos: null,
|
|
207
208
|
chunkOffset: 0,
|
|
209
|
+
chunkSize: 0,
|
|
208
210
|
protectionDataUpdate: false,
|
|
209
211
|
appendWindow: [undefined, undefined] };
|
|
210
212
|
}
|
|
@@ -216,6 +218,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
216
218
|
const timescale = segment.privateInfos?.smoothInitSegment?.timescale;
|
|
217
219
|
return { segmentType: "init",
|
|
218
220
|
initializationData: data,
|
|
221
|
+
initializationDataSize: data.byteLength,
|
|
219
222
|
// smooth init segments are crafted by hand.
|
|
220
223
|
// Their timescale is the one from the manifest.
|
|
221
224
|
initTimescale: timescale,
|
|
@@ -244,6 +247,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
244
247
|
chunkData,
|
|
245
248
|
chunkInfos,
|
|
246
249
|
chunkOffset: 0,
|
|
250
|
+
chunkSize: chunkData.length,
|
|
247
251
|
protectionDataUpdate: false,
|
|
248
252
|
appendWindow: [undefined, undefined] };
|
|
249
253
|
},
|
|
@@ -302,9 +306,11 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
302
306
|
const isMP4 = isMP4EmbeddedTrack(representation);
|
|
303
307
|
const { mimeType = "", codec = "" } = representation;
|
|
304
308
|
const { data, isChunked } = loadedSegment;
|
|
309
|
+
let chunkSize : number | undefined;
|
|
305
310
|
if (segment.isInit) { // text init segment has no use in HSS
|
|
306
311
|
return { segmentType: "init",
|
|
307
312
|
initializationData: null,
|
|
313
|
+
initializationDataSize: 0,
|
|
308
314
|
protectionDataUpdate: false,
|
|
309
315
|
initTimescale: undefined };
|
|
310
316
|
}
|
|
@@ -313,6 +319,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
313
319
|
chunkData: null,
|
|
314
320
|
chunkInfos: null,
|
|
315
321
|
chunkOffset: 0,
|
|
322
|
+
chunkSize: 0,
|
|
316
323
|
protectionDataUpdate: false,
|
|
317
324
|
appendWindow: [undefined, undefined] };
|
|
318
325
|
}
|
|
@@ -333,6 +340,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
333
340
|
chunkBytes = data instanceof Uint8Array ? data :
|
|
334
341
|
new Uint8Array(data);
|
|
335
342
|
}
|
|
343
|
+
chunkSize = chunkBytes.length;
|
|
336
344
|
const timingInfos = initTimescale !== undefined ?
|
|
337
345
|
extractTimingsInfos(chunkBytes,
|
|
338
346
|
isChunked,
|
|
@@ -380,6 +388,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
380
388
|
if (typeof data !== "string") {
|
|
381
389
|
const bytesData = data instanceof Uint8Array ? data :
|
|
382
390
|
new Uint8Array(data);
|
|
391
|
+
chunkSize = bytesData.length;
|
|
383
392
|
chunkString = utf8ToStr(bytesData);
|
|
384
393
|
} else {
|
|
385
394
|
chunkString = data;
|
|
@@ -423,6 +432,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
423
432
|
start: segmentStart,
|
|
424
433
|
end: segmentEnd,
|
|
425
434
|
language },
|
|
435
|
+
chunkSize,
|
|
426
436
|
chunkInfos,
|
|
427
437
|
chunkOffset,
|
|
428
438
|
protectionDataUpdate: false,
|
|
@@ -431,7 +441,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
431
441
|
};
|
|
432
442
|
|
|
433
443
|
const imageTrackPipeline = {
|
|
434
|
-
loadSegment(
|
|
444
|
+
async loadSegment(
|
|
435
445
|
url : string | null,
|
|
436
446
|
content : ISegmentContext,
|
|
437
447
|
cancelSignal : CancellationSignal,
|
|
@@ -440,16 +450,16 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
440
450
|
ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>> {
|
|
441
451
|
if (content.segment.isInit || url === null) {
|
|
442
452
|
// image do not need an init segment. Passthrough directly to the parser
|
|
443
|
-
return
|
|
444
|
-
|
|
453
|
+
return { resultType: "segment-created" as const,
|
|
454
|
+
resultData: null };
|
|
445
455
|
}
|
|
446
456
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
457
|
+
const data = await request({ url,
|
|
458
|
+
responseType: "arraybuffer",
|
|
459
|
+
onProgress: callbacks.onProgress,
|
|
460
|
+
cancelSignal });
|
|
461
|
+
return { resultType: "segment-loaded" as const,
|
|
462
|
+
resultData: data };
|
|
453
463
|
},
|
|
454
464
|
|
|
455
465
|
parseSegment(
|
|
@@ -465,6 +475,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
465
475
|
if (content.segment.isInit) { // image init segment has no use
|
|
466
476
|
return { segmentType: "init",
|
|
467
477
|
initializationData: null,
|
|
478
|
+
initializationDataSize: 0,
|
|
468
479
|
protectionDataUpdate: false,
|
|
469
480
|
initTimescale: undefined };
|
|
470
481
|
}
|
|
@@ -479,6 +490,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
479
490
|
chunkData: null,
|
|
480
491
|
chunkInfos: null,
|
|
481
492
|
chunkOffset: 0,
|
|
493
|
+
chunkSize: 0,
|
|
482
494
|
protectionDataUpdate: false,
|
|
483
495
|
appendWindow: [undefined, undefined] };
|
|
484
496
|
}
|
|
@@ -493,6 +505,7 @@ export default function(options : ITransportOptions) : ITransportPipelines {
|
|
|
493
505
|
type: "bif" },
|
|
494
506
|
chunkInfos: { time: 0,
|
|
495
507
|
duration: Number.MAX_VALUE },
|
|
508
|
+
chunkSize: undefined,
|
|
496
509
|
chunkOffset: 0,
|
|
497
510
|
protectionDataUpdate: false,
|
|
498
511
|
appendWindow: [undefined, undefined] };
|