hls.js 1.6.0-beta.1.0.canary.10826 → 1.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hls.d.mts +2 -0
- package/dist/hls.d.ts +2 -0
- package/dist/hls.js +32 -19
- package/dist/hls.js.d.ts +2 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +26 -18
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +28 -22
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +34 -23
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/controller/buffer-controller.ts +21 -14
- package/src/controller/interstitials-controller.ts +7 -1
package/dist/hls.light.mjs
CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
|
|
401
401
|
// Some browsers don't allow to use bind on console object anyway
|
402
402
|
// fallback to default if needed
|
403
403
|
try {
|
404
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.
|
404
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2"}`);
|
405
405
|
} catch (e) {
|
406
406
|
/* log fn threw an exception. All logger methods are no-ops. */
|
407
407
|
return createLogger();
|
@@ -9356,12 +9356,8 @@ class BufferController extends Logger {
|
|
9356
9356
|
const trackNames = transferredTracks ? Object.keys(transferredTracks) : null;
|
9357
9357
|
const trackCount = trackNames ? trackNames.length : 0;
|
9358
9358
|
const mediaSourceOpenCallback = () => {
|
9359
|
-
if (this.media) {
|
9360
|
-
|
9361
|
-
const readyState = (_this$mediaSource2 = this.mediaSource) == null ? void 0 : _this$mediaSource2.readyState;
|
9362
|
-
if (readyState === 'open' || readyState === 'ended') {
|
9363
|
-
this._onMediaSourceOpen();
|
9364
|
-
}
|
9359
|
+
if (this.media && this.mediaSourceOpenOrEnded) {
|
9360
|
+
this._onMediaSourceOpen();
|
9365
9361
|
}
|
9366
9362
|
};
|
9367
9363
|
if (transferredTracks && trackNames && trackCount) {
|
@@ -9423,6 +9419,11 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
9423
9419
|
mediaSourceOpenCallback();
|
9424
9420
|
}
|
9425
9421
|
}
|
9422
|
+
get mediaSourceOpenOrEnded() {
|
9423
|
+
var _this$mediaSource2;
|
9424
|
+
const readyState = (_this$mediaSource2 = this.mediaSource) == null ? void 0 : _this$mediaSource2.readyState;
|
9425
|
+
return readyState === 'open' || readyState === 'ended';
|
9426
|
+
}
|
9426
9427
|
onMediaDetaching(event, data) {
|
9427
9428
|
const transferringMedia = !!data.transferMedia;
|
9428
9429
|
this.transferData = this.overrides = undefined;
|
@@ -9443,18 +9444,23 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
9443
9444
|
});
|
9444
9445
|
this.resetQueue();
|
9445
9446
|
} else {
|
9446
|
-
if (
|
9447
|
+
if (this.mediaSourceOpenOrEnded) {
|
9448
|
+
const open = mediaSource.readyState === 'open';
|
9447
9449
|
try {
|
9448
9450
|
const sourceBuffers = mediaSource.sourceBuffers;
|
9449
9451
|
for (let i = sourceBuffers.length; i--;) {
|
9450
|
-
|
9452
|
+
if (open) {
|
9453
|
+
sourceBuffers[i].abort();
|
9454
|
+
}
|
9451
9455
|
mediaSource.removeSourceBuffer(sourceBuffers[i]);
|
9452
9456
|
}
|
9453
|
-
|
9454
|
-
|
9455
|
-
|
9456
|
-
|
9457
|
-
|
9457
|
+
if (open) {
|
9458
|
+
// endOfStream could trigger exception if any sourcebuffer is in updating state
|
9459
|
+
// we don't really care about checking sourcebuffer state here,
|
9460
|
+
// as we are anyway detaching the MediaSource
|
9461
|
+
// let's just avoid this exception to propagate
|
9462
|
+
mediaSource.endOfStream();
|
9463
|
+
}
|
9458
9464
|
} catch (err) {
|
9459
9465
|
this.warn(`onMediaDetaching: ${err.message} while calling endOfStream`);
|
9460
9466
|
}
|
@@ -9603,7 +9609,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
9603
9609
|
if (this.sourceBufferCount) {
|
9604
9610
|
return;
|
9605
9611
|
}
|
9606
|
-
if (this.
|
9612
|
+
if (this.mediaSourceOpenOrEnded) {
|
9607
9613
|
this.checkPendingTracks();
|
9608
9614
|
}
|
9609
9615
|
}
|
@@ -9806,7 +9812,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
9806
9812
|
});
|
9807
9813
|
},
|
9808
9814
|
onError: error => {
|
9809
|
-
var _this$
|
9815
|
+
var _this$media;
|
9810
9816
|
// in case any error occured while appending, put back segment in segments table
|
9811
9817
|
const event = {
|
9812
9818
|
type: ErrorTypes.MEDIA_ERROR,
|
@@ -9824,7 +9830,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
9824
9830
|
// QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror
|
9825
9831
|
// let's stop appending any segments, and report BUFFER_FULL_ERROR error
|
9826
9832
|
event.details = ErrorDetails.BUFFER_FULL_ERROR;
|
9827
|
-
} else if (error.code === DOMException.INVALID_STATE_ERR &&
|
9833
|
+
} else if (error.code === DOMException.INVALID_STATE_ERR && this.mediaSourceOpenOrEnded && !((_this$media = this.media) != null && _this$media.error)) {
|
9828
9834
|
// Allow retry for "Failed to execute 'appendBuffer' on 'SourceBuffer': This SourceBuffer is still processing" errors
|
9829
9835
|
event.errorAction = createDoNothingErrorAction(true);
|
9830
9836
|
} else if (error.name === TRACK_REMOVED_ERROR_NAME) {
|
@@ -10323,8 +10329,8 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
10323
10329
|
operation.onStart();
|
10324
10330
|
}
|
10325
10331
|
onSBUpdateEnd(type) {
|
10326
|
-
var _this$
|
10327
|
-
if (((_this$
|
10332
|
+
var _this$mediaSource4;
|
10333
|
+
if (((_this$mediaSource4 = this.mediaSource) == null ? void 0 : _this$mediaSource4.readyState) === 'closed') {
|
10328
10334
|
this.resetBuffer(type);
|
10329
10335
|
return;
|
10330
10336
|
}
|
@@ -10336,8 +10342,8 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
|
|
10336
10342
|
this.shiftAndExecuteNext(type);
|
10337
10343
|
}
|
10338
10344
|
onSBUpdateError(type, event) {
|
10339
|
-
var _this$
|
10340
|
-
const error = new Error(`${type} SourceBuffer error. MediaSource readyState: ${(_this$
|
10345
|
+
var _this$mediaSource5;
|
10346
|
+
const error = new Error(`${type} SourceBuffer error. MediaSource readyState: ${(_this$mediaSource5 = this.mediaSource) == null ? void 0 : _this$mediaSource5.readyState}`);
|
10341
10347
|
this.error(`${error}`, event);
|
10342
10348
|
// according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error
|
10343
10349
|
// SourceBuffer errors are not necessarily fatal; if so, the HTMLMediaElement will fire an error event
|
@@ -19166,7 +19172,7 @@ class GapController extends Logger {
|
|
19166
19172
|
}
|
19167
19173
|
}
|
19168
19174
|
|
19169
|
-
const version = "1.6.0-beta.
|
19175
|
+
const version = "1.6.0-beta.2";
|
19170
19176
|
|
19171
19177
|
// ensure the worker ends up in the bundle
|
19172
19178
|
// If the worker should not be included this gets aliased to empty.js
|