rx-player 3.28.0-dev.2022063000 → 3.28.1-dev.2022083000
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/checks.yml +20 -18
- package/CHANGELOG.md +14 -2
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/load_session.d.ts +5 -6
- package/dist/_esm5.processed/compat/eme/load_session.js +5 -6
- package/dist/_esm5.processed/compat/event_listeners.js +5 -0
- package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +1 -1
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/decrypt/create_session.js +33 -4
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +14 -0
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +25 -0
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +1 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
- package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +110 -38
- package/dist/_esm5.processed/core/stream/representation/check_for_discontinuity.js +21 -9
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +21 -29
- package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +1 -2
- package/dist/_esm5.processed/errors/encrypted_media_error.js +0 -1
- package/dist/_esm5.processed/errors/error_codes.d.ts +6 -1
- package/dist/_esm5.processed/errors/media_error.d.ts +1 -2
- package/dist/_esm5.processed/errors/media_error.js +0 -1
- package/dist/_esm5.processed/errors/network_error.d.ts +1 -2
- package/dist/_esm5.processed/errors/network_error.js +0 -1
- package/dist/_esm5.processed/errors/other_error.d.ts +1 -2
- package/dist/_esm5.processed/errors/other_error.js +0 -1
- package/dist/_esm5.processed/manifest/manifest.d.ts +1 -1
- package/dist/_esm5.processed/manifest/manifest.js +1 -1
- package/dist/_esm5.processed/manifest/representation_index/static.d.ts +21 -6
- package/dist/_esm5.processed/manifest/representation_index/static.js +26 -8
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +55 -44
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +21 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +25 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +26 -12
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +26 -13
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +23 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +65 -22
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +20 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +57 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.d.ts → utils.d.ts} +3 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/{is_period_fulfilled.js → utils.js} +4 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +5 -8
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +21 -8
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +49 -14
- package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +16 -0
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +20 -6
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +28 -10
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +4 -4
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -12
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +39 -14
- package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +1 -1
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +0 -2
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +1 -1
- package/dist/_esm5.processed/transports/types.d.ts +1 -1
- package/dist/_esm5.processed/utils/deep_merge.d.ts +1 -1
- package/dist/_esm5.processed/utils/deep_merge.js +6 -5
- package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -3
- package/dist/_esm5.processed/utils/task_canceller.js +0 -3
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +1390 -1059
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +5 -0
- package/package.json +31 -30
- package/sonar-project.properties +1 -1
- package/src/compat/eme/load_session.ts +5 -6
- package/src/compat/event_listeners.ts +5 -0
- package/src/core/api/media_element_track_choice_manager.ts +1 -1
- package/src/core/api/public_api.ts +2 -2
- package/src/core/decrypt/create_session.ts +28 -2
- package/src/core/decrypt/utils/loaded_sessions_store.ts +29 -0
- package/src/core/fetchers/segment/segment_fetcher.ts +1 -1
- package/src/core/init/content_time_boundaries_observer.ts +116 -42
- package/src/core/stream/representation/check_for_discontinuity.ts +28 -10
- package/src/core/stream/representation/get_buffer_status.ts +27 -34
- package/src/errors/encrypted_media_error.ts +1 -2
- package/src/errors/error_codes.ts +2 -2
- package/src/errors/media_error.ts +1 -2
- package/src/errors/network_error.ts +1 -2
- package/src/errors/other_error.ts +1 -2
- package/src/manifest/__tests__/adaptation.test.ts +4 -3
- package/src/manifest/__tests__/representation.test.ts +4 -3
- package/src/manifest/manifest.ts +1 -1
- package/src/manifest/representation_index/__tests__/static.test.ts +5 -4
- package/src/manifest/representation_index/static.ts +28 -9
- package/src/manifest/representation_index/types.ts +62 -46
- package/src/parsers/manifest/dash/common/indexes/base.ts +27 -11
- package/src/parsers/manifest/dash/common/indexes/list.ts +32 -15
- package/src/parsers/manifest/dash/common/indexes/template.ts +73 -27
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +60 -8
- package/src/parsers/manifest/dash/common/indexes/{is_period_fulfilled.ts → utils.ts} +4 -13
- package/src/parsers/manifest/dash/common/parse_periods.ts +1 -1
- package/src/parsers/manifest/local/parse_local_manifest.ts +8 -20
- package/src/parsers/manifest/local/representation_index.ts +51 -16
- package/src/parsers/manifest/local/types.ts +13 -0
- package/src/parsers/manifest/metaplaylist/representation_index.ts +31 -11
- package/src/parsers/manifest/smooth/create_parser.ts +4 -4
- package/src/parsers/manifest/smooth/representation_index.ts +40 -15
- package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +4 -3
- package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +4 -3
- package/src/parsers/manifest/utils/get_first_time_from_adaptation.ts +1 -1
- package/src/parsers/manifest/utils/get_last_time_from_adaptation.ts +1 -1
- package/src/transports/metaplaylist/pipelines.ts +0 -2
- package/src/transports/smooth/segment_loader.ts +1 -1
- package/src/transports/types.ts +1 -1
- package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -0
- package/src/utils/deep_merge.ts +7 -4
- package/src/utils/task_canceller.ts +0 -3
|
@@ -24,10 +24,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
24
24
|
};
|
|
25
25
|
import log from "../../../log";
|
|
26
26
|
var LocalRepresentationIndex = /** @class */ (function () {
|
|
27
|
-
function LocalRepresentationIndex(index, representationId
|
|
27
|
+
function LocalRepresentationIndex(index, representationId) {
|
|
28
28
|
this._index = index;
|
|
29
29
|
this._representationId = representationId;
|
|
30
|
-
this._isFinished = isFinished;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* @returns {Object}
|
|
@@ -90,7 +89,7 @@ var LocalRepresentationIndex = /** @class */ (function () {
|
|
|
90
89
|
/**
|
|
91
90
|
* @returns {Number|undefined}
|
|
92
91
|
*/
|
|
93
|
-
LocalRepresentationIndex.prototype.
|
|
92
|
+
LocalRepresentationIndex.prototype.getFirstAvailablePosition = function () {
|
|
94
93
|
if (this._index.segments.length === 0) {
|
|
95
94
|
return undefined;
|
|
96
95
|
}
|
|
@@ -100,12 +99,56 @@ var LocalRepresentationIndex = /** @class */ (function () {
|
|
|
100
99
|
/**
|
|
101
100
|
* @returns {Number|undefined}
|
|
102
101
|
*/
|
|
103
|
-
LocalRepresentationIndex.prototype.
|
|
102
|
+
LocalRepresentationIndex.prototype.getLastAvailablePosition = function () {
|
|
104
103
|
if (this._index.segments.length === 0) {
|
|
105
104
|
return undefined;
|
|
106
105
|
}
|
|
107
106
|
var lastSegment = this._index.segments[this._index.segments.length - 1];
|
|
108
|
-
return lastSegment.time;
|
|
107
|
+
return lastSegment.time + lastSegment.duration;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Returns the expected ending position of this RepresentationIndex.
|
|
111
|
+
* `undefined` if unknown.
|
|
112
|
+
* @returns {number|undefined}
|
|
113
|
+
*/
|
|
114
|
+
LocalRepresentationIndex.prototype.getEnd = function () {
|
|
115
|
+
if (this._index.isFinished) {
|
|
116
|
+
return this.getLastAvailablePosition();
|
|
117
|
+
}
|
|
118
|
+
var _a = this._index, incomingRanges = _a.incomingRanges, segments = _a.segments;
|
|
119
|
+
if (incomingRanges === undefined || incomingRanges.length === 0) {
|
|
120
|
+
// If incomingRanges is empty but not finished... It's ambiguous.
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
var lastIncomingRange = incomingRanges[incomingRanges.length - 1];
|
|
124
|
+
var futureEnd = lastIncomingRange.end;
|
|
125
|
+
if (segments.length === 0) {
|
|
126
|
+
return futureEnd;
|
|
127
|
+
}
|
|
128
|
+
var lastSegment = this._index.segments[this._index.segments.length - 1];
|
|
129
|
+
return Math.max(lastSegment.time + lastSegment.duration, futureEnd);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Returns:
|
|
133
|
+
* - `true` if in the given time interval, at least one new segment is
|
|
134
|
+
* expected to be available in the future.
|
|
135
|
+
* - `false` either if all segments in that time interval are already
|
|
136
|
+
* available for download or if none will ever be available for it.
|
|
137
|
+
* - `undefined` when it is not possible to tell.
|
|
138
|
+
* @param {number} start
|
|
139
|
+
* @param {number} end
|
|
140
|
+
* @returns {boolean|undefined}
|
|
141
|
+
*/
|
|
142
|
+
LocalRepresentationIndex.prototype.awaitSegmentBetween = function (start, end) {
|
|
143
|
+
if (this.isFinished()) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
if (this._index.incomingRanges === undefined) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return this._index.incomingRanges.some(function (range) {
|
|
150
|
+
return range.start < end && range.end > start;
|
|
151
|
+
});
|
|
109
152
|
};
|
|
110
153
|
/**
|
|
111
154
|
* @returns {Boolean}
|
|
@@ -120,7 +163,7 @@ var LocalRepresentationIndex = /** @class */ (function () {
|
|
|
120
163
|
return true;
|
|
121
164
|
};
|
|
122
165
|
LocalRepresentationIndex.prototype.isFinished = function () {
|
|
123
|
-
return this.
|
|
166
|
+
return this._index.isFinished;
|
|
124
167
|
};
|
|
125
168
|
/**
|
|
126
169
|
* @returns {Boolean}
|
|
@@ -134,12 +177,6 @@ var LocalRepresentationIndex = /** @class */ (function () {
|
|
|
134
177
|
LocalRepresentationIndex.prototype.checkDiscontinuity = function () {
|
|
135
178
|
return null;
|
|
136
179
|
};
|
|
137
|
-
/**
|
|
138
|
-
* @returns {boolean}
|
|
139
|
-
*/
|
|
140
|
-
LocalRepresentationIndex.prototype.areSegmentsChronologicallyGenerated = function () {
|
|
141
|
-
return false;
|
|
142
|
-
};
|
|
143
180
|
/**
|
|
144
181
|
* @returns {Boolean}
|
|
145
182
|
*/
|
|
@@ -147,14 +184,12 @@ var LocalRepresentationIndex = /** @class */ (function () {
|
|
|
147
184
|
return true;
|
|
148
185
|
};
|
|
149
186
|
LocalRepresentationIndex.prototype._replace = function (newIndex) {
|
|
150
|
-
this._isFinished = newIndex._isFinished;
|
|
151
187
|
this._index.segments = newIndex._index.segments;
|
|
152
188
|
this._index.loadSegment = newIndex._index.loadSegment;
|
|
153
189
|
this._index.loadInitSegment = newIndex._index.loadInitSegment;
|
|
154
190
|
};
|
|
155
191
|
LocalRepresentationIndex.prototype._update = function (newIndex) {
|
|
156
192
|
var _this = this;
|
|
157
|
-
this._isFinished = newIndex._isFinished;
|
|
158
193
|
var newSegments = newIndex._index.segments;
|
|
159
194
|
if (newSegments.length <= 0) {
|
|
160
195
|
return;
|
|
@@ -148,6 +148,8 @@ export interface ILocalIndexSegment {
|
|
|
148
148
|
}
|
|
149
149
|
/** "Index" of a `ILocalRepresentation`. Allow to declare available segments. */
|
|
150
150
|
export interface ILocalIndex {
|
|
151
|
+
/** Every segments in that `ILocalIndex` has been downloaded. */
|
|
152
|
+
isFinished: boolean;
|
|
151
153
|
/** Callback used to retrieve the initialization segment of a `ILocalRepresentation`. */
|
|
152
154
|
loadInitSegment: ILocalManifestInitSegmentLoader;
|
|
153
155
|
/** Callback used to retrieve a media segment of a `ILocalRepresentation`. */
|
|
@@ -157,6 +159,14 @@ export interface ILocalIndex {
|
|
|
157
159
|
* Doesn't include the initialization segment.
|
|
158
160
|
*/
|
|
159
161
|
segments: ILocalIndexSegment[];
|
|
162
|
+
/**
|
|
163
|
+
* List of not yet available time ranges, that should become available once
|
|
164
|
+
* the content is fully loaded.
|
|
165
|
+
*/
|
|
166
|
+
incomingRanges?: Array<{
|
|
167
|
+
start: number;
|
|
168
|
+
end: number;
|
|
169
|
+
}>;
|
|
160
170
|
}
|
|
161
171
|
/** A quality for a given "local" Manifest track (`ILocalAdaptation`). */
|
|
162
172
|
export interface ILocalRepresentation {
|
|
@@ -235,6 +245,12 @@ export interface ILocalManifest {
|
|
|
235
245
|
* `start` and `duration` from a ILocalPeriod and `time` and
|
|
236
246
|
* `duration` from a `ILocalIndexSegment` are now in seconds
|
|
237
247
|
* instead of milliseconds.
|
|
248
|
+
*
|
|
249
|
+
* - "0.3": optional `futureSegments` has been added to `ILocalIndex`
|
|
250
|
+
* `duration` has been removed.
|
|
251
|
+
*
|
|
252
|
+
* A mandatory `isFinished` boolean should now be set on a
|
|
253
|
+
* `ILocalIndex`.
|
|
238
254
|
*/
|
|
239
255
|
version: string;
|
|
240
256
|
/**
|
|
@@ -73,13 +73,31 @@ export default class MetaRepresentationIndex implements IRepresentationIndex {
|
|
|
73
73
|
* `undefined` if we do not know this value.
|
|
74
74
|
* @return {Number|undefined}
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
getFirstAvailablePosition(): number | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Returns last possible position the last segment plays at, in seconds.
|
|
79
79
|
* `undefined` if we do not know this value.
|
|
80
80
|
* @return {Number|undefined}
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
getLastAvailablePosition(): number | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the absolute end in seconds this RepresentationIndex can reach once
|
|
85
|
+
* all segments are available.
|
|
86
|
+
* @returns {number|null|undefined}
|
|
87
|
+
*/
|
|
88
|
+
getEnd(): number | undefined | null;
|
|
89
|
+
/**
|
|
90
|
+
* Returns:
|
|
91
|
+
* - `true` if in the given time interval, at least one new segment is
|
|
92
|
+
* expected to be available in the future.
|
|
93
|
+
* - `false` either if all segments in that time interval are already
|
|
94
|
+
* available for download or if none will ever be available for it.
|
|
95
|
+
* - `undefined` when it is not possible to tell.
|
|
96
|
+
* @param {number} start
|
|
97
|
+
* @param {number} end
|
|
98
|
+
* @returns {boolean|undefined}
|
|
99
|
+
*/
|
|
100
|
+
awaitSegmentBetween(start: number, end: number): boolean | undefined;
|
|
83
101
|
/**
|
|
84
102
|
* Returns `false` if that segment is not currently available in the Manifest
|
|
85
103
|
* (e.g. it corresponds to a segment which is before the current buffer
|
|
@@ -100,10 +118,6 @@ export default class MetaRepresentationIndex implements IRepresentationIndex {
|
|
|
100
118
|
* @returns {Number | null}
|
|
101
119
|
*/
|
|
102
120
|
checkDiscontinuity(time: number): number | null;
|
|
103
|
-
/**
|
|
104
|
-
* @returns {Boolean}
|
|
105
|
-
*/
|
|
106
|
-
areSegmentsChronologicallyGenerated(): boolean;
|
|
107
121
|
/**
|
|
108
122
|
* @returns {Boolean}
|
|
109
123
|
*/
|
|
@@ -85,8 +85,8 @@ var MetaRepresentationIndex = /** @class */ (function () {
|
|
|
85
85
|
* `undefined` if we do not know this value.
|
|
86
86
|
* @return {Number|undefined}
|
|
87
87
|
*/
|
|
88
|
-
MetaRepresentationIndex.prototype.
|
|
89
|
-
var wrappedFirstPosition = this._wrappedIndex.
|
|
88
|
+
MetaRepresentationIndex.prototype.getFirstAvailablePosition = function () {
|
|
89
|
+
var wrappedFirstPosition = this._wrappedIndex.getFirstAvailablePosition();
|
|
90
90
|
return wrappedFirstPosition != null ? wrappedFirstPosition + this._timeOffset :
|
|
91
91
|
undefined;
|
|
92
92
|
};
|
|
@@ -95,11 +95,35 @@ var MetaRepresentationIndex = /** @class */ (function () {
|
|
|
95
95
|
* `undefined` if we do not know this value.
|
|
96
96
|
* @return {Number|undefined}
|
|
97
97
|
*/
|
|
98
|
-
MetaRepresentationIndex.prototype.
|
|
99
|
-
var wrappedLastPosition = this._wrappedIndex.
|
|
98
|
+
MetaRepresentationIndex.prototype.getLastAvailablePosition = function () {
|
|
99
|
+
var wrappedLastPosition = this._wrappedIndex.getLastAvailablePosition();
|
|
100
100
|
return wrappedLastPosition != null ? wrappedLastPosition + this._timeOffset :
|
|
101
101
|
undefined;
|
|
102
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Returns the absolute end in seconds this RepresentationIndex can reach once
|
|
105
|
+
* all segments are available.
|
|
106
|
+
* @returns {number|null|undefined}
|
|
107
|
+
*/
|
|
108
|
+
MetaRepresentationIndex.prototype.getEnd = function () {
|
|
109
|
+
var wrappedEnd = this._wrappedIndex.getEnd();
|
|
110
|
+
return wrappedEnd != null ? wrappedEnd + this._timeOffset :
|
|
111
|
+
undefined;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Returns:
|
|
115
|
+
* - `true` if in the given time interval, at least one new segment is
|
|
116
|
+
* expected to be available in the future.
|
|
117
|
+
* - `false` either if all segments in that time interval are already
|
|
118
|
+
* available for download or if none will ever be available for it.
|
|
119
|
+
* - `undefined` when it is not possible to tell.
|
|
120
|
+
* @param {number} start
|
|
121
|
+
* @param {number} end
|
|
122
|
+
* @returns {boolean|undefined}
|
|
123
|
+
*/
|
|
124
|
+
MetaRepresentationIndex.prototype.awaitSegmentBetween = function (start, end) {
|
|
125
|
+
return this._wrappedIndex.awaitSegmentBetween(start - this._timeOffset, end - this._timeOffset);
|
|
126
|
+
};
|
|
103
127
|
/**
|
|
104
128
|
* Returns `false` if that segment is not currently available in the Manifest
|
|
105
129
|
* (e.g. it corresponds to a segment which is before the current buffer
|
|
@@ -136,12 +160,6 @@ var MetaRepresentationIndex = /** @class */ (function () {
|
|
|
136
160
|
MetaRepresentationIndex.prototype.checkDiscontinuity = function (time) {
|
|
137
161
|
return this._wrappedIndex.checkDiscontinuity(time - this._timeOffset);
|
|
138
162
|
};
|
|
139
|
-
/**
|
|
140
|
-
* @returns {Boolean}
|
|
141
|
-
*/
|
|
142
|
-
MetaRepresentationIndex.prototype.areSegmentsChronologicallyGenerated = function () {
|
|
143
|
-
return this._wrappedIndex.areSegmentsChronologicallyGenerated();
|
|
144
|
-
};
|
|
145
163
|
/**
|
|
146
164
|
* @returns {Boolean}
|
|
147
165
|
*/
|
|
@@ -390,8 +390,8 @@ function createSmoothStreamingParser(parserOptions) {
|
|
|
390
390
|
if (firstVideoAdaptation !== undefined) {
|
|
391
391
|
var firstVideoRepresentation = firstVideoAdaptation.representations[0];
|
|
392
392
|
if (firstVideoRepresentation !== undefined) {
|
|
393
|
-
var firstVideoTimeReference = firstVideoRepresentation.index.
|
|
394
|
-
var lastVideoTimeReference = firstVideoRepresentation.index.
|
|
393
|
+
var firstVideoTimeReference = firstVideoRepresentation.index.getFirstAvailablePosition();
|
|
394
|
+
var lastVideoTimeReference = firstVideoRepresentation.index.getLastAvailablePosition();
|
|
395
395
|
if (firstVideoTimeReference != null) {
|
|
396
396
|
firstTimeReferences.push(firstVideoTimeReference);
|
|
397
397
|
}
|
|
@@ -403,8 +403,8 @@ function createSmoothStreamingParser(parserOptions) {
|
|
|
403
403
|
if (firstAudioAdaptation !== undefined) {
|
|
404
404
|
var firstAudioRepresentation = firstAudioAdaptation.representations[0];
|
|
405
405
|
if (firstAudioRepresentation !== undefined) {
|
|
406
|
-
var firstAudioTimeReference = firstAudioRepresentation.index.
|
|
407
|
-
var lastAudioTimeReference = firstAudioRepresentation.index.
|
|
406
|
+
var firstAudioTimeReference = firstAudioRepresentation.index.getFirstAvailablePosition();
|
|
407
|
+
var lastAudioTimeReference = firstAudioRepresentation.index.getLastAvailablePosition();
|
|
408
408
|
if (firstAudioTimeReference != null) {
|
|
409
409
|
firstTimeReferences.push(firstAudioTimeReference);
|
|
410
410
|
}
|
|
@@ -172,7 +172,7 @@ export default class SmoothRepresentationIndex implements IRepresentationIndex {
|
|
|
172
172
|
* Generate a list of Segments for a particular period of time.
|
|
173
173
|
*
|
|
174
174
|
* @param {Number} from
|
|
175
|
-
* @param {Number}
|
|
175
|
+
* @param {Number} dur
|
|
176
176
|
* @returns {Array.<Object>}
|
|
177
177
|
*/
|
|
178
178
|
getSegments(from: number, dur: number): ISegment[];
|
|
@@ -186,17 +186,32 @@ export default class SmoothRepresentationIndex implements IRepresentationIndex {
|
|
|
186
186
|
shouldRefresh(up: number, to: number): boolean;
|
|
187
187
|
/**
|
|
188
188
|
* Returns first position available in the index.
|
|
189
|
-
*
|
|
190
|
-
* @param {Object} index
|
|
191
189
|
* @returns {Number|null}
|
|
192
190
|
*/
|
|
193
|
-
|
|
191
|
+
getFirstAvailablePosition(): number | null;
|
|
194
192
|
/**
|
|
195
193
|
* Returns last position available in the index.
|
|
196
|
-
* @param {Object} index
|
|
197
194
|
* @returns {Number}
|
|
198
195
|
*/
|
|
199
|
-
|
|
196
|
+
getLastAvailablePosition(): number | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Returns the absolute end in seconds this RepresentationIndex can reach once
|
|
199
|
+
* all segments are available.
|
|
200
|
+
* @returns {number|null|undefined}
|
|
201
|
+
*/
|
|
202
|
+
getEnd(): number | null | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Returns:
|
|
205
|
+
* - `true` if in the given time interval, at least one new segment is
|
|
206
|
+
* expected to be available in the future.
|
|
207
|
+
* - `false` either if all segments in that time interval are already
|
|
208
|
+
* available for download or if none will ever be available for it.
|
|
209
|
+
* - `undefined` when it is not possible to tell.
|
|
210
|
+
* @param {number} start
|
|
211
|
+
* @param {number} end
|
|
212
|
+
* @returns {boolean|undefined}
|
|
213
|
+
*/
|
|
214
|
+
awaitSegmentBetween(start: number, end: number): boolean | undefined;
|
|
200
215
|
/**
|
|
201
216
|
* Checks if `timeSec` is in a discontinuity.
|
|
202
217
|
* That is, if there's no segment available for the `timeSec` position.
|
|
@@ -207,12 +222,6 @@ export default class SmoothRepresentationIndex implements IRepresentationIndex {
|
|
|
207
222
|
* position for which a segment is available in seconds.
|
|
208
223
|
*/
|
|
209
224
|
checkDiscontinuity(timeSec: number): number | null;
|
|
210
|
-
/**
|
|
211
|
-
* Returns `true` as Smooth segments should always be generated in
|
|
212
|
-
* chronological order.
|
|
213
|
-
* @returns {boolean}
|
|
214
|
-
*/
|
|
215
|
-
areSegmentsChronologicallyGenerated(): true;
|
|
216
225
|
/**
|
|
217
226
|
* Returns `true` if a Segment returned by this index is still considered
|
|
218
227
|
* available.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NetworkError } from "../../../errors";
|
|
17
17
|
import log from "../../../log";
|
|
18
|
+
import assert from "../../../utils/assert";
|
|
18
19
|
import clearTimelineFromPosition from "../utils/clear_timeline_from_position";
|
|
19
20
|
import { checkDiscontinuity, getIndexSegmentEnd, } from "../utils/index_helpers";
|
|
20
21
|
import isSegmentStillAvailable from "../utils/is_segment_still_available";
|
|
@@ -128,7 +129,7 @@ var SmoothRepresentationIndex = /** @class */ (function () {
|
|
|
128
129
|
* Generate a list of Segments for a particular period of time.
|
|
129
130
|
*
|
|
130
131
|
* @param {Number} from
|
|
131
|
-
* @param {Number}
|
|
132
|
+
* @param {Number} dur
|
|
132
133
|
* @returns {Array.<Object>}
|
|
133
134
|
*/
|
|
134
135
|
SmoothRepresentationIndex.prototype.getSegments = function (from, dur) {
|
|
@@ -214,11 +215,9 @@ var SmoothRepresentationIndex = /** @class */ (function () {
|
|
|
214
215
|
};
|
|
215
216
|
/**
|
|
216
217
|
* Returns first position available in the index.
|
|
217
|
-
*
|
|
218
|
-
* @param {Object} index
|
|
219
218
|
* @returns {Number|null}
|
|
220
219
|
*/
|
|
221
|
-
SmoothRepresentationIndex.prototype.
|
|
220
|
+
SmoothRepresentationIndex.prototype.getFirstAvailablePosition = function () {
|
|
222
221
|
this._refreshTimeline();
|
|
223
222
|
var index = this._index;
|
|
224
223
|
if (index.timeline.length === 0) {
|
|
@@ -228,10 +227,9 @@ var SmoothRepresentationIndex = /** @class */ (function () {
|
|
|
228
227
|
};
|
|
229
228
|
/**
|
|
230
229
|
* Returns last position available in the index.
|
|
231
|
-
* @param {Object} index
|
|
232
230
|
* @returns {Number}
|
|
233
231
|
*/
|
|
234
|
-
SmoothRepresentationIndex.prototype.
|
|
232
|
+
SmoothRepresentationIndex.prototype.getLastAvailablePosition = function () {
|
|
235
233
|
this._refreshTimeline();
|
|
236
234
|
var index = this._index;
|
|
237
235
|
if (this._scaledLiveGap == null) {
|
|
@@ -253,6 +251,41 @@ var SmoothRepresentationIndex = /** @class */ (function () {
|
|
|
253
251
|
}
|
|
254
252
|
return undefined;
|
|
255
253
|
};
|
|
254
|
+
/**
|
|
255
|
+
* Returns the absolute end in seconds this RepresentationIndex can reach once
|
|
256
|
+
* all segments are available.
|
|
257
|
+
* @returns {number|null|undefined}
|
|
258
|
+
*/
|
|
259
|
+
SmoothRepresentationIndex.prototype.getEnd = function () {
|
|
260
|
+
if (!this._isLive) {
|
|
261
|
+
return this.getLastAvailablePosition();
|
|
262
|
+
}
|
|
263
|
+
return undefined;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Returns:
|
|
267
|
+
* - `true` if in the given time interval, at least one new segment is
|
|
268
|
+
* expected to be available in the future.
|
|
269
|
+
* - `false` either if all segments in that time interval are already
|
|
270
|
+
* available for download or if none will ever be available for it.
|
|
271
|
+
* - `undefined` when it is not possible to tell.
|
|
272
|
+
* @param {number} start
|
|
273
|
+
* @param {number} end
|
|
274
|
+
* @returns {boolean|undefined}
|
|
275
|
+
*/
|
|
276
|
+
SmoothRepresentationIndex.prototype.awaitSegmentBetween = function (start, end) {
|
|
277
|
+
var _a;
|
|
278
|
+
assert(start <= end);
|
|
279
|
+
if (this.isFinished()) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
var lastAvailablePosition = this.getLastAvailablePosition();
|
|
283
|
+
if (lastAvailablePosition !== undefined && end < lastAvailablePosition) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
return end > ((_a = this.getFirstAvailablePosition()) !== null && _a !== void 0 ? _a : 0) ? undefined :
|
|
287
|
+
false;
|
|
288
|
+
};
|
|
256
289
|
/**
|
|
257
290
|
* Checks if `timeSec` is in a discontinuity.
|
|
258
291
|
* That is, if there's no segment available for the `timeSec` position.
|
|
@@ -266,14 +299,6 @@ var SmoothRepresentationIndex = /** @class */ (function () {
|
|
|
266
299
|
this._refreshTimeline();
|
|
267
300
|
return checkDiscontinuity(this._index, timeSec, undefined);
|
|
268
301
|
};
|
|
269
|
-
/**
|
|
270
|
-
* Returns `true` as Smooth segments should always be generated in
|
|
271
|
-
* chronological order.
|
|
272
|
-
* @returns {boolean}
|
|
273
|
-
*/
|
|
274
|
-
SmoothRepresentationIndex.prototype.areSegmentsChronologicallyGenerated = function () {
|
|
275
|
-
return true;
|
|
276
|
-
};
|
|
277
302
|
/**
|
|
278
303
|
* Returns `true` if a Segment returned by this index is still considered
|
|
279
304
|
* available.
|
|
@@ -27,7 +27,7 @@ export default function getFirstPositionFromAdaptation(adaptation) {
|
|
|
27
27
|
var representations = adaptation.representations;
|
|
28
28
|
var max = null;
|
|
29
29
|
for (var i = 0; i < representations.length; i++) {
|
|
30
|
-
var firstPosition = representations[i].index.
|
|
30
|
+
var firstPosition = representations[i].index.getFirstAvailablePosition();
|
|
31
31
|
if (firstPosition === undefined) { // we cannot tell
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
@@ -29,7 +29,7 @@ export default function getLastPositionFromAdaptation(adaptation) {
|
|
|
29
29
|
var representations = adaptation.representations;
|
|
30
30
|
var min = null;
|
|
31
31
|
for (var i = 0; i < representations.length; i++) {
|
|
32
|
-
var lastPosition = representations[i].index.
|
|
32
|
+
var lastPosition = representations[i].index.getLastAvailablePosition();
|
|
33
33
|
if (lastPosition === undefined) { // we cannot tell
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
@@ -33,7 +33,6 @@ import generateManifestLoader from "./manifest_loader";
|
|
|
33
33
|
/**
|
|
34
34
|
* Get base - real - content from an offseted metaplaylist content.
|
|
35
35
|
* @param {Object} segment
|
|
36
|
-
* @param {number} offset
|
|
37
36
|
* @returns {Object}
|
|
38
37
|
*/
|
|
39
38
|
function getOriginalContent(segment) {
|
|
@@ -128,7 +127,6 @@ export default function (options) {
|
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
129
|
* @param {number} contentOffset
|
|
131
|
-
* @param {number} scaledContentOffset
|
|
132
130
|
* @param {number|undefined} contentEnd
|
|
133
131
|
* @param {Object} segmentResponse
|
|
134
132
|
* @returns {Object}
|
|
@@ -33,7 +33,7 @@ import { createAudioInitSegment, createVideoInitSegment, } from "./isobmff";
|
|
|
33
33
|
import { isMP4EmbeddedTrack } from "./utils";
|
|
34
34
|
/**
|
|
35
35
|
* Segment loader triggered if there was no custom-defined one in the API.
|
|
36
|
-
* @param {string}
|
|
36
|
+
* @param {string} url
|
|
37
37
|
* @param {Object} content
|
|
38
38
|
* @param {Object} callbacks
|
|
39
39
|
* @param {Object} cancelSignal
|
|
@@ -161,7 +161,7 @@ export interface ISegmentPipeline<TLoadedFormat, TParsedSegmentDataFormat> {
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Segment loader function, allowing to load a segment of any type.
|
|
164
|
-
* @param {
|
|
164
|
+
* @param {string|null} url - URL at which the segment should be downloaded.
|
|
165
165
|
* `null` if we do not have an URL (in which case the segment should be loaded
|
|
166
166
|
* through other means, such as information taken from the segment's content).
|
|
167
167
|
* @param {Object} content - Content linked to the wanted segment.
|
|
@@ -8,5 +8,5 @@ declare type ISourcesArgument<T> = Array<IDeepPartial<T> | unknown>;
|
|
|
8
8
|
* @param sources
|
|
9
9
|
* @returns output : merged object
|
|
10
10
|
*/
|
|
11
|
-
export default function deepMerge<T
|
|
11
|
+
export default function deepMerge<T extends Record<string | number | symbol, unknown>>(target: T, ...sources: ISourcesArgument<T>): T;
|
|
12
12
|
export {};
|
|
@@ -26,7 +26,7 @@ function isObject(item) {
|
|
|
26
26
|
* @returns output : merged object
|
|
27
27
|
*/
|
|
28
28
|
export default function deepMerge(target) {
|
|
29
|
-
var _a
|
|
29
|
+
var _a;
|
|
30
30
|
var sources = [];
|
|
31
31
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
32
32
|
sources[_i - 1] = arguments[_i];
|
|
@@ -38,14 +38,15 @@ export default function deepMerge(target) {
|
|
|
38
38
|
if (isObject(target) && isObject(source)) {
|
|
39
39
|
for (var key in source) {
|
|
40
40
|
if (isObject(source[key])) {
|
|
41
|
-
if (target[key] === undefined) {
|
|
42
|
-
objectAssign(target, (_a = {}, _a[key] = {}, _a));
|
|
43
|
-
}
|
|
44
41
|
var newTarget = target[key];
|
|
42
|
+
if (newTarget === undefined) {
|
|
43
|
+
newTarget = {};
|
|
44
|
+
target[key] = newTarget;
|
|
45
|
+
}
|
|
45
46
|
deepMerge(newTarget, source[key]);
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
objectAssign(target, (
|
|
49
|
+
objectAssign(target, (_a = {}, _a[key] = source[key], _a));
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -241,8 +241,5 @@ export declare type ICancellationListener = (error: CancellationError) => void;
|
|
|
241
241
|
export declare class CancellationError extends Error {
|
|
242
242
|
readonly name: "CancellationError";
|
|
243
243
|
readonly message: string;
|
|
244
|
-
/**
|
|
245
|
-
* @param {string} message
|
|
246
|
-
*/
|
|
247
244
|
constructor();
|
|
248
245
|
}
|
|
@@ -264,9 +264,6 @@ export { CancellationSignal };
|
|
|
264
264
|
*/
|
|
265
265
|
var CancellationError = /** @class */ (function (_super) {
|
|
266
266
|
__extends(CancellationError, _super);
|
|
267
|
-
/**
|
|
268
|
-
* @param {string} message
|
|
269
|
-
*/
|
|
270
267
|
function CancellationError() {
|
|
271
268
|
var _this = _super.call(this) || this;
|
|
272
269
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
package/dist/mpd-parser.wasm
CHANGED
|
Binary file
|