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.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();
|
@@ -1663,11 +1663,13 @@ function parseSegmentIndex(sidx) {
|
|
1663
1663
|
let earliestPresentationTime = 0;
|
1664
1664
|
let firstOffset = 0;
|
1665
1665
|
if (version === 0) {
|
1666
|
-
earliestPresentationTime = readUint32(sidx, index
|
1667
|
-
firstOffset = readUint32(sidx, index
|
1666
|
+
earliestPresentationTime = readUint32(sidx, index);
|
1667
|
+
firstOffset = readUint32(sidx, index + 4);
|
1668
|
+
index += 8;
|
1668
1669
|
} else {
|
1669
|
-
earliestPresentationTime = readUint64(sidx, index
|
1670
|
-
firstOffset = readUint64(sidx, index
|
1670
|
+
earliestPresentationTime = readUint64(sidx, index);
|
1671
|
+
firstOffset = readUint64(sidx, index + 8);
|
1672
|
+
index += 16;
|
1671
1673
|
}
|
1672
1674
|
|
1673
1675
|
// skip reserved
|
@@ -7280,8 +7282,7 @@ class AbrController extends Logger {
|
|
7280
7282
|
return nextABRAutoLevel;
|
7281
7283
|
}
|
7282
7284
|
getAutoLevelKey() {
|
7283
|
-
|
7284
|
-
return `${this.getBwEstimate()}_${(_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len}`;
|
7285
|
+
return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`;
|
7285
7286
|
}
|
7286
7287
|
getNextABRAutoLevel() {
|
7287
7288
|
const {
|
@@ -7292,18 +7293,12 @@ class AbrController extends Logger {
|
|
7292
7293
|
const {
|
7293
7294
|
maxAutoLevel,
|
7294
7295
|
config,
|
7295
|
-
minAutoLevel
|
7296
|
-
media
|
7296
|
+
minAutoLevel
|
7297
7297
|
} = hls;
|
7298
7298
|
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
7299
|
const avgbw = this.getBwEstimate();
|
7304
7300
|
// bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
|
7305
|
-
const
|
7306
|
-
const bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
7301
|
+
const bufferStarvationDelay = this.getStarvationDelay();
|
7307
7302
|
let bwFactor = config.abrBandWidthFactor;
|
7308
7303
|
let bwUpFactor = config.abrBandWidthUpFactor;
|
7309
7304
|
|
@@ -7346,6 +7341,18 @@ class AbrController extends Logger {
|
|
7346
7341
|
// or if bitrate is not lower, continue to use loadLevel
|
7347
7342
|
return hls.loadLevel;
|
7348
7343
|
}
|
7344
|
+
getStarvationDelay() {
|
7345
|
+
const hls = this.hls;
|
7346
|
+
const media = hls.media;
|
7347
|
+
if (!media) {
|
7348
|
+
return Infinity;
|
7349
|
+
}
|
7350
|
+
// playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
|
7351
|
+
// if we're playing back at the normal rate.
|
7352
|
+
const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
|
7353
|
+
const bufferInfo = hls.mainForwardBufferInfo;
|
7354
|
+
return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
|
7355
|
+
}
|
7349
7356
|
getBwEstimate() {
|
7350
7357
|
return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
|
7351
7358
|
}
|
@@ -7415,6 +7422,9 @@ class AbrController extends Logger {
|
|
7415
7422
|
if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference)) {
|
7416
7423
|
levelInfo.supportedPromise = getMediaDecodingInfoPromise(levelInfo, audioTracksByGroup, mediaCapabilities);
|
7417
7424
|
levelInfo.supportedPromise.then(decodingInfo => {
|
7425
|
+
if (!this.hls) {
|
7426
|
+
return;
|
7427
|
+
}
|
7418
7428
|
levelInfo.supportedResult = decodingInfo;
|
7419
7429
|
const levels = this.hls.levels;
|
7420
7430
|
const index = levels.indexOf(levelInfo);
|
@@ -27618,15 +27628,11 @@ class StreamController extends BaseStreamController {
|
|
27618
27628
|
levels,
|
27619
27629
|
media
|
27620
27630
|
} = this;
|
27621
|
-
const {
|
27622
|
-
config,
|
27623
|
-
nextLoadLevel: level
|
27624
|
-
} = hls;
|
27625
27631
|
|
27626
27632
|
// if start level not parsed yet OR
|
27627
27633
|
// if video not attached AND start fragment already requested OR start frag prefetch not enabled
|
27628
27634
|
// 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)) {
|
27635
|
+
if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
|
27630
27636
|
return;
|
27631
27637
|
}
|
27632
27638
|
|
@@ -27634,7 +27640,8 @@ class StreamController extends BaseStreamController {
|
|
27634
27640
|
if (this.altAudio && this.audioOnly) {
|
27635
27641
|
return;
|
27636
27642
|
}
|
27637
|
-
|
27643
|
+
const level = hls.nextLoadLevel;
|
27644
|
+
if (!(levels != null && levels[level])) {
|
27638
27645
|
return;
|
27639
27646
|
}
|
27640
27647
|
const levelInfo = levels[level];
|
@@ -28594,7 +28601,7 @@ class Hls {
|
|
28594
28601
|
* Get the video-dev/hls.js package version.
|
28595
28602
|
*/
|
28596
28603
|
static get version() {
|
28597
|
-
return "1.5.
|
28604
|
+
return "1.5.7-0.canary.10014";
|
28598
28605
|
}
|
28599
28606
|
|
28600
28607
|
/**
|