hls.js 1.5.5-0.canary.9985 → 1.5.5-0.canary.9987
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 +64 -7
- package/dist/hls.js.d.ts +2 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +63 -6
- 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 +63 -6
- 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 +64 -7
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/base-stream-controller.ts +93 -4
- package/src/controller/subtitle-stream-controller.ts +1 -1
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.5-0.canary.
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.5-0.canary.9987"}`);
|
516
516
|
} catch (e) {
|
517
517
|
/* log fn threw an exception. All logger methods are no-ops. */
|
518
518
|
return createLogger();
|
@@ -11966,6 +11966,7 @@ class BaseStreamController extends TaskLoop {
|
|
11966
11966
|
this.decrypter = void 0;
|
11967
11967
|
this.initPTS = [];
|
11968
11968
|
this.buffering = true;
|
11969
|
+
this.loadingParts = false;
|
11969
11970
|
this.onMediaSeeking = () => {
|
11970
11971
|
const {
|
11971
11972
|
config,
|
@@ -12002,6 +12003,14 @@ class BaseStreamController extends TaskLoop {
|
|
12002
12003
|
// Remove gap fragments
|
12003
12004
|
this.fragmentTracker.removeFragmentsInRange(currentTime, Infinity, this.playlistType, true);
|
12004
12005
|
this.lastCurrentTime = currentTime;
|
12006
|
+
if (!this.loadingParts) {
|
12007
|
+
const bufferEnd = Math.max(bufferInfo.end, currentTime);
|
12008
|
+
const shouldLoadParts = this.shouldLoadParts(this.getLevelDetails(), bufferEnd);
|
12009
|
+
if (shouldLoadParts) {
|
12010
|
+
this.log(`LL-Part loading ON after seeking to ${currentTime.toFixed(2)} with buffer @${bufferEnd.toFixed(2)}`);
|
12011
|
+
this.loadingParts = shouldLoadParts;
|
12012
|
+
}
|
12013
|
+
}
|
12005
12014
|
}
|
12006
12015
|
|
12007
12016
|
// in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target
|
@@ -12412,8 +12421,16 @@ class BaseStreamController extends TaskLoop {
|
|
12412
12421
|
} else if (!frag.encrypted && details.encryptedFragments.length) {
|
12413
12422
|
this.keyLoader.loadClear(frag, details.encryptedFragments);
|
12414
12423
|
}
|
12424
|
+
const fragPrevious = this.fragPrevious;
|
12425
|
+
if (frag.sn !== 'initSegment' && (!fragPrevious || frag.sn !== fragPrevious.sn)) {
|
12426
|
+
const shouldLoadParts = this.shouldLoadParts(level.details, frag.end);
|
12427
|
+
if (shouldLoadParts !== this.loadingParts) {
|
12428
|
+
this.log(`LL-Part loading ${shouldLoadParts ? 'ON' : 'OFF'} loading sn ${fragPrevious == null ? void 0 : fragPrevious.sn}->${frag.sn}`);
|
12429
|
+
this.loadingParts = shouldLoadParts;
|
12430
|
+
}
|
12431
|
+
}
|
12415
12432
|
targetBufferTime = Math.max(frag.start, targetBufferTime || 0);
|
12416
|
-
if (this.
|
12433
|
+
if (this.loadingParts && frag.sn !== 'initSegment') {
|
12417
12434
|
const partList = details.partList;
|
12418
12435
|
if (partList && progressCallback) {
|
12419
12436
|
if (targetBufferTime > frag.end && details.fragmentHint) {
|
@@ -12451,6 +12468,13 @@ class BaseStreamController extends TaskLoop {
|
|
12451
12468
|
}
|
12452
12469
|
}
|
12453
12470
|
}
|
12471
|
+
if (frag.sn !== 'initSegment' && this.loadingParts) {
|
12472
|
+
this.log(`LL-Part loading OFF after next part miss @${targetBufferTime.toFixed(2)}`);
|
12473
|
+
this.loadingParts = false;
|
12474
|
+
} else if (!frag.url) {
|
12475
|
+
// Selected fragment hint for part but not loading parts
|
12476
|
+
return Promise.resolve(null);
|
12477
|
+
}
|
12454
12478
|
this.log(`Loading fragment ${frag.sn} cc: ${frag.cc} ${details ? 'of [' + details.startSN + '-' + details.endSN + '] ' : ''}${this.playlistType === PlaylistLevelType.MAIN ? 'level' : 'track'}: ${frag.level}, target: ${parseFloat(targetBufferTime.toFixed(3))}`);
|
12455
12479
|
// Don't update nextLoadPosition for fragments which are not buffered
|
12456
12480
|
if (isFiniteNumber(frag.sn) && !this.bitrateTest) {
|
@@ -12549,8 +12573,36 @@ class BaseStreamController extends TaskLoop {
|
|
12549
12573
|
if (part) {
|
12550
12574
|
part.stats.parsing.end = now;
|
12551
12575
|
}
|
12576
|
+
// See if part loading should be disabled/enabled based on buffer and playback position.
|
12577
|
+
if (frag.sn !== 'initSegment') {
|
12578
|
+
const levelDetails = this.getLevelDetails();
|
12579
|
+
const loadingPartsAtEdge = levelDetails && frag.sn > levelDetails.endSN;
|
12580
|
+
const shouldLoadParts = loadingPartsAtEdge || this.shouldLoadParts(levelDetails, frag.end);
|
12581
|
+
if (shouldLoadParts !== this.loadingParts) {
|
12582
|
+
this.log(`LL-Part loading ${shouldLoadParts ? 'ON' : 'OFF'} after parsing segment ending @${frag.end.toFixed(2)}`);
|
12583
|
+
this.loadingParts = shouldLoadParts;
|
12584
|
+
}
|
12585
|
+
}
|
12552
12586
|
this.updateLevelTiming(frag, part, level, chunkMeta.partial);
|
12553
12587
|
}
|
12588
|
+
shouldLoadParts(details, bufferEnd) {
|
12589
|
+
if (this.config.lowLatencyMode) {
|
12590
|
+
if (!details) {
|
12591
|
+
return this.loadingParts;
|
12592
|
+
}
|
12593
|
+
if (details != null && details.partList) {
|
12594
|
+
var _details$fragmentHint;
|
12595
|
+
// Buffer must be ahead of first part + duration of parts after last segment
|
12596
|
+
// and playback must be at or past segment adjacent to part list
|
12597
|
+
const firstPart = details.partList[0];
|
12598
|
+
const safePartStart = firstPart.end + (((_details$fragmentHint = details.fragmentHint) == null ? void 0 : _details$fragmentHint.duration) || 0);
|
12599
|
+
if (bufferEnd >= safePartStart && this.lastCurrentTime > firstPart.start - firstPart.fragment.duration) {
|
12600
|
+
return true;
|
12601
|
+
}
|
12602
|
+
}
|
12603
|
+
}
|
12604
|
+
return false;
|
12605
|
+
}
|
12554
12606
|
getCurrentContext(chunkMeta) {
|
12555
12607
|
const {
|
12556
12608
|
levels,
|
@@ -12699,7 +12751,8 @@ class BaseStreamController extends TaskLoop {
|
|
12699
12751
|
config
|
12700
12752
|
} = this;
|
12701
12753
|
const start = fragments[0].start;
|
12702
|
-
|
12754
|
+
const canLoadParts = config.lowLatencyMode && !!levelDetails.partList;
|
12755
|
+
let frag = null;
|
12703
12756
|
if (levelDetails.live) {
|
12704
12757
|
const initialLiveManifestSize = config.initialLiveManifestSize;
|
12705
12758
|
if (fragLen < initialLiveManifestSize) {
|
@@ -12711,6 +12764,10 @@ class BaseStreamController extends TaskLoop {
|
|
12711
12764
|
// Do not load using live logic if the starting frag is requested - we want to use getFragmentAtPosition() so that
|
12712
12765
|
// we get the fragment matching that start time
|
12713
12766
|
if (!levelDetails.PTSKnown && !this.startFragRequested && this.startPosition === -1 || pos < start) {
|
12767
|
+
if (canLoadParts && !this.loadingParts) {
|
12768
|
+
this.log(`LL-Part loading ON for initial live fragment`);
|
12769
|
+
this.loadingParts = true;
|
12770
|
+
}
|
12714
12771
|
frag = this.getInitialLiveFragment(levelDetails, fragments);
|
12715
12772
|
this.startPosition = this.nextLoadPosition = frag ? this.hls.liveSyncPosition || frag.start : pos;
|
12716
12773
|
}
|
@@ -12721,7 +12778,7 @@ class BaseStreamController extends TaskLoop {
|
|
12721
12778
|
|
12722
12779
|
// If we haven't run into any special cases already, just load the fragment most closely matching the requested position
|
12723
12780
|
if (!frag) {
|
12724
|
-
const end =
|
12781
|
+
const end = this.loadingParts ? levelDetails.partEnd : levelDetails.fragmentEnd;
|
12725
12782
|
frag = this.getFragmentAtPosition(pos, end, levelDetails);
|
12726
12783
|
}
|
12727
12784
|
return this.mapToInitFragWhenRequired(frag);
|
@@ -12843,7 +12900,7 @@ class BaseStreamController extends TaskLoop {
|
|
12843
12900
|
} = levelDetails;
|
12844
12901
|
const tolerance = config.maxFragLookUpTolerance;
|
12845
12902
|
const partList = levelDetails.partList;
|
12846
|
-
const loadingParts = !!(
|
12903
|
+
const loadingParts = !!(this.loadingParts && partList != null && partList.length && fragmentHint);
|
12847
12904
|
if (loadingParts && fragmentHint && !this.bitrateTest) {
|
12848
12905
|
// Include incomplete fragment with parts at end
|
12849
12906
|
fragments = fragments.concat(fragmentHint);
|
@@ -19934,7 +19991,7 @@ class Hls {
|
|
19934
19991
|
* Get the video-dev/hls.js package version.
|
19935
19992
|
*/
|
19936
19993
|
static get version() {
|
19937
|
-
return "1.5.5-0.canary.
|
19994
|
+
return "1.5.5-0.canary.9987";
|
19938
19995
|
}
|
19939
19996
|
|
19940
19997
|
/**
|