rx-player 3.26.2 → 3.26.3-dev.2022021400
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/.github/workflows/perfs.yml +22 -0
- package/CHANGELOG.md +19 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +6 -2
- package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +28 -6
- package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
- package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
- package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
- package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
- package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.d.ts +6 -0
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +20 -3
- package/dist/_esm5.processed/core/api/public_api.d.ts +3 -3
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +6 -6
- package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.d.ts +0 -2
- package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.js +5 -10
- package/dist/_esm5.processed/core/eme/find_key_system.js +15 -5
- package/dist/_esm5.processed/core/eme/types.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +4 -4
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +5 -1
- package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +1 -1
- package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +2 -2
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +1 -1
- package/dist/_esm5.processed/core/init/manifest_update_scheduler.d.ts +4 -4
- package/dist/_esm5.processed/core/init/stream_events_emitter/are_same_stream_events.d.ts +4 -4
- package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +3 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +3 -4
- package/dist/_esm5.processed/errors/request_error.js +3 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.d.ts +2 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +1 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
- package/dist/_esm5.processed/manifest/adaptation.d.ts +2 -2
- package/dist/_esm5.processed/manifest/adaptation.js +3 -1
- package/dist/_esm5.processed/manifest/manifest.d.ts +9 -9
- package/dist/_esm5.processed/manifest/period.d.ts +3 -3
- package/dist/_esm5.processed/manifest/representation.d.ts +2 -2
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
- package/dist/_esm5.processed/manifest/types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +19 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +24 -23
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +1 -1
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
- package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
- package/dist/_esm5.processed/transports/smooth/pipelines.js +1 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/types.d.ts +36 -30
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
- package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
- package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
- package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
- package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -5
- package/dist/_esm5.processed/utils/request/fetch.js +7 -4
- package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
- package/dist/_esm5.processed/utils/request/xhr.js +2 -1
- package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
- package/dist/rx-player.js +404 -321
- package/dist/rx-player.min.js +1 -1
- package/package.json +3 -4
- package/scripts/doc-generator/generate_header_html.js +6 -7
- package/scripts/doc-generator/generate_page_html.js +3 -4
- package/scripts/doc-generator/generate_page_list_html.js +4 -5
- package/scripts/doc-generator/generate_sidebar_html.js +4 -7
- package/scripts/doc-generator/utils.js +0 -11
- package/scripts/generate_demo_list.js +3 -3
- package/scripts/generate_documentation_list.js +3 -3
- package/scripts/launch_static_server.js +127 -67
- package/scripts/run_standalone_demo.js +1 -0
- package/scripts/start_demo_web_server.js +1 -0
- package/sonar-project.properties +1 -1
- package/src/compat/__tests__/fullscreen.test.ts +7 -7
- package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
- package/src/compat/eme/custom_media_keys/index.ts +7 -3
- package/src/core/abr/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
- package/src/core/abr/buffer_based_chooser.ts +85 -20
- package/src/core/abr/network_analyzer.ts +1 -1
- package/src/core/abr/pending_requests_store.ts +3 -5
- package/src/core/abr/representation_estimator.ts +6 -3
- package/src/core/api/media_element_track_choice_manager.ts +22 -3
- package/src/core/api/public_api.ts +6 -6
- package/src/core/api/track_choice_manager.ts +10 -9
- package/src/core/eme/__tests__/__global__/utils.ts +5 -10
- package/src/core/eme/find_key_system.ts +14 -12
- package/src/core/eme/types.ts +2 -2
- package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -5
- package/src/core/fetchers/segment/segment_fetcher.ts +6 -3
- package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
- package/src/core/init/initialize_directfile.ts +2 -2
- package/src/core/init/initialize_media_source.ts +2 -2
- package/src/core/init/manifest_update_scheduler.ts +7 -7
- package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
- package/src/core/init/stream_events_emitter/types.ts +2 -2
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -3
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
- package/src/core/stream/representation/force_garbage_collection.ts +3 -5
- package/src/errors/request_error.ts +4 -1
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +3 -6
- package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +1 -1
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
- package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
- package/src/manifest/adaptation.ts +6 -4
- package/src/manifest/manifest.ts +10 -10
- package/src/manifest/period.ts +3 -3
- package/src/manifest/representation.ts +2 -2
- package/src/manifest/representation_index/types.ts +18 -18
- package/src/manifest/types.ts +3 -3
- package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
- package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
- package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
- package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
- package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
- package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
- package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
- package/src/parsers/manifest/dash/common/indexes/template.ts +17 -16
- package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +50 -22
- package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
- package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +58 -70
- package/src/parsers/manifest/dash/common/parse_mpd.ts +8 -8
- package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
- package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
- package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
- package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
- package/src/parsers/manifest/dash/parsers_types.ts +3 -3
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
- package/src/parsers/manifest/smooth/create_parser.ts +23 -21
- package/src/parsers/manifest/smooth/representation_index.ts +14 -14
- package/src/parsers/manifest/types.ts +28 -28
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
- package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
- package/src/parsers/manifest/utils/index_helpers.ts +2 -2
- package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
- package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
- package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
- package/src/transports/dash/image_pipelines.ts +1 -1
- package/src/transports/dash/init_segment_loader.ts +1 -1
- package/src/transports/dash/manifest_parser.ts +1 -1
- package/src/transports/dash/segment_loader.ts +7 -7
- package/src/transports/dash/segment_parser.ts +3 -1
- package/src/transports/dash/text_loader.ts +2 -2
- package/src/transports/dash/text_parser.ts +3 -1
- package/src/transports/local/segment_loader.ts +4 -4
- package/src/transports/metaplaylist/manifest_loader.ts +1 -1
- package/src/transports/metaplaylist/pipelines.ts +1 -1
- package/src/transports/smooth/pipelines.ts +7 -7
- package/src/transports/smooth/segment_loader.ts +8 -8
- package/src/transports/types.ts +37 -30
- package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
- package/src/transports/utils/generate_manifest_loader.ts +1 -1
- package/src/utils/__tests__/flat_map.test.ts +12 -7
- package/src/utils/cancellable_sleep.ts +1 -1
- package/src/utils/cast_to_observable.ts +1 -2
- package/src/utils/request/fetch.ts +16 -13
- package/src/utils/request/xhr.ts +9 -7
- package/src/utils/rx-from_cancellable_promise.ts +1 -2
- package/tsconfig.json +1 -2
- package/tsconfig.modules.json +1 -2
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
- package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
- package/src/core/abr/get_estimate_from_buffer_levels.ts +0 -85
|
@@ -58,7 +58,7 @@ export interface ITimelineIndex {
|
|
|
58
58
|
/** If `false`, the last segment anounced might be still incomplete. */
|
|
59
59
|
availabilityTimeComplete : boolean;
|
|
60
60
|
/** Byte range for a possible index of segments in the server. */
|
|
61
|
-
indexRange?: [number, number];
|
|
61
|
+
indexRange?: [number, number] | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* Temporal offset, in the current timescale (see timescale), to add to the
|
|
64
64
|
* presentation time (time a segment has at decoding time) to obtain the
|
|
@@ -77,15 +77,15 @@ export interface ITimelineIndex {
|
|
|
77
77
|
/** URLs to access the initialization segment. */
|
|
78
78
|
mediaURLs: string[] | null;
|
|
79
79
|
/** possible byte range to request it. */
|
|
80
|
-
range?: [number, number];
|
|
81
|
-
};
|
|
80
|
+
range?: [number, number] | undefined;
|
|
81
|
+
} | undefined;
|
|
82
82
|
/**
|
|
83
83
|
* Base URL(s) to access any segment. Can contain tokens to replace to convert
|
|
84
84
|
* it to real URLs.
|
|
85
85
|
*/
|
|
86
86
|
mediaURLs : string[] | null ;
|
|
87
87
|
/** Number from which the first segments in this index starts with. */
|
|
88
|
-
startNumber? : number;
|
|
88
|
+
startNumber? : number | undefined;
|
|
89
89
|
/**
|
|
90
90
|
* Every segments defined in this index.
|
|
91
91
|
* `null` at the beginning as this property is parsed lazily (only when first
|
|
@@ -117,11 +117,13 @@ export interface ITimelineIndex {
|
|
|
117
117
|
* Most of the properties here are already defined in ITimelineIndex.
|
|
118
118
|
*/
|
|
119
119
|
export interface ITimelineIndexIndexArgument {
|
|
120
|
-
indexRange?: [number, number];
|
|
121
|
-
initialization? : { media? : string
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
indexRange?: [number, number] | undefined;
|
|
121
|
+
initialization? : { media? : string | undefined;
|
|
122
|
+
range?: [number, number] | undefined; } |
|
|
123
|
+
undefined;
|
|
124
|
+
media? : string | undefined;
|
|
125
|
+
startNumber? : number | undefined;
|
|
126
|
+
timescale? : number | undefined;
|
|
125
127
|
/**
|
|
126
128
|
* Offset present in the index to convert from the mediaTime (time declared in
|
|
127
129
|
* the media segments and in this index) to the presentationTime (time wanted
|
|
@@ -136,10 +138,10 @@ export interface ITimelineIndexIndexArgument {
|
|
|
136
138
|
* The time given here is in the current
|
|
137
139
|
* timescale (see timescale)
|
|
138
140
|
*/
|
|
139
|
-
presentationTimeOffset? : number;
|
|
141
|
+
presentationTimeOffset? : number | undefined;
|
|
140
142
|
|
|
141
|
-
timelineParser? : () => HTMLCollection;
|
|
142
|
-
timeline? : ISegmentTimelineElement[];
|
|
143
|
+
timelineParser? : (() => HTMLCollection) | undefined;
|
|
144
|
+
timeline? : ISegmentTimelineElement[] | undefined;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
/** Aditional context needed by a SegmentTimeline RepresentationIndex. */
|
|
@@ -148,9 +150,9 @@ export interface ITimelineIndexContextArgument {
|
|
|
148
150
|
availabilityTimeComplete : boolean;
|
|
149
151
|
/** Allows to obtain the minimum and maximum positions of a content. */
|
|
150
152
|
manifestBoundsCalculator : ManifestBoundsCalculator;
|
|
151
|
-
/** Start of the period
|
|
153
|
+
/** Start of the period linked to this RepresentationIndex, in seconds. */
|
|
152
154
|
periodStart : number;
|
|
153
|
-
/** End of the period
|
|
155
|
+
/** End of the period linked to this RepresentationIndex, in seconds. */
|
|
154
156
|
periodEnd : number|undefined;
|
|
155
157
|
/** Whether the corresponding Manifest can be updated and changed. */
|
|
156
158
|
isDynamic : boolean;
|
|
@@ -158,13 +160,13 @@ export interface ITimelineIndexContextArgument {
|
|
|
158
160
|
* Time (in terms of `performance.now`) at which the XML file containing this
|
|
159
161
|
* index was received
|
|
160
162
|
*/
|
|
161
|
-
receivedTime? : number;
|
|
163
|
+
receivedTime? : number | undefined;
|
|
162
164
|
/** Base URL for the Representation concerned. */
|
|
163
165
|
representationBaseURLs : IResolvedBaseUrl[];
|
|
164
166
|
/** ID of the Representation concerned. */
|
|
165
|
-
representationId? : string;
|
|
167
|
+
representationId? : string | undefined;
|
|
166
168
|
/** Bitrate of the Representation concerned. */
|
|
167
|
-
representationBitrate? : number;
|
|
169
|
+
representationBitrate? : number | undefined;
|
|
168
170
|
/**
|
|
169
171
|
* The parser should take this previous version of the
|
|
170
172
|
* `TimelineRepresentationIndex` - which was from the same Representation
|
|
@@ -174,13 +176,18 @@ export interface ITimelineIndexContextArgument {
|
|
|
174
176
|
* Use with moderation.
|
|
175
177
|
*/
|
|
176
178
|
unsafelyBaseOnPreviousRepresentation : Representation | null;
|
|
177
|
-
|
|
179
|
+
/** Function that tells if an EMSG is whitelisted by the manifest */
|
|
178
180
|
isEMSGWhitelisted: (inbandEvent: IEMSG) => boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Set to `true` if the linked Period is the chronologically last one in the
|
|
183
|
+
* Manifest.
|
|
184
|
+
*/
|
|
185
|
+
isLastPeriod : boolean;
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
export interface ILastSegmentInformation {
|
|
182
189
|
/** End of the timeline on `time`, timescaled. */
|
|
183
|
-
lastPosition? : number;
|
|
190
|
+
lastPosition? : number | undefined;
|
|
184
191
|
|
|
185
192
|
/** Defines the time at which `lastPosition` was last calculated. */
|
|
186
193
|
time : number;
|
|
@@ -224,6 +231,9 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
224
231
|
/* Function that tells if an EMSG is whitelisted by the manifest */
|
|
225
232
|
private _isEMSGWhitelisted: (inbandEvent: IEMSG) => boolean;
|
|
226
233
|
|
|
234
|
+
/** `true` if the linked Period is the chronologically last one in the Manifest. */
|
|
235
|
+
private _isLastPeriod: boolean;
|
|
236
|
+
|
|
227
237
|
/**
|
|
228
238
|
* @param {Object} index
|
|
229
239
|
* @param {Object} context
|
|
@@ -239,6 +249,7 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
239
249
|
const { availabilityTimeComplete,
|
|
240
250
|
manifestBoundsCalculator,
|
|
241
251
|
isDynamic,
|
|
252
|
+
isLastPeriod,
|
|
242
253
|
representationBaseURLs,
|
|
243
254
|
representationId,
|
|
244
255
|
representationBitrate,
|
|
@@ -257,6 +268,7 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
257
268
|
this._manifestBoundsCalculator = manifestBoundsCalculator;
|
|
258
269
|
|
|
259
270
|
this._isEMSGWhitelisted = isEMSGWhitelisted;
|
|
271
|
+
this._isLastPeriod = isLastPeriod;
|
|
260
272
|
this._lastUpdate = context.receivedTime == null ?
|
|
261
273
|
performance.now() :
|
|
262
274
|
context.receivedTime;
|
|
@@ -454,6 +466,7 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
454
466
|
this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
|
|
455
467
|
this._lastUpdate = newIndex._lastUpdate;
|
|
456
468
|
this._manifestBoundsCalculator = newIndex._manifestBoundsCalculator;
|
|
469
|
+
this._isLastPeriod = newIndex._isLastPeriod;
|
|
457
470
|
}
|
|
458
471
|
|
|
459
472
|
/**
|
|
@@ -468,11 +481,16 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
468
481
|
if (newIndex._index.timeline === null) {
|
|
469
482
|
newIndex._index.timeline = newIndex._getTimeline();
|
|
470
483
|
}
|
|
471
|
-
updateSegmentTimeline(this._index.timeline,
|
|
484
|
+
const hasReplaced = updateSegmentTimeline(this._index.timeline,
|
|
485
|
+
newIndex._index.timeline);
|
|
486
|
+
if (hasReplaced) {
|
|
487
|
+
this._index.startNumber = newIndex._index.startNumber;
|
|
488
|
+
}
|
|
472
489
|
this._isDynamic = newIndex._isDynamic;
|
|
473
490
|
this._scaledPeriodStart = newIndex._scaledPeriodStart;
|
|
474
491
|
this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
|
|
475
492
|
this._lastUpdate = newIndex._lastUpdate;
|
|
493
|
+
this._isLastPeriod = newIndex._isLastPeriod;
|
|
476
494
|
}
|
|
477
495
|
|
|
478
496
|
/**
|
|
@@ -482,7 +500,13 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
482
500
|
* @returns {Boolean}
|
|
483
501
|
*/
|
|
484
502
|
isFinished() : boolean {
|
|
485
|
-
if (!this._isDynamic) {
|
|
503
|
+
if (!this._isDynamic || !this._isLastPeriod) {
|
|
504
|
+
// Either the content is not dynamic, in which case no new segment will
|
|
505
|
+
// be generated, either it is but this index is not linked to the current
|
|
506
|
+
// last Period in the MPD, in which case it is inferred that it has been
|
|
507
|
+
// completely generated. Note that this second condition might break very
|
|
508
|
+
// very rare use cases where old Periods are still being generated, yet it
|
|
509
|
+
// should fix more cases than it breaks.
|
|
486
510
|
return true;
|
|
487
511
|
}
|
|
488
512
|
|
|
@@ -531,7 +555,11 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
|
|
|
531
555
|
return; // we don't know yet
|
|
532
556
|
}
|
|
533
557
|
const scaledFirstPosition = toIndexTime(firstPosition, this._index);
|
|
534
|
-
clearTimelineFromPosition(this._index.timeline,
|
|
558
|
+
const nbEltsRemoved = clearTimelineFromPosition(this._index.timeline,
|
|
559
|
+
scaledFirstPosition);
|
|
560
|
+
if (this._index.startNumber !== undefined) {
|
|
561
|
+
this._index.startNumber += nbEltsRemoved;
|
|
562
|
+
}
|
|
535
563
|
}
|
|
536
564
|
|
|
537
565
|
static getIndexEnd(timeline : IIndexSegment[],
|
|
@@ -30,8 +30,8 @@ const SUPPORTED_TEXT_TYPES = ["subtitle", "caption"];
|
|
|
30
30
|
|
|
31
31
|
/** Structure of a parsed "scheme-like" element in the MPD. */
|
|
32
32
|
interface IScheme {
|
|
33
|
-
schemeIdUri? : string;
|
|
34
|
-
value? : string;
|
|
33
|
+
schemeIdUri? : string | undefined;
|
|
34
|
+
value? : string | undefined;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -47,7 +47,7 @@ export default class ManifestBoundsCalculator {
|
|
|
47
47
|
/**
|
|
48
48
|
* @param {Object} args
|
|
49
49
|
*/
|
|
50
|
-
constructor(args : { timeShiftBufferDepth
|
|
50
|
+
constructor(args : { timeShiftBufferDepth : number | undefined;
|
|
51
51
|
isDynamic : boolean; }
|
|
52
52
|
) {
|
|
53
53
|
this._isDynamic = args.isDynamic;
|
|
@@ -31,52 +31,10 @@ import {
|
|
|
31
31
|
import attachTrickModeTrack from "./attach_trickmode_track";
|
|
32
32
|
// eslint-disable-next-line max-len
|
|
33
33
|
import inferAdaptationType from "./infer_adaptation_type";
|
|
34
|
-
import ManifestBoundsCalculator from "./manifest_bounds_calculator";
|
|
35
34
|
import parseRepresentations, {
|
|
36
|
-
|
|
35
|
+
IRepresentationContext,
|
|
37
36
|
} from "./parse_representations";
|
|
38
|
-
import resolveBaseURLs
|
|
39
|
-
IResolvedBaseUrl,
|
|
40
|
-
} from "./resolve_base_urls";
|
|
41
|
-
|
|
42
|
-
/** Context needed when calling `parseAdaptationSets`. */
|
|
43
|
-
export interface IAdaptationSetsContextInfos {
|
|
44
|
-
/** Whether we should request new segments even if they are not yet finished. */
|
|
45
|
-
aggressiveMode : boolean;
|
|
46
|
-
availabilityTimeComplete: boolean;
|
|
47
|
-
/** availabilityTimeOffset of the concerned period. */
|
|
48
|
-
availabilityTimeOffset: number;
|
|
49
|
-
/** Eventual URLs from which every relative URL will be based on. */
|
|
50
|
-
baseURLs : IResolvedBaseUrl[];
|
|
51
|
-
/** Allows to obtain the first available position of a content. */
|
|
52
|
-
manifestBoundsCalculator : ManifestBoundsCalculator;
|
|
53
|
-
/* End time of the current period, in seconds. */
|
|
54
|
-
end? : number;
|
|
55
|
-
/** Whether the Manifest can evolve with time. */
|
|
56
|
-
isDynamic : boolean;
|
|
57
|
-
/** Manifest DASH profiles used for signaling some features */
|
|
58
|
-
manifestProfiles?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Time (in terms of `performance.now`) at which the XML file containing
|
|
61
|
-
* this AdaptationSet was received.
|
|
62
|
-
*/
|
|
63
|
-
receivedTime? : number;
|
|
64
|
-
/** SegmentTemplate parsed in the Period, if found. */
|
|
65
|
-
segmentTemplate? : ISegmentTemplateIntermediateRepresentation;
|
|
66
|
-
/** Start time of the current period, in seconds. */
|
|
67
|
-
start : number;
|
|
68
|
-
/** Depth of the buffer for the whole content, in seconds. */
|
|
69
|
-
timeShiftBufferDepth? : number;
|
|
70
|
-
/**
|
|
71
|
-
* The parser should take this Period - which is from a previously parsed
|
|
72
|
-
* Manifest for the same dynamic content - as a base to speed-up the parsing
|
|
73
|
-
* process.
|
|
74
|
-
* /!\ If unexpected differences exist between both, there is a risk of
|
|
75
|
-
* de-synchronization with what is actually on the server,
|
|
76
|
-
* Use with moderation.
|
|
77
|
-
*/
|
|
78
|
-
unsafelyBaseOnPreviousPeriod : Period | null;
|
|
79
|
-
}
|
|
37
|
+
import resolveBaseURLs from "./resolve_base_urls";
|
|
80
38
|
|
|
81
39
|
/**
|
|
82
40
|
* Supplementary information for "switchable" AdaptationSets of the same Period.
|
|
@@ -121,9 +79,11 @@ interface IAdaptationSwitchingInfos {
|
|
|
121
79
|
* @returns {Boolean}
|
|
122
80
|
*/
|
|
123
81
|
function isVisuallyImpaired(
|
|
124
|
-
accessibility
|
|
82
|
+
accessibility : { schemeIdUri? : string | undefined;
|
|
83
|
+
value? : string | undefined; } |
|
|
84
|
+
undefined
|
|
125
85
|
) : boolean {
|
|
126
|
-
if (accessibility
|
|
86
|
+
if (accessibility === undefined) {
|
|
127
87
|
return false;
|
|
128
88
|
}
|
|
129
89
|
|
|
@@ -148,9 +108,11 @@ function isVisuallyImpaired(
|
|
|
148
108
|
* @returns {Boolean}
|
|
149
109
|
*/
|
|
150
110
|
function isHardOfHearing(
|
|
151
|
-
accessibility
|
|
111
|
+
accessibility : { schemeIdUri? : string | undefined;
|
|
112
|
+
value? : string | undefined; } |
|
|
113
|
+
undefined
|
|
152
114
|
) : boolean {
|
|
153
|
-
if (accessibility
|
|
115
|
+
if (accessibility === undefined) {
|
|
154
116
|
return false;
|
|
155
117
|
}
|
|
156
118
|
|
|
@@ -166,9 +128,11 @@ function isHardOfHearing(
|
|
|
166
128
|
* @returns {Boolean}
|
|
167
129
|
*/
|
|
168
130
|
function hasSignLanguageInterpretation(
|
|
169
|
-
accessibility
|
|
131
|
+
accessibility : { schemeIdUri? : string | undefined;
|
|
132
|
+
value? : string | undefined; } |
|
|
133
|
+
undefined
|
|
170
134
|
) : boolean {
|
|
171
|
-
if (accessibility
|
|
135
|
+
if (accessibility === undefined) {
|
|
172
136
|
return false;
|
|
173
137
|
}
|
|
174
138
|
|
|
@@ -264,12 +228,12 @@ function getAdaptationSetSwitchingIDs(
|
|
|
264
228
|
* Note that the AdaptationSets returned are sorted by priority (from the most
|
|
265
229
|
* priority to the least one).
|
|
266
230
|
* @param {Array.<Object>} adaptationsIR
|
|
267
|
-
* @param {Object}
|
|
231
|
+
* @param {Object} context
|
|
268
232
|
* @returns {Array.<Object>}
|
|
269
233
|
*/
|
|
270
234
|
export default function parseAdaptationSets(
|
|
271
235
|
adaptationsIR : IAdaptationSetIntermediateRepresentation[],
|
|
272
|
-
|
|
236
|
+
context : IAdaptationSetContext
|
|
273
237
|
): IParsedAdaptations {
|
|
274
238
|
const parsedAdaptations : IParsedAdaptations = {};
|
|
275
239
|
const trickModeAdaptations: Array<{ adaptation: IParsedAdaptation;
|
|
@@ -306,10 +270,10 @@ export default function parseAdaptationSets(
|
|
|
306
270
|
const representationsIR = adaptation.children.representations;
|
|
307
271
|
const availabilityTimeComplete =
|
|
308
272
|
adaptation.attributes.availabilityTimeComplete ??
|
|
309
|
-
|
|
273
|
+
context.availabilityTimeComplete;
|
|
310
274
|
const availabilityTimeOffset =
|
|
311
275
|
(adaptation.attributes.availabilityTimeOffset ?? 0) +
|
|
312
|
-
|
|
276
|
+
context.availabilityTimeOffset;
|
|
313
277
|
|
|
314
278
|
const adaptationMimeType = adaptation.attributes.mimeType;
|
|
315
279
|
const adaptationCodecs = adaptation.attributes.codecs;
|
|
@@ -331,26 +295,27 @@ export default function parseAdaptationSets(
|
|
|
331
295
|
let newID : string;
|
|
332
296
|
const adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
|
|
333
297
|
const parentSegmentTemplates = [];
|
|
334
|
-
if (
|
|
335
|
-
parentSegmentTemplates.push(
|
|
298
|
+
if (context.segmentTemplate !== undefined) {
|
|
299
|
+
parentSegmentTemplates.push(context.segmentTemplate);
|
|
336
300
|
}
|
|
337
301
|
if (adaptation.children.segmentTemplate !== undefined) {
|
|
338
302
|
parentSegmentTemplates.push(adaptation.children.segmentTemplate);
|
|
339
303
|
}
|
|
340
304
|
|
|
341
|
-
const
|
|
342
|
-
aggressiveMode:
|
|
305
|
+
const reprCtxt : IRepresentationContext = {
|
|
306
|
+
aggressiveMode: context.aggressiveMode,
|
|
343
307
|
availabilityTimeComplete,
|
|
344
308
|
availabilityTimeOffset,
|
|
345
|
-
baseURLs: resolveBaseURLs(
|
|
346
|
-
manifestBoundsCalculator:
|
|
347
|
-
end:
|
|
348
|
-
isDynamic:
|
|
349
|
-
|
|
309
|
+
baseURLs: resolveBaseURLs(context.baseURLs, adaptationChildren.baseURLs),
|
|
310
|
+
manifestBoundsCalculator: context.manifestBoundsCalculator,
|
|
311
|
+
end: context.end,
|
|
312
|
+
isDynamic: context.isDynamic,
|
|
313
|
+
isLastPeriod: context.isLastPeriod,
|
|
314
|
+
manifestProfiles: context.manifestProfiles,
|
|
350
315
|
parentSegmentTemplates,
|
|
351
|
-
receivedTime:
|
|
352
|
-
start:
|
|
353
|
-
timeShiftBufferDepth:
|
|
316
|
+
receivedTime: context.receivedTime,
|
|
317
|
+
start: context.start,
|
|
318
|
+
timeShiftBufferDepth: context.timeShiftBufferDepth,
|
|
354
319
|
unsafelyBaseOnPreviousAdaptation: null,
|
|
355
320
|
};
|
|
356
321
|
|
|
@@ -377,11 +342,11 @@ export default function parseAdaptationSets(
|
|
|
377
342
|
// Add to the already existing main video adaptation
|
|
378
343
|
// TODO remove that ugly custom logic?
|
|
379
344
|
const videoMainAdaptation = parsedAdaptations.video[lastMainAdaptationIndex.video];
|
|
380
|
-
|
|
345
|
+
reprCtxt.unsafelyBaseOnPreviousAdaptation = context
|
|
381
346
|
.unsafelyBaseOnPreviousPeriod?.getAdaptation(videoMainAdaptation.id) ?? null;
|
|
382
347
|
const representations = parseRepresentations(representationsIR,
|
|
383
348
|
adaptation,
|
|
384
|
-
|
|
349
|
+
reprCtxt);
|
|
385
350
|
videoMainAdaptation.representations.push(...representations);
|
|
386
351
|
newID = videoMainAdaptation.id;
|
|
387
352
|
} else {
|
|
@@ -430,12 +395,12 @@ export default function parseAdaptationSets(
|
|
|
430
395
|
newID = adaptationID;
|
|
431
396
|
parsedAdaptationsIDs.push(adaptationID);
|
|
432
397
|
|
|
433
|
-
|
|
398
|
+
reprCtxt.unsafelyBaseOnPreviousAdaptation = context
|
|
434
399
|
.unsafelyBaseOnPreviousPeriod?.getAdaptation(adaptationID) ?? null;
|
|
435
400
|
|
|
436
401
|
const representations = parseRepresentations(representationsIR,
|
|
437
402
|
adaptation,
|
|
438
|
-
|
|
403
|
+
reprCtxt);
|
|
439
404
|
const parsedAdaptationSet : IParsedAdaptation =
|
|
440
405
|
{ id: adaptationID,
|
|
441
406
|
representations,
|
|
@@ -528,3 +493,26 @@ export default function parseAdaptationSets(
|
|
|
528
493
|
attachTrickModeTrack(parsedAdaptations, trickModeAdaptations);
|
|
529
494
|
return parsedAdaptations;
|
|
530
495
|
}
|
|
496
|
+
|
|
497
|
+
/** Context needed when calling `parseAdaptationSets`. */
|
|
498
|
+
export interface IAdaptationSetContext extends IInheritedRepresentationContext {
|
|
499
|
+
/** SegmentTemplate parsed in the Period, if found. */
|
|
500
|
+
segmentTemplate? : ISegmentTemplateIntermediateRepresentation | undefined;
|
|
501
|
+
/**
|
|
502
|
+
* The parser should take this Period - which is from a previously parsed
|
|
503
|
+
* Manifest for the same dynamic content - as a base to speed-up the parsing
|
|
504
|
+
* process.
|
|
505
|
+
* /!\ If unexpected differences exist between both, there is a risk of
|
|
506
|
+
* de-synchronization with what is actually on the server,
|
|
507
|
+
* Use with moderation.
|
|
508
|
+
*/
|
|
509
|
+
unsafelyBaseOnPreviousPeriod : Period | null;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Supplementary context needed to parse a Representation common with
|
|
514
|
+
* `IRepresentationContext`.
|
|
515
|
+
*/
|
|
516
|
+
type IInheritedRepresentationContext = Omit<IRepresentationContext,
|
|
517
|
+
"unsafelyBaseOnPreviousAdaptation" |
|
|
518
|
+
"parentSegmentTemplates">;
|
|
@@ -47,11 +47,11 @@ export interface IMPDParserArguments {
|
|
|
47
47
|
* If set, offset to add to `performance.now()` to obtain the current server's
|
|
48
48
|
* time.
|
|
49
49
|
*/
|
|
50
|
-
externalClockOffset? : number;
|
|
50
|
+
externalClockOffset? : number | undefined;
|
|
51
51
|
/** Time, in terms of `performance.now` at which this MPD was received. */
|
|
52
|
-
manifestReceivedTime? : number;
|
|
52
|
+
manifestReceivedTime? : number | undefined;
|
|
53
53
|
/** Default base time, in seconds. */
|
|
54
|
-
referenceDateTime? : number;
|
|
54
|
+
referenceDateTime? : number | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* The parser should take this Manifest - which is a previously parsed
|
|
57
57
|
* Manifest for the same dynamic content - as a base to speed-up the parsing
|
|
@@ -62,13 +62,13 @@ export interface IMPDParserArguments {
|
|
|
62
62
|
*/
|
|
63
63
|
unsafelyBaseOnPreviousManifest : Manifest | null;
|
|
64
64
|
/** URL of the manifest (post-redirection if one). */
|
|
65
|
-
url? : string;
|
|
65
|
+
url? : string | undefined;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export interface ILoadedXlinkData {
|
|
69
|
-
url? : string;
|
|
70
|
-
sendingTime? : number;
|
|
71
|
-
receivedTime? : number;
|
|
69
|
+
url? : string | undefined;
|
|
70
|
+
sendingTime? : number | undefined;
|
|
71
|
+
receivedTime? : number | undefined;
|
|
72
72
|
parsed : IPeriodIntermediateRepresentation[];
|
|
73
73
|
warnings : Error[];
|
|
74
74
|
}
|
|
@@ -127,7 +127,7 @@ export default function parseMpdIr(
|
|
|
127
127
|
mpdIR : IMPDIntermediateRepresentation,
|
|
128
128
|
args : IMPDParserArguments,
|
|
129
129
|
warnings : Error[],
|
|
130
|
-
hasLoadedClock? : boolean,
|
|
130
|
+
hasLoadedClock? : boolean | undefined,
|
|
131
131
|
xlinkInfos : IXLinkInfos = new WeakMap()
|
|
132
132
|
) : IIrParserResponse {
|
|
133
133
|
const { children: rootChildren,
|