hls.js 1.5.12-0.canary.10397 → 1.5.12-0.canary.10399
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 +21 -11
- package/dist/hls.js.d.ts +2 -1
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +21 -11
- 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 +21 -11
- 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 +21 -11
- 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 +15 -8
- package/src/controller/latency-controller.ts +8 -0
- package/src/hls.ts +4 -0
package/dist/hls.light.js
CHANGED
@@ -493,7 +493,7 @@
|
|
493
493
|
// Some browsers don't allow to use bind on console object anyway
|
494
494
|
// fallback to default if needed
|
495
495
|
try {
|
496
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.
|
496
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10399");
|
497
497
|
} catch (e) {
|
498
498
|
/* log fn threw an exception. All logger methods are no-ops. */
|
499
499
|
return createLogger();
|
@@ -4751,6 +4751,7 @@
|
|
4751
4751
|
this.currentTime = 0;
|
4752
4752
|
this.stallCount = 0;
|
4753
4753
|
this._latency = null;
|
4754
|
+
this._targetLatencyUpdated = false;
|
4754
4755
|
this.onTimeupdate = function () {
|
4755
4756
|
var media = _this.media,
|
4756
4757
|
levelDetails = _this.levelDetails;
|
@@ -4895,11 +4896,16 @@
|
|
4895
4896
|
lowLatencyMode = _this$config2.lowLatencyMode;
|
4896
4897
|
var userConfig = this.hls.userConfig;
|
4897
4898
|
var targetLatency = lowLatencyMode ? partHoldBack || holdBack : holdBack;
|
4898
|
-
if (userConfig.liveSyncDuration || userConfig.liveSyncDurationCount || targetLatency === 0) {
|
4899
|
+
if (this._targetLatencyUpdated || userConfig.liveSyncDuration || userConfig.liveSyncDurationCount || targetLatency === 0) {
|
4899
4900
|
targetLatency = liveSyncDuration !== undefined ? liveSyncDuration : liveSyncDurationCount * targetduration;
|
4900
4901
|
}
|
4901
4902
|
var maxLiveSyncOnStallIncrease = targetduration;
|
4902
4903
|
return targetLatency + Math.min(this.stallCount * this.config.liveSyncOnStallIncrease, maxLiveSyncOnStallIncrease);
|
4904
|
+
},
|
4905
|
+
set: function set(latency) {
|
4906
|
+
this.stallCount = 0;
|
4907
|
+
this.config.liveSyncDuration = latency;
|
4908
|
+
this._targetLatencyUpdated = true;
|
4903
4909
|
}
|
4904
4910
|
}, {
|
4905
4911
|
key: "liveSyncPosition",
|
@@ -13080,7 +13086,7 @@
|
|
13080
13086
|
// If backtracking, always remove from the tracker without reducing max buffer length
|
13081
13087
|
var backtrackFragment = this.backtrackFragment;
|
13082
13088
|
var backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
|
13083
|
-
if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
|
13089
|
+
if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength, frag.duration)) {
|
13084
13090
|
fragmentTracker.removeFragment(frag);
|
13085
13091
|
}
|
13086
13092
|
} else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
|
@@ -13578,10 +13584,10 @@
|
|
13578
13584
|
}
|
13579
13585
|
return Math.min(maxBufLen, config.maxMaxBufferLength);
|
13580
13586
|
};
|
13581
|
-
_proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold) {
|
13587
|
+
_proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold, fragDuration) {
|
13582
13588
|
var config = this.config;
|
13583
|
-
var minLength = threshold
|
13584
|
-
var reducedLength = config.maxMaxBufferLength / 2;
|
13589
|
+
var minLength = Math.max(Math.min(threshold, config.maxBufferLength), fragDuration);
|
13590
|
+
var reducedLength = Math.max(threshold - fragDuration * 3, config.maxMaxBufferLength / 2);
|
13585
13591
|
if (reducedLength >= minLength) {
|
13586
13592
|
// reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
|
13587
13593
|
config.maxMaxBufferLength = reducedLength;
|
@@ -13956,13 +13962,14 @@
|
|
13956
13962
|
_proto.reduceLengthAndFlushBuffer = function reduceLengthAndFlushBuffer(data) {
|
13957
13963
|
// if in appending state
|
13958
13964
|
if (this.state === State.PARSING || this.state === State.PARSED) {
|
13965
|
+
var frag = data.frag;
|
13959
13966
|
var playlistType = data.parent;
|
13960
13967
|
var bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
|
13961
13968
|
// 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end
|
13962
13969
|
// reduce max buf len if current position is buffered
|
13963
13970
|
var buffered = bufferedInfo && bufferedInfo.len > 0.5;
|
13964
13971
|
if (buffered) {
|
13965
|
-
this.reduceMaxBufferLength(bufferedInfo.len);
|
13972
|
+
this.reduceMaxBufferLength(bufferedInfo.len, (frag == null ? void 0 : frag.duration) || 10);
|
13966
13973
|
}
|
13967
13974
|
var flushBuffer = !buffered;
|
13968
13975
|
if (flushBuffer) {
|
@@ -13971,9 +13978,9 @@
|
|
13971
13978
|
// in that case flush the whole audio buffer to recover
|
13972
13979
|
this.warn("Buffer full error while media.currentTime is not buffered, flush " + playlistType + " buffer");
|
13973
13980
|
}
|
13974
|
-
if (
|
13975
|
-
this.fragmentTracker.removeFragment(
|
13976
|
-
this.nextLoadPosition =
|
13981
|
+
if (frag) {
|
13982
|
+
this.fragmentTracker.removeFragment(frag);
|
13983
|
+
this.nextLoadPosition = frag.start;
|
13977
13984
|
}
|
13978
13985
|
this.resetLoadingState();
|
13979
13986
|
return flushBuffer;
|
@@ -21952,6 +21959,9 @@
|
|
21952
21959
|
key: "targetLatency",
|
21953
21960
|
get: function get() {
|
21954
21961
|
return this.latencyController.targetLatency;
|
21962
|
+
},
|
21963
|
+
set: function set(latency) {
|
21964
|
+
this.latencyController.targetLatency = latency;
|
21955
21965
|
}
|
21956
21966
|
|
21957
21967
|
/**
|
@@ -21990,7 +22000,7 @@
|
|
21990
22000
|
* Get the video-dev/hls.js package version.
|
21991
22001
|
*/
|
21992
22002
|
function get() {
|
21993
|
-
return "1.5.12-0.canary.
|
22003
|
+
return "1.5.12-0.canary.10399";
|
21994
22004
|
}
|
21995
22005
|
}, {
|
21996
22006
|
key: "Events",
|