rx-player 4.0.0-beta.0 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +8 -0
- package/CHANGELOG.md +93 -0
- package/CONTRIBUTING.md +48 -168
- package/FILES.md +40 -92
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.d.ts +25 -12
- package/dist/_esm5.processed/compat/browser_detection.js +85 -38
- package/dist/_esm5.processed/compat/can_reuse_media_keys.js +2 -2
- package/dist/_esm5.processed/compat/eme/close_session.js +2 -2
- package/dist/_esm5.processed/compat/eme/load_session.js +1 -1
- package/dist/_esm5.processed/compat/event_listeners.js +1 -1
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +26 -0
- package/dist/_esm5.processed/config.d.ts +4 -0
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +9 -6
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +18 -1
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +106 -25
- package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +6 -6
- package/dist/_esm5.processed/core/adaptive/network_analyzer.js +8 -5
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +19 -1
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +1 -1
- package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +104 -0
- package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
- package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/index.js +2 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +180 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
- package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/render.js +32 -0
- package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
- package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
- package/dist/_esm5.processed/core/api/playback_observer.js +4 -2
- package/dist/_esm5.processed/core/api/public_api.d.ts +60 -3
- package/dist/_esm5.processed/core/api/public_api.js +280 -60
- package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +10 -1
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +13 -1
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +30 -15
- package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +3 -1
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +67 -152
- package/dist/_esm5.processed/core/api/utils.d.ts +10 -0
- package/dist/_esm5.processed/core/api/utils.js +23 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +27 -8
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +29 -6
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +42 -32
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +2 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +5 -1
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +17 -7
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +2 -2
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +74 -41
- package/dist/_esm5.processed/core/init/types.d.ts +9 -1
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +28 -1
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +24 -11
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +58 -0
- package/dist/_esm5.processed/core/init/utils/{media_duration_updater.js → media_source_duration_updater.js} +87 -86
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +36 -2
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +83 -3
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
- package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
- 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 +38 -50
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +8 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +16 -2
- 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/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +30 -16
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +47 -0
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +70 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +41 -20
- package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -11
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +37 -28
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +3 -3
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
- 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 +8 -8
- 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/core/stream/utils/create_reload_request.js +1 -1
- package/dist/_esm5.processed/default_config.d.ts +41 -0
- package/dist/_esm5.processed/default_config.js +46 -2
- package/dist/_esm5.processed/errors/index.d.ts +2 -2
- package/dist/_esm5.processed/errors/media_error.d.ts +23 -1
- package/dist/_esm5.processed/errors/media_error.js +18 -5
- package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
- package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
- package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
- package/dist/_esm5.processed/experimental/features/index.js +1 -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/prepare_source_buffer.js +7 -4
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +24 -12
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +0 -2
- package/dist/_esm5.processed/features/features_object.js +1 -0
- package/dist/_esm5.processed/features/initialize_features.js +13 -10
- package/dist/_esm5.processed/features/types.d.ts +3 -0
- package/dist/_esm5.processed/manifest/adaptation.d.ts +21 -2
- package/dist/_esm5.processed/manifest/adaptation.js +80 -1
- package/dist/_esm5.processed/manifest/manifest.js +2 -0
- package/dist/_esm5.processed/manifest/period.js +2 -2
- package/dist/_esm5.processed/manifest/representation.d.ts +33 -2
- package/dist/_esm5.processed/manifest/representation.js +32 -4
- package/dist/_esm5.processed/manifest/utils.js +1 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -0
- package/dist/_esm5.processed/public_types.d.ts +13 -3
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +1 -1
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +15 -11
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.d.ts +4 -6
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +4 -6
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
- package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
- package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
- package/dist/_esm5.processed/utils/is_null_or_undefined.d.ts +1 -1
- package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -1
- package/dist/_esm5.processed/utils/reference.js +6 -0
- package/dist/_esm5.processed/utils/request/xhr.js +1 -1
- package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
- package/dist/_esm5.processed/utils/task_canceller.js +55 -22
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +5424 -4712
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -5
- package/package.json +44 -40
- package/scripts/build/constants.d.ts +1 -0
- package/scripts/build/generate_build.js +1 -1
- package/scripts/fast_demo_build.js +40 -40
- package/scripts/generate_full_demo.js +1 -1
- package/sonar-project.properties +1 -1
- package/src/compat/browser_detection.ts +105 -52
- package/src/compat/can_reuse_media_keys.ts +5 -2
- package/src/compat/eme/close_session.ts +2 -2
- package/src/compat/eme/load_session.ts +1 -1
- package/src/compat/event_listeners.ts +1 -1
- package/src/compat/has_issues_with_high_media_source_duration.ts +27 -0
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +147 -48
- package/src/core/adaptive/adaptive_representation_selector.ts +11 -6
- package/src/core/adaptive/buffer_based_chooser.ts +144 -26
- package/src/core/adaptive/guess_based_chooser.ts +9 -8
- package/src/core/adaptive/network_analyzer.ts +9 -4
- package/src/core/adaptive/utils/representation_score_calculator.ts +22 -2
- package/src/core/api/debug/buffer_graph.ts +247 -0
- package/src/core/api/debug/buffer_size_graph.ts +130 -0
- package/src/core/api/debug/constants.ts +2 -0
- package/src/core/api/debug/index.ts +3 -0
- package/src/core/api/debug/modules/general_info.ts +184 -0
- package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
- package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
- package/src/core/api/debug/render.ts +40 -0
- package/src/core/api/debug/utils.ts +103 -0
- package/src/core/api/playback_observer.ts +5 -2
- package/src/core/api/public_api.ts +334 -73
- package/src/core/api/track_management/media_element_tracks_store.ts +17 -8
- package/src/core/api/track_management/track_dispatcher.ts +37 -14
- package/src/core/api/track_management/tracks_store.ts +77 -167
- package/src/core/api/utils.ts +29 -3
- package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
- package/src/core/decrypt/attach_media_keys.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +1 -1
- package/src/core/decrypt/find_key_system.ts +25 -11
- package/src/core/decrypt/session_events_listener.ts +45 -39
- package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
- package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +2 -1
- package/src/core/decrypt/utils/loaded_sessions_store.ts +8 -1
- package/src/core/fetchers/cdn_prioritizer.ts +18 -9
- package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
- package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
- package/src/core/fetchers/utils/schedule_request.ts +18 -7
- package/src/core/init/directfile_content_initializer.ts +2 -1
- package/src/core/init/media_source_content_initializer.ts +89 -50
- package/src/core/init/types.ts +9 -1
- package/src/core/init/utils/content_time_boundaries_observer.ts +48 -12
- package/src/core/init/utils/create_media_source.ts +4 -16
- package/src/core/init/utils/end_of_stream.ts +6 -3
- package/src/core/init/utils/get_loaded_reference.ts +2 -1
- package/src/core/init/utils/initial_seek_and_play.ts +9 -5
- package/src/core/init/utils/initialize_content_decryption.ts +2 -1
- package/src/core/init/utils/{media_duration_updater.ts → media_source_duration_updater.ts} +103 -110
- package/src/core/init/utils/rebuffering_controller.ts +115 -4
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
- package/src/core/init/utils/throw_on_media_error.ts +1 -1
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +63 -66
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +20 -2
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +16 -0
- package/src/core/segment_buffers/implementations/types.ts +16 -4
- package/src/core/segment_buffers/index.ts +2 -0
- package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
- package/src/core/stream/adaptation/adaptation_stream.ts +33 -19
- package/src/core/stream/adaptation/utils/create_representation_estimator.ts +114 -0
- package/src/core/stream/orchestrator/stream_orchestrator.ts +42 -20
- package/src/core/stream/period/period_stream.ts +13 -11
- package/src/core/stream/representation/representation_stream.ts +49 -37
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +9 -4
- package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
- package/src/core/stream/representation/utils/push_init_segment.ts +11 -6
- package/src/core/stream/representation/utils/push_media_segment.ts +3 -3
- package/src/core/stream/utils/create_reload_request.ts +1 -1
- package/src/default_config.ts +59 -11
- package/src/errors/__tests__/media_error.test.ts +6 -6
- package/src/errors/index.ts +4 -1
- package/src/errors/media_error.ts +67 -1
- package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
- package/src/experimental/features/debug_element.ts +13 -0
- package/src/experimental/features/index.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +10 -7
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +25 -10
- package/src/experimental/tools/mediaCapabilitiesProber/index.ts +0 -4
- package/src/features/__tests__/initialize_features.test.ts +11 -0
- package/src/features/features_object.ts +1 -0
- package/src/features/initialize_features.ts +15 -10
- package/src/features/types.ts +9 -0
- package/src/manifest/__tests__/manifest.test.ts +7 -7
- package/src/manifest/__tests__/period.test.ts +90 -45
- package/src/manifest/adaptation.ts +96 -1
- package/src/manifest/manifest.ts +4 -0
- package/src/manifest/period.ts +4 -2
- package/src/manifest/representation.ts +77 -5
- package/src/manifest/utils.ts +1 -3
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
- package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
- package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +1 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -0
- package/src/parsers/texttracks/ttml/parse_ttml.ts +1 -1
- package/src/public_types.ts +16 -1
- package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +31 -22
- package/src/transports/dash/low_latency_segment_loader.ts +2 -2
- package/src/transports/dash/manifest_parser.ts +1 -1
- package/src/transports/dash/segment_loader.ts +4 -4
- package/src/transports/local/segment_loader.ts +14 -30
- package/src/transports/smooth/isobmff/create_boxes.ts +4 -6
- package/src/transports/smooth/segment_loader.ts +4 -4
- package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
- package/src/typings/globals.d.ts +21 -19
- package/src/utils/cancellable_sleep.ts +5 -14
- package/src/utils/create_cancellable_promise.ts +69 -0
- package/src/utils/is_null_or_undefined.ts +1 -1
- package/src/utils/reference.ts +6 -0
- package/src/utils/request/xhr.ts +1 -1
- package/src/utils/task_canceller.ts +63 -34
- package/tsconfig.json +1 -1
- package/tsconfig.modules.json +1 -1
- package/dist/_esm5.processed/core/init/utils/media_duration_updater.d.ts +0 -56
- package/locked_reps.js +0 -46
- package/scripts/doc-generator/construct_table_of_contents.js +0 -76
- package/scripts/doc-generator/convert_MD_to_HMTL.js +0 -26
- package/scripts/doc-generator/create_documentation.js +0 -331
- package/scripts/doc-generator/create_documentation_page.js +0 -209
- package/scripts/doc-generator/create_page.js +0 -210
- package/scripts/doc-generator/generate_header_html.js +0 -147
- package/scripts/doc-generator/generate_page_html.js +0 -115
- package/scripts/doc-generator/generate_page_list_html.js +0 -92
- package/scripts/doc-generator/generate_sidebar_html.js +0 -85
- package/scripts/doc-generator/get_search_data_for_content.js +0 -137
- package/scripts/doc-generator/index.js +0 -34
- package/scripts/doc-generator/parse_doc_configs.js +0 -327
- package/scripts/doc-generator/scripts/lunr.js +0 -10
- package/scripts/doc-generator/scripts/script.js +0 -451
- package/scripts/doc-generator/styles/code.css +0 -99
- package/scripts/doc-generator/styles/style.css +0 -835
- package/scripts/doc-generator/utils.js +0 -74
|
@@ -32,7 +32,7 @@ export default function createReloadRequest (
|
|
|
32
32
|
timeBounds : { start : number | undefined; end : number | undefined },
|
|
33
33
|
cancelSignal : CancellationSignal
|
|
34
34
|
) : void {
|
|
35
|
-
if (cancelSignal.isCancelled) {
|
|
35
|
+
if (cancelSignal.isCancelled()) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
package/src/default_config.ts
CHANGED
|
@@ -374,6 +374,33 @@ const DEFAULT_CONFIG = {
|
|
|
374
374
|
*/
|
|
375
375
|
SAMPLING_INTERVAL_NO_MEDIASOURCE: 500,
|
|
376
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Amount of buffer to have ahead of the current position before we may
|
|
379
|
+
* consider buffer-based adaptive estimates, in seconds.
|
|
380
|
+
*
|
|
381
|
+
* For example setting it to `10` means that we need to have ten seconds of
|
|
382
|
+
* buffer ahead of the current position before relying on buffer-based
|
|
383
|
+
* adaptive estimates.
|
|
384
|
+
*
|
|
385
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
386
|
+
* should be set higher than `ABR_EXIT_BUFFER_BASED_ALGO`.
|
|
387
|
+
*/
|
|
388
|
+
ABR_ENTER_BUFFER_BASED_ALGO: 10,
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Below this amount of buffer ahead of the current position, in seconds, we
|
|
392
|
+
* will stop using buffer-based estimate in our adaptive logic to select a
|
|
393
|
+
* quality.
|
|
394
|
+
*
|
|
395
|
+
* For example setting it to `5` means that if we have less than 5 seconds of
|
|
396
|
+
* buffer ahead of the current position, we should stop relying on
|
|
397
|
+
* buffer-based estimates to choose a quality.
|
|
398
|
+
*
|
|
399
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
400
|
+
* should be set lower than `ABR_ENTER_BUFFER_BASED_ALGO`.
|
|
401
|
+
*/
|
|
402
|
+
ABR_EXIT_BUFFER_BASED_ALGO: 5,
|
|
403
|
+
|
|
377
404
|
/**
|
|
378
405
|
* Minimum number of bytes sampled before we trust the estimate.
|
|
379
406
|
* If we have not sampled much data, our estimate may not be accurate
|
|
@@ -412,8 +439,8 @@ const DEFAULT_CONFIG = {
|
|
|
412
439
|
* @type {Object}
|
|
413
440
|
*/
|
|
414
441
|
ABR_REGULAR_FACTOR: {
|
|
415
|
-
DEFAULT: 0.
|
|
416
|
-
LOW_LATENCY: 0.
|
|
442
|
+
DEFAULT: 0.72,
|
|
443
|
+
LOW_LATENCY: 0.72,
|
|
417
444
|
},
|
|
418
445
|
|
|
419
446
|
/**
|
|
@@ -810,15 +837,36 @@ const DEFAULT_CONFIG = {
|
|
|
810
837
|
*/
|
|
811
838
|
MIN_CANCELABLE_PRIORITY: 3, // priority number 3 onward can be cancelled
|
|
812
839
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
840
|
+
/**
|
|
841
|
+
* Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
|
|
842
|
+
* (DRM).
|
|
843
|
+
*
|
|
844
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
845
|
+
* @type {Array.<string>}
|
|
846
|
+
*/
|
|
847
|
+
EME_DEFAULT_VIDEO_CODECS: [ "video/mp4;codecs=\"avc1.4d401e\"",
|
|
848
|
+
"video/mp4;codecs=\"avc1.42e01e\"",
|
|
849
|
+
"video/webm;codecs=\"vp8\"" ],
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
|
|
853
|
+
* (DRM).
|
|
854
|
+
*
|
|
855
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
856
|
+
* @type {Array.<string>}
|
|
857
|
+
*/
|
|
858
|
+
EME_DEFAULT_AUDIO_CODECS: [ "audio/mp4;codecs=\"mp4a.40.2\"",
|
|
859
|
+
"audio/webm;codecs=opus" ],
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Robustnesses used in the {audio,video}Capabilities of the
|
|
863
|
+
* MediaKeySystemConfiguration (DRM).
|
|
864
|
+
*
|
|
865
|
+
* Only used for widevine keysystems.
|
|
866
|
+
*
|
|
867
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
868
|
+
* @type {Array.<string>}
|
|
869
|
+
*/
|
|
822
870
|
EME_DEFAULT_WIDEVINE_ROBUSTNESSES: [ "HW_SECURE_ALL",
|
|
823
871
|
"HW_SECURE_DECODE",
|
|
824
872
|
"HW_SECURE_CRYPTO",
|
|
@@ -19,25 +19,25 @@ import MediaError from "../media_error";
|
|
|
19
19
|
describe("errors - MediaError", () => {
|
|
20
20
|
it("should format a MediaError", () => {
|
|
21
21
|
const reason = "test";
|
|
22
|
-
const mediaError = new MediaError("
|
|
22
|
+
const mediaError = new MediaError("MEDIA_TIME_BEFORE_MANIFEST", reason);
|
|
23
23
|
expect(mediaError).toBeInstanceOf(Error);
|
|
24
24
|
expect(mediaError.name).toBe("MediaError");
|
|
25
25
|
expect(mediaError.type).toBe("MEDIA_ERROR");
|
|
26
|
-
expect(mediaError.code).toBe("
|
|
26
|
+
expect(mediaError.code).toBe("MEDIA_TIME_BEFORE_MANIFEST");
|
|
27
27
|
expect(mediaError.fatal).toBe(false);
|
|
28
|
-
expect(mediaError.message).toBe("MediaError (
|
|
28
|
+
expect(mediaError.message).toBe("MediaError (MEDIA_TIME_BEFORE_MANIFEST) test");
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it("should be able to set it as fatal", () => {
|
|
32
32
|
const reason = "test";
|
|
33
|
-
const mediaError = new MediaError("
|
|
33
|
+
const mediaError = new MediaError("MEDIA_TIME_AFTER_MANIFEST", reason);
|
|
34
34
|
mediaError.fatal = true;
|
|
35
35
|
expect(mediaError).toBeInstanceOf(Error);
|
|
36
36
|
expect(mediaError.name).toBe("MediaError");
|
|
37
37
|
expect(mediaError.type).toBe("MEDIA_ERROR");
|
|
38
|
-
expect(mediaError.code).toBe("
|
|
38
|
+
expect(mediaError.code).toBe("MEDIA_TIME_AFTER_MANIFEST");
|
|
39
39
|
expect(mediaError.fatal).toBe(true);
|
|
40
|
-
expect(mediaError.message).toBe("MediaError (
|
|
40
|
+
expect(mediaError.message).toBe("MediaError (MEDIA_TIME_AFTER_MANIFEST) test");
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it("should filter in a valid error code", () => {
|
package/src/errors/index.ts
CHANGED
|
@@ -26,7 +26,9 @@ import {
|
|
|
26
26
|
} from "./error_codes";
|
|
27
27
|
import formatError from "./format_error";
|
|
28
28
|
import isKnownError from "./is_known_error";
|
|
29
|
-
import MediaError
|
|
29
|
+
import MediaError, {
|
|
30
|
+
IMediaErrorTrackContext,
|
|
31
|
+
} from "./media_error";
|
|
30
32
|
import NetworkError from "./network_error";
|
|
31
33
|
import OtherError from "./other_error";
|
|
32
34
|
import RequestError from "./request_error";
|
|
@@ -39,6 +41,7 @@ export {
|
|
|
39
41
|
ErrorTypes,
|
|
40
42
|
IErrorCode,
|
|
41
43
|
IErrorType,
|
|
44
|
+
IMediaErrorTrackContext,
|
|
42
45
|
formatError,
|
|
43
46
|
MediaError as MediaError,
|
|
44
47
|
NetworkError,
|
|
@@ -14,12 +14,42 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { Adaptation } from "../manifest";
|
|
18
|
+
import {
|
|
19
|
+
IAudioTrack,
|
|
20
|
+
ITextTrack,
|
|
21
|
+
IVideoTrack,
|
|
22
|
+
} from "../public_types";
|
|
17
23
|
import {
|
|
18
24
|
ErrorTypes,
|
|
19
25
|
IMediaErrorCode,
|
|
20
26
|
} from "./error_codes";
|
|
21
27
|
import errorMessage from "./error_message";
|
|
22
28
|
|
|
29
|
+
interface IAudioTrackMediaErrorContext {
|
|
30
|
+
type : "audio";
|
|
31
|
+
track : IAudioTrack;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface IVideoTrackMediaErrorContext {
|
|
35
|
+
type : "video";
|
|
36
|
+
track : IVideoTrack;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface ITextTrackMediaErrorContext {
|
|
40
|
+
type : "text";
|
|
41
|
+
track : ITextTrack;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type IMediaErrorTrackContext = IAudioTrackMediaErrorContext |
|
|
45
|
+
IVideoTrackMediaErrorContext |
|
|
46
|
+
ITextTrackMediaErrorContext;
|
|
47
|
+
|
|
48
|
+
type ICodeWithAdaptationType = "BUFFER_APPEND_ERROR" |
|
|
49
|
+
"BUFFER_FULL_ERROR" |
|
|
50
|
+
"NO_PLAYABLE_REPRESENTATION" |
|
|
51
|
+
"MANIFEST_INCOMPATIBLE_CODECS_ERROR";
|
|
52
|
+
|
|
23
53
|
/**
|
|
24
54
|
* Error linked to the media Playback.
|
|
25
55
|
*
|
|
@@ -31,13 +61,32 @@ export default class MediaError extends Error {
|
|
|
31
61
|
public readonly type : "MEDIA_ERROR";
|
|
32
62
|
public readonly message : string;
|
|
33
63
|
public readonly code : IMediaErrorCode;
|
|
64
|
+
public readonly trackInfo : IMediaErrorTrackContext | undefined;
|
|
34
65
|
public fatal : boolean;
|
|
35
66
|
|
|
36
67
|
/**
|
|
37
68
|
* @param {string} code
|
|
38
69
|
* @param {string} reason
|
|
70
|
+
* @param {Object|undefined} [context]
|
|
39
71
|
*/
|
|
40
|
-
constructor(
|
|
72
|
+
constructor(
|
|
73
|
+
code : ICodeWithAdaptationType,
|
|
74
|
+
reason : string,
|
|
75
|
+
context: {
|
|
76
|
+
adaptation : Adaptation | undefined;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
constructor(
|
|
80
|
+
code : Exclude<IMediaErrorCode, ICodeWithAdaptationType>,
|
|
81
|
+
reason : string,
|
|
82
|
+
);
|
|
83
|
+
constructor(
|
|
84
|
+
code : IMediaErrorCode,
|
|
85
|
+
reason : string,
|
|
86
|
+
context? : {
|
|
87
|
+
adaptation? : Adaptation | undefined;
|
|
88
|
+
} | undefined
|
|
89
|
+
) {
|
|
41
90
|
super();
|
|
42
91
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
43
92
|
Object.setPrototypeOf(this, MediaError.prototype);
|
|
@@ -48,5 +97,22 @@ export default class MediaError extends Error {
|
|
|
48
97
|
this.code = code;
|
|
49
98
|
this.message = errorMessage(this.name, this.code, reason);
|
|
50
99
|
this.fatal = false;
|
|
100
|
+
const adaptation = context?.adaptation;
|
|
101
|
+
if (adaptation !== undefined) {
|
|
102
|
+
switch (adaptation.type) {
|
|
103
|
+
case "audio":
|
|
104
|
+
this.trackInfo = { type: "audio",
|
|
105
|
+
track: adaptation.toAudioTrack(false) };
|
|
106
|
+
break;
|
|
107
|
+
case "video":
|
|
108
|
+
this.trackInfo = { type: "video",
|
|
109
|
+
track: adaptation.toVideoTrack(false) };
|
|
110
|
+
break;
|
|
111
|
+
case "text":
|
|
112
|
+
this.trackInfo = { type: "text",
|
|
113
|
+
track: adaptation.toTextTrack() };
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
51
117
|
}
|
|
52
118
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
7
|
+
|
|
8
|
+
describe("Features list - DEBUG_ELEMENT", () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.resetModules();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should add DEBUG_ELEMENT in the current features", () => {
|
|
14
|
+
const feat = {};
|
|
15
|
+
jest.mock("../../../core/api/debug", () => ({ __esModule: true as const,
|
|
16
|
+
default: feat }));
|
|
17
|
+
const addFeature = jest.requireActual("../debug_element").default;
|
|
18
|
+
|
|
19
|
+
const featureObject : {
|
|
20
|
+
createDebugElement? : unknown;
|
|
21
|
+
} = {};
|
|
22
|
+
addFeature(featureObject);
|
|
23
|
+
expect(featureObject).toEqual({ createDebugElement: {} });
|
|
24
|
+
expect(featureObject.createDebugElement).toBe(feat);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import createDebugElement from "../../core/api/debug";
|
|
2
|
+
import { IFeaturesObject } from "../../features/types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Add ability to parse SAMI text tracks in an HTML textrack mode.
|
|
6
|
+
* @param {Object} features
|
|
7
|
+
*/
|
|
8
|
+
function addDebugElementFeature(features : IFeaturesObject) : void {
|
|
9
|
+
features.createDebugElement = createDebugElement;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { addDebugElementFeature as DEBUG_ELEMENT };
|
|
13
|
+
export default addDebugElementFeature;
|
|
@@ -33,30 +33,33 @@ export default function loadAndPushSegment(
|
|
|
33
33
|
segmentInfo : ISegmentLoaderContent,
|
|
34
34
|
segmentBuffer: AudioVideoSegmentBuffer,
|
|
35
35
|
segmentFetcher: ISegmentFetcher<ArrayBuffer | Uint8Array>,
|
|
36
|
+
initSegmentUniqueId : string | null,
|
|
36
37
|
cancelSignal: CancellationSignal
|
|
37
38
|
): Promise<unknown> {
|
|
38
39
|
const pushOperations : Array<Promise<unknown>> = [];
|
|
39
40
|
return segmentFetcher(segmentInfo, {
|
|
40
41
|
onChunk(parseChunk) {
|
|
41
42
|
const parsed = parseChunk(undefined);
|
|
42
|
-
let
|
|
43
|
+
let isInitSegment : boolean;
|
|
43
44
|
let data : BufferSource | null;
|
|
44
45
|
let timestampOffset : number;
|
|
45
46
|
const codec = segmentInfo.representation.getMimeTypeString();
|
|
46
47
|
if (parsed.segmentType === "init") {
|
|
47
|
-
|
|
48
|
+
isInitSegment = true;
|
|
48
49
|
data = parsed.initializationData;
|
|
49
50
|
timestampOffset = 0;
|
|
51
|
+
if (initSegmentUniqueId !== null) {
|
|
52
|
+
segmentBuffer.declareInitSegment(initSegmentUniqueId, data);
|
|
53
|
+
}
|
|
50
54
|
} else {
|
|
51
|
-
|
|
55
|
+
isInitSegment = false;
|
|
52
56
|
data = parsed.chunkData;
|
|
53
57
|
timestampOffset = parsed.chunkOffset;
|
|
54
58
|
}
|
|
55
59
|
const pushOperation = segmentBuffer.pushChunk({
|
|
56
|
-
data: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
data,
|
|
60
|
+
data: { initSegmentUniqueId,
|
|
61
|
+
chunk: isInitSegment ? null :
|
|
62
|
+
data,
|
|
60
63
|
appendWindow: [segmentInfo.period.start, segmentInfo.period.end],
|
|
61
64
|
timestampOffset,
|
|
62
65
|
codec },
|
|
@@ -18,6 +18,7 @@ import { MediaSource_ } from "../../../compat";
|
|
|
18
18
|
import { resetMediaSource } from "../../../core/init/utils/create_media_source";
|
|
19
19
|
import { AudioVideoSegmentBuffer } from "../../../core/segment_buffers/implementations";
|
|
20
20
|
import log from "../../../log";
|
|
21
|
+
import createCancellablePromise from "../../../utils/create_cancellable_promise";
|
|
21
22
|
import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
22
23
|
import { CancellationSignal } from "../../../utils/task_canceller";
|
|
23
24
|
|
|
@@ -33,7 +34,7 @@ export default function prepareSourceBuffer(
|
|
|
33
34
|
codec: string,
|
|
34
35
|
cleanUpSignal: CancellationSignal
|
|
35
36
|
): Promise<AudioVideoSegmentBuffer> {
|
|
36
|
-
return
|
|
37
|
+
return createCancellablePromise(cleanUpSignal, (resolve, reject) => {
|
|
37
38
|
if (MediaSource_ == null) {
|
|
38
39
|
throw new Error("No MediaSource Object was found in the current browser.");
|
|
39
40
|
}
|
|
@@ -49,15 +50,17 @@ export default function prepareSourceBuffer(
|
|
|
49
50
|
|
|
50
51
|
log.info("Init: Attaching MediaSource URL to the media element", objectURL);
|
|
51
52
|
videoElement.src = objectURL;
|
|
53
|
+
cleanUpSignal.register(() => {
|
|
54
|
+
resetMediaSource(videoElement, mediaSource, objectURL);
|
|
55
|
+
});
|
|
52
56
|
|
|
53
57
|
mediaSource.addEventListener("sourceopen", onSourceOpen);
|
|
54
58
|
mediaSource.addEventListener("webkitsourceopen", onSourceOpen);
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
return () => {
|
|
57
61
|
mediaSource.removeEventListener("sourceopen", onSourceOpen);
|
|
58
62
|
mediaSource.removeEventListener("webkitsourceopen", onSourceOpen);
|
|
59
|
-
|
|
60
|
-
});
|
|
63
|
+
};
|
|
61
64
|
|
|
62
65
|
function onSourceOpen() {
|
|
63
66
|
try {
|
|
@@ -167,7 +167,7 @@ export default class VideoThumbnailLoader {
|
|
|
167
167
|
|
|
168
168
|
let lastRepInfo : IVideoThumbnailLoaderRepresentationInfo;
|
|
169
169
|
if (this._lastRepresentationInfo === null) {
|
|
170
|
-
const
|
|
170
|
+
const lastRepInfoCleaner = new TaskCanceller();
|
|
171
171
|
const segmentFetcher = createSegmentFetcher(
|
|
172
172
|
"video",
|
|
173
173
|
loader.video,
|
|
@@ -179,13 +179,17 @@ export default class VideoThumbnailLoader {
|
|
|
179
179
|
maxRetry: 0,
|
|
180
180
|
requestTimeout: config.getCurrent().DEFAULT_REQUEST_TIMEOUT }
|
|
181
181
|
) as ISegmentFetcher<ArrayBuffer | Uint8Array>;
|
|
182
|
+
const initSegment = content.representation.index.getInitSegment();
|
|
183
|
+
const initSegmentUniqueId = initSegment !== null ?
|
|
184
|
+
content.representation.uniqueId :
|
|
185
|
+
null;
|
|
182
186
|
const segmentBufferProm = prepareSourceBuffer(
|
|
183
187
|
this._videoElement,
|
|
184
188
|
content.representation.getMimeTypeString(),
|
|
185
|
-
|
|
189
|
+
lastRepInfoCleaner.signal
|
|
186
190
|
).then(async (segmentBuffer) => {
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
if (initSegment === null || initSegmentUniqueId === null) {
|
|
192
|
+
lastRepInfo.initSegmentUniqueId = null;
|
|
189
193
|
return segmentBuffer;
|
|
190
194
|
}
|
|
191
195
|
const segmentInfo = objectAssign({ segment: initSegment },
|
|
@@ -193,13 +197,18 @@ export default class VideoThumbnailLoader {
|
|
|
193
197
|
await loadAndPushSegment(segmentInfo,
|
|
194
198
|
segmentBuffer,
|
|
195
199
|
lastRepInfo.segmentFetcher,
|
|
196
|
-
|
|
200
|
+
initSegmentUniqueId,
|
|
201
|
+
lastRepInfoCleaner.signal);
|
|
202
|
+
lastRepInfoCleaner.signal.register(() => {
|
|
203
|
+
segmentBuffer.freeInitSegment(initSegmentUniqueId);
|
|
204
|
+
});
|
|
197
205
|
return segmentBuffer;
|
|
198
206
|
});
|
|
199
207
|
lastRepInfo = {
|
|
200
|
-
cleaner,
|
|
208
|
+
cleaner: lastRepInfoCleaner,
|
|
201
209
|
segmentBuffer: segmentBufferProm,
|
|
202
210
|
content,
|
|
211
|
+
initSegmentUniqueId,
|
|
203
212
|
segmentFetcher,
|
|
204
213
|
pendingRequests: [],
|
|
205
214
|
};
|
|
@@ -243,15 +252,20 @@ export default class VideoThumbnailLoader {
|
|
|
243
252
|
if (pending !== undefined) {
|
|
244
253
|
promises.push(pending.promise);
|
|
245
254
|
} else {
|
|
246
|
-
const requestCanceller = new TaskCanceller(
|
|
247
|
-
|
|
248
|
-
|
|
255
|
+
const requestCanceller = new TaskCanceller();
|
|
256
|
+
const unlinkSignal = requestCanceller
|
|
257
|
+
.linkToSignal(lastRepInfo.cleaner.signal);
|
|
249
258
|
const segmentInfo = objectAssign({ segment },
|
|
250
259
|
content);
|
|
251
260
|
const prom = loadAndPushSegment(segmentInfo,
|
|
252
261
|
segmentBuffer,
|
|
253
262
|
lastRepInfo.segmentFetcher,
|
|
254
|
-
|
|
263
|
+
lastRepInfo.initSegmentUniqueId,
|
|
264
|
+
requestCanceller.signal)
|
|
265
|
+
.then(unlinkSignal, (err) => {
|
|
266
|
+
unlinkSignal();
|
|
267
|
+
throw err;
|
|
268
|
+
});
|
|
255
269
|
const newReq = {
|
|
256
270
|
segmentId: segment.id,
|
|
257
271
|
canceller: requestCanceller,
|
|
@@ -386,6 +400,7 @@ interface IVideoThumbnailLoaderRepresentationInfo {
|
|
|
386
400
|
* `pendingRequests`.
|
|
387
401
|
*/
|
|
388
402
|
pendingRequests : IPendingRequestInfo[];
|
|
403
|
+
initSegmentUniqueId : string | null;
|
|
389
404
|
}
|
|
390
405
|
|
|
391
406
|
interface IPendingRequestInfo {
|
|
@@ -47,6 +47,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
47
47
|
HTML_VTT: 0,
|
|
48
48
|
LOCAL_MANIFEST: 0,
|
|
49
49
|
METAPLAYLIST: 0,
|
|
50
|
+
DEBUG_ELEMENT: 0,
|
|
50
51
|
NATIVE_SAMI: 0,
|
|
51
52
|
NATIVE_SRT: 0,
|
|
52
53
|
NATIVE_TTML: 0,
|
|
@@ -76,6 +77,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
76
77
|
HTML_VTT: 1,
|
|
77
78
|
LOCAL_MANIFEST: 1,
|
|
78
79
|
METAPLAYLIST: 1,
|
|
80
|
+
DEBUG_ELEMENT: 1,
|
|
79
81
|
NATIVE_SAMI: 1,
|
|
80
82
|
NATIVE_SRT: 1,
|
|
81
83
|
NATIVE_TTML: 1,
|
|
@@ -110,6 +112,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
110
112
|
wasm: null,
|
|
111
113
|
},
|
|
112
114
|
ContentDecryptor: jest.requireActual("../../core/decrypt/index").default,
|
|
115
|
+
createDebugElement: jest.requireActual("../../core/api/debug").default,
|
|
113
116
|
directfile: {
|
|
114
117
|
initDirectFile: jest.requireActual("../../core/init/directfile_content_initializer").default,
|
|
115
118
|
mediaElementTracksStore:
|
|
@@ -150,6 +153,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
150
153
|
HTML_VTT: 1,
|
|
151
154
|
LOCAL_MANIFEST: 0,
|
|
152
155
|
METAPLAYLIST: 0,
|
|
156
|
+
DEBUG_ELEMENT: 0,
|
|
153
157
|
NATIVE_SAMI: 0,
|
|
154
158
|
NATIVE_SRT: 0,
|
|
155
159
|
NATIVE_TTML: 0,
|
|
@@ -191,6 +195,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
191
195
|
HTML_VTT: 0,
|
|
192
196
|
LOCAL_MANIFEST: 0,
|
|
193
197
|
METAPLAYLIST: 0,
|
|
198
|
+
DEBUG_ELEMENT: 0,
|
|
194
199
|
NATIVE_SAMI: 0,
|
|
195
200
|
NATIVE_SRT: 0,
|
|
196
201
|
NATIVE_TTML: 0,
|
|
@@ -232,6 +237,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
232
237
|
HTML_VTT: 0,
|
|
233
238
|
LOCAL_MANIFEST: 0,
|
|
234
239
|
METAPLAYLIST: 0,
|
|
240
|
+
DEBUG_ELEMENT: 0,
|
|
235
241
|
NATIVE_SAMI: 0,
|
|
236
242
|
NATIVE_SRT: 0,
|
|
237
243
|
NATIVE_TTML: 0,
|
|
@@ -273,6 +279,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
273
279
|
HTML_VTT: 0,
|
|
274
280
|
LOCAL_MANIFEST: 0,
|
|
275
281
|
METAPLAYLIST: 0,
|
|
282
|
+
DEBUG_ELEMENT: 0,
|
|
276
283
|
NATIVE_SAMI: 0,
|
|
277
284
|
NATIVE_SRT: 0,
|
|
278
285
|
NATIVE_TTML: 0,
|
|
@@ -314,6 +321,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
314
321
|
HTML_VTT: 0,
|
|
315
322
|
LOCAL_MANIFEST: 0,
|
|
316
323
|
METAPLAYLIST: 0,
|
|
324
|
+
DEBUG_ELEMENT: 0,
|
|
317
325
|
NATIVE_SAMI: 0,
|
|
318
326
|
NATIVE_SRT: 0,
|
|
319
327
|
NATIVE_TTML: 0,
|
|
@@ -355,6 +363,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
355
363
|
HTML_VTT: 0,
|
|
356
364
|
LOCAL_MANIFEST: 0,
|
|
357
365
|
METAPLAYLIST: 0,
|
|
366
|
+
DEBUG_ELEMENT: 0,
|
|
358
367
|
NATIVE_SAMI: 1,
|
|
359
368
|
NATIVE_SRT: 0,
|
|
360
369
|
NATIVE_TTML: 0,
|
|
@@ -396,6 +405,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
396
405
|
HTML_VTT: 0,
|
|
397
406
|
LOCAL_MANIFEST: 0,
|
|
398
407
|
METAPLAYLIST: 0,
|
|
408
|
+
DEBUG_ELEMENT: 0,
|
|
399
409
|
NATIVE_SAMI: 0,
|
|
400
410
|
NATIVE_SRT: 0,
|
|
401
411
|
NATIVE_TTML: 1,
|
|
@@ -437,6 +447,7 @@ describe("Features - initializeFeaturesObject", () => {
|
|
|
437
447
|
HTML_VTT: 0,
|
|
438
448
|
LOCAL_MANIFEST: 0,
|
|
439
449
|
METAPLAYLIST: 0,
|
|
450
|
+
DEBUG_ELEMENT: 0,
|
|
440
451
|
NATIVE_SAMI: 0,
|
|
441
452
|
NATIVE_SRT: 1,
|
|
442
453
|
NATIVE_TTML: 0,
|
|
@@ -29,10 +29,11 @@ export default function initializeFeaturesObject() : void {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Feature switching the Native TextTrack implementation
|
|
32
|
-
const HAS_NATIVE_MODE =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const HAS_NATIVE_MODE =
|
|
33
|
+
__FEATURES__.NATIVE_VTT === __FEATURES__.IS_ENABLED as number ||
|
|
34
|
+
__FEATURES__.NATIVE_SAMI === __FEATURES__.IS_ENABLED as number ||
|
|
35
|
+
__FEATURES__.NATIVE_TTML === __FEATURES__.IS_ENABLED as number ||
|
|
36
|
+
__FEATURES__.NATIVE_SRT === __FEATURES__.IS_ENABLED as number;
|
|
36
37
|
|
|
37
38
|
if (__FEATURES__.SMOOTH === __FEATURES__.IS_ENABLED as number) {
|
|
38
39
|
features.transports.smooth = require("../transports/smooth/index.ts").default;
|
|
@@ -49,8 +50,11 @@ export default function initializeFeaturesObject() : void {
|
|
|
49
50
|
features.transports.metaplaylist =
|
|
50
51
|
require("../transports/metaplaylist/index.ts").default;
|
|
51
52
|
}
|
|
53
|
+
if (__FEATURES__.DEBUG_ELEMENT === __FEATURES__.IS_ENABLED as number) {
|
|
54
|
+
features.createDebugElement = require("../core/api/debug/index.ts").default;
|
|
55
|
+
}
|
|
52
56
|
|
|
53
|
-
if (HAS_NATIVE_MODE
|
|
57
|
+
if (HAS_NATIVE_MODE) {
|
|
54
58
|
features.nativeTextTracksBuffer =
|
|
55
59
|
require("../core/segment_buffers/implementations/text/native/index.ts").default;
|
|
56
60
|
if (__FEATURES__.NATIVE_VTT === __FEATURES__.IS_ENABLED as number) {
|
|
@@ -75,12 +79,13 @@ export default function initializeFeaturesObject() : void {
|
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
// Feature switching the HTML TextTrack implementation
|
|
78
|
-
const HAS_HTML_MODE =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const HAS_HTML_MODE =
|
|
83
|
+
__FEATURES__.HTML_VTT === __FEATURES__.IS_ENABLED as number ||
|
|
84
|
+
__FEATURES__.HTML_SAMI === __FEATURES__.IS_ENABLED as number ||
|
|
85
|
+
__FEATURES__.HTML_TTML === __FEATURES__.IS_ENABLED as number ||
|
|
86
|
+
__FEATURES__.HTML_SRT === __FEATURES__.IS_ENABLED as number;
|
|
82
87
|
|
|
83
|
-
if (HAS_HTML_MODE
|
|
88
|
+
if (HAS_HTML_MODE) {
|
|
84
89
|
features.htmlTextTracksBuffer =
|
|
85
90
|
require("../core/segment_buffers/implementations/text/html/index.ts").default;
|
|
86
91
|
if (__FEATURES__.HTML_SAMI === __FEATURES__.IS_ENABLED as number) {
|
package/src/features/types.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import RxPlayer from "../core/api";
|
|
17
18
|
// eslint-disable-next-line max-len
|
|
18
19
|
import MediaElementTracksStore from "../core/api/track_management/media_element_tracks_store";
|
|
19
20
|
import type ContentDecryptor from "../core/decrypt";
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
INativeTextTracksParserFn,
|
|
30
31
|
} from "../parsers/texttracks";
|
|
31
32
|
import { ITransportFunction } from "../transports";
|
|
33
|
+
import { CancellationSignal } from "../utils/task_canceller";
|
|
32
34
|
|
|
33
35
|
export type IDirectFileInit = typeof DirectFileContentInitializer;
|
|
34
36
|
|
|
@@ -55,6 +57,13 @@ export interface IFeaturesObject {
|
|
|
55
57
|
mediaElementTracksStore : IMediaElementTracksStore; } |
|
|
56
58
|
null;
|
|
57
59
|
ContentDecryptor : IContentDecryptorClass|null;
|
|
60
|
+
createDebugElement : (
|
|
61
|
+
(
|
|
62
|
+
parentElt : HTMLElement,
|
|
63
|
+
instance : RxPlayer,
|
|
64
|
+
cancelSignal : CancellationSignal
|
|
65
|
+
) => void
|
|
66
|
+
) | null;
|
|
58
67
|
htmlTextTracksBuffer : IHTMLTextTracksBuffer|null;
|
|
59
68
|
htmlTextTracksParsers : Partial<Record<string, IHTMLTextTracksParserFn>>;
|
|
60
69
|
transports : Partial<Record<string, ITransportFunction>>;
|