rx-player 3.28.1-dev.2022083000 → 3.29.0-dev.2022090500
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 +11 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/event_listeners.d.ts +18 -2
- package/dist/_esm5.processed/compat/event_listeners.js +64 -2
- package/dist/_esm5.processed/compat/on_height_width_change.d.ts +5 -4
- package/dist/_esm5.processed/compat/on_height_width_change.js +43 -34
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +12 -2
- package/dist/_esm5.processed/core/api/playback_observer.js +27 -12
- package/dist/_esm5.processed/core/api/public_api.js +14 -14
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +7 -0
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +10 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +10 -4
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +7 -0
- package/dist/_esm5.processed/core/init/initialize_directfile.js +1 -1
- package/dist/_esm5.processed/core/init/load_on_media_source.js +1 -1
- package/dist/_esm5.processed/core/init/stall_avoider.d.ts +4 -2
- package/dist/_esm5.processed/core/init/stall_avoider.js +32 -26
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.d.ts +12 -6
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +142 -78
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -16
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +53 -41
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +6 -5
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +37 -39
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +23 -22
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +84 -72
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +6 -12
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +33 -43
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +12 -9
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +7 -6
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +17 -10
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +20 -9
- package/dist/_esm5.processed/core/stream/period/period_stream.js +25 -14
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.d.ts +4 -7
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +80 -23
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.d.ts +5 -4
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +78 -26
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +7 -3
- package/dist/_esm5.processed/core/stream/representation/push_init_segment.js +7 -1
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +7 -1
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +15 -8
- package/dist/_esm5.processed/default_config.js +1 -1
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -2
- package/dist/_esm5.processed/errors/custom_loader_error.js +3 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +9 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +3 -1
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +4 -3
- package/dist/_esm5.processed/public_types.d.ts +22 -3
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +3 -1
- package/dist/_esm5.processed/transports/dash/init_segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +12 -6
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +3 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +6 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +12 -9
- package/dist/_esm5.processed/transports/dash/text_loader.js +6 -3
- package/dist/_esm5.processed/transports/local/pipelines.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/pipelines.js +6 -6
- package/dist/_esm5.processed/transports/local/segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +4 -3
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +5 -2
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +15 -10
- package/dist/_esm5.processed/transports/smooth/pipelines.d.ts +1 -1
- package/dist/_esm5.processed/transports/smooth/pipelines.js +18 -14
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +8 -6
- package/dist/_esm5.processed/transports/types.d.ts +25 -2
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +9 -6
- package/dist/_esm5.processed/utils/request/fetch.js +7 -8
- package/dist/_esm5.processed/utils/request/xhr.d.ts +1 -1
- package/dist/_esm5.processed/utils/request/xhr.js +28 -14
- package/dist/_esm5.processed/utils/task_canceller.d.ts +1 -2
- package/dist/_esm5.processed/utils/task_canceller.js +1 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +1116 -695
- package/dist/rx-player.min.js +1 -1
- package/package.json +7 -7
- package/sonar-project.properties +1 -1
- package/src/compat/event_listeners.ts +86 -1
- package/src/compat/on_height_width_change.ts +48 -49
- package/src/core/api/playback_observer.ts +34 -14
- package/src/core/api/public_api.ts +23 -18
- package/src/core/fetchers/manifest/manifest_fetcher.ts +20 -2
- package/src/core/fetchers/segment/segment_fetcher.ts +23 -3
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +7 -0
- package/src/core/init/initialize_directfile.ts +1 -1
- package/src/core/init/load_on_media_source.ts +1 -0
- package/src/core/init/stall_avoider.ts +40 -26
- package/src/core/segment_buffers/garbage_collector.ts +55 -47
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +92 -70
- package/src/core/segment_buffers/implementations/image/image_segment_buffer.ts +37 -42
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +103 -105
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +35 -46
- package/src/core/segment_buffers/implementations/types.ts +22 -9
- package/src/core/segment_buffers/segment_buffers_store.ts +23 -14
- package/src/core/stream/orchestrator/stream_orchestrator.ts +31 -12
- package/src/core/stream/period/period_stream.ts +31 -18
- package/src/core/stream/representation/append_segment_to_buffer.ts +27 -42
- package/src/core/stream/representation/force_garbage_collection.ts +28 -32
- package/src/core/stream/representation/get_buffer_status.ts +7 -3
- package/src/core/stream/representation/push_init_segment.ts +12 -6
- package/src/core/stream/representation/push_media_segment.ts +12 -6
- package/src/core/stream/representation/representation_stream.ts +11 -5
- package/src/default_config.ts +17 -17
- package/src/errors/custom_loader_error.ts +3 -2
- package/src/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.ts +7 -2
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +6 -2
- package/src/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.ts +10 -2
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +3 -1
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +4 -3
- package/src/public_types.ts +28 -4
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
- package/src/transports/dash/image_pipelines.ts +4 -0
- package/src/transports/dash/init_segment_loader.ts +8 -0
- package/src/transports/dash/low_latency_segment_loader.ts +4 -0
- package/src/transports/dash/manifest_parser.ts +4 -0
- package/src/transports/dash/segment_loader.ts +21 -5
- package/src/transports/dash/text_loader.ts +7 -2
- package/src/transports/local/pipelines.ts +7 -5
- package/src/transports/local/segment_loader.ts +4 -2
- package/src/transports/metaplaylist/manifest_loader.ts +9 -2
- package/src/transports/metaplaylist/pipelines.ts +16 -6
- package/src/transports/smooth/pipelines.ts +17 -9
- package/src/transports/smooth/segment_loader.ts +8 -0
- package/src/transports/types.ts +27 -0
- package/src/transports/utils/call_custom_manifest_loader.ts +8 -2
- package/src/transports/utils/generate_manifest_loader.ts +18 -5
- package/src/utils/request/fetch.ts +7 -8
- package/src/utils/request/xhr.ts +31 -15
- package/src/utils/task_canceller.ts +1 -2
|
@@ -28,7 +28,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
28
28
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
|
-
import { fromEvent, interval, Observable, Subject, takeUntil, tap, } from "rxjs";
|
|
32
31
|
import { tryToChangeSourceBufferType, } from "../../../../compat";
|
|
33
32
|
import config from "../../../../config";
|
|
34
33
|
import log from "../../../../log";
|
|
@@ -37,7 +36,9 @@ import areArraysOfNumbersEqual from "../../../../utils/are_arrays_of_numbers_equ
|
|
|
37
36
|
import assertUnreachable from "../../../../utils/assert_unreachable";
|
|
38
37
|
import { toUint8Array } from "../../../../utils/byte_parsing";
|
|
39
38
|
import hashBuffer from "../../../../utils/hash_buffer";
|
|
39
|
+
import noop from "../../../../utils/noop";
|
|
40
40
|
import objectAssign from "../../../../utils/object_assign";
|
|
41
|
+
import TaskCanceller, { CancellationError, } from "../../../../utils/task_canceller";
|
|
41
42
|
import { SegmentBuffer, SegmentBufferOperation, } from "../types";
|
|
42
43
|
/**
|
|
43
44
|
* Allows to push and remove new segments to a SourceBuffer in a FIFO queue (not
|
|
@@ -55,12 +56,12 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
55
56
|
* @constructor
|
|
56
57
|
* @param {string} bufferType
|
|
57
58
|
* @param {string} codec
|
|
58
|
-
* @param {
|
|
59
|
+
* @param {MediaSource} mediaSource
|
|
59
60
|
*/
|
|
60
61
|
function AudioVideoSegmentBuffer(bufferType, codec, mediaSource) {
|
|
61
62
|
var _this = _super.call(this) || this;
|
|
62
63
|
var sourceBuffer = mediaSource.addSourceBuffer(codec);
|
|
63
|
-
_this.
|
|
64
|
+
_this._canceller = new TaskCanceller();
|
|
64
65
|
_this.bufferType = bufferType;
|
|
65
66
|
_this._mediaSource = mediaSource;
|
|
66
67
|
_this._sourceBuffer = sourceBuffer;
|
|
@@ -68,16 +69,23 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
68
69
|
_this._pendingTask = null;
|
|
69
70
|
_this._lastInitSegment = null;
|
|
70
71
|
_this.codec = codec;
|
|
71
|
-
var
|
|
72
|
+
var onError = _this._onPendingTaskError.bind(_this);
|
|
73
|
+
var reCheck = _this._flush.bind(_this);
|
|
72
74
|
// Some browsers (happened with firefox 66) sometimes "forget" to send us
|
|
73
75
|
// `update` or `updateend` events.
|
|
74
76
|
// In that case, we're completely unable to continue the queue here and
|
|
75
77
|
// stay locked in a waiting state.
|
|
76
78
|
// This interval is here to check at regular intervals if the underlying
|
|
77
79
|
// SourceBuffer is currently updating.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
var SOURCE_BUFFER_FLUSHING_INTERVAL = config.getCurrent().SOURCE_BUFFER_FLUSHING_INTERVAL;
|
|
81
|
+
var intervalId = setInterval(reCheck, SOURCE_BUFFER_FLUSHING_INTERVAL);
|
|
82
|
+
_this._sourceBuffer.addEventListener("error", onError);
|
|
83
|
+
_this._sourceBuffer.addEventListener("updateend", reCheck);
|
|
84
|
+
_this._canceller.signal.register(function () {
|
|
85
|
+
clearInterval(intervalId);
|
|
86
|
+
_this._sourceBuffer.removeEventListener("error", onError);
|
|
87
|
+
_this._sourceBuffer.removeEventListener("updateend", reCheck);
|
|
88
|
+
});
|
|
81
89
|
return _this;
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
@@ -104,38 +112,40 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
104
112
|
* `data.chunk` argument to null.
|
|
105
113
|
*
|
|
106
114
|
* @param {Object} infos
|
|
107
|
-
* @
|
|
115
|
+
* @param {Object} cancellationSignal
|
|
116
|
+
* @returns {Promise}
|
|
108
117
|
*/
|
|
109
|
-
AudioVideoSegmentBuffer.prototype.pushChunk = function (infos) {
|
|
118
|
+
AudioVideoSegmentBuffer.prototype.pushChunk = function (infos, cancellationSignal) {
|
|
110
119
|
assertPushedDataIsBufferSource(infos);
|
|
111
120
|
log.debug("AVSB: receiving order to push data to the SourceBuffer", this.bufferType, getLoggableSegmentId(infos.inventoryInfos));
|
|
112
121
|
return this._addToQueue({ type: SegmentBufferOperation.Push,
|
|
113
|
-
value: infos });
|
|
122
|
+
value: infos }, cancellationSignal);
|
|
114
123
|
};
|
|
115
124
|
/**
|
|
116
125
|
* Remove buffered data (added to the same FIFO queue than `pushChunk`).
|
|
117
126
|
* @param {number} start - start position, in seconds
|
|
118
127
|
* @param {number} end - end position, in seconds
|
|
119
|
-
* @
|
|
128
|
+
* @param {Object} cancellationSignal
|
|
129
|
+
* @returns {Promise}
|
|
120
130
|
*/
|
|
121
|
-
AudioVideoSegmentBuffer.prototype.removeBuffer = function (start, end) {
|
|
131
|
+
AudioVideoSegmentBuffer.prototype.removeBuffer = function (start, end, cancellationSignal) {
|
|
122
132
|
log.debug("AVSB: receiving order to remove data from the SourceBuffer", this.bufferType, start, end);
|
|
123
133
|
return this._addToQueue({ type: SegmentBufferOperation.Remove,
|
|
124
|
-
value: { start: start, end: end } });
|
|
134
|
+
value: { start: start, end: end } }, cancellationSignal);
|
|
125
135
|
};
|
|
126
136
|
/**
|
|
127
137
|
* Indicate that every chunks from a Segment has been given to pushChunk so
|
|
128
138
|
* far.
|
|
129
139
|
* This will update our internal Segment inventory accordingly.
|
|
130
|
-
* The returned
|
|
131
|
-
*
|
|
140
|
+
* The returned Promise will resolve once the whole segment has been pushed
|
|
141
|
+
* and this indication is acknowledged.
|
|
132
142
|
* @param {Object} infos
|
|
133
|
-
* @returns {
|
|
143
|
+
* @returns {Promise}
|
|
134
144
|
*/
|
|
135
|
-
AudioVideoSegmentBuffer.prototype.endOfSegment = function (infos) {
|
|
145
|
+
AudioVideoSegmentBuffer.prototype.endOfSegment = function (infos, cancellationSignal) {
|
|
136
146
|
log.debug("AVSB: receiving order for validating end of segment", this.bufferType, getLoggableSegmentId(infos));
|
|
137
147
|
return this._addToQueue({ type: SegmentBufferOperation.EndOfSegment,
|
|
138
|
-
value: infos });
|
|
148
|
+
value: infos }, cancellationSignal);
|
|
139
149
|
};
|
|
140
150
|
/**
|
|
141
151
|
* Returns the currently buffered data, in a TimeRanges object.
|
|
@@ -175,16 +185,15 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
175
185
|
* @private
|
|
176
186
|
*/
|
|
177
187
|
AudioVideoSegmentBuffer.prototype.dispose = function () {
|
|
178
|
-
this.
|
|
179
|
-
this._destroy$.complete();
|
|
188
|
+
this._canceller.cancel();
|
|
180
189
|
if (this._pendingTask !== null) {
|
|
181
|
-
this._pendingTask.
|
|
190
|
+
this._pendingTask.reject(new CancellationError());
|
|
182
191
|
this._pendingTask = null;
|
|
183
192
|
}
|
|
184
193
|
while (this._queue.length > 0) {
|
|
185
194
|
var nextElement = this._queue.shift();
|
|
186
195
|
if (nextElement !== undefined) {
|
|
187
|
-
nextElement.
|
|
196
|
+
nextElement.reject(new CancellationError());
|
|
188
197
|
}
|
|
189
198
|
}
|
|
190
199
|
if (this._mediaSource.readyState === "open") {
|
|
@@ -198,7 +207,7 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
198
207
|
};
|
|
199
208
|
/**
|
|
200
209
|
* Called when an error arised that made the current task fail.
|
|
201
|
-
* @param {Event}
|
|
210
|
+
* @param {Event} err
|
|
202
211
|
*/
|
|
203
212
|
AudioVideoSegmentBuffer.prototype._onPendingTaskError = function (err) {
|
|
204
213
|
this._lastInitSegment = null; // initialize init segment as a security
|
|
@@ -207,7 +216,7 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
207
216
|
err :
|
|
208
217
|
new Error("An unknown error occured when doing operations " +
|
|
209
218
|
"on the SourceBuffer");
|
|
210
|
-
this._pendingTask.
|
|
219
|
+
this._pendingTask.reject(error);
|
|
211
220
|
}
|
|
212
221
|
};
|
|
213
222
|
/**
|
|
@@ -218,22 +227,20 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
218
227
|
* Cancel queued operation on unsubscription.
|
|
219
228
|
* @private
|
|
220
229
|
* @param {Object} operation
|
|
221
|
-
* @
|
|
230
|
+
* @param {Object} cancellationSignal
|
|
231
|
+
* @returns {Promise}
|
|
222
232
|
*/
|
|
223
|
-
AudioVideoSegmentBuffer.prototype._addToQueue = function (operation) {
|
|
233
|
+
AudioVideoSegmentBuffer.prototype._addToQueue = function (operation, cancellationSignal) {
|
|
224
234
|
var _this = this;
|
|
225
|
-
return new
|
|
235
|
+
return new Promise(function (resolve, reject) {
|
|
236
|
+
if (cancellationSignal.cancellationError !== null) {
|
|
237
|
+
return reject(cancellationSignal.cancellationError);
|
|
238
|
+
}
|
|
226
239
|
var shouldRestartQueue = _this._queue.length === 0 &&
|
|
227
240
|
_this._pendingTask === null;
|
|
228
|
-
var
|
|
229
|
-
var queueItem = objectAssign({ subject: subject }, operation);
|
|
241
|
+
var queueItem = objectAssign({ resolve: resolve, reject: reject }, operation);
|
|
230
242
|
_this._queue.push(queueItem);
|
|
231
|
-
|
|
232
|
-
if (shouldRestartQueue) {
|
|
233
|
-
_this._flush();
|
|
234
|
-
}
|
|
235
|
-
return function () {
|
|
236
|
-
subscription.unsubscribe();
|
|
243
|
+
cancellationSignal.register(function (error) {
|
|
237
244
|
// Remove the corresponding element from the AudioVideoSegmentBuffer's
|
|
238
245
|
// queue.
|
|
239
246
|
// If the operation was a pending task, it should still continue to not
|
|
@@ -242,7 +249,13 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
242
249
|
if (index >= 0) {
|
|
243
250
|
_this._queue.splice(index, 1);
|
|
244
251
|
}
|
|
245
|
-
|
|
252
|
+
queueItem.resolve = noop;
|
|
253
|
+
queueItem.reject = noop;
|
|
254
|
+
reject(error);
|
|
255
|
+
});
|
|
256
|
+
if (shouldRestartQueue) {
|
|
257
|
+
_this._flush();
|
|
258
|
+
}
|
|
246
259
|
});
|
|
247
260
|
};
|
|
248
261
|
/**
|
|
@@ -272,10 +285,9 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
272
285
|
default:
|
|
273
286
|
assertUnreachable(task);
|
|
274
287
|
}
|
|
275
|
-
var
|
|
288
|
+
var resolve = task.resolve;
|
|
276
289
|
this._pendingTask = null;
|
|
277
|
-
|
|
278
|
-
subject.complete();
|
|
290
|
+
resolve();
|
|
279
291
|
this._flush(); // Go to next item in queue
|
|
280
292
|
return;
|
|
281
293
|
}
|
|
@@ -301,7 +313,7 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
301
313
|
e :
|
|
302
314
|
new Error("An unknown error occured when preparing a push operation");
|
|
303
315
|
this._lastInitSegment = null; // initialize init segment as a security
|
|
304
|
-
nextItem.
|
|
316
|
+
nextItem.reject(error);
|
|
305
317
|
return;
|
|
306
318
|
}
|
|
307
319
|
this._pendingTask = objectAssign({ data: dataToPush,
|
|
@@ -345,7 +357,7 @@ var AudioVideoSegmentBuffer = /** @class */ (function (_super) {
|
|
|
345
357
|
*
|
|
346
358
|
* This method allows to "prepare" that push operation so that all is left is
|
|
347
359
|
* to push the returned segment data one after the other (from first to last).
|
|
348
|
-
* @param {Object}
|
|
360
|
+
* @param {Object} data
|
|
349
361
|
* @returns {Object}
|
|
350
362
|
*/
|
|
351
363
|
AudioVideoSegmentBuffer.prototype._preparePushOperation = function (data) {
|
package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Observable } from "rxjs";
|
|
17
16
|
import { IBifThumbnail } from "../../../../parsers/images/bif";
|
|
18
17
|
import { IEndOfSegmentInfos, IPushChunkInfos, SegmentBuffer } from "../types";
|
|
19
18
|
import ManualTimeRanges from "../utils/manual_time_ranges";
|
|
@@ -27,13 +26,15 @@ export default class ImageSegmentBuffer extends SegmentBuffer {
|
|
|
27
26
|
constructor();
|
|
28
27
|
/**
|
|
29
28
|
* @param {Object} data
|
|
29
|
+
* @returns {Promise}
|
|
30
30
|
*/
|
|
31
|
-
pushChunk(infos: IPushChunkInfos<unknown>):
|
|
31
|
+
pushChunk(infos: IPushChunkInfos<unknown>): Promise<void>;
|
|
32
32
|
/**
|
|
33
33
|
* @param {Number} from
|
|
34
34
|
* @param {Number} to
|
|
35
|
+
* @returns {Promise}
|
|
35
36
|
*/
|
|
36
|
-
removeBuffer(start: number, end: number):
|
|
37
|
+
removeBuffer(start: number, end: number): Promise<void>;
|
|
37
38
|
/**
|
|
38
39
|
* Indicate that every chunks from a Segment has been given to pushChunk so
|
|
39
40
|
* far.
|
|
@@ -41,9 +42,9 @@ export default class ImageSegmentBuffer extends SegmentBuffer {
|
|
|
41
42
|
* The returned Observable will emit and complete successively once the whole
|
|
42
43
|
* segment has been pushed and this indication is acknowledged.
|
|
43
44
|
* @param {Object} infos
|
|
44
|
-
* @returns {
|
|
45
|
+
* @returns {Promise}
|
|
45
46
|
*/
|
|
46
|
-
endOfSegment(_infos: IEndOfSegmentInfos):
|
|
47
|
+
endOfSegment(_infos: IEndOfSegmentInfos): Promise<void>;
|
|
47
48
|
/**
|
|
48
49
|
* Returns the currently buffered data, in a TimeRanges object.
|
|
49
50
|
* @returns {TimeRanges}
|
package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js
CHANGED
|
@@ -28,7 +28,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
28
28
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
|
-
import { defer as observableDefer, of as observableOf, } from "rxjs";
|
|
32
31
|
import log from "../../../../log";
|
|
33
32
|
import { SegmentBuffer, } from "../types";
|
|
34
33
|
import ManualTimeRanges from "../utils/manual_time_ranges";
|
|
@@ -48,48 +47,50 @@ var ImageSegmentBuffer = /** @class */ (function (_super) {
|
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* @param {Object} data
|
|
50
|
+
* @returns {Promise}
|
|
51
51
|
*/
|
|
52
52
|
ImageSegmentBuffer.prototype.pushChunk = function (infos) {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_this._buffered.insert(startTime, endTime);
|
|
53
|
+
var _a, _b;
|
|
54
|
+
log.debug("ISB: appending new data.");
|
|
55
|
+
if (infos.data.chunk === null) {
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
}
|
|
58
|
+
var _c = infos.data, appendWindow = _c.appendWindow, chunk = _c.chunk;
|
|
59
|
+
// The following check is ugly. I don't care, the image buffer is there
|
|
60
|
+
// due to an ugly deprecated API that will soon disappear
|
|
61
|
+
var _d = chunk, start = _d.start, end = _d.end, timescale = _d.timescale;
|
|
62
|
+
var appendWindowStart = (_a = appendWindow[0]) !== null && _a !== void 0 ? _a : 0;
|
|
63
|
+
var appendWindowEnd = (_b = appendWindow[1]) !== null && _b !== void 0 ? _b : Infinity;
|
|
64
|
+
var timescaledStart = start / timescale;
|
|
65
|
+
var timescaledEnd = end / timescale;
|
|
66
|
+
var startTime = Math.max(appendWindowStart, timescaledStart);
|
|
67
|
+
var endTime = Math.min(appendWindowEnd, timescaledEnd);
|
|
68
|
+
try {
|
|
69
|
+
this._buffered.insert(startTime, endTime);
|
|
71
70
|
if (infos.inventoryInfos !== null) {
|
|
72
|
-
|
|
71
|
+
this._segmentInventory.insertChunk(infos.inventoryInfos);
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
return Promise.reject(err);
|
|
76
|
+
}
|
|
77
|
+
return Promise.resolve();
|
|
76
78
|
};
|
|
77
79
|
/**
|
|
78
80
|
* @param {Number} from
|
|
79
81
|
* @param {Number} to
|
|
82
|
+
* @returns {Promise}
|
|
80
83
|
*/
|
|
81
84
|
ImageSegmentBuffer.prototype.removeBuffer = function (start, end) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return observableOf(undefined);
|
|
92
|
-
});
|
|
85
|
+
log.info("ISB: ignored image data remove order", start, end);
|
|
86
|
+
// Logic removed as it caused more problems than it resolved:
|
|
87
|
+
// Image thumbnails are always downloaded as a single BIF file, meaning that
|
|
88
|
+
// any removing might necessitate to re-load the whole file in the future
|
|
89
|
+
// which seems pointless.
|
|
90
|
+
// In any case, image handling through the regular RxPlayer APIs has been
|
|
91
|
+
// completely deprecated now for several reasons, and should disappear in
|
|
92
|
+
// the next major version.
|
|
93
|
+
return Promise.resolve();
|
|
93
94
|
};
|
|
94
95
|
/**
|
|
95
96
|
* Indicate that every chunks from a Segment has been given to pushChunk so
|
|
@@ -98,14 +99,11 @@ var ImageSegmentBuffer = /** @class */ (function (_super) {
|
|
|
98
99
|
* The returned Observable will emit and complete successively once the whole
|
|
99
100
|
* segment has been pushed and this indication is acknowledged.
|
|
100
101
|
* @param {Object} infos
|
|
101
|
-
* @returns {
|
|
102
|
+
* @returns {Promise}
|
|
102
103
|
*/
|
|
103
104
|
ImageSegmentBuffer.prototype.endOfSegment = function (_infos) {
|
|
104
|
-
|
|
105
|
-
return
|
|
106
|
-
_this._segmentInventory.completeSegment(_infos, _this._buffered);
|
|
107
|
-
return observableOf(undefined);
|
|
108
|
-
});
|
|
105
|
+
this._segmentInventory.completeSegment(_infos, this._buffered);
|
|
106
|
+
return Promise.resolve();
|
|
109
107
|
};
|
|
110
108
|
/**
|
|
111
109
|
* Returns the currently buffered data, in a TimeRanges object.
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Observable } from "rxjs";
|
|
17
16
|
import { IEndOfSegmentInfos, IPushChunkInfos, SegmentBuffer } from "../../types";
|
|
18
17
|
import ManualTimeRanges from "../../utils/manual_time_ranges";
|
|
19
18
|
/**
|
|
@@ -28,22 +27,18 @@ export default class HTMLTextSegmentBuffer extends SegmentBuffer {
|
|
|
28
27
|
* Used to know when the user is seeking, for example.
|
|
29
28
|
*/
|
|
30
29
|
private readonly _videoElement;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
* unsubscribed.
|
|
34
|
-
* Used for clean-up
|
|
35
|
-
*/
|
|
36
|
-
private readonly _destroy$;
|
|
30
|
+
/** Used for clean-up. */
|
|
31
|
+
private readonly _canceller;
|
|
37
32
|
/** HTMLElement which will contain the cues */
|
|
38
33
|
private readonly _textTrackElement;
|
|
39
34
|
/** Buffer containing the data */
|
|
40
35
|
private readonly _buffer;
|
|
41
36
|
/**
|
|
42
37
|
* We could need us to automatically update styling depending on
|
|
43
|
-
* `_textTrackElement`'s size. This
|
|
38
|
+
* `_textTrackElement`'s size. This TaskCanceller allows to stop that
|
|
44
39
|
* regular check.
|
|
45
40
|
*/
|
|
46
|
-
private
|
|
41
|
+
private _sizeUpdateCanceller;
|
|
47
42
|
/** Information on cues currently displayed. */
|
|
48
43
|
private _currentCues;
|
|
49
44
|
private _buffered;
|
|
@@ -55,26 +50,21 @@ export default class HTMLTextSegmentBuffer extends SegmentBuffer {
|
|
|
55
50
|
/**
|
|
56
51
|
* Push segment on Subscription.
|
|
57
52
|
* @param {Object} infos
|
|
58
|
-
* @returns {
|
|
53
|
+
* @returns {Promise}
|
|
59
54
|
*/
|
|
60
|
-
pushChunk(infos: IPushChunkInfos<unknown>):
|
|
55
|
+
pushChunk(infos: IPushChunkInfos<unknown>): Promise<void>;
|
|
61
56
|
/**
|
|
62
57
|
* Remove buffered data.
|
|
63
58
|
* @param {number} start - start position, in seconds
|
|
64
59
|
* @param {number} end - end position, in seconds
|
|
65
|
-
* @returns {
|
|
60
|
+
* @returns {Promise}
|
|
66
61
|
*/
|
|
67
|
-
removeBuffer(start: number, end: number):
|
|
62
|
+
removeBuffer(start: number, end: number): Promise<void>;
|
|
68
63
|
/**
|
|
69
|
-
* Indicate that every chunks from a Segment has been given to pushChunk so
|
|
70
|
-
* far.
|
|
71
|
-
* This will update our internal Segment inventory accordingly.
|
|
72
|
-
* The returned Observable will emit and complete successively once the whole
|
|
73
|
-
* segment has been pushed and this indication is acknowledged.
|
|
74
64
|
* @param {Object} infos
|
|
75
|
-
* @returns {
|
|
65
|
+
* @returns {Promise}
|
|
76
66
|
*/
|
|
77
|
-
endOfSegment(
|
|
67
|
+
endOfSegment(infos: IEndOfSegmentInfos): Promise<void>;
|
|
78
68
|
/**
|
|
79
69
|
* Returns the currently buffered data, in a TimeRanges object.
|
|
80
70
|
* @returns {TimeRanges}
|
|
@@ -93,7 +83,7 @@ export default class HTMLTextSegmentBuffer extends SegmentBuffer {
|
|
|
93
83
|
*
|
|
94
84
|
* /!\ This method won't add any data to the linked inventory.
|
|
95
85
|
* Please use the `pushChunk` method for most use-cases.
|
|
96
|
-
* @param {Object}
|
|
86
|
+
* @param {Object} infos
|
|
97
87
|
* @returns {boolean}
|
|
98
88
|
*/
|
|
99
89
|
pushChunkSync(infos: IPushChunkInfos<unknown>): void;
|
|
@@ -109,9 +99,20 @@ export default class HTMLTextSegmentBuffer extends SegmentBuffer {
|
|
|
109
99
|
private _disableCurrentCues;
|
|
110
100
|
/**
|
|
111
101
|
* Display a new Cue. If one was already present, it will be replaced.
|
|
112
|
-
* @param {HTMLElement}
|
|
102
|
+
* @param {HTMLElement} elements
|
|
113
103
|
*/
|
|
114
104
|
private _displayCues;
|
|
105
|
+
/**
|
|
106
|
+
* Auto-refresh the display of subtitles according to the media element's
|
|
107
|
+
* position and events.
|
|
108
|
+
* @param {Object} cancellationSignal
|
|
109
|
+
*/
|
|
110
|
+
private autoRefreshSubtitles;
|
|
111
|
+
/**
|
|
112
|
+
* Refresh current subtitles according to the current media element's
|
|
113
|
+
* position.
|
|
114
|
+
*/
|
|
115
|
+
private refreshSubtitles;
|
|
115
116
|
}
|
|
116
117
|
/** Data of chunks that should be pushed to the NativeTextSegmentBuffer. */
|
|
117
118
|
export interface INativeTextTracksBufferSegmentData {
|