hls.js 1.5.6-0.canary.9999 → 1.5.7-0.canary.10014
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 +29 -20
- package/dist/hls.js.d.ts +1 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +26 -20
- 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 +26 -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 +29 -22
- 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 +4 -4
- package/src/controller/abr-controller.ts +20 -10
- package/src/controller/stream-controller.ts +3 -3
- package/src/utils/mp4-tools.ts +6 -4
package/dist/hls.light.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.
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.7-0.canary.10014"}`);
|
516
516
|
} catch (e) {
|
517
517
|
/* log fn threw an exception. All logger methods are no-ops. */
|
518
518
|
return createLogger();
|
@@ -1505,11 +1505,13 @@ function parseSegmentIndex(sidx) {
|
|
1505
1505
|
let earliestPresentationTime = 0;
|
1506
1506
|
let firstOffset = 0;
|
1507
1507
|
if (version === 0) {
|
1508
|
-
earliestPresentationTime = readUint32(sidx, index
|
1509
|
-
firstOffset = readUint32(sidx, index
|
1508
|
+
earliestPresentationTime = readUint32(sidx, index);
|
1509
|
+
firstOffset = readUint32(sidx, index + 4);
|
1510
|
+
index += 8;
|
1510
1511
|
} else {
|
1511
|
-
earliestPresentationTime = readUint64(sidx, index
|
1512
|
-
firstOffset = readUint64(sidx, index
|
1512
|
+
earliestPresentationTime = readUint64(sidx, index);
|
1513
|
+
firstOffset = readUint64(sidx, index + 8);
|
1514
|
+
index += 16;
|
1513
1515
|
}
|
1514
1516
|
|
1515
1517
|
// skip reserved
|
@@ -6583,8 +6585,7 @@ class AbrController extends Logger {
|
|
6583
6585
|
return nextABRAutoLevel;
|
6584
6586
|
}
|
6585
6587
|
getAutoLevelKey() {
|
6586
|
-
|
6587
|
-
return `${this.getBwEstimate()}_${(_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len}`;
|
6588
|
+
return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`;
|
6588
6589
|
}
|
6589
6590
|
getNextABRAutoLevel() {
|
6590
6591
|
const {
|
@@ -6595,18 +6596,12 @@ class AbrController extends Logger {
|
|
6595
6596
|
const {
|
6596
6597
|
maxAutoLevel,
|
6597
6598
|
config,
|
6598
|
-
minAutoLevel
|
6599
|
-
media
|
6599
|
+
minAutoLevel
|
6600
6600
|
} = hls;
|
6601
6601
|
const currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
|
6602
|
-
|
6603
|
-
// playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
|
6604
|
-
// if we're playing back at the normal rate.
|
6605
|
-
const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
|
6606
6602
|
const avgbw = this.getBwEstimate();
|
6607
6603
|
// bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
|
6608
|
-
const
|
6609
|
-
const bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
6604
|
+
const bufferStarvationDelay = this.getStarvationDelay();
|
6610
6605
|
let bwFactor = config.abrBandWidthFactor;
|
6611
6606
|
let bwUpFactor = config.abrBandWidthUpFactor;
|
6612
6607
|
|
@@ -6649,6 +6644,18 @@ class AbrController extends Logger {
|
|
6649
6644
|
// or if bitrate is not lower, continue to use loadLevel
|
6650
6645
|
return hls.loadLevel;
|
6651
6646
|
}
|
6647
|
+
getStarvationDelay() {
|
6648
|
+
const hls = this.hls;
|
6649
|
+
const media = hls.media;
|
6650
|
+
if (!media) {
|
6651
|
+
return Infinity;
|
6652
|
+
}
|
6653
|
+
// playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
|
6654
|
+
// if we're playing back at the normal rate.
|
6655
|
+
const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
|
6656
|
+
const bufferInfo = hls.mainForwardBufferInfo;
|
6657
|
+
return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
6658
|
+
}
|
6652
6659
|
getBwEstimate() {
|
6653
6660
|
return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
|
6654
6661
|
}
|
@@ -19015,15 +19022,11 @@ class StreamController extends BaseStreamController {
|
|
19015
19022
|
levels,
|
19016
19023
|
media
|
19017
19024
|
} = this;
|
19018
|
-
const {
|
19019
|
-
config,
|
19020
|
-
nextLoadLevel: level
|
19021
|
-
} = hls;
|
19022
19025
|
|
19023
19026
|
// if start level not parsed yet OR
|
19024
19027
|
// if video not attached AND start fragment already requested OR start frag prefetch not enabled
|
19025
19028
|
// exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
|
19026
|
-
if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {
|
19029
|
+
if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
|
19027
19030
|
return;
|
19028
19031
|
}
|
19029
19032
|
|
@@ -19031,7 +19034,8 @@ class StreamController extends BaseStreamController {
|
|
19031
19034
|
if (this.altAudio && this.audioOnly) {
|
19032
19035
|
return;
|
19033
19036
|
}
|
19034
|
-
|
19037
|
+
const level = hls.nextLoadLevel;
|
19038
|
+
if (!(levels != null && levels[level])) {
|
19035
19039
|
return;
|
19036
19040
|
}
|
19037
19041
|
const levelInfo = levels[level];
|
@@ -19991,7 +19995,7 @@ class Hls {
|
|
19991
19995
|
* Get the video-dev/hls.js package version.
|
19992
19996
|
*/
|
19993
19997
|
static get version() {
|
19994
|
-
return "1.5.
|
19998
|
+
return "1.5.7-0.canary.10014";
|
19995
19999
|
}
|
19996
20000
|
|
19997
20001
|
/**
|