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
|
@@ -49,6 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
import objectAssign from "../../../../utils/object_assign";
|
|
52
53
|
import appendSegmentToBuffer from "./append_segment_to_buffer";
|
|
53
54
|
/**
|
|
54
55
|
* Push the initialization segment to the SegmentBuffer.
|
|
@@ -57,24 +58,23 @@ import appendSegmentToBuffer from "./append_segment_to_buffer";
|
|
|
57
58
|
* @returns {Promise}
|
|
58
59
|
*/
|
|
59
60
|
export default function pushInitSegment(_a, cancelSignal) {
|
|
60
|
-
var playbackObserver = _a.playbackObserver, content = _a.content, segment = _a.segment, segmentData = _a.segmentData, segmentBuffer = _a.segmentBuffer;
|
|
61
|
+
var playbackObserver = _a.playbackObserver, content = _a.content, initSegmentUniqueId = _a.initSegmentUniqueId, segment = _a.segment, segmentData = _a.segmentData, segmentBuffer = _a.segmentBuffer;
|
|
61
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var codec, data, buffered;
|
|
63
|
+
var codec, data, inventoryInfos, buffered;
|
|
63
64
|
return __generator(this, function (_b) {
|
|
64
65
|
switch (_b.label) {
|
|
65
66
|
case 0:
|
|
66
|
-
if (segmentData === null) {
|
|
67
|
-
return [2 /*return*/, null];
|
|
68
|
-
}
|
|
69
67
|
if (cancelSignal.cancellationError !== null) {
|
|
70
68
|
throw cancelSignal.cancellationError;
|
|
71
69
|
}
|
|
72
70
|
codec = content.representation.getMimeTypeString();
|
|
73
|
-
data = {
|
|
74
|
-
chunk: null,
|
|
71
|
+
data = { initSegmentUniqueId: initSegmentUniqueId, chunk: null,
|
|
75
72
|
timestampOffset: 0,
|
|
76
73
|
appendWindow: [undefined, undefined], codec: codec };
|
|
77
|
-
|
|
74
|
+
inventoryInfos = objectAssign({ segment: segment, chunkSize: undefined,
|
|
75
|
+
start: 0,
|
|
76
|
+
end: 0 }, content);
|
|
77
|
+
return [4 /*yield*/, appendSegmentToBuffer(playbackObserver, segmentBuffer, { data: data, inventoryInfos: inventoryInfos }, cancelSignal)];
|
|
78
78
|
case 1:
|
|
79
79
|
_b.sent();
|
|
80
80
|
buffered = segmentBuffer.getBufferedRanges();
|
|
@@ -25,7 +25,7 @@ import { IRepresentationStreamPlaybackObservation, IStreamEventAddedSegmentPaylo
|
|
|
25
25
|
* @param {Object} cancelSignal
|
|
26
26
|
* @returns {Promise}
|
|
27
27
|
*/
|
|
28
|
-
export default function pushMediaSegment<T>({ playbackObserver, content,
|
|
28
|
+
export default function pushMediaSegment<T>({ playbackObserver, content, initSegmentUniqueId, parsedSegment, segment, segmentBuffer }: {
|
|
29
29
|
playbackObserver: IReadOnlyPlaybackObserver<IRepresentationStreamPlaybackObservation>;
|
|
30
30
|
content: {
|
|
31
31
|
adaptation: Adaptation;
|
|
@@ -33,7 +33,7 @@ export default function pushMediaSegment<T>({ playbackObserver, content, initSeg
|
|
|
33
33
|
period: Period;
|
|
34
34
|
representation: Representation;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
initSegmentUniqueId: string | null;
|
|
37
37
|
parsedSegment: ISegmentParserParsedMediaChunk<T>;
|
|
38
38
|
segment: ISegment;
|
|
39
39
|
segmentBuffer: SegmentBuffer;
|
|
@@ -60,7 +60,7 @@ import appendSegmentToBuffer from "./append_segment_to_buffer";
|
|
|
60
60
|
*/
|
|
61
61
|
export default function pushMediaSegment(_a, cancelSignal) {
|
|
62
62
|
var _b, _c;
|
|
63
|
-
var playbackObserver = _a.playbackObserver, content = _a.content,
|
|
63
|
+
var playbackObserver = _a.playbackObserver, content = _a.content, initSegmentUniqueId = _a.initSegmentUniqueId, parsedSegment = _a.parsedSegment, segment = _a.segment, segmentBuffer = _a.segmentBuffer;
|
|
64
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
65
|
var chunkData, chunkInfos, chunkOffset, chunkSize, appendWindow, codec, APPEND_WINDOW_SECURITIES, safeAppendWindow, data, estimatedStart, estimatedDuration, estimatedEnd, inventoryInfos, buffered;
|
|
66
66
|
return __generator(this, function (_d) {
|
|
@@ -83,8 +83,7 @@ export default function pushMediaSegment(_a, cancelSignal) {
|
|
|
83
83
|
appendWindow[1] + APPEND_WINDOW_SECURITIES.END :
|
|
84
84
|
undefined,
|
|
85
85
|
];
|
|
86
|
-
data = {
|
|
87
|
-
chunk: chunkData,
|
|
86
|
+
data = { initSegmentUniqueId: initSegmentUniqueId, chunk: chunkData,
|
|
88
87
|
timestampOffset: chunkOffset,
|
|
89
88
|
appendWindow: safeAppendWindow, codec: codec };
|
|
90
89
|
estimatedStart = (_b = chunkInfos === null || chunkInfos === void 0 ? void 0 : chunkInfos.time) !== null && _b !== void 0 ? _b : segment.time;
|
|
@@ -18,7 +18,7 @@ import nextTick from "next-tick";
|
|
|
18
18
|
* MediaSource to be reloaded.
|
|
19
19
|
*/
|
|
20
20
|
export default function createReloadRequest(playbackObserver, fn, deltaPos, timeBounds, cancelSignal) {
|
|
21
|
-
if (cancelSignal.isCancelled) {
|
|
21
|
+
if (cancelSignal.isCancelled()) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
// We begin by scheduling a micro-task to reduce the possibility of race
|
|
@@ -334,6 +334,31 @@ declare const DEFAULT_CONFIG: {
|
|
|
334
334
|
* @type {Number}
|
|
335
335
|
*/
|
|
336
336
|
SAMPLING_INTERVAL_NO_MEDIASOURCE: number;
|
|
337
|
+
/**
|
|
338
|
+
* Amount of buffer to have ahead of the current position before we may
|
|
339
|
+
* consider buffer-based adaptive estimates, in seconds.
|
|
340
|
+
*
|
|
341
|
+
* For example setting it to `10` means that we need to have ten seconds of
|
|
342
|
+
* buffer ahead of the current position before relying on buffer-based
|
|
343
|
+
* adaptive estimates.
|
|
344
|
+
*
|
|
345
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
346
|
+
* should be set higher than `ABR_EXIT_BUFFER_BASED_ALGO`.
|
|
347
|
+
*/
|
|
348
|
+
ABR_ENTER_BUFFER_BASED_ALGO: number;
|
|
349
|
+
/**
|
|
350
|
+
* Below this amount of buffer ahead of the current position, in seconds, we
|
|
351
|
+
* will stop using buffer-based estimate in our adaptive logic to select a
|
|
352
|
+
* quality.
|
|
353
|
+
*
|
|
354
|
+
* For example setting it to `5` means that if we have less than 5 seconds of
|
|
355
|
+
* buffer ahead of the current position, we should stop relying on
|
|
356
|
+
* buffer-based estimates to choose a quality.
|
|
357
|
+
*
|
|
358
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
359
|
+
* should be set lower than `ABR_ENTER_BUFFER_BASED_ALGO`.
|
|
360
|
+
*/
|
|
361
|
+
ABR_EXIT_BUFFER_BASED_ALGO: number;
|
|
337
362
|
/**
|
|
338
363
|
* Minimum number of bytes sampled before we trust the estimate.
|
|
339
364
|
* If we have not sampled much data, our estimate may not be accurate
|
|
@@ -737,6 +762,22 @@ declare const DEFAULT_CONFIG: {
|
|
|
737
762
|
* @type {number}
|
|
738
763
|
*/
|
|
739
764
|
MIN_CANCELABLE_PRIORITY: number;
|
|
765
|
+
/**
|
|
766
|
+
* Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
|
|
767
|
+
* (DRM).
|
|
768
|
+
*
|
|
769
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
770
|
+
* @type {Array.<string>}
|
|
771
|
+
*/
|
|
772
|
+
EME_DEFAULT_VIDEO_CODECS: string[];
|
|
773
|
+
/**
|
|
774
|
+
* Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
|
|
775
|
+
* (DRM).
|
|
776
|
+
*
|
|
777
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
778
|
+
* @type {Array.<string>}
|
|
779
|
+
*/
|
|
780
|
+
EME_DEFAULT_AUDIO_CODECS: string[];
|
|
740
781
|
/**
|
|
741
782
|
* Robustnesses used in the {audio,video}Capabilities of the
|
|
742
783
|
* MediaKeySystemConfiguration (DRM).
|
|
@@ -340,6 +340,31 @@ var DEFAULT_CONFIG = {
|
|
|
340
340
|
* @type {Number}
|
|
341
341
|
*/
|
|
342
342
|
SAMPLING_INTERVAL_NO_MEDIASOURCE: 500,
|
|
343
|
+
/**
|
|
344
|
+
* Amount of buffer to have ahead of the current position before we may
|
|
345
|
+
* consider buffer-based adaptive estimates, in seconds.
|
|
346
|
+
*
|
|
347
|
+
* For example setting it to `10` means that we need to have ten seconds of
|
|
348
|
+
* buffer ahead of the current position before relying on buffer-based
|
|
349
|
+
* adaptive estimates.
|
|
350
|
+
*
|
|
351
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
352
|
+
* should be set higher than `ABR_EXIT_BUFFER_BASED_ALGO`.
|
|
353
|
+
*/
|
|
354
|
+
ABR_ENTER_BUFFER_BASED_ALGO: 10,
|
|
355
|
+
/**
|
|
356
|
+
* Below this amount of buffer ahead of the current position, in seconds, we
|
|
357
|
+
* will stop using buffer-based estimate in our adaptive logic to select a
|
|
358
|
+
* quality.
|
|
359
|
+
*
|
|
360
|
+
* For example setting it to `5` means that if we have less than 5 seconds of
|
|
361
|
+
* buffer ahead of the current position, we should stop relying on
|
|
362
|
+
* buffer-based estimates to choose a quality.
|
|
363
|
+
*
|
|
364
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
365
|
+
* should be set lower than `ABR_ENTER_BUFFER_BASED_ALGO`.
|
|
366
|
+
*/
|
|
367
|
+
ABR_EXIT_BUFFER_BASED_ALGO: 5,
|
|
343
368
|
/**
|
|
344
369
|
* Minimum number of bytes sampled before we trust the estimate.
|
|
345
370
|
* If we have not sampled much data, our estimate may not be accurate
|
|
@@ -375,8 +400,8 @@ var DEFAULT_CONFIG = {
|
|
|
375
400
|
* @type {Object}
|
|
376
401
|
*/
|
|
377
402
|
ABR_REGULAR_FACTOR: {
|
|
378
|
-
DEFAULT: 0.
|
|
379
|
-
LOW_LATENCY: 0.
|
|
403
|
+
DEFAULT: 0.72,
|
|
404
|
+
LOW_LATENCY: 0.72,
|
|
380
405
|
},
|
|
381
406
|
/**
|
|
382
407
|
* If a media buffer has less than ABR_STARVATION_GAP in seconds ahead of the
|
|
@@ -749,6 +774,25 @@ var DEFAULT_CONFIG = {
|
|
|
749
774
|
* @type {number}
|
|
750
775
|
*/
|
|
751
776
|
MIN_CANCELABLE_PRIORITY: 3,
|
|
777
|
+
/**
|
|
778
|
+
* Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
|
|
779
|
+
* (DRM).
|
|
780
|
+
*
|
|
781
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
782
|
+
* @type {Array.<string>}
|
|
783
|
+
*/
|
|
784
|
+
EME_DEFAULT_VIDEO_CODECS: ["video/mp4;codecs=\"avc1.4d401e\"",
|
|
785
|
+
"video/mp4;codecs=\"avc1.42e01e\"",
|
|
786
|
+
"video/webm;codecs=\"vp8\""],
|
|
787
|
+
/**
|
|
788
|
+
* Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
|
|
789
|
+
* (DRM).
|
|
790
|
+
*
|
|
791
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
792
|
+
* @type {Array.<string>}
|
|
793
|
+
*/
|
|
794
|
+
EME_DEFAULT_AUDIO_CODECS: ["audio/mp4;codecs=\"mp4a.40.2\"",
|
|
795
|
+
"audio/webm;codecs=opus"],
|
|
752
796
|
/**
|
|
753
797
|
* Robustnesses used in the {audio,video}Capabilities of the
|
|
754
798
|
* MediaKeySystemConfiguration (DRM).
|
|
@@ -19,8 +19,8 @@ import EncryptedMediaError from "./encrypted_media_error";
|
|
|
19
19
|
import { ErrorCodes, ErrorTypes, IErrorCode, IErrorType, NetworkErrorTypes } from "./error_codes";
|
|
20
20
|
import formatError from "./format_error";
|
|
21
21
|
import isKnownError from "./is_known_error";
|
|
22
|
-
import MediaError from "./media_error";
|
|
22
|
+
import MediaError, { IMediaErrorTrackContext } from "./media_error";
|
|
23
23
|
import NetworkError from "./network_error";
|
|
24
24
|
import OtherError from "./other_error";
|
|
25
25
|
import RequestError from "./request_error";
|
|
26
|
-
export { AssertionError, CustomLoaderError, EncryptedMediaError, ErrorCodes, ErrorTypes, IErrorCode, IErrorType, formatError, MediaError as MediaError, NetworkError, OtherError, RequestError, NetworkErrorTypes, isKnownError, };
|
|
26
|
+
export { AssertionError, CustomLoaderError, EncryptedMediaError, ErrorCodes, ErrorTypes, IErrorCode, IErrorType, IMediaErrorTrackContext, formatError, MediaError as MediaError, NetworkError, OtherError, RequestError, NetworkErrorTypes, isKnownError, };
|
|
@@ -13,7 +13,23 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Adaptation } from "../manifest";
|
|
17
|
+
import { IAudioTrack, ITextTrack, IVideoTrack } from "../public_types";
|
|
16
18
|
import { IMediaErrorCode } from "./error_codes";
|
|
19
|
+
interface IAudioTrackMediaErrorContext {
|
|
20
|
+
type: "audio";
|
|
21
|
+
track: IAudioTrack;
|
|
22
|
+
}
|
|
23
|
+
interface IVideoTrackMediaErrorContext {
|
|
24
|
+
type: "video";
|
|
25
|
+
track: IVideoTrack;
|
|
26
|
+
}
|
|
27
|
+
interface ITextTrackMediaErrorContext {
|
|
28
|
+
type: "text";
|
|
29
|
+
track: ITextTrack;
|
|
30
|
+
}
|
|
31
|
+
export type IMediaErrorTrackContext = IAudioTrackMediaErrorContext | IVideoTrackMediaErrorContext | ITextTrackMediaErrorContext;
|
|
32
|
+
type ICodeWithAdaptationType = "BUFFER_APPEND_ERROR" | "BUFFER_FULL_ERROR" | "NO_PLAYABLE_REPRESENTATION" | "MANIFEST_INCOMPATIBLE_CODECS_ERROR";
|
|
17
33
|
/**
|
|
18
34
|
* Error linked to the media Playback.
|
|
19
35
|
*
|
|
@@ -25,10 +41,16 @@ export default class MediaError extends Error {
|
|
|
25
41
|
readonly type: "MEDIA_ERROR";
|
|
26
42
|
readonly message: string;
|
|
27
43
|
readonly code: IMediaErrorCode;
|
|
44
|
+
readonly trackInfo: IMediaErrorTrackContext | undefined;
|
|
28
45
|
fatal: boolean;
|
|
29
46
|
/**
|
|
30
47
|
* @param {string} code
|
|
31
48
|
* @param {string} reason
|
|
49
|
+
* @param {Object|undefined} [context]
|
|
32
50
|
*/
|
|
33
|
-
constructor(code:
|
|
51
|
+
constructor(code: ICodeWithAdaptationType, reason: string, context: {
|
|
52
|
+
adaptation: Adaptation | undefined;
|
|
53
|
+
});
|
|
54
|
+
constructor(code: Exclude<IMediaErrorCode, ICodeWithAdaptationType>, reason: string);
|
|
34
55
|
}
|
|
56
|
+
export {};
|
|
@@ -38,11 +38,7 @@ import errorMessage from "./error_message";
|
|
|
38
38
|
*/
|
|
39
39
|
var MediaError = /** @class */ (function (_super) {
|
|
40
40
|
__extends(MediaError, _super);
|
|
41
|
-
|
|
42
|
-
* @param {string} code
|
|
43
|
-
* @param {string} reason
|
|
44
|
-
*/
|
|
45
|
-
function MediaError(code, reason) {
|
|
41
|
+
function MediaError(code, reason, context) {
|
|
46
42
|
var _this = _super.call(this) || this;
|
|
47
43
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
48
44
|
Object.setPrototypeOf(_this, MediaError.prototype);
|
|
@@ -51,6 +47,23 @@ var MediaError = /** @class */ (function (_super) {
|
|
|
51
47
|
_this.code = code;
|
|
52
48
|
_this.message = errorMessage(_this.name, _this.code, reason);
|
|
53
49
|
_this.fatal = false;
|
|
50
|
+
var adaptation = context === null || context === void 0 ? void 0 : context.adaptation;
|
|
51
|
+
if (adaptation !== undefined) {
|
|
52
|
+
switch (adaptation.type) {
|
|
53
|
+
case "audio":
|
|
54
|
+
_this.trackInfo = { type: "audio",
|
|
55
|
+
track: adaptation.toAudioTrack(false) };
|
|
56
|
+
break;
|
|
57
|
+
case "video":
|
|
58
|
+
_this.trackInfo = { type: "video",
|
|
59
|
+
track: adaptation.toVideoTrack(false) };
|
|
60
|
+
break;
|
|
61
|
+
case "text":
|
|
62
|
+
_this.trackInfo = { type: "text",
|
|
63
|
+
track: adaptation.toTextTrack() };
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
54
67
|
return _this;
|
|
55
68
|
}
|
|
56
69
|
return MediaError;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFeaturesObject } from "../../features/types";
|
|
2
|
+
/**
|
|
3
|
+
* Add ability to parse SAMI text tracks in an HTML textrack mode.
|
|
4
|
+
* @param {Object} features
|
|
5
|
+
*/
|
|
6
|
+
declare function addDebugElementFeature(features: IFeaturesObject): void;
|
|
7
|
+
export { addDebugElementFeature as DEBUG_ELEMENT };
|
|
8
|
+
export default addDebugElementFeature;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import createDebugElement from "../../core/api/debug";
|
|
2
|
+
/**
|
|
3
|
+
* Add ability to parse SAMI text tracks in an HTML textrack mode.
|
|
4
|
+
* @param {Object} features
|
|
5
|
+
*/
|
|
6
|
+
function addDebugElementFeature(features) {
|
|
7
|
+
features.createDebugElement = createDebugElement;
|
|
8
|
+
}
|
|
9
|
+
export { addDebugElementFeature as DEBUG_ELEMENT };
|
|
10
|
+
export default addDebugElementFeature;
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ import { CancellationSignal } from "../../../utils/task_canceller";
|
|
|
23
23
|
* @param {Object} cancelSignal
|
|
24
24
|
* @returns {Promise}
|
|
25
25
|
*/
|
|
26
|
-
export default function loadAndPushSegment(segmentInfo: ISegmentLoaderContent, segmentBuffer: AudioVideoSegmentBuffer, segmentFetcher: ISegmentFetcher<ArrayBuffer | Uint8Array>, cancelSignal: CancellationSignal): Promise<unknown>;
|
|
26
|
+
export default function loadAndPushSegment(segmentInfo: ISegmentLoaderContent, segmentBuffer: AudioVideoSegmentBuffer, segmentFetcher: ISegmentFetcher<ArrayBuffer | Uint8Array>, initSegmentUniqueId: string | null, cancelSignal: CancellationSignal): Promise<unknown>;
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js
CHANGED
|
@@ -21,29 +21,30 @@ import log from "../../../log";
|
|
|
21
21
|
* @param {Object} cancelSignal
|
|
22
22
|
* @returns {Promise}
|
|
23
23
|
*/
|
|
24
|
-
export default function loadAndPushSegment(segmentInfo, segmentBuffer, segmentFetcher, cancelSignal) {
|
|
24
|
+
export default function loadAndPushSegment(segmentInfo, segmentBuffer, segmentFetcher, initSegmentUniqueId, cancelSignal) {
|
|
25
25
|
var pushOperations = [];
|
|
26
26
|
return segmentFetcher(segmentInfo, {
|
|
27
27
|
onChunk: function (parseChunk) {
|
|
28
28
|
var parsed = parseChunk(undefined);
|
|
29
|
-
var
|
|
29
|
+
var isInitSegment;
|
|
30
30
|
var data;
|
|
31
31
|
var timestampOffset;
|
|
32
32
|
var codec = segmentInfo.representation.getMimeTypeString();
|
|
33
33
|
if (parsed.segmentType === "init") {
|
|
34
|
-
|
|
34
|
+
isInitSegment = true;
|
|
35
35
|
data = parsed.initializationData;
|
|
36
36
|
timestampOffset = 0;
|
|
37
|
+
if (initSegmentUniqueId !== null) {
|
|
38
|
+
segmentBuffer.declareInitSegment(initSegmentUniqueId, data);
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
39
|
-
|
|
42
|
+
isInitSegment = false;
|
|
40
43
|
data = parsed.chunkData;
|
|
41
44
|
timestampOffset = parsed.chunkOffset;
|
|
42
45
|
}
|
|
43
46
|
var pushOperation = segmentBuffer.pushChunk({
|
|
44
|
-
data: {
|
|
45
|
-
null,
|
|
46
|
-
chunk: isIsInitSegment ? null :
|
|
47
|
+
data: { initSegmentUniqueId: initSegmentUniqueId, chunk: isInitSegment ? null :
|
|
47
48
|
data,
|
|
48
49
|
appendWindow: [segmentInfo.period.start, segmentInfo.period.end], timestampOffset: timestampOffset, codec: codec },
|
|
49
50
|
inventoryInfos: null,
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js
CHANGED
|
@@ -17,6 +17,7 @@ import { MediaSource_ } from "../../../compat";
|
|
|
17
17
|
import { resetMediaSource } from "../../../core/init/utils/create_media_source";
|
|
18
18
|
import { AudioVideoSegmentBuffer } from "../../../core/segment_buffers/implementations";
|
|
19
19
|
import log from "../../../log";
|
|
20
|
+
import createCancellablePromise from "../../../utils/create_cancellable_promise";
|
|
20
21
|
import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
21
22
|
/**
|
|
22
23
|
* Open the media source and create the `AudioVideoSegmentBuffer`.
|
|
@@ -26,7 +27,7 @@ import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
|
26
27
|
* @returns {Promise.<Object>}
|
|
27
28
|
*/
|
|
28
29
|
export default function prepareSourceBuffer(videoElement, codec, cleanUpSignal) {
|
|
29
|
-
return
|
|
30
|
+
return createCancellablePromise(cleanUpSignal, function (resolve, reject) {
|
|
30
31
|
if (MediaSource_ == null) {
|
|
31
32
|
throw new Error("No MediaSource Object was found in the current browser.");
|
|
32
33
|
}
|
|
@@ -39,13 +40,15 @@ export default function prepareSourceBuffer(videoElement, codec, cleanUpSignal)
|
|
|
39
40
|
var objectURL = URL.createObjectURL(mediaSource);
|
|
40
41
|
log.info("Init: Attaching MediaSource URL to the media element", objectURL);
|
|
41
42
|
videoElement.src = objectURL;
|
|
43
|
+
cleanUpSignal.register(function () {
|
|
44
|
+
resetMediaSource(videoElement, mediaSource, objectURL);
|
|
45
|
+
});
|
|
42
46
|
mediaSource.addEventListener("sourceopen", onSourceOpen);
|
|
43
47
|
mediaSource.addEventListener("webkitsourceopen", onSourceOpen);
|
|
44
|
-
|
|
48
|
+
return function () {
|
|
45
49
|
mediaSource.removeEventListener("sourceopen", onSourceOpen);
|
|
46
50
|
mediaSource.removeEventListener("webkitsourceopen", onSourceOpen);
|
|
47
|
-
|
|
48
|
-
});
|
|
51
|
+
};
|
|
49
52
|
function onSourceOpen() {
|
|
50
53
|
try {
|
|
51
54
|
mediaSource.removeEventListener("sourceopen", onSourceOpen);
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js
CHANGED
|
@@ -161,34 +161,42 @@ var VideoThumbnailLoader = /** @class */ (function () {
|
|
|
161
161
|
}
|
|
162
162
|
var lastRepInfo;
|
|
163
163
|
if (this._lastRepresentationInfo === null) {
|
|
164
|
-
var
|
|
164
|
+
var lastRepInfoCleaner_1 = new TaskCanceller();
|
|
165
165
|
var segmentFetcher = createSegmentFetcher("video", loader.video, null,
|
|
166
166
|
// We don't care about the SegmentFetcher's lifecycle events
|
|
167
167
|
{}, { baseDelay: 0,
|
|
168
168
|
maxDelay: 0,
|
|
169
169
|
maxRetry: 0,
|
|
170
170
|
requestTimeout: config.getCurrent().DEFAULT_REQUEST_TIMEOUT });
|
|
171
|
-
var
|
|
172
|
-
|
|
171
|
+
var initSegment_1 = content.representation.index.getInitSegment();
|
|
172
|
+
var initSegmentUniqueId_1 = initSegment_1 !== null ?
|
|
173
|
+
content.representation.uniqueId :
|
|
174
|
+
null;
|
|
175
|
+
var segmentBufferProm = prepareSourceBuffer(this._videoElement, content.representation.getMimeTypeString(), lastRepInfoCleaner_1.signal).then(function (segmentBuffer) { return __awaiter(_this, void 0, void 0, function () {
|
|
176
|
+
var segmentInfo;
|
|
173
177
|
return __generator(this, function (_a) {
|
|
174
178
|
switch (_a.label) {
|
|
175
179
|
case 0:
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
if (initSegment_1 === null || initSegmentUniqueId_1 === null) {
|
|
181
|
+
lastRepInfo.initSegmentUniqueId = null;
|
|
178
182
|
return [2 /*return*/, segmentBuffer];
|
|
179
183
|
}
|
|
180
|
-
segmentInfo = objectAssign({ segment:
|
|
181
|
-
return [4 /*yield*/, loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher,
|
|
184
|
+
segmentInfo = objectAssign({ segment: initSegment_1 }, content);
|
|
185
|
+
return [4 /*yield*/, loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, initSegmentUniqueId_1, lastRepInfoCleaner_1.signal)];
|
|
182
186
|
case 1:
|
|
183
187
|
_a.sent();
|
|
188
|
+
lastRepInfoCleaner_1.signal.register(function () {
|
|
189
|
+
segmentBuffer.freeInitSegment(initSegmentUniqueId_1);
|
|
190
|
+
});
|
|
184
191
|
return [2 /*return*/, segmentBuffer];
|
|
185
192
|
}
|
|
186
193
|
});
|
|
187
194
|
}); });
|
|
188
195
|
lastRepInfo = {
|
|
189
|
-
cleaner:
|
|
196
|
+
cleaner: lastRepInfoCleaner_1,
|
|
190
197
|
segmentBuffer: segmentBufferProm,
|
|
191
198
|
content: content,
|
|
199
|
+
initSegmentUniqueId: initSegmentUniqueId_1,
|
|
192
200
|
segmentFetcher: segmentFetcher,
|
|
193
201
|
pendingRequests: [],
|
|
194
202
|
};
|
|
@@ -229,11 +237,15 @@ var VideoThumbnailLoader = /** @class */ (function () {
|
|
|
229
237
|
promises.push(pending_1.promise);
|
|
230
238
|
}
|
|
231
239
|
else {
|
|
232
|
-
var requestCanceller = new TaskCanceller(
|
|
233
|
-
|
|
234
|
-
|
|
240
|
+
var requestCanceller = new TaskCanceller();
|
|
241
|
+
var unlinkSignal_1 = requestCanceller
|
|
242
|
+
.linkToSignal(lastRepInfo.cleaner.signal);
|
|
235
243
|
var segmentInfo = objectAssign({ segment: segment }, content);
|
|
236
|
-
var prom = loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, requestCanceller.signal)
|
|
244
|
+
var prom = loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, lastRepInfo.initSegmentUniqueId, requestCanceller.signal)
|
|
245
|
+
.then(unlinkSignal_1, function (err) {
|
|
246
|
+
unlinkSignal_1();
|
|
247
|
+
throw err;
|
|
248
|
+
});
|
|
237
249
|
var newReq_1 = {
|
|
238
250
|
segmentId: segment.id,
|
|
239
251
|
canceller: requestCanceller,
|
|
@@ -25,10 +25,10 @@ export default function initializeFeaturesObject() {
|
|
|
25
25
|
features.ContentDecryptor = require("../core/decrypt/index.ts").default;
|
|
26
26
|
}
|
|
27
27
|
// Feature switching the Native TextTrack implementation
|
|
28
|
-
var HAS_NATIVE_MODE = 0 /* __FEATURES__.NATIVE_VTT */ ||
|
|
29
|
-
0 /* __FEATURES__.NATIVE_SAMI */ ||
|
|
30
|
-
0 /* __FEATURES__.NATIVE_TTML */ ||
|
|
31
|
-
0 /* __FEATURES__.NATIVE_SRT */;
|
|
28
|
+
var HAS_NATIVE_MODE = 0 /* __FEATURES__.NATIVE_VTT */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
29
|
+
0 /* __FEATURES__.NATIVE_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
30
|
+
0 /* __FEATURES__.NATIVE_TTML */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
31
|
+
0 /* __FEATURES__.NATIVE_SRT */ === 1 /* __FEATURES__.IS_ENABLED */;
|
|
32
32
|
if (0 /* __FEATURES__.SMOOTH */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
33
33
|
features.transports.smooth = require("../transports/smooth/index.ts").default;
|
|
34
34
|
}
|
|
@@ -44,7 +44,10 @@ export default function initializeFeaturesObject() {
|
|
|
44
44
|
features.transports.metaplaylist =
|
|
45
45
|
require("../transports/metaplaylist/index.ts").default;
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
47
|
+
if (0 /* __FEATURES__.DEBUG_ELEMENT */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
48
|
+
features.createDebugElement = require("../core/api/debug/index.ts").default;
|
|
49
|
+
}
|
|
50
|
+
if (HAS_NATIVE_MODE) {
|
|
48
51
|
features.nativeTextTracksBuffer =
|
|
49
52
|
require("../core/segment_buffers/implementations/text/native/index.ts").default;
|
|
50
53
|
if (0 /* __FEATURES__.NATIVE_VTT */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
@@ -65,11 +68,11 @@ export default function initializeFeaturesObject() {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
// Feature switching the HTML TextTrack implementation
|
|
68
|
-
var HAS_HTML_MODE = 0 /* __FEATURES__.HTML_VTT */ ||
|
|
69
|
-
0 /* __FEATURES__.HTML_SAMI */ ||
|
|
70
|
-
0 /* __FEATURES__.HTML_TTML */ ||
|
|
71
|
-
0 /* __FEATURES__.HTML_SRT */;
|
|
72
|
-
if (HAS_HTML_MODE
|
|
71
|
+
var HAS_HTML_MODE = 0 /* __FEATURES__.HTML_VTT */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
72
|
+
0 /* __FEATURES__.HTML_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
73
|
+
0 /* __FEATURES__.HTML_TTML */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
74
|
+
0 /* __FEATURES__.HTML_SRT */ === 1 /* __FEATURES__.IS_ENABLED */;
|
|
75
|
+
if (HAS_HTML_MODE) {
|
|
73
76
|
features.htmlTextTracksBuffer =
|
|
74
77
|
require("../core/segment_buffers/implementations/text/html/index.ts").default;
|
|
75
78
|
if (0 /* __FEATURES__.HTML_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import RxPlayer from "../core/api";
|
|
16
17
|
import MediaElementTracksStore from "../core/api/track_management/media_element_tracks_store";
|
|
17
18
|
import type ContentDecryptor from "../core/decrypt";
|
|
18
19
|
import DirectFileContentInitializer from "../core/init/directfile_content_initializer";
|
|
@@ -21,6 +22,7 @@ import { IDashParserResponse, IMPDParserArguments } from "../parsers/manifest/da
|
|
|
21
22
|
import DashWasmParser from "../parsers/manifest/dash/wasm-parser";
|
|
22
23
|
import { IHTMLTextTracksParserFn, INativeTextTracksParserFn } from "../parsers/texttracks";
|
|
23
24
|
import { ITransportFunction } from "../transports";
|
|
25
|
+
import { CancellationSignal } from "../utils/task_canceller";
|
|
24
26
|
export type IDirectFileInit = typeof DirectFileContentInitializer;
|
|
25
27
|
export type IContentDecryptorClass = typeof ContentDecryptor;
|
|
26
28
|
export type IHTMLTextTracksBuffer = new (mediaElement: HTMLMediaElement, textTrackElement: HTMLElement) => SegmentBuffer;
|
|
@@ -33,6 +35,7 @@ export interface IFeaturesObject {
|
|
|
33
35
|
mediaElementTracksStore: IMediaElementTracksStore;
|
|
34
36
|
} | null;
|
|
35
37
|
ContentDecryptor: IContentDecryptorClass | null;
|
|
38
|
+
createDebugElement: ((parentElt: HTMLElement, instance: RxPlayer, cancelSignal: CancellationSignal) => void) | null;
|
|
36
39
|
htmlTextTracksBuffer: IHTMLTextTracksBuffer | null;
|
|
37
40
|
htmlTextTracksParsers: Partial<Record<string, IHTMLTextTracksParserFn>>;
|
|
38
41
|
transports: Partial<Record<string, ITransportFunction>>;
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { IParsedAdaptation } from "../parsers/manifest";
|
|
17
|
-
import { ITrackType, IRepresentationFilter } from "../public_types";
|
|
17
|
+
import { IAudioTrack, ITrackType, IRepresentationFilter, ITextTrack, IVideoTrack } from "../public_types";
|
|
18
18
|
import Representation from "./representation";
|
|
19
19
|
/** List in an array every possible value for the Adaptation's `type` property. */
|
|
20
20
|
export declare const SUPPORTED_ADAPTATIONS_TYPE: ITrackType[];
|
|
21
21
|
/**
|
|
22
22
|
* Normalized Adaptation structure.
|
|
23
|
-
* An Adaptation describes a single `Track`. For example a specific audio
|
|
23
|
+
* An `Adaptation` describes a single `Track`. For example a specific audio
|
|
24
24
|
* track (in a given language) or a specific video track.
|
|
25
25
|
* It istelf can be represented in different qualities, which we call here
|
|
26
26
|
* `Representation`.
|
|
@@ -91,4 +91,23 @@ export default class Adaptation {
|
|
|
91
91
|
* @returns {Object|undefined}
|
|
92
92
|
*/
|
|
93
93
|
getRepresentation(wantedId: number | string): Representation | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
96
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
97
|
+
* will be returned.
|
|
98
|
+
* @returns {Object}
|
|
99
|
+
*/
|
|
100
|
+
toAudioTrack(filterPlayable: boolean): IAudioTrack;
|
|
101
|
+
/**
|
|
102
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
103
|
+
* @returns {Object}
|
|
104
|
+
*/
|
|
105
|
+
toTextTrack(): ITextTrack;
|
|
106
|
+
/**
|
|
107
|
+
* Format an `Adaptation`, generally of type `"video"`, as an `IAudioTrack`.
|
|
108
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
109
|
+
* will be returned.
|
|
110
|
+
* @returns {Object}
|
|
111
|
+
*/
|
|
112
|
+
toVideoTrack(filterPlayable: boolean): IVideoTrack;
|
|
94
113
|
}
|