rx-player 4.0.0-dev.2023110700 → 4.0.0-dev.2023120600
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -226
- package/FILES.md +1 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -3
- package/dist/_esm5.processed/compat/add_text_track.js +4 -7
- package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -7
- package/dist/_esm5.processed/compat/event_listeners.d.ts +2 -15
- package/dist/_esm5.processed/compat/event_listeners.js +2 -37
- package/dist/_esm5.processed/compat/index.d.ts +1 -3
- package/dist/_esm5.processed/compat/index.js +1 -3
- package/dist/_esm5.processed/config.d.ts +9 -21
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -58
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +14 -54
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +2 -8
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +2 -11
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +13 -32
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +14 -35
- package/dist/_esm5.processed/core/api/option_utils.js +47 -230
- package/dist/_esm5.processed/core/api/public_api.d.ts +92 -266
- package/dist/_esm5.processed/core/api/public_api.js +451 -807
- package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.d.ts +3 -2
- package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.js +3 -2
- package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +15 -75
- package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +74 -193
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +84 -0
- package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +158 -0
- package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +406 -0
- package/dist/_esm5.processed/core/api/track_management/tracks_store.js +932 -0
- package/dist/_esm5.processed/core/api/utils.d.ts +1 -0
- package/dist/_esm5.processed/core/api/utils.js +28 -11
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +83 -71
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +6 -5
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +10 -72
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +6 -4
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +1 -3
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +7 -26
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +3 -9
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +16 -9
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +1 -6
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +4 -41
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +1 -8
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -19
- package/dist/_esm5.processed/core/init/types.d.ts +5 -15
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +19 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
- package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +0 -15
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +183 -93
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
- package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
- package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +27 -13
- package/dist/_esm5.processed/core/stream/index.d.ts +2 -3
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +2 -0
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -7
- package/dist/_esm5.processed/core/stream/period/period_stream.js +13 -12
- package/dist/_esm5.processed/core/stream/period/types.d.ts +5 -14
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +2 -4
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +10 -46
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +29 -23
- package/dist/_esm5.processed/core/stream/representation/types.d.ts +11 -1
- package/dist/_esm5.processed/default_config.d.ts +35 -98
- package/dist/_esm5.processed/default_config.js +36 -113
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +1 -3
- package/dist/_esm5.processed/errors/custom_loader_error.js +1 -3
- package/dist/_esm5.processed/errors/media_error.js +2 -2
- package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/network_error.js +0 -1
- package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
- package/dist/_esm5.processed/errors/request_error.js +2 -5
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
- package/dist/_esm5.processed/features/features_object.js +0 -2
- package/dist/_esm5.processed/features/list/directfile.js +2 -5
- package/dist/_esm5.processed/features/list/index.d.ts +0 -2
- package/dist/_esm5.processed/features/list/index.js +0 -2
- package/dist/_esm5.processed/features/types.d.ts +3 -27
- package/dist/_esm5.processed/manifest/adaptation.d.ts +9 -11
- package/dist/_esm5.processed/manifest/adaptation.js +41 -30
- package/dist/_esm5.processed/manifest/index.d.ts +3 -4
- package/dist/_esm5.processed/manifest/manifest.d.ts +5 -54
- package/dist/_esm5.processed/manifest/manifest.js +5 -110
- package/dist/_esm5.processed/manifest/period.d.ts +4 -5
- package/dist/_esm5.processed/manifest/representation.d.ts +10 -5
- package/dist/_esm5.processed/manifest/representation.js +33 -10
- package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
- package/dist/_esm5.processed/manifest/representation_index/static.d.ts +2 -0
- package/dist/_esm5.processed/manifest/representation_index/static.js +6 -0
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +42 -21
- package/dist/_esm5.processed/manifest/types.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +17 -31
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +26 -19
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +7 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +2 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +11 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +29 -17
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +13 -6
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +7 -2
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +6 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +7 -6
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +5 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +6 -0
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +11 -17
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -83
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +53 -125
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +4 -3
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
- package/dist/_esm5.processed/public_types.d.ts +396 -308
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +5 -4
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +5 -4
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
- package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +26 -20
- package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
- package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
- package/dist/_esm5.processed/transports/dash/text_parser.js +28 -33
- package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
- package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -52
- package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/smooth/is_mp4_embedded_track.d.ts} +5 -5
- package/dist/_esm5.processed/{features/list/image_buffer.d.ts → transports/smooth/is_mp4_embedded_track.js} +7 -6
- package/dist/_esm5.processed/transports/smooth/pipelines.js +33 -190
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +28 -22
- package/dist/_esm5.processed/transports/smooth/utils.d.ts +1 -26
- package/dist/_esm5.processed/transports/smooth/utils.js +1 -55
- package/dist/_esm5.processed/transports/types.d.ts +94 -89
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
- package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
- package/dist/_esm5.processed/utils/array_includes.d.ts +2 -1
- package/dist/_esm5.processed/utils/array_includes.js +30 -28
- package/dist/_esm5.processed/utils/request/xhr.js +5 -5
- package/dist/commonjs/compat/is_codec_supported.js +22 -1
- package/dist/commonjs/compat/patch_webkit_source_buffer.js +2 -2
- package/dist/commonjs/config.d.ts +1 -0
- package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
- package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
- package/dist/commonjs/core/api/option_utils.d.ts +4 -0
- package/dist/commonjs/core/api/option_utils.js +8 -3
- package/dist/commonjs/core/api/public_api.d.ts +11 -1
- package/dist/commonjs/core/api/public_api.js +46 -11
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/commonjs/core/init/directfile_content_initializer.js +24 -7
- package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/commonjs/core/init/media_source_content_initializer.js +4 -6
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +16 -17
- package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
- package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.js +19 -2
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +2 -2
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/commonjs/core/stream/period/period_stream.js +2 -2
- package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +3 -3
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/commonjs/default_config.d.ts +5 -0
- package/dist/commonjs/default_config.js +5 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/commonjs/manifest/representation.js +18 -5
- package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
- package/dist/commonjs/manifest/representation_index/static.js +2 -2
- package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
- package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.js +30 -0
- package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
- package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +36 -20
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +2 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/commonjs/parsers/manifest/types.d.ts +1 -0
- package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/commonjs/public_types.d.ts +78 -34
- package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
- package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
- package/dist/commonjs/transports/dash/segment_loader.js +2 -1
- package/dist/commonjs/transports/dash/text_loader.js +2 -0
- package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
- package/dist/commonjs/transports/smooth/pipelines.js +4 -2
- package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
- package/dist/commonjs/transports/types.d.ts +12 -0
- package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
- package/dist/commonjs/utils/queue_microtask.d.ts +2 -0
- package/dist/commonjs/utils/queue_microtask.js +7 -0
- package/dist/commonjs/utils/request/fetch.d.ts +6 -0
- package/dist/commonjs/utils/request/fetch.js +29 -8
- package/dist/commonjs/utils/request/xhr.d.ts +11 -5
- package/dist/commonjs/utils/request/xhr.js +29 -8
- package/dist/es2017/compat/is_codec_supported.js +22 -1
- package/dist/es2017/compat/patch_webkit_source_buffer.js +2 -2
- package/dist/es2017/config.d.ts +1 -0
- package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
- package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
- package/dist/es2017/core/api/option_utils.d.ts +4 -0
- package/dist/es2017/core/api/option_utils.js +8 -3
- package/dist/es2017/core/api/public_api.d.ts +11 -1
- package/dist/es2017/core/api/public_api.js +44 -9
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
- package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
- package/dist/es2017/core/init/directfile_content_initializer.js +24 -7
- package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
- package/dist/es2017/core/init/media_source_content_initializer.js +4 -6
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +16 -15
- package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
- package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
- package/dist/es2017/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.js +18 -2
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +2 -2
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/es2017/core/stream/period/period_stream.js +2 -2
- package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +3 -3
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
- package/dist/es2017/default_config.d.ts +5 -0
- package/dist/es2017/default_config.js +5 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
- package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
- package/dist/es2017/manifest/representation.js +18 -5
- package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
- package/dist/es2017/manifest/representation_index/static.js +2 -2
- package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
- package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
- package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
- package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +36 -20
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +2 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
- package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
- package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
- package/dist/es2017/parsers/manifest/types.d.ts +1 -0
- package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
- package/dist/es2017/public_types.d.ts +78 -34
- package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
- package/dist/es2017/transports/dash/manifest_parser.js +3 -0
- package/dist/es2017/transports/dash/segment_loader.js +1 -0
- package/dist/es2017/transports/dash/text_loader.js +2 -0
- package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
- package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
- package/dist/es2017/transports/smooth/pipelines.js +2 -0
- package/dist/es2017/transports/smooth/segment_loader.js +1 -0
- package/dist/es2017/transports/types.d.ts +12 -0
- package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
- package/dist/es2017/utils/queue_microtask.d.ts +2 -0
- package/dist/es2017/utils/queue_microtask.js +5 -0
- package/dist/es2017/utils/request/fetch.d.ts +6 -0
- package/dist/es2017/utils/request/fetch.js +29 -8
- package/dist/es2017/utils/request/xhr.d.ts +11 -5
- package/dist/es2017/utils/request/xhr.js +30 -9
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +900 -492
- package/dist/rx-player.min.js +1 -1
- package/package.json +3 -7
- package/scripts/update-version +2 -0
- package/sonar-project.properties +1 -1
- package/src/compat/is_codec_supported.ts +23 -1
- package/src/compat/patch_webkit_source_buffer.ts +2 -2
- package/src/core/api/debug/buffer_graph.ts +2 -5
- package/src/core/api/debug/modules/general_info.ts +15 -10
- package/src/core/api/option_utils.ts +11 -3
- package/src/core/api/public_api.ts +48 -8
- package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
- package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
- package/src/core/fetchers/utils/schedule_request.ts +1 -1
- package/src/core/init/directfile_content_initializer.ts +23 -7
- package/src/core/init/media_source_content_initializer.ts +13 -7
- package/src/core/init/utils/content_time_boundaries_observer.ts +23 -22
- package/src/core/init/utils/get_initial_time.ts +25 -12
- package/src/core/segment_buffers/implementations/text/html/__tests__/utils.test.ts +15 -0
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +57 -6
- package/src/core/segment_buffers/implementations/text/html/utils.ts +19 -2
- package/src/core/stream/adaptation/adaptation_stream.ts +2 -2
- package/src/core/stream/orchestrator/stream_orchestrator.ts +3 -3
- package/src/core/stream/period/period_stream.ts +2 -2
- package/src/core/stream/representation/utils/get_buffer_status.ts +3 -3
- package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
- package/src/default_config.ts +5 -0
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
- package/src/manifest/representation.ts +19 -6
- package/src/manifest/representation_index/static.ts +2 -2
- package/src/manifest/representation_index/types.ts +4 -4
- package/src/parsers/manifest/dash/common/__tests__/convert_supplemental_codecs.test.ts +37 -0
- package/src/parsers/manifest/dash/common/__tests__/flatten_overlapping_period.test.ts +20 -0
- package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
- package/src/parsers/manifest/dash/common/convert_supplemental_codecs.ts +32 -0
- package/src/parsers/manifest/dash/common/flatten_overlapping_periods.ts +5 -0
- package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
- package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
- package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
- package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
- package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
- package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
- package/src/parsers/manifest/dash/common/parse_representations.ts +39 -20
- package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +4 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +4 -0
- package/src/parsers/manifest/dash/node_parser_types.ts +2 -0
- package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +2 -0
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +2 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +4 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +4 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +2 -0
- package/src/parsers/manifest/local/representation_index.ts +3 -3
- package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
- package/src/parsers/manifest/smooth/representation_index.ts +23 -9
- package/src/parsers/manifest/types.ts +2 -0
- package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
- package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
- package/src/parsers/manifest/utils/index_helpers.ts +1 -1
- package/src/public_types.ts +79 -34
- package/src/transports/dash/init_segment_loader.ts +5 -0
- package/src/transports/dash/manifest_parser.ts +6 -0
- package/src/transports/dash/segment_loader.ts +1 -0
- package/src/transports/dash/text_loader.ts +2 -0
- package/src/transports/metaplaylist/manifest_loader.ts +1 -0
- package/src/transports/metaplaylist/pipelines.ts +4 -1
- package/src/transports/smooth/pipelines.ts +2 -0
- package/src/transports/smooth/segment_loader.ts +1 -0
- package/src/transports/types.ts +12 -0
- package/src/transports/utils/generate_manifest_loader.ts +3 -0
- package/src/utils/queue_microtask.ts +7 -0
- package/src/utils/request/fetch.ts +35 -8
- package/src/utils/request/xhr.ts +45 -14
- package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
- package/dist/_esm5.processed/compat/fullscreen.js +0 -78
- package/dist/_esm5.processed/compat/is_offline.d.ts +0 -39
- package/dist/_esm5.processed/compat/is_offline.js +0 -43
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +0 -258
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +0 -989
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -75
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -133
- package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
- package/dist/_esm5.processed/features/list/bif_parser.js +0 -27
- package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -38
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -129
- package/dist/_esm5.processed/utils/list_to_map.js +0 -28
- package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
- package/dist/_esm5.processed/utils/simple_set.js +0 -57
- package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
- package/dist/_esm5.processed/utils/uniq.js +0 -43
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
- package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
- package/src/typings/next-tick.d.ts +0 -23
- package/src/typings/object-assign.d.ts +0 -48
|
@@ -49,8 +49,8 @@ var task_canceller_1 = require("../../../utils/task_canceller");
|
|
|
49
49
|
/**
|
|
50
50
|
* Observes what's being played and take care of media events relating to time
|
|
51
51
|
* boundaries:
|
|
52
|
-
* - Emits a `
|
|
53
|
-
* known and every time it changes.
|
|
52
|
+
* - Emits a `endingPositionChange` when the known maximum playable position
|
|
53
|
+
* of the current content is known and every time it changes.
|
|
54
54
|
* - Emits `endOfStream` API once segments have been pushed until the end and
|
|
55
55
|
* `resumeStream` if downloads starts back.
|
|
56
56
|
* - Emits a `periodChange` event when the currently-playing Period seemed to
|
|
@@ -95,7 +95,7 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
|
|
|
95
95
|
}
|
|
96
96
|
}, { includeLastObservation: true, clearSignal: cancelSignal });
|
|
97
97
|
manifest.addEventListener("manifestUpdate", function () {
|
|
98
|
-
_this.trigger("
|
|
98
|
+
_this.trigger("endingPositionChange", _this._getManifestEndTime());
|
|
99
99
|
if (cancelSignal.isCancelled()) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -104,11 +104,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
|
|
|
104
104
|
return _this;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Returns an estimate of the current
|
|
107
|
+
* Returns an estimate of the current last position which may be played in
|
|
108
|
+
* the content at the moment.
|
|
108
109
|
* @returns {Object}
|
|
109
110
|
*/
|
|
110
|
-
ContentTimeBoundariesObserver.prototype.
|
|
111
|
-
return this.
|
|
111
|
+
ContentTimeBoundariesObserver.prototype.getCurrentEndingTime = function () {
|
|
112
|
+
return this._getManifestEndTime();
|
|
112
113
|
};
|
|
113
114
|
/**
|
|
114
115
|
* Method to call any time an Adaptation has been selected.
|
|
@@ -137,12 +138,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
|
|
|
137
138
|
.updateLastVideoAdaptation(adaptation);
|
|
138
139
|
}
|
|
139
140
|
var endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
140
|
-
var
|
|
141
|
-
{ isEnd: true,
|
|
142
|
-
duration: endingPosition } :
|
|
141
|
+
var newEndingPosition = endingPosition !== undefined ?
|
|
142
|
+
{ isEnd: true, endingPosition: endingPosition } :
|
|
143
143
|
{ isEnd: false,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
endingPosition: this._maximumPositionCalculator
|
|
145
|
+
.getMaximumAvailablePosition() };
|
|
146
|
+
this.trigger("endingPositionChange", newEndingPosition);
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
}
|
|
@@ -286,13 +287,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
|
|
|
286
287
|
finally { if (e_1) throw e_1.error; }
|
|
287
288
|
}
|
|
288
289
|
};
|
|
289
|
-
ContentTimeBoundariesObserver.prototype.
|
|
290
|
+
ContentTimeBoundariesObserver.prototype._getManifestEndTime = function () {
|
|
290
291
|
var endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
291
292
|
return endingPosition !== undefined ?
|
|
292
|
-
{ isEnd: true,
|
|
293
|
-
duration: endingPosition } :
|
|
293
|
+
{ isEnd: true, endingPosition: endingPosition } :
|
|
294
294
|
{ isEnd: false,
|
|
295
|
-
|
|
295
|
+
endingPosition: this._maximumPositionCalculator.getMaximumAvailablePosition() };
|
|
296
296
|
};
|
|
297
297
|
ContentTimeBoundariesObserver.prototype._lazilyCreateActiveStreamInfo = function (bufferType) {
|
|
298
298
|
var streamInfo = this._activeStreams.get(bufferType);
|
|
@@ -366,9 +366,8 @@ var MaximumPositionCalculator = /** @class */ (function () {
|
|
|
366
366
|
* @returns {number}
|
|
367
367
|
*/
|
|
368
368
|
MaximumPositionCalculator.prototype.getMaximumAvailablePosition = function () {
|
|
369
|
-
var _a;
|
|
370
369
|
if (this._manifest.isDynamic) {
|
|
371
|
-
return
|
|
370
|
+
return this._manifest.getMaximumSafePosition();
|
|
372
371
|
}
|
|
373
372
|
if (this._lastVideoAdaptation === undefined ||
|
|
374
373
|
this._lastAudioAdaptation === undefined) {
|
|
@@ -37,11 +37,25 @@ export interface IInitialTimeOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
fromFirstPosition?: number | null | undefined;
|
|
39
39
|
/**
|
|
40
|
-
* If set, we should begin at this position relative to the content's
|
|
41
|
-
* in seconds.
|
|
40
|
+
* If set, we should begin at this position relative to the content's maximum
|
|
41
|
+
* seekable position, in seconds.
|
|
42
|
+
*
|
|
43
|
+
* It should consequently in most cases be a negative value.
|
|
42
44
|
*/
|
|
43
45
|
fromLastPosition?: number | null | undefined;
|
|
44
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* If set, we should begin at this position relative to the content's live
|
|
48
|
+
* edge if it makes sense, in seconds.
|
|
49
|
+
*
|
|
50
|
+
* It should consequently in most cases be a negative value.
|
|
51
|
+
*
|
|
52
|
+
* If the live edge is unknown or if it does not make sense for the current
|
|
53
|
+
* content, that position is relative to the content's maximum position
|
|
54
|
+
* instead.
|
|
55
|
+
*/
|
|
56
|
+
fromLivePosition?: number | null | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* If set, we should begin at this position relative to the whole duration of
|
|
45
59
|
* the content, in percentage.
|
|
46
60
|
*/
|
|
47
61
|
percentage?: number | null | undefined;
|
|
@@ -33,15 +33,10 @@ var monotonic_timestamp_1 = require("../../../utils/monotonic_timestamp");
|
|
|
33
33
|
* @returns {Number}
|
|
34
34
|
*/
|
|
35
35
|
function getInitialTime(manifest, lowLatencyMode, startAt) {
|
|
36
|
+
var _a;
|
|
36
37
|
if (!(0, is_null_or_undefined_1.default)(startAt)) {
|
|
37
38
|
var min = manifest.getMinimumSafePosition();
|
|
38
|
-
var max =
|
|
39
|
-
if (manifest.isLive) {
|
|
40
|
-
max = manifest.getLivePosition();
|
|
41
|
-
}
|
|
42
|
-
if (max === undefined) {
|
|
43
|
-
max = manifest.getMaximumSafePosition();
|
|
44
|
-
}
|
|
39
|
+
var max = manifest.getMaximumSafePosition();
|
|
45
40
|
if (!(0, is_null_or_undefined_1.default)(startAt.position)) {
|
|
46
41
|
log_1.default.debug("Init: using startAt.minimumPosition");
|
|
47
42
|
return Math.max(Math.min(startAt.position, max), min);
|
|
@@ -66,6 +61,13 @@ function getInitialTime(manifest, lowLatencyMode, startAt) {
|
|
|
66
61
|
return fromLastPosition >= 0 ? max :
|
|
67
62
|
Math.max(min, max + fromLastPosition);
|
|
68
63
|
}
|
|
64
|
+
else if (!(0, is_null_or_undefined_1.default)(startAt.fromLivePosition)) {
|
|
65
|
+
log_1.default.debug("Init: using startAt.fromLivePosition");
|
|
66
|
+
var livePosition = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : max;
|
|
67
|
+
var fromLivePosition = startAt.fromLivePosition;
|
|
68
|
+
return fromLivePosition >= 0 ? livePosition :
|
|
69
|
+
Math.max(min, livePosition + fromLivePosition);
|
|
70
|
+
}
|
|
69
71
|
else if (!(0, is_null_or_undefined_1.default)(startAt.percentage)) {
|
|
70
72
|
log_1.default.debug("Init: using startAt.percentage");
|
|
71
73
|
var percentage = startAt.percentage;
|
package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.js
CHANGED
|
@@ -33,6 +33,22 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
var assert_1 = require("../../../../../utils/assert");
|
|
35
35
|
var utils_1 = require("./utils");
|
|
36
|
+
/**
|
|
37
|
+
* first or last IHTMLCue in a group can have a slighlty different start
|
|
38
|
+
* or end time than the start or end time of the ICuesGroup due to parsing
|
|
39
|
+
* approximation.
|
|
40
|
+
* DELTA_CUES_GROUP defines the tolerance level when comparing the start/end
|
|
41
|
+
* of a IHTMLCue to the start/end of a ICuesGroup.
|
|
42
|
+
* Having this value too high may lead to have unwanted subtitle displayed
|
|
43
|
+
* Having this value too low may lead to have subtitles not displayed
|
|
44
|
+
*/
|
|
45
|
+
var DELTA_CUES_GROUP = 1e-3;
|
|
46
|
+
/**
|
|
47
|
+
* segment_duration / RELATIVE_DELTA_RATIO = relative_delta
|
|
48
|
+
*
|
|
49
|
+
* relative_delta is the tolerance to determine if two segements are the same
|
|
50
|
+
*/
|
|
51
|
+
var RELATIVE_DELTA_RATIO = 5;
|
|
36
52
|
/**
|
|
37
53
|
* Manage the buffer of the HTMLTextSegmentBuffer.
|
|
38
54
|
* Allows to add, remove and recuperate cues at given times.
|
|
@@ -75,6 +91,18 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
75
91
|
ret.push(cues[j].element);
|
|
76
92
|
}
|
|
77
93
|
}
|
|
94
|
+
// first or last IHTMLCue in a group can have a slighlty different start
|
|
95
|
+
// or end time than the start or end time of the ICuesGroup due to parsing
|
|
96
|
+
// approximation.
|
|
97
|
+
// Add a tolerance of 1ms to fix this issue
|
|
98
|
+
if (ret.length === 0 && cues.length > 0) {
|
|
99
|
+
for (var j = 0; j < cues.length; j++) {
|
|
100
|
+
if ((0, utils_1.areNearlyEqual)(time, cues[j].start, DELTA_CUES_GROUP)
|
|
101
|
+
|| (0, utils_1.areNearlyEqual)(time, cues[j].end, DELTA_CUES_GROUP)) {
|
|
102
|
+
ret.push(cues[j].element);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
78
106
|
return ret;
|
|
79
107
|
}
|
|
80
108
|
}
|
|
@@ -161,6 +189,11 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
161
189
|
TextTrackCuesStore.prototype.insert = function (cues, start, end) {
|
|
162
190
|
var cuesBuffer = this._cuesBuffer;
|
|
163
191
|
var cuesInfosToInsert = { start: start, end: end, cues: cues };
|
|
192
|
+
// it's preferable to have a delta depending on the duration of the segment
|
|
193
|
+
// if the delta is one fifth of the length of the segment:
|
|
194
|
+
// a segment of [0, 2] is the "same" segment as [0, 2.1]
|
|
195
|
+
// but [0, 0.04] is not the "same" segement as [0,04, 0.08]
|
|
196
|
+
var relativeDelta = Math.abs(start - end) / RELATIVE_DELTA_RATIO;
|
|
164
197
|
/**
|
|
165
198
|
* Called when we found the index of the next cue relative to the cue we
|
|
166
199
|
* want to insert (that is a cue starting after its start or at the same
|
|
@@ -172,7 +205,7 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
172
205
|
function onIndexOfNextCueFound(indexOfNextCue) {
|
|
173
206
|
var nextCue = cuesBuffer[indexOfNextCue];
|
|
174
207
|
if (nextCue === undefined || // no cue
|
|
175
|
-
(0, utils_1.areNearlyEqual)(cuesInfosToInsert.end, nextCue.end)) // samey end
|
|
208
|
+
(0, utils_1.areNearlyEqual)(cuesInfosToInsert.end, nextCue.end, relativeDelta)) // samey end
|
|
176
209
|
{
|
|
177
210
|
// ours: |AAAAA|
|
|
178
211
|
// the current one: |BBBBB|
|
|
@@ -208,8 +241,8 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
208
241
|
for (var cueIdx = 0; cueIdx < cuesBuffer.length; cueIdx++) {
|
|
209
242
|
var cuesInfos = cuesBuffer[cueIdx];
|
|
210
243
|
if (start < cuesInfos.end) {
|
|
211
|
-
if ((0, utils_1.areNearlyEqual)(start, cuesInfos.start)) {
|
|
212
|
-
if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end)) {
|
|
244
|
+
if ((0, utils_1.areNearlyEqual)(start, cuesInfos.start, relativeDelta)) {
|
|
245
|
+
if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end, relativeDelta)) {
|
|
213
246
|
// exact same segment
|
|
214
247
|
// ours: |AAAAA|
|
|
215
248
|
// the current one: |BBBBB|
|
|
@@ -257,7 +290,7 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
257
290
|
cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
|
|
258
291
|
return;
|
|
259
292
|
}
|
|
260
|
-
else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.start)) {
|
|
293
|
+
else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.start, relativeDelta)) {
|
|
261
294
|
// our cue goes just before the current one:
|
|
262
295
|
// ours: |AAAAAAA|
|
|
263
296
|
// the current one: |BBBB|
|
|
@@ -269,7 +302,7 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
269
302
|
cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
|
|
270
303
|
return;
|
|
271
304
|
}
|
|
272
|
-
else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end)) {
|
|
305
|
+
else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end, relativeDelta)) {
|
|
273
306
|
// ours: |AAAAAAA|
|
|
274
307
|
// the current one: |BBBB|
|
|
275
308
|
// Result: |AAAAAAA|
|
|
@@ -297,7 +330,7 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
297
330
|
return;
|
|
298
331
|
}
|
|
299
332
|
// else -> start > cuesInfos.start
|
|
300
|
-
if ((0, utils_1.areNearlyEqual)(cuesInfos.end, end)) {
|
|
333
|
+
if ((0, utils_1.areNearlyEqual)(cuesInfos.end, end, relativeDelta)) {
|
|
301
334
|
// ours: |AAAAAA|
|
|
302
335
|
// the current one: |BBBBBBBB|
|
|
303
336
|
// Result: |BBAAAAAA|
|
|
@@ -333,6 +366,21 @@ var TextTrackCuesStore = /** @class */ (function () {
|
|
|
333
366
|
}
|
|
334
367
|
}
|
|
335
368
|
}
|
|
369
|
+
if (cuesBuffer.length) {
|
|
370
|
+
var lastCue = cuesBuffer[cuesBuffer.length - 1];
|
|
371
|
+
if ((0, utils_1.areNearlyEqual)(lastCue.end, start, relativeDelta)) {
|
|
372
|
+
// Match the end of the previous cue to the start of the following one
|
|
373
|
+
// if they are close enough. If there is a small gap between two segments
|
|
374
|
+
// it can lead to having no subtitles for a short time, this is noticeable when
|
|
375
|
+
// two successive segments displays the same text, making it diseappear
|
|
376
|
+
// and reappear quickly, which gives the impression of blinking
|
|
377
|
+
//
|
|
378
|
+
// ours: |AAAAA|
|
|
379
|
+
// the current one: |BBBBB|...
|
|
380
|
+
// Result: |BBBBBBBAAAAA|
|
|
381
|
+
lastCue.end = start;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
336
384
|
// no cues group has the end after our current start.
|
|
337
385
|
// These cues should be the last one
|
|
338
386
|
cuesBuffer.push(cuesInfosToInsert);
|
|
@@ -18,9 +18,10 @@ import { ICuesGroup, IHTMLCue } from "./types";
|
|
|
18
18
|
* @see MAX_DELTA_BUFFER_TIME
|
|
19
19
|
* @param {Number} a
|
|
20
20
|
* @param {Number} b
|
|
21
|
+
* @param {Number} delta
|
|
21
22
|
* @returns {Boolean}
|
|
22
23
|
*/
|
|
23
|
-
export declare function areNearlyEqual(a: number, b: number): boolean;
|
|
24
|
+
export declare function areNearlyEqual(a: number, b: number, delta?: number): boolean;
|
|
24
25
|
/**
|
|
25
26
|
* Get all cues which have data before the given time.
|
|
26
27
|
* @param {Object} cues
|
|
@@ -47,6 +47,21 @@ exports.removeCuesInfosBetween = exports.getCuesAfter = exports.getCuesBefore =
|
|
|
47
47
|
* Setting a value too high might lead to two segments targeting different times
|
|
48
48
|
* to be wrongly believed to target the same time. In worst case scenarios, this
|
|
49
49
|
* could lead to wanted text tracks being removed.
|
|
50
|
+
*
|
|
51
|
+
* When comparing 2 segments s1 and s2, you may want to take into account the duration
|
|
52
|
+
* of the segments:
|
|
53
|
+
* - if s1 is [0, 2] and s2 is [0, 2.1] s1 and s2 can be considered as nearly equal as
|
|
54
|
+
* there is a relative difference of: (2.1-2) / 2 = 5%;
|
|
55
|
+
* Formula: (end_s1 - end_s2) / duration_s2 = relative_difference
|
|
56
|
+
* - if s1 is [0, 0.04] and s2 is [0.04, 0.08] s1 and s2 may not considered as nearly
|
|
57
|
+
* equal as there is a relative difference of: (0.04-0.08) / 0.04 = 100%
|
|
58
|
+
*
|
|
59
|
+
* To compare relatively to the duration of a segment you can provide and additional
|
|
60
|
+
* parameter "delta" that remplace MAX_DELTA_BUFFER_TIME.
|
|
61
|
+
* If parameter "delta" is higher than MAX_DELTA_BUFFER_TIME, MAX_DELTA_BUFFER_TIME
|
|
62
|
+
* is used instead of delta. This ensure that segments are nearly equal when comparing
|
|
63
|
+
* relatively AND absolutely.
|
|
64
|
+
*
|
|
50
65
|
* @type Number
|
|
51
66
|
*/
|
|
52
67
|
var MAX_DELTA_BUFFER_TIME = 0.2;
|
|
@@ -54,10 +69,12 @@ var MAX_DELTA_BUFFER_TIME = 0.2;
|
|
|
54
69
|
* @see MAX_DELTA_BUFFER_TIME
|
|
55
70
|
* @param {Number} a
|
|
56
71
|
* @param {Number} b
|
|
72
|
+
* @param {Number} delta
|
|
57
73
|
* @returns {Boolean}
|
|
58
74
|
*/
|
|
59
|
-
function areNearlyEqual(a, b) {
|
|
60
|
-
|
|
75
|
+
function areNearlyEqual(a, b, delta) {
|
|
76
|
+
if (delta === void 0) { delta = MAX_DELTA_BUFFER_TIME; }
|
|
77
|
+
return Math.abs(a - b) <= Math.min(delta, MAX_DELTA_BUFFER_TIME);
|
|
61
78
|
}
|
|
62
79
|
exports.areNearlyEqual = areNearlyEqual;
|
|
63
80
|
/**
|
|
@@ -47,7 +47,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
47
47
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
var next_tick_1 = require("next-tick");
|
|
51
50
|
var config_1 = require("../../../config");
|
|
52
51
|
var errors_1 = require("../../../errors");
|
|
53
52
|
var log_1 = require("../../../log");
|
|
@@ -55,6 +54,7 @@ var assert_unreachable_1 = require("../../../utils/assert_unreachable");
|
|
|
55
54
|
var cancellable_sleep_1 = require("../../../utils/cancellable_sleep");
|
|
56
55
|
var noop_1 = require("../../../utils/noop");
|
|
57
56
|
var object_assign_1 = require("../../../utils/object_assign");
|
|
57
|
+
var queue_microtask_1 = require("../../../utils/queue_microtask");
|
|
58
58
|
var reference_1 = require("../../../utils/reference");
|
|
59
59
|
var task_canceller_1 = require("../../../utils/task_canceller");
|
|
60
60
|
var representation_1 = require("../representation");
|
|
@@ -194,7 +194,7 @@ function AdaptationStream(_a, callbacks, parentCancelSignal) {
|
|
|
194
194
|
// conditions where the inner logic would be called synchronously before
|
|
195
195
|
// the next observation (which may reflect very different playback conditions)
|
|
196
196
|
// is actually received.
|
|
197
|
-
return [2 /*return*/, (0,
|
|
197
|
+
return [2 /*return*/, (0, queue_microtask_1.default)(function () {
|
|
198
198
|
playbackObserver.listen(function () {
|
|
199
199
|
if (fnCancelSignal.isCancelled()) {
|
|
200
200
|
return;
|
|
@@ -98,10 +98,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
98
98
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
99
99
|
};
|
|
100
100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
101
|
-
var next_tick_1 = require("next-tick");
|
|
102
101
|
var config_1 = require("../../../config");
|
|
103
102
|
var errors_1 = require("../../../errors");
|
|
104
103
|
var log_1 = require("../../../log");
|
|
104
|
+
var queue_microtask_1 = require("../../../utils/queue_microtask");
|
|
105
105
|
var reference_1 = require("../../../utils/reference");
|
|
106
106
|
var sorted_list_1 = require("../../../utils/sorted_list");
|
|
107
107
|
var task_canceller_1 = require("../../../utils/task_canceller");
|
|
@@ -381,7 +381,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
381
381
|
// Schedule micro task before checking the last playback observation
|
|
382
382
|
// to reduce the risk of race conditions where the next observation
|
|
383
383
|
// was going to be emitted synchronously.
|
|
384
|
-
(0,
|
|
384
|
+
(0, queue_microtask_1.default)(function () {
|
|
385
385
|
var _a;
|
|
386
386
|
if (orchestratorCancelSignal.isCancelled()) {
|
|
387
387
|
return;
|
|
@@ -538,7 +538,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
538
538
|
// conditions where the inner logic would be called synchronously before
|
|
539
539
|
// the next observation (which may reflect very different playback
|
|
540
540
|
// conditions) is actually received.
|
|
541
|
-
return (0,
|
|
541
|
+
return (0, queue_microtask_1.default)(function () {
|
|
542
542
|
if (innerCancelSignal.isCancelled()) {
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
@@ -73,11 +73,11 @@ var __values = (this && this.__values) || function(o) {
|
|
|
73
73
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
var next_tick_1 = require("next-tick");
|
|
77
76
|
var config_1 = require("../../../config");
|
|
78
77
|
var errors_1 = require("../../../errors");
|
|
79
78
|
var log_1 = require("../../../log");
|
|
80
79
|
var object_assign_1 = require("../../../utils/object_assign");
|
|
80
|
+
var queue_microtask_1 = require("../../../utils/queue_microtask");
|
|
81
81
|
var ranges_1 = require("../../../utils/ranges");
|
|
82
82
|
var reference_1 = require("../../../utils/reference");
|
|
83
83
|
var task_canceller_1 = require("../../../utils/task_canceller");
|
|
@@ -355,7 +355,7 @@ function PeriodStream(_a, callbacks, parentCancelSignal) {
|
|
|
355
355
|
// is actually received.
|
|
356
356
|
// It can happen when `askForMediaSourceReload` is called as a side-effect of
|
|
357
357
|
// the same event that triggers the playback observation to be emitted.
|
|
358
|
-
(0,
|
|
358
|
+
(0, queue_microtask_1.default)(function () {
|
|
359
359
|
playbackObserver.listen(function () {
|
|
360
360
|
if (cancelSignal.isCancelled()) {
|
|
361
361
|
return;
|
|
@@ -96,7 +96,7 @@ function getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitc
|
|
|
96
96
|
* needed segments for this Representation until the end of the Period.
|
|
97
97
|
*/
|
|
98
98
|
var hasFinishedLoading = representation.index.isInitialized() &&
|
|
99
|
-
representation.index.
|
|
99
|
+
!representation.index.isStillAwaitingFutureSegments() &&
|
|
100
100
|
neededRange.hasReachedPeriodEnd &&
|
|
101
101
|
prioritizedNeededSegments.length === 0 &&
|
|
102
102
|
segmentsOnHold.length === 0;
|
|
@@ -147,7 +147,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
147
147
|
segment_buffers_1.default.isNative(content.adaptation.type) &&
|
|
148
148
|
initialWantedTime >= lastIndexPosition &&
|
|
149
149
|
representationIndex.isInitialized() &&
|
|
150
|
-
representationIndex.
|
|
150
|
+
!representationIndex.isStillAwaitingFutureSegments() &&
|
|
151
151
|
isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime)) {
|
|
152
152
|
wantedStartPosition = lastIndexPosition - 1;
|
|
153
153
|
}
|
|
@@ -157,7 +157,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
157
157
|
var wantedEndPosition = wantedStartPosition + bufferGoal;
|
|
158
158
|
var hasReachedPeriodEnd;
|
|
159
159
|
if (!representation.index.isInitialized() ||
|
|
160
|
-
|
|
160
|
+
representation.index.isStillAwaitingFutureSegments() ||
|
|
161
161
|
period.end === undefined) {
|
|
162
162
|
hasReachedPeriodEnd = false;
|
|
163
163
|
}
|
|
@@ -324,7 +324,7 @@ function doesEndSeemGarbageCollected(currentSeg, nextSeg, minimumEndTime) {
|
|
|
324
324
|
}
|
|
325
325
|
if (minimumEndTime > currentSeg.bufferedEnd &&
|
|
326
326
|
currentSeg.end - currentSeg.bufferedEnd > MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT) {
|
|
327
|
-
log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.
|
|
327
|
+
log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.end, currentSeg.bufferedEnd);
|
|
328
328
|
return true;
|
|
329
329
|
}
|
|
330
330
|
return false;
|
|
@@ -21,6 +21,11 @@ declare const DEFAULT_CONFIG: {
|
|
|
21
21
|
* @type {Number}
|
|
22
22
|
*/
|
|
23
23
|
DEFAULT_REQUEST_TIMEOUT: number;
|
|
24
|
+
/**
|
|
25
|
+
* Default connection time after which a request will timeout, in ms.
|
|
26
|
+
* @type {Number}
|
|
27
|
+
*/
|
|
28
|
+
DEFAULT_CONNECTION_TIMEOUT: number;
|
|
24
29
|
/**
|
|
25
30
|
* Can be either:
|
|
26
31
|
* - "native": Subtitles are all displayed in a <track> element
|
|
@@ -23,6 +23,11 @@ var DEFAULT_CONFIG = {
|
|
|
23
23
|
* @type {Number}
|
|
24
24
|
*/
|
|
25
25
|
DEFAULT_REQUEST_TIMEOUT: 30 * 1000,
|
|
26
|
+
/**
|
|
27
|
+
* Default connection time after which a request will timeout, in ms.
|
|
28
|
+
* @type {Number}
|
|
29
|
+
*/
|
|
30
|
+
DEFAULT_CONNECTION_TIMEOUT: 15 * 1000,
|
|
26
31
|
/**
|
|
27
32
|
* Can be either:
|
|
28
33
|
* - "native": Subtitles are all displayed in a <track> element
|
|
@@ -181,7 +181,9 @@ var VideoThumbnailLoader = /** @class */ (function () {
|
|
|
181
181
|
{}, { baseDelay: 0,
|
|
182
182
|
maxDelay: 0,
|
|
183
183
|
maxRetry: 0,
|
|
184
|
-
requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT
|
|
184
|
+
requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
185
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
186
|
+
});
|
|
185
187
|
var initSegment_1 = content.representation.index.getInitSegment();
|
|
186
188
|
var initSegmentUniqueId_1 = initSegment_1 !== null ?
|
|
187
189
|
content.representation.uniqueId :
|
|
@@ -112,6 +112,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
112
112
|
url: url,
|
|
113
113
|
responseType: "document",
|
|
114
114
|
timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
115
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
115
116
|
// We won't cancel
|
|
116
117
|
cancelSignal: new task_canceller_1.default().signal,
|
|
117
118
|
})];
|
|
@@ -148,6 +149,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
148
149
|
url: url,
|
|
149
150
|
responseType: "text",
|
|
150
151
|
timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
152
|
+
connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
|
|
151
153
|
// We won't cancel
|
|
152
154
|
cancelSignal: new task_canceller_1.default().signal,
|
|
153
155
|
})];
|
|
@@ -40,6 +40,7 @@ var Representation = /** @class */ (function () {
|
|
|
40
40
|
* @param {Object} args
|
|
41
41
|
*/
|
|
42
42
|
function Representation(args, opts) {
|
|
43
|
+
var _a;
|
|
43
44
|
this.id = args.id;
|
|
44
45
|
this.uniqueId = generateRepresentationUniqueId();
|
|
45
46
|
this.bitrate = args.bitrate;
|
|
@@ -68,12 +69,24 @@ var Representation = /** @class */ (function () {
|
|
|
68
69
|
this.cdnMetadata = args.cdnMetadata;
|
|
69
70
|
this.index = args.index;
|
|
70
71
|
if (opts.type === "audio" || opts.type === "video") {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
this.isSupported = false;
|
|
73
|
+
// Supplemental codecs are defined as backwards-compatible codecs enhancing
|
|
74
|
+
// the experience of a base layer codec
|
|
75
|
+
if (args.supplementalCodecs !== undefined) {
|
|
76
|
+
var supplementalCodecMimeTypeStr = "".concat((_a = this.mimeType) !== null && _a !== void 0 ? _a : "", ";codecs=\"").concat(args.supplementalCodecs, "\"");
|
|
77
|
+
if ((0, compat_1.isCodecSupported)(supplementalCodecMimeTypeStr)) {
|
|
78
|
+
this.codec = args.supplementalCodecs;
|
|
79
|
+
this.isSupported = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!this.isSupported) {
|
|
83
|
+
var mimeTypeStr = this.getMimeTypeString();
|
|
84
|
+
var isSupported = (0, compat_1.isCodecSupported)(mimeTypeStr);
|
|
85
|
+
if (!isSupported) {
|
|
86
|
+
log_1.default.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
|
|
87
|
+
}
|
|
88
|
+
this.isSupported = isSupported;
|
|
75
89
|
}
|
|
76
|
-
this.isSupported = isSupported;
|
|
77
90
|
}
|
|
78
91
|
else {
|
|
79
92
|
this.isSupported = true; // TODO for other types
|
|
@@ -117,8 +117,8 @@ var StaticRepresentationIndex = /** @class */ (function () {
|
|
|
117
117
|
/**
|
|
118
118
|
* @returns {Boolean}
|
|
119
119
|
*/
|
|
120
|
-
StaticRepresentationIndex.prototype.
|
|
121
|
-
return
|
|
120
|
+
StaticRepresentationIndex.prototype.isStillAwaitingFutureSegments = function () {
|
|
121
|
+
return false;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* @returns {Boolean}
|
|
@@ -304,7 +304,7 @@ export interface IRepresentationIndex {
|
|
|
304
304
|
getLastAvailablePosition(): number | null | undefined;
|
|
305
305
|
/**
|
|
306
306
|
* Returns the ending time, in seconds, of the Representation once it is
|
|
307
|
-
* "finished" (@see
|
|
307
|
+
* "finished" (@see isStillAwaitingFutureSegments).
|
|
308
308
|
* Should thus be equivalent to `getLastAvailablePosition` once finished.
|
|
309
309
|
*
|
|
310
310
|
* Returns `null` if nothing is in the index
|
|
@@ -352,13 +352,13 @@ export interface IRepresentationIndex {
|
|
|
352
352
|
*/
|
|
353
353
|
checkDiscontinuity(time: number): number | null;
|
|
354
354
|
/**
|
|
355
|
-
* Returns `
|
|
355
|
+
* Returns `false` if the last segments in this index have already been
|
|
356
356
|
* generated so that we can freely go to the next period.
|
|
357
|
-
* Returns `
|
|
357
|
+
* Returns `true` if the index is still waiting on future segments to be
|
|
358
358
|
* generated.
|
|
359
359
|
* @returns {boolean}
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
isStillAwaitingFutureSegments(): boolean;
|
|
362
362
|
/**
|
|
363
363
|
* Returns `true` if this index has all the data it needs to give the list
|
|
364
364
|
* of available segments.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts SCTE 214 supplemental codec string into RFC4281 codec string
|
|
3
|
+
*
|
|
4
|
+
* The returned value is a codec string respecting RFC6381
|
|
5
|
+
*
|
|
6
|
+
* SCTE 214 defines supplemental codecs as a whitespace-separated multiple list of
|
|
7
|
+
* codec strings
|
|
8
|
+
*
|
|
9
|
+
* RFC6381 defines codecs as a comma-separated list of codec strings.
|
|
10
|
+
*
|
|
11
|
+
* This two syntax differs and this parser is used to convert SCTE214
|
|
12
|
+
* to be compliant with what MSE APIs expect
|
|
13
|
+
*
|
|
14
|
+
* @param {string} val - The codec string to parse
|
|
15
|
+
* @returns { Array.<string | undefined | null>}
|
|
16
|
+
*/
|
|
17
|
+
export declare function convertSupplementalCodecsToRFC6381(val: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertSupplementalCodecsToRFC6381 = void 0;
|
|
4
|
+
var is_non_empty_string_1 = require("../../../../utils/is_non_empty_string");
|
|
5
|
+
var supplementalCodecSeparator = /[, ]+/g;
|
|
6
|
+
/**
|
|
7
|
+
* Converts SCTE 214 supplemental codec string into RFC4281 codec string
|
|
8
|
+
*
|
|
9
|
+
* The returned value is a codec string respecting RFC6381
|
|
10
|
+
*
|
|
11
|
+
* SCTE 214 defines supplemental codecs as a whitespace-separated multiple list of
|
|
12
|
+
* codec strings
|
|
13
|
+
*
|
|
14
|
+
* RFC6381 defines codecs as a comma-separated list of codec strings.
|
|
15
|
+
*
|
|
16
|
+
* This two syntax differs and this parser is used to convert SCTE214
|
|
17
|
+
* to be compliant with what MSE APIs expect
|
|
18
|
+
*
|
|
19
|
+
* @param {string} val - The codec string to parse
|
|
20
|
+
* @returns { Array.<string | undefined | null>}
|
|
21
|
+
*/
|
|
22
|
+
function convertSupplementalCodecsToRFC6381(val) {
|
|
23
|
+
if ((0, is_non_empty_string_1.default)(val)) {
|
|
24
|
+
return val
|
|
25
|
+
.trim()
|
|
26
|
+
.replace(supplementalCodecSeparator, ", ");
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
exports.convertSupplementalCodecsToRFC6381 = convertSupplementalCodecsToRFC6381;
|
|
@@ -67,6 +67,11 @@ function flattenOverlappingPeriods(parsedPeriods) {
|
|
|
67
67
|
// `lastFlattenedPeriod` has now a negative or `0` duration.
|
|
68
68
|
// Remove it, consider the next Period in its place, and re-start the loop.
|
|
69
69
|
flattenedPeriods.pop();
|
|
70
|
+
if (flattenedPeriods.length === 0) {
|
|
71
|
+
// There's no remaining Period to compare to `parsedPeriod`
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
// Take the previous Period as reference and compare it now to `parsedPeriod`
|
|
70
75
|
lastFlattenedPeriod = flattenedPeriods[flattenedPeriods.length - 1];
|
|
71
76
|
}
|
|
72
77
|
}
|