hls.js 1.5.6-0.canary.10005 → 1.5.6-0.canary.10006
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.js +22 -15
- package/dist/hls.js.d.ts +1 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +19 -15
- 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 +19 -17
- 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 +22 -17
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/abr-controller.ts +20 -10
- package/src/controller/stream-controller.ts +2 -2
package/dist/hls.mjs
CHANGED
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
|
|
512
512
|
// Some browsers don't allow to use bind on console object anyway
|
513
513
|
// fallback to default if needed
|
514
514
|
try {
|
515
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.6-0.canary.
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.6-0.canary.10006"}`);
|
516
516
|
} catch (e) {
|
517
517
|
/* log fn threw an exception. All logger methods are no-ops. */
|
518
518
|
return createLogger();
|
@@ -7280,8 +7280,7 @@ class AbrController extends Logger {
|
|
7280
7280
|
return nextABRAutoLevel;
|
7281
7281
|
}
|
7282
7282
|
getAutoLevelKey() {
|
7283
|
-
|
7284
|
-
return `${this.getBwEstimate()}_${(_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len}`;
|
7283
|
+
return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`;
|
7285
7284
|
}
|
7286
7285
|
getNextABRAutoLevel() {
|
7287
7286
|
const {
|
@@ -7292,18 +7291,12 @@ class AbrController extends Logger {
|
|
7292
7291
|
const {
|
7293
7292
|
maxAutoLevel,
|
7294
7293
|
config,
|
7295
|
-
minAutoLevel
|
7296
|
-
media
|
7294
|
+
minAutoLevel
|
7297
7295
|
} = hls;
|
7298
7296
|
const currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
|
7299
|
-
|
7300
|
-
// playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
|
7301
|
-
// if we're playing back at the normal rate.
|
7302
|
-
const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
|
7303
7297
|
const avgbw = this.getBwEstimate();
|
7304
7298
|
// bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
|
7305
|
-
const
|
7306
|
-
const bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
7299
|
+
const bufferStarvationDelay = this.getStarvationDelay();
|
7307
7300
|
let bwFactor = config.abrBandWidthFactor;
|
7308
7301
|
let bwUpFactor = config.abrBandWidthUpFactor;
|
7309
7302
|
|
@@ -7346,6 +7339,18 @@ class AbrController extends Logger {
|
|
7346
7339
|
// or if bitrate is not lower, continue to use loadLevel
|
7347
7340
|
return hls.loadLevel;
|
7348
7341
|
}
|
7342
|
+
getStarvationDelay() {
|
7343
|
+
const hls = this.hls;
|
7344
|
+
const media = hls.media;
|
7345
|
+
if (!media) {
|
7346
|
+
return Infinity;
|
7347
|
+
}
|
7348
|
+
// playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
|
7349
|
+
// if we're playing back at the normal rate.
|
7350
|
+
const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
|
7351
|
+
const bufferInfo = hls.mainForwardBufferInfo;
|
7352
|
+
return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
7353
|
+
}
|
7349
7354
|
getBwEstimate() {
|
7350
7355
|
return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
|
7351
7356
|
}
|
@@ -7415,6 +7420,9 @@ class AbrController extends Logger {
|
|
7415
7420
|
if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference)) {
|
7416
7421
|
levelInfo.supportedPromise = getMediaDecodingInfoPromise(levelInfo, audioTracksByGroup, mediaCapabilities);
|
7417
7422
|
levelInfo.supportedPromise.then(decodingInfo => {
|
7423
|
+
if (!this.hls) {
|
7424
|
+
return;
|
7425
|
+
}
|
7418
7426
|
levelInfo.supportedResult = decodingInfo;
|
7419
7427
|
const levels = this.hls.levels;
|
7420
7428
|
const index = levels.indexOf(levelInfo);
|
@@ -27618,15 +27626,11 @@ class StreamController extends BaseStreamController {
|
|
27618
27626
|
levels,
|
27619
27627
|
media
|
27620
27628
|
} = this;
|
27621
|
-
const {
|
27622
|
-
config,
|
27623
|
-
nextLoadLevel: level
|
27624
|
-
} = hls;
|
27625
27629
|
|
27626
27630
|
// if start level not parsed yet OR
|
27627
27631
|
// if video not attached AND start fragment already requested OR start frag prefetch not enabled
|
27628
27632
|
// exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
|
27629
|
-
if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {
|
27633
|
+
if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
|
27630
27634
|
return;
|
27631
27635
|
}
|
27632
27636
|
|
@@ -27634,6 +27638,7 @@ class StreamController extends BaseStreamController {
|
|
27634
27638
|
if (this.altAudio && this.audioOnly) {
|
27635
27639
|
return;
|
27636
27640
|
}
|
27641
|
+
const level = hls.nextLoadLevel;
|
27637
27642
|
if (!this.buffering || !(levels != null && levels[level])) {
|
27638
27643
|
return;
|
27639
27644
|
}
|
@@ -28594,7 +28599,7 @@ class Hls {
|
|
28594
28599
|
* Get the video-dev/hls.js package version.
|
28595
28600
|
*/
|
28596
28601
|
static get version() {
|
28597
|
-
return "1.5.6-0.canary.
|
28602
|
+
return "1.5.6-0.canary.10006";
|
28598
28603
|
}
|
28599
28604
|
|
28600
28605
|
/**
|