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
|
@@ -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 log from "../log";
|
|
16
17
|
import arrayFind from "../utils/array_find";
|
|
17
18
|
import isNullOrUndefined from "../utils/is_null_or_undefined";
|
|
18
19
|
import normalizeLanguage from "../utils/languages";
|
|
@@ -21,7 +22,7 @@ import Representation from "./representation";
|
|
|
21
22
|
export var SUPPORTED_ADAPTATIONS_TYPE = ["audio", "video", "text"];
|
|
22
23
|
/**
|
|
23
24
|
* Normalized Adaptation structure.
|
|
24
|
-
* An Adaptation describes a single `Track`. For example a specific audio
|
|
25
|
+
* An `Adaptation` describes a single `Track`. For example a specific audio
|
|
25
26
|
* track (in a given language) or a specific video track.
|
|
26
27
|
* It istelf can be represented in different qualities, which we call here
|
|
27
28
|
* `Representation`.
|
|
@@ -109,6 +110,9 @@ var Adaptation = /** @class */ (function () {
|
|
|
109
110
|
isSupported = true;
|
|
110
111
|
}
|
|
111
112
|
}
|
|
113
|
+
else {
|
|
114
|
+
log.debug("Filtering Representation due to representationFilter", this.type, "Adaptation: ".concat(this.id), "Representation: ".concat(representation.id), "(".concat(representation.bitrate, ")"));
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
representations.sort(function (a, b) { return a.bitrate - b.bitrate; });
|
|
114
118
|
this.representations = representations;
|
|
@@ -135,6 +139,81 @@ var Adaptation = /** @class */ (function () {
|
|
|
135
139
|
return wantedId === id;
|
|
136
140
|
});
|
|
137
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
144
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
145
|
+
* will be returned.
|
|
146
|
+
* @returns {Object}
|
|
147
|
+
*/
|
|
148
|
+
Adaptation.prototype.toAudioTrack = function (filterPlayable) {
|
|
149
|
+
var _a, _b;
|
|
150
|
+
var formatted = {
|
|
151
|
+
language: (_a = this.language) !== null && _a !== void 0 ? _a : "",
|
|
152
|
+
normalized: (_b = this.normalizedLanguage) !== null && _b !== void 0 ? _b : "",
|
|
153
|
+
audioDescription: this.isAudioDescription === true,
|
|
154
|
+
id: this.id,
|
|
155
|
+
representations: (filterPlayable ?
|
|
156
|
+
this.getPlayableRepresentations() :
|
|
157
|
+
this.representations).map(function (r) { return r.toAudioRepresentation(); }),
|
|
158
|
+
label: this.label,
|
|
159
|
+
};
|
|
160
|
+
if (this.isDub === true) {
|
|
161
|
+
formatted.dub = true;
|
|
162
|
+
}
|
|
163
|
+
return formatted;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Format an `Adaptation`, generally of type `"audio"`, as an `IAudioTrack`.
|
|
167
|
+
* @returns {Object}
|
|
168
|
+
*/
|
|
169
|
+
Adaptation.prototype.toTextTrack = function () {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
return {
|
|
172
|
+
language: (_a = this.language) !== null && _a !== void 0 ? _a : "",
|
|
173
|
+
normalized: (_b = this.normalizedLanguage) !== null && _b !== void 0 ? _b : "",
|
|
174
|
+
closedCaption: this.isClosedCaption === true,
|
|
175
|
+
id: this.id,
|
|
176
|
+
label: this.label,
|
|
177
|
+
forced: this.isForcedSubtitles,
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Format an `Adaptation`, generally of type `"video"`, as an `IAudioTrack`.
|
|
182
|
+
* @param {boolean} filterPlayable - If `true` only "playable" Representation
|
|
183
|
+
* will be returned.
|
|
184
|
+
* @returns {Object}
|
|
185
|
+
*/
|
|
186
|
+
Adaptation.prototype.toVideoTrack = function (filterPlayable) {
|
|
187
|
+
var trickModeTracks = this.trickModeTracks !== undefined ?
|
|
188
|
+
this.trickModeTracks.map(function (trickModeAdaptation) {
|
|
189
|
+
var representations = (filterPlayable ?
|
|
190
|
+
trickModeAdaptation.getPlayableRepresentations() :
|
|
191
|
+
trickModeAdaptation.representations).map(function (r) { return r.toVideoRepresentation(); });
|
|
192
|
+
var trickMode = { id: trickModeAdaptation.id, representations: representations, isTrickModeTrack: true };
|
|
193
|
+
if (trickModeAdaptation.isSignInterpreted === true) {
|
|
194
|
+
trickMode.signInterpreted = true;
|
|
195
|
+
}
|
|
196
|
+
return trickMode;
|
|
197
|
+
}) :
|
|
198
|
+
undefined;
|
|
199
|
+
var videoTrack = {
|
|
200
|
+
id: this.id,
|
|
201
|
+
representations: (filterPlayable ?
|
|
202
|
+
this.getPlayableRepresentations() :
|
|
203
|
+
this.representations).map(function (r) { return r.toVideoRepresentation(); }),
|
|
204
|
+
label: this.label,
|
|
205
|
+
};
|
|
206
|
+
if (this.isSignInterpreted === true) {
|
|
207
|
+
videoTrack.signInterpreted = true;
|
|
208
|
+
}
|
|
209
|
+
if (this.isTrickModeTrack === true) {
|
|
210
|
+
videoTrack.isTrickModeTrack = true;
|
|
211
|
+
}
|
|
212
|
+
if (trickModeTracks !== undefined) {
|
|
213
|
+
videoTrack.trickModeTracks = trickModeTracks;
|
|
214
|
+
}
|
|
215
|
+
return videoTrack;
|
|
216
|
+
};
|
|
138
217
|
return Adaptation;
|
|
139
218
|
}());
|
|
140
219
|
export default Adaptation;
|
|
@@ -28,6 +28,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
28
28
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
|
+
import log from "../log";
|
|
31
32
|
import arrayFind from "../utils/array_find";
|
|
32
33
|
import EventEmitter from "../utils/event_emitter";
|
|
33
34
|
import idGenerator from "../utils/id_generator";
|
|
@@ -373,6 +374,7 @@ function updateDeciperability(manifest, isDecipherable) {
|
|
|
373
374
|
if (result !== representation.decipherable) {
|
|
374
375
|
updates.push({ manifest: manifest, period: period, adaptation: adaptation, representation: representation });
|
|
375
376
|
representation.decipherable = result;
|
|
377
|
+
log.debug("Decipherability changed for \"".concat(representation.id, "\""), "(".concat(representation.bitrate, ")"), String(representation.decipherable));
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
}
|
|
@@ -42,7 +42,7 @@ var Period = /** @class */ (function () {
|
|
|
42
42
|
.map(function (adaptation) {
|
|
43
43
|
var newAdaptation = new Adaptation(adaptation, { representationFilter: representationFilter });
|
|
44
44
|
if (newAdaptation.representations.length > 0 && !newAdaptation.isSupported) {
|
|
45
|
-
var error = new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR", "An Adaptation contains only incompatible codecs.");
|
|
45
|
+
var error = new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR", "An Adaptation contains only incompatible codecs.", { adaptation: newAdaptation });
|
|
46
46
|
_this.contentWarnings.push(error);
|
|
47
47
|
}
|
|
48
48
|
return newAdaptation;
|
|
@@ -53,7 +53,7 @@ var Period = /** @class */ (function () {
|
|
|
53
53
|
if (filteredAdaptations.every(function (adaptation) { return !adaptation.isSupported; }) &&
|
|
54
54
|
adaptationsForType.length > 0 &&
|
|
55
55
|
(type === "video" || type === "audio")) {
|
|
56
|
-
throw new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR", "No supported " + type + " adaptations");
|
|
56
|
+
throw new MediaError("MANIFEST_INCOMPATIBLE_CODECS_ERROR", "No supported " + type + " adaptations", { adaptation: undefined });
|
|
57
57
|
}
|
|
58
58
|
if (filteredAdaptations.length > 0) {
|
|
59
59
|
acc[type] = filteredAdaptations;
|
|
@@ -14,15 +14,36 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ICdnMetadata, IContentProtections, IParsedRepresentation } from "../parsers/manifest";
|
|
17
|
-
import { ITrackType, IHDRInformation } from "../public_types";
|
|
17
|
+
import { IAudioRepresentation, ITrackType, IHDRInformation, IVideoRepresentation } from "../public_types";
|
|
18
18
|
import { IRepresentationIndex } from "./representation_index";
|
|
19
19
|
/**
|
|
20
20
|
* Normalized Representation structure.
|
|
21
21
|
* @class Representation
|
|
22
22
|
*/
|
|
23
23
|
declare class Representation {
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* ID uniquely identifying the `Representation` in its parent `Adaptation`.
|
|
26
|
+
*
|
|
27
|
+
* This identifier might be linked to an identifier present in the original
|
|
28
|
+
* Manifest file, it is thus the identifier to use to determine if a
|
|
29
|
+
* `Representation` from a refreshed `Manifest` is actually the same one than
|
|
30
|
+
* one in the previously loaded Manifest (as long as the `Adaptation` and
|
|
31
|
+
* `Period` are also the same).
|
|
32
|
+
*
|
|
33
|
+
* For a globally unique identifier regardless of the `Adaptation`, `Period`
|
|
34
|
+
* or even `Manifest`, you can rely on `uniqueId` instead.
|
|
35
|
+
*/
|
|
25
36
|
readonly id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Globally unique identifier for this `Representation` object.
|
|
39
|
+
*
|
|
40
|
+
* This identifier is guaranteed to be unique for any `Representation`s of all
|
|
41
|
+
* `Manifest` objects created in the current JS Realm.
|
|
42
|
+
* As such, it can be used as an identifier for the JS object itself, whereas
|
|
43
|
+
* `id` is the identifier for the original Manifest's Representation in the
|
|
44
|
+
* scope of its parent `Adaptation`.
|
|
45
|
+
*/
|
|
46
|
+
readonly uniqueId: string;
|
|
26
47
|
/**
|
|
27
48
|
* Interface allowing to get information about segments available for this
|
|
28
49
|
* Representation.
|
|
@@ -165,6 +186,16 @@ declare class Representation {
|
|
|
165
186
|
systemId: string;
|
|
166
187
|
data: Uint8Array;
|
|
167
188
|
}>): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Format Representation as an `IAudioRepresentation`.
|
|
191
|
+
* @returns {Object}
|
|
192
|
+
*/
|
|
193
|
+
toAudioRepresentation(): IAudioRepresentation;
|
|
194
|
+
/**
|
|
195
|
+
* Format Representation as an `IVideoRepresentation`.
|
|
196
|
+
* @returns {Object}
|
|
197
|
+
*/
|
|
198
|
+
toVideoRepresentation(): IVideoRepresentation;
|
|
168
199
|
/**
|
|
169
200
|
* Returns `true` if this Representation can be played (that is: not
|
|
170
201
|
* undecipherable and with a supported codec).
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
import { isCodecSupported } from "../compat";
|
|
17
17
|
import log from "../log";
|
|
18
18
|
import areArraysOfNumbersEqual from "../utils/are_arrays_of_numbers_equal";
|
|
19
|
+
import idGenerator from "../utils/id_generator";
|
|
20
|
+
var generateRepresentationUniqueId = idGenerator();
|
|
19
21
|
/**
|
|
20
22
|
* Normalized Representation structure.
|
|
21
23
|
* @class Representation
|
|
@@ -26,6 +28,7 @@ var Representation = /** @class */ (function () {
|
|
|
26
28
|
*/
|
|
27
29
|
function Representation(args, opts) {
|
|
28
30
|
this.id = args.id;
|
|
31
|
+
this.uniqueId = generateRepresentationUniqueId();
|
|
29
32
|
this.bitrate = args.bitrate;
|
|
30
33
|
this.codec = args.codecs;
|
|
31
34
|
if (args.height !== undefined) {
|
|
@@ -48,10 +51,17 @@ var Representation = /** @class */ (function () {
|
|
|
48
51
|
}
|
|
49
52
|
this.cdnMetadata = args.cdnMetadata;
|
|
50
53
|
this.index = args.index;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
isCodecSupported(
|
|
54
|
-
|
|
54
|
+
if (opts.type === "audio" || opts.type === "video") {
|
|
55
|
+
var mimeTypeStr = this.getMimeTypeString();
|
|
56
|
+
var isSupported = isCodecSupported(mimeTypeStr);
|
|
57
|
+
if (!isSupported) {
|
|
58
|
+
log.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
|
|
59
|
+
}
|
|
60
|
+
this.isSupported = isSupported;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.isSupported = true; // TODO for other types
|
|
64
|
+
}
|
|
55
65
|
}
|
|
56
66
|
/**
|
|
57
67
|
* Returns "mime-type string" which includes both the mime-type and the codec,
|
|
@@ -218,6 +228,24 @@ var Representation = /** @class */ (function () {
|
|
|
218
228
|
values: data });
|
|
219
229
|
return true;
|
|
220
230
|
};
|
|
231
|
+
/**
|
|
232
|
+
* Format Representation as an `IAudioRepresentation`.
|
|
233
|
+
* @returns {Object}
|
|
234
|
+
*/
|
|
235
|
+
Representation.prototype.toAudioRepresentation = function () {
|
|
236
|
+
var _a = this, id = _a.id, bitrate = _a.bitrate, codec = _a.codec, isSupported = _a.isSupported, decipherable = _a.decipherable;
|
|
237
|
+
return { id: id, bitrate: bitrate, codec: codec, isCodecSupported: isSupported,
|
|
238
|
+
seemsDecipherable: decipherable };
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Format Representation as an `IVideoRepresentation`.
|
|
242
|
+
* @returns {Object}
|
|
243
|
+
*/
|
|
244
|
+
Representation.prototype.toVideoRepresentation = function () {
|
|
245
|
+
var _a = this, id = _a.id, bitrate = _a.bitrate, frameRate = _a.frameRate, width = _a.width, height = _a.height, codec = _a.codec, hdrInfo = _a.hdrInfo, isSupported = _a.isSupported, decipherable = _a.decipherable;
|
|
246
|
+
return { id: id, bitrate: bitrate, frameRate: frameRate, width: width, height: height, codec: codec, hdrInfo: hdrInfo, isCodecSupported: isSupported,
|
|
247
|
+
seemsDecipherable: decipherable };
|
|
248
|
+
};
|
|
221
249
|
/**
|
|
222
250
|
* Returns `true` if this Representation can be played (that is: not
|
|
223
251
|
* undecipherable and with a supported codec).
|
|
@@ -22,9 +22,7 @@ import isNullOrUndefined from "../utils/is_null_or_undefined";
|
|
|
22
22
|
*/
|
|
23
23
|
export function areSameContent(content1, content2) {
|
|
24
24
|
return (content1.segment.id === content2.segment.id &&
|
|
25
|
-
content1.representation.
|
|
26
|
-
content1.adaptation.id === content2.adaptation.id &&
|
|
27
|
-
content1.period.id === content2.period.id);
|
|
25
|
+
content1.representation.uniqueId === content2.representation.uniqueId);
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* Get string describing a given ISegment, useful for log functions.
|
|
@@ -159,22 +159,13 @@ function getAdaptationSetSwitchingIDs(adaptation) {
|
|
|
159
159
|
* @returns {Array.<Object>}
|
|
160
160
|
*/
|
|
161
161
|
export default function parseAdaptationSets(adaptationsIR, context) {
|
|
162
|
-
var _a;
|
|
163
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
|
164
163
|
var parsedAdaptations = { video: [],
|
|
165
164
|
audio: [],
|
|
166
165
|
text: [] };
|
|
167
166
|
var trickModeAdaptations = [];
|
|
168
167
|
var adaptationSwitchingInfos = {};
|
|
169
168
|
var parsedAdaptationsIDs = [];
|
|
170
|
-
/**
|
|
171
|
-
* Index of the last parsed Video AdaptationSet with a Role set as "main" in
|
|
172
|
-
* `parsedAdaptations.video`.
|
|
173
|
-
* `-1` if not yet encountered.
|
|
174
|
-
* Used as we merge all main video AdaptationSet due to a comprehension of the
|
|
175
|
-
* DASH-IF IOP.
|
|
176
|
-
*/
|
|
177
|
-
var lastMainVideoAdapIdx = -1;
|
|
178
169
|
for (var adaptationIdx = 0; adaptationIdx < adaptationsIR.length; adaptationIdx++) {
|
|
179
170
|
var adaptation = adaptationsIR[adaptationIdx];
|
|
180
171
|
var adaptationChildren = adaptation.children;
|
|
@@ -183,8 +174,8 @@ export default function parseAdaptationSets(adaptationsIR, context) {
|
|
|
183
174
|
roles.some(function (role) { return role.value === "main"; }) &&
|
|
184
175
|
roles.some(function (role) { return role.schemeIdUri === "urn:mpeg:dash:role:2011"; });
|
|
185
176
|
var representationsIR = adaptation.children.representations;
|
|
186
|
-
var availabilityTimeComplete = (
|
|
187
|
-
var availabilityTimeOffset = ((
|
|
177
|
+
var availabilityTimeComplete = (_a = adaptation.attributes.availabilityTimeComplete) !== null && _a !== void 0 ? _a : context.availabilityTimeComplete;
|
|
178
|
+
var availabilityTimeOffset = ((_b = adaptation.attributes.availabilityTimeOffset) !== null && _b !== void 0 ? _b : 0) +
|
|
188
179
|
context.availabilityTimeOffset;
|
|
189
180
|
var adaptationMimeType = adaptation.attributes.mimeType;
|
|
190
181
|
var adaptationCodecs = adaptation.attributes.codecs;
|
|
@@ -198,9 +189,8 @@ export default function parseAdaptationSets(adaptationsIR, context) {
|
|
|
198
189
|
if (type === undefined) {
|
|
199
190
|
continue;
|
|
200
191
|
}
|
|
201
|
-
var priority = (
|
|
192
|
+
var priority = (_c = adaptation.attributes.selectionPriority) !== null && _c !== void 0 ? _c : 1;
|
|
202
193
|
var originalID = adaptation.attributes.id;
|
|
203
|
-
var newID = void 0;
|
|
204
194
|
var adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
|
|
205
195
|
var parentSegmentTemplates = [];
|
|
206
196
|
if (context.segmentTemplate !== undefined) {
|
|
@@ -228,134 +218,112 @@ export default function parseAdaptationSets(adaptationsIR, context) {
|
|
|
228
218
|
arrayFind(essentialProperties, function (scheme) {
|
|
229
219
|
return scheme.schemeIdUri === "http://dashif.org/guidelines/trickmode";
|
|
230
220
|
}) : undefined;
|
|
231
|
-
var trickModeAttachedAdaptationIds = (
|
|
221
|
+
var trickModeAttachedAdaptationIds = (_d = trickModeProperty === null || trickModeProperty === void 0 ? void 0 : trickModeProperty.value) === null || _d === void 0 ? void 0 : _d.split(" ");
|
|
232
222
|
var isTrickModeTrack = trickModeAttachedAdaptationIds !== undefined;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
(_a = videoMainAdaptation.representations).push.apply(_a, representations);
|
|
243
|
-
newID = videoMainAdaptation.id;
|
|
223
|
+
var accessibilities = adaptationChildren.accessibilities;
|
|
224
|
+
var isDub = void 0;
|
|
225
|
+
if (roles !== undefined &&
|
|
226
|
+
roles.some(function (role) { return role.value === "dub"; })) {
|
|
227
|
+
isDub = true;
|
|
228
|
+
}
|
|
229
|
+
var isClosedCaption = void 0;
|
|
230
|
+
if (type !== "text") {
|
|
231
|
+
isClosedCaption = false;
|
|
244
232
|
}
|
|
245
233
|
else {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
mergedInto[
|
|
328
|
-
|
|
329
|
-
mergedInto[0].closedCaption ===
|
|
330
|
-
parsedAdaptationSet.closedCaption &&
|
|
331
|
-
mergedInto[0].language === parsedAdaptationSet.language) {
|
|
332
|
-
log.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
|
|
333
|
-
(_k = mergedInto[0].representations).push.apply(_k, parsedAdaptationSet.representations);
|
|
334
|
-
if (type === "video" &&
|
|
335
|
-
isMainAdaptation &&
|
|
336
|
-
!mergedInto[1].isMainAdaptation) {
|
|
337
|
-
lastMainVideoAdapIdx = Math.max(lastMainVideoAdapIdx, mergedIntoIdx);
|
|
338
|
-
}
|
|
339
|
-
mergedInto[1] = {
|
|
340
|
-
priority: Math.max(priority, mergedInto[1].priority),
|
|
341
|
-
isMainAdaptation: isMainAdaptation ||
|
|
342
|
-
mergedInto[1].isMainAdaptation,
|
|
343
|
-
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd),
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
for (var _i = 0, adaptationSetSwitchingIDs_1 = adaptationSetSwitchingIDs; _i < adaptationSetSwitchingIDs_1.length; _i++) {
|
|
349
|
-
var id = adaptationSetSwitchingIDs_1[_i];
|
|
350
|
-
_loop_1(id);
|
|
351
|
-
}
|
|
352
|
-
if (mergedIntoIdx < 0) {
|
|
353
|
-
parsedAdaptations[type].push([parsedAdaptationSet,
|
|
354
|
-
{ priority: priority, isMainAdaptation: isMainAdaptation, indexInMpd: adaptationIdx }]);
|
|
355
|
-
if (type === "video" && isMainAdaptation) {
|
|
356
|
-
lastMainVideoAdapIdx = parsedAdaptations.video.length - 1;
|
|
234
|
+
isClosedCaption = isCaptionning(accessibilities, roles);
|
|
235
|
+
}
|
|
236
|
+
var isForcedSubtitle = void 0;
|
|
237
|
+
if (type === "text" &&
|
|
238
|
+
roles !== undefined &&
|
|
239
|
+
roles.some(function (role) { return role.value === "forced-subtitle" ||
|
|
240
|
+
role.value === "forced_subtitle"; })) {
|
|
241
|
+
isForcedSubtitle = true;
|
|
242
|
+
}
|
|
243
|
+
var isAudioDescription = void 0;
|
|
244
|
+
if (type !== "audio") {
|
|
245
|
+
isAudioDescription = false;
|
|
246
|
+
}
|
|
247
|
+
else if (accessibilities !== undefined) {
|
|
248
|
+
isAudioDescription = accessibilities.some(isVisuallyImpaired);
|
|
249
|
+
}
|
|
250
|
+
var isSignInterpreted = void 0;
|
|
251
|
+
if (type !== "video") {
|
|
252
|
+
isSignInterpreted = false;
|
|
253
|
+
}
|
|
254
|
+
else if (accessibilities !== undefined) {
|
|
255
|
+
isSignInterpreted = accessibilities.some(hasSignLanguageInterpretation);
|
|
256
|
+
}
|
|
257
|
+
var adaptationID = getAdaptationID(adaptation, { isAudioDescription: isAudioDescription, isForcedSubtitle: isForcedSubtitle, isClosedCaption: isClosedCaption, isSignInterpreted: isSignInterpreted, isTrickModeTrack: isTrickModeTrack, type: type });
|
|
258
|
+
// Avoid duplicate IDs
|
|
259
|
+
while (arrayIncludes(parsedAdaptationsIDs, adaptationID)) {
|
|
260
|
+
adaptationID += "-dup";
|
|
261
|
+
}
|
|
262
|
+
var newID = adaptationID;
|
|
263
|
+
parsedAdaptationsIDs.push(adaptationID);
|
|
264
|
+
reprCtxt.unsafelyBaseOnPreviousAdaptation = (_f = (_e = context
|
|
265
|
+
.unsafelyBaseOnPreviousPeriod) === null || _e === void 0 ? void 0 : _e.getAdaptation(adaptationID)) !== null && _f !== void 0 ? _f : null;
|
|
266
|
+
var representations = parseRepresentations(representationsIR, adaptation, reprCtxt);
|
|
267
|
+
var parsedAdaptationSet = { id: adaptationID, representations: representations, type: type, isTrickModeTrack: isTrickModeTrack };
|
|
268
|
+
if (adaptation.attributes.language != null) {
|
|
269
|
+
parsedAdaptationSet.language = adaptation.attributes.language;
|
|
270
|
+
}
|
|
271
|
+
if (isClosedCaption != null) {
|
|
272
|
+
parsedAdaptationSet.closedCaption = isClosedCaption;
|
|
273
|
+
}
|
|
274
|
+
if (isAudioDescription != null) {
|
|
275
|
+
parsedAdaptationSet.audioDescription = isAudioDescription;
|
|
276
|
+
}
|
|
277
|
+
if (isDub === true) {
|
|
278
|
+
parsedAdaptationSet.isDub = true;
|
|
279
|
+
}
|
|
280
|
+
if (isForcedSubtitle !== undefined) {
|
|
281
|
+
parsedAdaptationSet.forcedSubtitles = isForcedSubtitle;
|
|
282
|
+
}
|
|
283
|
+
if (isSignInterpreted === true) {
|
|
284
|
+
parsedAdaptationSet.isSignInterpreted = true;
|
|
285
|
+
}
|
|
286
|
+
if (label !== undefined) {
|
|
287
|
+
parsedAdaptationSet.label = label;
|
|
288
|
+
}
|
|
289
|
+
if (trickModeAttachedAdaptationIds !== undefined) {
|
|
290
|
+
trickModeAdaptations.push({ adaptation: parsedAdaptationSet, trickModeAttachedAdaptationIds: trickModeAttachedAdaptationIds });
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
// look if we have to merge this into another Adaptation
|
|
294
|
+
var mergedIntoIdx = -1;
|
|
295
|
+
var _loop_1 = function (id) {
|
|
296
|
+
var _g;
|
|
297
|
+
var switchingInfos = adaptationSwitchingInfos[id];
|
|
298
|
+
if (switchingInfos !== undefined &&
|
|
299
|
+
switchingInfos.newID !== newID &&
|
|
300
|
+
arrayIncludes(switchingInfos.adaptationSetSwitchingIDs, originalID)) {
|
|
301
|
+
mergedIntoIdx = arrayFindIndex(parsedAdaptations[type], function (a) { return a[0].id === id; });
|
|
302
|
+
var mergedInto = parsedAdaptations[type][mergedIntoIdx];
|
|
303
|
+
if (mergedInto !== undefined &&
|
|
304
|
+
mergedInto[0].audioDescription ===
|
|
305
|
+
parsedAdaptationSet.audioDescription &&
|
|
306
|
+
mergedInto[0].closedCaption ===
|
|
307
|
+
parsedAdaptationSet.closedCaption &&
|
|
308
|
+
mergedInto[0].language === parsedAdaptationSet.language) {
|
|
309
|
+
log.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
|
|
310
|
+
(_g = mergedInto[0].representations).push.apply(_g, parsedAdaptationSet.representations);
|
|
311
|
+
mergedInto[1] = {
|
|
312
|
+
priority: Math.max(priority, mergedInto[1].priority),
|
|
313
|
+
isMainAdaptation: isMainAdaptation ||
|
|
314
|
+
mergedInto[1].isMainAdaptation,
|
|
315
|
+
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd),
|
|
316
|
+
};
|
|
357
317
|
}
|
|
358
318
|
}
|
|
319
|
+
};
|
|
320
|
+
for (var _i = 0, adaptationSetSwitchingIDs_1 = adaptationSetSwitchingIDs; _i < adaptationSetSwitchingIDs_1.length; _i++) {
|
|
321
|
+
var id = adaptationSetSwitchingIDs_1[_i];
|
|
322
|
+
_loop_1(id);
|
|
323
|
+
}
|
|
324
|
+
if (mergedIntoIdx < 0) {
|
|
325
|
+
parsedAdaptations[type].push([parsedAdaptationSet,
|
|
326
|
+
{ priority: priority, isMainAdaptation: isMainAdaptation, indexInMpd: adaptationIdx }]);
|
|
359
327
|
}
|
|
360
328
|
}
|
|
361
329
|
if (originalID != null && adaptationSwitchingInfos[originalID] == null) {
|
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
17
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
18
|
+
if (ar || !(i in from)) {
|
|
19
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
20
|
+
ar[i] = from[i];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
24
|
+
};
|
|
16
25
|
import log from "../../../../log";
|
|
17
26
|
import arrayFind from "../../../../utils/array_find";
|
|
18
27
|
import objectAssign from "../../../../utils/object_assign";
|
|
@@ -45,11 +54,8 @@ function combineInbandEventStreams(representation, adaptation) {
|
|
|
45
54
|
* @returns {Object | undefined}
|
|
46
55
|
*/
|
|
47
56
|
function getHDRInformation(_a) {
|
|
48
|
-
var adaptationProfiles = _a.adaptationProfiles, manifestProfiles = _a.manifestProfiles, codecs = _a.codecs;
|
|
57
|
+
var adaptationProfiles = _a.adaptationProfiles, essentialProperties = _a.essentialProperties, supplementalProperties = _a.supplementalProperties, manifestProfiles = _a.manifestProfiles, codecs = _a.codecs;
|
|
49
58
|
var profiles = (adaptationProfiles !== null && adaptationProfiles !== void 0 ? adaptationProfiles : "") + (manifestProfiles !== null && manifestProfiles !== void 0 ? manifestProfiles : "");
|
|
50
|
-
if (codecs === undefined) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
59
|
if (profiles.indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10") !== -1) {
|
|
54
60
|
if (codecs === "hvc1.2.4.L153.B0" ||
|
|
55
61
|
codecs === "hev1.2.4.L153.B0") {
|
|
@@ -58,7 +64,18 @@ function getHDRInformation(_a) {
|
|
|
58
64
|
colorSpace: "rec2020" };
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
|
-
|
|
67
|
+
var transferCharacteristicScheme = arrayFind(__spreadArray(__spreadArray([], (essentialProperties !== null && essentialProperties !== void 0 ? essentialProperties : []), true), (supplementalProperties !== null && supplementalProperties !== void 0 ? supplementalProperties : []), true), function (p) { return p.schemeIdUri === "urn:mpeg:mpegB:cicp:TransferCharacteristics"; });
|
|
68
|
+
if (transferCharacteristicScheme !== undefined) {
|
|
69
|
+
switch (transferCharacteristicScheme.value) {
|
|
70
|
+
case "15":
|
|
71
|
+
return undefined; // SDR
|
|
72
|
+
case "16":
|
|
73
|
+
return { eotf: "pq" };
|
|
74
|
+
case "18":
|
|
75
|
+
return { eotf: "hlg" };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (codecs !== undefined && /^vp(08|09|10)/.exec(codecs)) {
|
|
62
79
|
return getWEBMHDRInformation(codecs);
|
|
63
80
|
}
|
|
64
81
|
}
|
|
@@ -218,6 +235,9 @@ export default function parseRepresentations(representationsIR, adaptation, cont
|
|
|
218
235
|
}
|
|
219
236
|
parsedRepresentation.hdrInfo =
|
|
220
237
|
getHDRInformation({ adaptationProfiles: adaptation.attributes.profiles,
|
|
238
|
+
supplementalProperties: adaptation.children
|
|
239
|
+
.supplementalProperties,
|
|
240
|
+
essentialProperties: adaptation.children.essentialProperties,
|
|
221
241
|
manifestProfiles: context.manifestProfiles, codecs: codecs });
|
|
222
242
|
parsedRepresentations.push(parsedRepresentation);
|
|
223
243
|
};
|
|
@@ -17,7 +17,7 @@ import { IMPDParserArguments } from "../common";
|
|
|
17
17
|
import { IDashParserResponse } from "../parsers_types";
|
|
18
18
|
/**
|
|
19
19
|
* Parse MPD through the JS parser, on a `Document` instance.
|
|
20
|
-
* @param {Document}
|
|
20
|
+
* @param {Document} document - Original manifest as returned by the server
|
|
21
21
|
* @param {Object} args - Various parsing options and information.
|
|
22
22
|
* @returns {Object} - Response returned by the DASH-JS parser.
|
|
23
23
|
*/
|
|
@@ -20,7 +20,7 @@ import { createMPDIntermediateRepresentation, } from "./node_parsers/MPD";
|
|
|
20
20
|
import { createPeriodIntermediateRepresentation, } from "./node_parsers/Period";
|
|
21
21
|
/**
|
|
22
22
|
* Parse MPD through the JS parser, on a `Document` instance.
|
|
23
|
-
* @param {Document}
|
|
23
|
+
* @param {Document} document - Original manifest as returned by the server
|
|
24
24
|
* @param {Object} args - Various parsing options and information.
|
|
25
25
|
* @returns {Object} - Response returned by the DASH-JS parser.
|
|
26
26
|
*/
|