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
|
@@ -72,7 +72,7 @@ describe("Manifest - Manifest", () => {
|
|
|
72
72
|
expect(manifest.suggestedPresentationDelay).toEqual(undefined);
|
|
73
73
|
expect(manifest.uris).toEqual([]);
|
|
74
74
|
|
|
75
|
-
expect(fakeIdGenerator).
|
|
75
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
76
76
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
77
77
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
78
78
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -114,7 +114,7 @@ describe("Manifest - Manifest", () => {
|
|
|
114
114
|
contentWarnings: [] } ]);
|
|
115
115
|
expect(manifest.adaptations).toEqual({});
|
|
116
116
|
|
|
117
|
-
expect(fakeIdGenerator).
|
|
117
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
118
118
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
119
119
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
120
120
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -152,7 +152,7 @@ describe("Manifest - Manifest", () => {
|
|
|
152
152
|
expect(fakePeriod).toHaveBeenCalledTimes(2);
|
|
153
153
|
expect(fakePeriod).toHaveBeenCalledWith(period1, representationFilter);
|
|
154
154
|
expect(fakePeriod).toHaveBeenCalledWith(period2, representationFilter);
|
|
155
|
-
expect(fakeIdGenerator).
|
|
155
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
156
156
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
157
157
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
158
158
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -194,7 +194,7 @@ describe("Manifest - Manifest", () => {
|
|
|
194
194
|
]);
|
|
195
195
|
expect(manifest.adaptations).toBe(adapP1);
|
|
196
196
|
|
|
197
|
-
expect(fakeIdGenerator).
|
|
197
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
198
198
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
199
199
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
200
200
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -234,7 +234,7 @@ describe("Manifest - Manifest", () => {
|
|
|
234
234
|
expect(manifest.contentWarnings).toContainEqual(new Error("0"));
|
|
235
235
|
expect(manifest.contentWarnings).toContainEqual(new Error("1"));
|
|
236
236
|
|
|
237
|
-
expect(fakeIdGenerator).
|
|
237
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
238
238
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
239
239
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
240
240
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -285,7 +285,7 @@ describe("Manifest - Manifest", () => {
|
|
|
285
285
|
]);
|
|
286
286
|
expect(manifest.suggestedPresentationDelay).toEqual(99);
|
|
287
287
|
expect(manifest.uris).toEqual(["url1", "url2"]);
|
|
288
|
-
expect(fakeIdGenerator).
|
|
288
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
289
289
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
290
290
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
291
291
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -419,7 +419,7 @@ describe("Manifest - Manifest", () => {
|
|
|
419
419
|
.toHaveBeenCalledWith(manifest.periods, newManifest.periods);
|
|
420
420
|
expect(mockTrigger).toHaveBeenCalledTimes(1);
|
|
421
421
|
expect(mockTrigger).toHaveBeenCalledWith("manifestUpdate", fakeReplacePeriodsRes);
|
|
422
|
-
expect(fakeIdGenerator).
|
|
422
|
+
expect(fakeIdGenerator).toHaveBeenCalled();
|
|
423
423
|
expect(fakeGenerateNewId).toHaveBeenCalledTimes(1);
|
|
424
424
|
expect(fakeLogger.info).not.toHaveBeenCalled();
|
|
425
425
|
expect(fakeLogger.warn).not.toHaveBeenCalled();
|
|
@@ -149,25 +149,30 @@ describe("Manifest - Period", () => {
|
|
|
149
149
|
const videoAda1 = { type: "video",
|
|
150
150
|
id: "54",
|
|
151
151
|
isSupported: true,
|
|
152
|
-
representations: [{}]
|
|
152
|
+
representations: [{}],
|
|
153
|
+
toVideoTrack() { return videoAda1; } };
|
|
153
154
|
const videoAda2 = { type: "video",
|
|
154
155
|
id: "56",
|
|
155
156
|
isSupported: true,
|
|
156
|
-
representations: [{}]
|
|
157
|
+
representations: [{}],
|
|
158
|
+
toVideoTrack() { return videoAda2; } };
|
|
157
159
|
const videoAda3 = { type: "video",
|
|
158
160
|
id: "57",
|
|
159
161
|
isSupported: true,
|
|
160
|
-
representations: [{}]
|
|
162
|
+
representations: [{}],
|
|
163
|
+
toVideoTrack() { return videoAda3; } };
|
|
161
164
|
const video = [videoAda1, videoAda2, videoAda3];
|
|
162
165
|
|
|
163
166
|
const audioAda1 = { type: "audio",
|
|
164
167
|
id: "58",
|
|
165
168
|
isSupported: true,
|
|
166
|
-
representations: []
|
|
169
|
+
representations: [],
|
|
170
|
+
toAudioTrack() { return audioAda1; } };
|
|
167
171
|
const audioAda2 = { type: "audio",
|
|
168
172
|
id: "59",
|
|
169
173
|
isSupported: true,
|
|
170
|
-
representations: []
|
|
174
|
+
representations: [],
|
|
175
|
+
toAudioTrack() { return audioAda2; } };
|
|
171
176
|
const audio = [audioAda1, audioAda2];
|
|
172
177
|
const args = { id: "12", adaptations: { video, audio }, start: 0 };
|
|
173
178
|
let period = null;
|
|
@@ -205,25 +210,30 @@ describe("Manifest - Period", () => {
|
|
|
205
210
|
const videoAda1 = { type: "video",
|
|
206
211
|
id: "54",
|
|
207
212
|
isSupported: true,
|
|
208
|
-
representations: [{}]
|
|
213
|
+
representations: [{}],
|
|
214
|
+
toVideoTrack() { return videoAda1; } };
|
|
209
215
|
const videoAda2 = { type: "video",
|
|
210
216
|
id: "55",
|
|
211
217
|
isSupported: true,
|
|
212
|
-
representations: [{}]
|
|
218
|
+
representations: [{}],
|
|
219
|
+
toVideoTrack() { return videoAda2; } };
|
|
213
220
|
const videoAda3 = { type: "video",
|
|
214
221
|
id: "56",
|
|
215
222
|
isSupported: true,
|
|
216
|
-
representations: [{}]
|
|
223
|
+
representations: [{}],
|
|
224
|
+
toVideoTrack() { return videoAda3; } };
|
|
217
225
|
const video = [videoAda1, videoAda2, videoAda3];
|
|
218
226
|
|
|
219
227
|
const audioAda1 = { type: "audio",
|
|
220
228
|
id: "57",
|
|
221
229
|
isSupported: false,
|
|
222
|
-
representations: [{}]
|
|
230
|
+
representations: [{}],
|
|
231
|
+
toAudioTrack() { return audioAda1; } };
|
|
223
232
|
const audioAda2 = { type: "audio",
|
|
224
233
|
id: "58",
|
|
225
234
|
isSupported: false,
|
|
226
|
-
representations: [{}]
|
|
235
|
+
representations: [{}],
|
|
236
|
+
toAudioTrack() { return audioAda1; } };
|
|
227
237
|
const audio = [audioAda1, audioAda2];
|
|
228
238
|
const args = { id: "12", adaptations: { video, audio }, start: 0 };
|
|
229
239
|
let period = null;
|
|
@@ -261,25 +271,30 @@ describe("Manifest - Period", () => {
|
|
|
261
271
|
const videoAda1 = { type: "video",
|
|
262
272
|
id: "54",
|
|
263
273
|
isSupported: true,
|
|
264
|
-
representations: []
|
|
274
|
+
representations: [],
|
|
275
|
+
toVideoTrack() { return videoAda1; } };
|
|
265
276
|
const videoAda2 = { type: "video",
|
|
266
277
|
id: "55",
|
|
267
278
|
isSupported: true,
|
|
268
|
-
representations: []
|
|
279
|
+
representations: [],
|
|
280
|
+
toVideoTrack() { return videoAda2; } };
|
|
269
281
|
const videoAda3 = { type: "video",
|
|
270
282
|
id: "56",
|
|
271
283
|
isSupported: true,
|
|
272
|
-
representations: []
|
|
284
|
+
representations: [],
|
|
285
|
+
toVideoTrack() { return videoAda3; } };
|
|
273
286
|
const video = [videoAda1, videoAda2, videoAda3];
|
|
274
287
|
|
|
275
288
|
const audioAda1 = { type: "audio",
|
|
276
289
|
id: "58",
|
|
277
290
|
isSupported: true,
|
|
278
|
-
representations: [{}]
|
|
291
|
+
representations: [{}],
|
|
292
|
+
toAudioTrack() { return audioAda1; } };
|
|
279
293
|
const audioAda2 = { type: "audio",
|
|
280
294
|
id: "59",
|
|
281
295
|
isSupported: true,
|
|
282
|
-
representations: [{}]
|
|
296
|
+
representations: [{}],
|
|
297
|
+
toAudioTrack() { return audioAda2; } };
|
|
283
298
|
const audio = [audioAda1, audioAda2];
|
|
284
299
|
const args = { id: "12", adaptations: { video, audio }, start: 0 };
|
|
285
300
|
let period = null;
|
|
@@ -317,25 +332,30 @@ describe("Manifest - Period", () => {
|
|
|
317
332
|
const videoAda1 = { type: "video",
|
|
318
333
|
id: "54",
|
|
319
334
|
isSupported: false,
|
|
320
|
-
representations: [{}]
|
|
335
|
+
representations: [{}],
|
|
336
|
+
toVideoTrack() { return videoAda1; } };
|
|
321
337
|
const videoAda2 = { type: "video",
|
|
322
338
|
id: "55",
|
|
323
339
|
isSupported: false,
|
|
324
|
-
representations: [{}]
|
|
340
|
+
representations: [{}],
|
|
341
|
+
toVideoTrack() { return videoAda2; } };
|
|
325
342
|
const videoAda3 = { type: "video",
|
|
326
343
|
id: "56",
|
|
327
344
|
isSupported: false,
|
|
328
|
-
representations: [{}]
|
|
345
|
+
representations: [{}],
|
|
346
|
+
toVideoTrack() { return videoAda3; } };
|
|
329
347
|
const video = [videoAda1, videoAda2, videoAda3];
|
|
330
348
|
|
|
331
349
|
const audioAda1 = { type: "audio",
|
|
332
350
|
id: "58",
|
|
333
351
|
isSupported: true,
|
|
334
|
-
representations: [{}]
|
|
352
|
+
representations: [{}],
|
|
353
|
+
toAudioTrack() { return audioAda1; } };
|
|
335
354
|
const audioAda2 = { type: "audio",
|
|
336
355
|
id: "59",
|
|
337
356
|
isSupported: true,
|
|
338
|
-
representations: [{}]
|
|
357
|
+
representations: [{}],
|
|
358
|
+
toAudioTrack() { return audioAda2; } };
|
|
339
359
|
const audio = [audioAda1, audioAda2];
|
|
340
360
|
const args = { id: "12", adaptations: { video, audio }, start: 0 };
|
|
341
361
|
let period = null;
|
|
@@ -376,12 +396,14 @@ describe("Manifest - Period", () => {
|
|
|
376
396
|
const videoAda1 = { type: "video",
|
|
377
397
|
id: "55",
|
|
378
398
|
isSupported: true,
|
|
379
|
-
representations: [{}]
|
|
399
|
+
representations: [{}],
|
|
400
|
+
toVideoTrack() { return videoAda1; } };
|
|
380
401
|
const video = [videoAda1];
|
|
381
402
|
const videoAda2 = { type: "video",
|
|
382
403
|
id: "55",
|
|
383
404
|
isSupported: false,
|
|
384
|
-
representations: [{}]
|
|
405
|
+
representations: [{}],
|
|
406
|
+
toVideoTrack() { return videoAda2; } };
|
|
385
407
|
const video2 = [videoAda2];
|
|
386
408
|
const args = { id: "12", adaptations: { video, video2 }, start: 0 };
|
|
387
409
|
const period = new Period(args);
|
|
@@ -412,7 +434,8 @@ describe("Manifest - Period", () => {
|
|
|
412
434
|
const videoAda1 = { type: "video",
|
|
413
435
|
id: "55",
|
|
414
436
|
isSupported: true,
|
|
415
|
-
representations: [{}]
|
|
437
|
+
representations: [{}],
|
|
438
|
+
toVideoTrack() { return videoAda1; } };
|
|
416
439
|
const video = [videoAda1];
|
|
417
440
|
const bar = undefined;
|
|
418
441
|
const args = { id: "12", adaptations: { bar, video }, start: 0 };
|
|
@@ -439,11 +462,13 @@ describe("Manifest - Period", () => {
|
|
|
439
462
|
const videoAda1 = { type: "video",
|
|
440
463
|
id: "54",
|
|
441
464
|
isSupported: true,
|
|
442
|
-
representations: [{}]
|
|
465
|
+
representations: [{}],
|
|
466
|
+
toVideoTrack() { return videoAda1; } };
|
|
443
467
|
const videoAda2 = { type: "video",
|
|
444
468
|
id: "55",
|
|
445
469
|
isSupported: true,
|
|
446
|
-
representations: [{}]
|
|
470
|
+
representations: [{}],
|
|
471
|
+
toVideoTrack() { return videoAda2; } };
|
|
447
472
|
const video = [videoAda1, videoAda2];
|
|
448
473
|
const args = { id: "12", adaptations: { video }, start: 0 };
|
|
449
474
|
const period = new Period(args, representationFilter);
|
|
@@ -471,11 +496,13 @@ describe("Manifest - Period", () => {
|
|
|
471
496
|
const videoAda1 = { type: "video",
|
|
472
497
|
id: "54",
|
|
473
498
|
isSupported: false,
|
|
474
|
-
representations: [{}]
|
|
499
|
+
representations: [{}],
|
|
500
|
+
toVideoTrack() { return videoAda1; } };
|
|
475
501
|
const videoAda2 = { type: "video",
|
|
476
502
|
id: "55",
|
|
477
503
|
isSupported: true,
|
|
478
|
-
representations: [{}]
|
|
504
|
+
representations: [{}],
|
|
505
|
+
toVideoTrack() { return videoAda2; } };
|
|
479
506
|
const fooAda1 = { type: "foo",
|
|
480
507
|
id: "12",
|
|
481
508
|
isSupported: false,
|
|
@@ -507,11 +534,13 @@ describe("Manifest - Period", () => {
|
|
|
507
534
|
const videoAda1 = { type: "video",
|
|
508
535
|
id: "54",
|
|
509
536
|
isSupported: false,
|
|
510
|
-
representations: []
|
|
537
|
+
representations: [],
|
|
538
|
+
toVideoTrack() { return videoAda1; } };
|
|
511
539
|
const videoAda2 = { type: "video",
|
|
512
540
|
id: "55",
|
|
513
541
|
isSupported: true,
|
|
514
|
-
representations: [{}]
|
|
542
|
+
representations: [{}],
|
|
543
|
+
toVideoTrack() { return videoAda2; } };
|
|
515
544
|
const fooAda1 = { type: "foo",
|
|
516
545
|
id: "12",
|
|
517
546
|
isSupported: false,
|
|
@@ -536,11 +565,13 @@ describe("Manifest - Period", () => {
|
|
|
536
565
|
const videoAda1 = { type: "video",
|
|
537
566
|
id: "54",
|
|
538
567
|
isSupported: true,
|
|
539
|
-
representations: [{}]
|
|
568
|
+
representations: [{}],
|
|
569
|
+
toVideoTrack() { return videoAda1; } };
|
|
540
570
|
const videoAda2 = { type: "video",
|
|
541
571
|
id: "55",
|
|
542
572
|
isSupported: true,
|
|
543
|
-
representations: [{}]
|
|
573
|
+
representations: [{}],
|
|
574
|
+
toVideoTrack() { return videoAda2; } };
|
|
544
575
|
const video = [videoAda1, videoAda2];
|
|
545
576
|
const args = { id: "12", adaptations: { video }, start: 72 };
|
|
546
577
|
const period = new Period(args);
|
|
@@ -561,11 +592,13 @@ describe("Manifest - Period", () => {
|
|
|
561
592
|
const videoAda1 = { type: "video",
|
|
562
593
|
id: "54",
|
|
563
594
|
isSupported: true,
|
|
564
|
-
representations: [{}]
|
|
595
|
+
representations: [{}],
|
|
596
|
+
toVideoTrack() { return videoAda1; } };
|
|
565
597
|
const videoAda2 = { type: "video",
|
|
566
598
|
id: "55",
|
|
567
599
|
isSupported: true,
|
|
568
|
-
representations: [{}]
|
|
600
|
+
representations: [{}],
|
|
601
|
+
toVideoTrack() { return videoAda2; } };
|
|
569
602
|
const video = [videoAda1, videoAda2];
|
|
570
603
|
const args = { id: "12", adaptations: { video }, start: 0, duration: 12 };
|
|
571
604
|
const period = new Period(args);
|
|
@@ -586,11 +619,13 @@ describe("Manifest - Period", () => {
|
|
|
586
619
|
const videoAda1 = { type: "video",
|
|
587
620
|
id: "54",
|
|
588
621
|
isSupported: true,
|
|
589
|
-
representations: [{}]
|
|
622
|
+
representations: [{}],
|
|
623
|
+
toVideoTrack() { return videoAda1; } };
|
|
590
624
|
const videoAda2 = { type: "video",
|
|
591
625
|
id: "55",
|
|
592
626
|
isSupported: true,
|
|
593
|
-
representations: [{}]
|
|
627
|
+
representations: [{}],
|
|
628
|
+
toVideoTrack() { return videoAda2; } };
|
|
594
629
|
const video = [videoAda1, videoAda2];
|
|
595
630
|
const args = { id: "12", adaptations: { video }, start: 50, duration: 12 };
|
|
596
631
|
const period = new Period(args);
|
|
@@ -611,17 +646,20 @@ describe("Manifest - Period", () => {
|
|
|
611
646
|
const videoAda1 = { type: "video",
|
|
612
647
|
id: "54",
|
|
613
648
|
isSupported: true,
|
|
614
|
-
representations: [{}]
|
|
649
|
+
representations: [{}],
|
|
650
|
+
toVideoTrack() { return videoAda1; } };
|
|
615
651
|
const videoAda2 = { type: "video",
|
|
616
652
|
id: "55",
|
|
617
653
|
isSupported: true,
|
|
618
|
-
representations: [{}]
|
|
654
|
+
representations: [{}],
|
|
655
|
+
toVideoTrack() { return videoAda2; } };
|
|
619
656
|
const video = [videoAda1, videoAda2];
|
|
620
657
|
|
|
621
658
|
const audioAda1 = { type: "audio",
|
|
622
659
|
id: "56",
|
|
623
660
|
isSupported: true,
|
|
624
|
-
representations: [{}]
|
|
661
|
+
representations: [{}],
|
|
662
|
+
toAudioTrack() { return audioAda1; } };
|
|
625
663
|
const audio = [audioAda1];
|
|
626
664
|
|
|
627
665
|
const args = { id: "12", adaptations: { video, audio }, start: 50, duration: 12 };
|
|
@@ -647,17 +685,20 @@ describe("Manifest - Period", () => {
|
|
|
647
685
|
const videoAda1 = { type: "video",
|
|
648
686
|
id: "54",
|
|
649
687
|
isSupported: true,
|
|
650
|
-
representations: [{}]
|
|
688
|
+
representations: [{}],
|
|
689
|
+
toVideoTrack() { return videoAda1; } };
|
|
651
690
|
const videoAda2 = { type: "video",
|
|
652
691
|
id: "55",
|
|
653
692
|
isSupported: true,
|
|
654
|
-
representations: [{}]
|
|
693
|
+
representations: [{}],
|
|
694
|
+
toVideoTrack() { return videoAda2; } };
|
|
655
695
|
const video = [videoAda1, videoAda2];
|
|
656
696
|
|
|
657
697
|
const audioAda1 = { type: "audio",
|
|
658
698
|
id: "56",
|
|
659
699
|
isSupported: true,
|
|
660
|
-
representations: [{}]
|
|
700
|
+
representations: [{}],
|
|
701
|
+
toAudioTrack() { return audioAda1; } };
|
|
661
702
|
const audio = [audioAda1];
|
|
662
703
|
|
|
663
704
|
const args = { id: "12", adaptations: { video, audio }, start: 50, duration: 12 };
|
|
@@ -689,21 +730,25 @@ describe("Manifest - Period", () => {
|
|
|
689
730
|
const videoAda1 = { type: "video",
|
|
690
731
|
id: "54",
|
|
691
732
|
isSupported: true,
|
|
692
|
-
representations: [{}]
|
|
733
|
+
representations: [{}],
|
|
734
|
+
toVideoTrack() { return videoAda1; } };
|
|
693
735
|
const videoAda2 = { type: "video",
|
|
694
736
|
id: "55",
|
|
695
737
|
isSupported: true,
|
|
696
|
-
representations: [{}]
|
|
738
|
+
representations: [{}],
|
|
739
|
+
toVideoTrack() { return videoAda2; } };
|
|
697
740
|
const videoAda3 = { type: "video",
|
|
698
741
|
id: "55",
|
|
699
742
|
isSupported: true,
|
|
700
|
-
representations: [{}]
|
|
743
|
+
representations: [{}],
|
|
744
|
+
toVideoTrack() { return videoAda3; } };
|
|
701
745
|
const video = [videoAda1, videoAda2, videoAda3];
|
|
702
746
|
|
|
703
747
|
const audioAda1 = { type: "audio",
|
|
704
748
|
id: "56",
|
|
705
749
|
isSupported: true,
|
|
706
|
-
representations: [{}]
|
|
750
|
+
representations: [{}],
|
|
751
|
+
toAudioTrack() { return audioAda1; } };
|
|
707
752
|
const audio = [audioAda1];
|
|
708
753
|
|
|
709
754
|
const args = { id: "12", adaptations: { video, audio }, start: 50, duration: 12 };
|
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import log from "../log";
|
|
17
18
|
import { IParsedAdaptation } from "../parsers/manifest";
|
|
18
19
|
import {
|
|
20
|
+
IAudioTrack,
|
|
19
21
|
ITrackType,
|
|
20
22
|
IRepresentationFilter,
|
|
23
|
+
ITextTrack,
|
|
24
|
+
IVideoTrack,
|
|
21
25
|
IRepresentationFilterRepresentation,
|
|
22
26
|
} from "../public_types";
|
|
23
27
|
import arrayFind from "../utils/array_find";
|
|
@@ -30,7 +34,7 @@ export const SUPPORTED_ADAPTATIONS_TYPE: ITrackType[] = ["audio", "video", "text
|
|
|
30
34
|
|
|
31
35
|
/**
|
|
32
36
|
* Normalized Adaptation structure.
|
|
33
|
-
* An Adaptation describes a single `Track`. For example a specific audio
|
|
37
|
+
* An `Adaptation` describes a single `Track`. For example a specific audio
|
|
34
38
|
* track (in a given language) or a specific video track.
|
|
35
39
|
* It istelf can be represented in different qualities, which we call here
|
|
36
40
|
* `Representation`.
|
|
@@ -181,6 +185,12 @@ export default class Adaptation {
|
|
|
181
185
|
if (!isSupported && representation.isSupported) {
|
|
182
186
|
isSupported = true;
|
|
183
187
|
}
|
|
188
|
+
} else {
|
|
189
|
+
log.debug("Filtering Representation due to representationFilter",
|
|
190
|
+
this.type,
|
|
191
|
+
`Adaptation: ${this.id}`,
|
|
192
|
+
`Representation: ${representation.id}`,
|
|
193
|
+
`(${representation.bitrate})`);
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
representations.sort((a, b) => a.bitrate - b.bitrate);
|
|
@@ -209,4 +219,89 @@ export default class Adaptation {
|
|
|
209
219
|
getRepresentation(wantedId : number|string) : Representation|undefined {
|
|
210
220
|
return arrayFind(this.representations, ({ id }) => wantedId === id);
|
|
211
221
|
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
225
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
226
|
+
* will be returned.
|
|
227
|
+
* @returns {Object}
|
|
228
|
+
*/
|
|
229
|
+
public toAudioTrack(filterPlayable: boolean) : IAudioTrack {
|
|
230
|
+
const formatted : IAudioTrack = {
|
|
231
|
+
language: this.language ?? "",
|
|
232
|
+
normalized: this.normalizedLanguage ?? "",
|
|
233
|
+
audioDescription: this.isAudioDescription === true,
|
|
234
|
+
id: this.id,
|
|
235
|
+
representations: (
|
|
236
|
+
filterPlayable ?
|
|
237
|
+
this.getPlayableRepresentations() :
|
|
238
|
+
this.representations
|
|
239
|
+
).map(r => r.toAudioRepresentation()),
|
|
240
|
+
label: this.label,
|
|
241
|
+
};
|
|
242
|
+
if (this.isDub === true) {
|
|
243
|
+
formatted.dub = true;
|
|
244
|
+
}
|
|
245
|
+
return formatted;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
250
|
+
* @returns {Object}
|
|
251
|
+
*/
|
|
252
|
+
public toTextTrack() : ITextTrack {
|
|
253
|
+
return {
|
|
254
|
+
language: this.language ?? "",
|
|
255
|
+
normalized: this.normalizedLanguage ?? "",
|
|
256
|
+
closedCaption: this.isClosedCaption === true,
|
|
257
|
+
id: this.id,
|
|
258
|
+
label: this.label,
|
|
259
|
+
forced: this.isForcedSubtitles,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Format an `Adaptation`, generally of type `"video"`, as an `IAudioTrack`.
|
|
265
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
266
|
+
* will be returned.
|
|
267
|
+
* @returns {Object}
|
|
268
|
+
*/
|
|
269
|
+
public toVideoTrack(filterPlayable: boolean) : IVideoTrack {
|
|
270
|
+
const trickModeTracks = this.trickModeTracks !== undefined ?
|
|
271
|
+
this.trickModeTracks.map((trickModeAdaptation) => {
|
|
272
|
+
const representations = (
|
|
273
|
+
filterPlayable ?
|
|
274
|
+
trickModeAdaptation.getPlayableRepresentations() :
|
|
275
|
+
trickModeAdaptation.representations
|
|
276
|
+
).map(r => r.toVideoRepresentation());
|
|
277
|
+
const trickMode : IVideoTrack = { id: trickModeAdaptation.id,
|
|
278
|
+
representations,
|
|
279
|
+
isTrickModeTrack: true };
|
|
280
|
+
if (trickModeAdaptation.isSignInterpreted === true) {
|
|
281
|
+
trickMode.signInterpreted = true;
|
|
282
|
+
}
|
|
283
|
+
return trickMode;
|
|
284
|
+
}) :
|
|
285
|
+
undefined;
|
|
286
|
+
|
|
287
|
+
const videoTrack: IVideoTrack = {
|
|
288
|
+
id: this.id,
|
|
289
|
+
representations: (
|
|
290
|
+
filterPlayable ?
|
|
291
|
+
this.getPlayableRepresentations() :
|
|
292
|
+
this.representations
|
|
293
|
+
).map(r => r.toVideoRepresentation()),
|
|
294
|
+
label: this.label,
|
|
295
|
+
};
|
|
296
|
+
if (this.isSignInterpreted === true) {
|
|
297
|
+
videoTrack.signInterpreted = true;
|
|
298
|
+
}
|
|
299
|
+
if (this.isTrickModeTrack === true) {
|
|
300
|
+
videoTrack.isTrickModeTrack = true;
|
|
301
|
+
}
|
|
302
|
+
if (trickModeTracks !== undefined) {
|
|
303
|
+
videoTrack.trickModeTracks = trickModeTracks;
|
|
304
|
+
}
|
|
305
|
+
return videoTrack;
|
|
306
|
+
}
|
|
212
307
|
}
|
package/src/manifest/manifest.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import log from "../log";
|
|
17
18
|
import { IParsedManifest } from "../parsers/manifest";
|
|
18
19
|
import {
|
|
19
20
|
ITrackType,
|
|
@@ -626,6 +627,9 @@ function updateDeciperability(
|
|
|
626
627
|
if (result !== representation.decipherable) {
|
|
627
628
|
updates.push({ manifest, period, adaptation, representation });
|
|
628
629
|
representation.decipherable = result;
|
|
630
|
+
log.debug(`Decipherability changed for "${representation.id}"`,
|
|
631
|
+
`(${representation.bitrate})`,
|
|
632
|
+
String(representation.decipherable));
|
|
629
633
|
}
|
|
630
634
|
}
|
|
631
635
|
}
|
package/src/manifest/period.ts
CHANGED
|
@@ -89,7 +89,8 @@ export default class Period {
|
|
|
89
89
|
if (newAdaptation.representations.length > 0 && !newAdaptation.isSupported) {
|
|
90
90
|
const error =
|
|
91
91
|
new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR",
|
|
92
|
-
"An Adaptation contains only incompatible codecs."
|
|
92
|
+
"An Adaptation contains only incompatible codecs.",
|
|
93
|
+
{ adaptation: newAdaptation });
|
|
93
94
|
this.contentWarnings.push(error);
|
|
94
95
|
}
|
|
95
96
|
return newAdaptation;
|
|
@@ -102,7 +103,8 @@ export default class Period {
|
|
|
102
103
|
(type === "video" || type === "audio")
|
|
103
104
|
) {
|
|
104
105
|
throw new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR",
|
|
105
|
-
"No supported " + type + " adaptations"
|
|
106
|
+
"No supported " + type + " adaptations",
|
|
107
|
+
{ adaptation: undefined });
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
if (filteredAdaptations.length > 0) {
|