mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update shared components
This commit is contained in:
parent
fb269362ff
commit
71811cb9e3
221 changed files with 32936 additions and 101 deletions
|
@ -196,8 +196,11 @@ class StreamController extends EventHandler {
|
|||
if (levelDetails.live) {
|
||||
// check if requested position is within seekable boundaries :
|
||||
//logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);
|
||||
if (bufferEnd < Math.max(start,end-config.liveMaxLatencyDurationCount*levelDetails.targetduration)) {
|
||||
this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - config.liveSyncDurationCount * levelDetails.targetduration);
|
||||
let maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount*levelDetails.targetduration;
|
||||
|
||||
if (bufferEnd < Math.max(start, end - maxLatency)) {
|
||||
let targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration;
|
||||
this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - targetLatency);
|
||||
logger.log(`buffer end: ${bufferEnd} is located too far from the end of live sliding playlist, media position will be reseted to: ${this.seekAfterBuffered.toFixed(3)}`);
|
||||
bufferEnd = this.seekAfterBuffered;
|
||||
}
|
||||
|
@ -433,7 +436,7 @@ class StreamController extends EventHandler {
|
|||
if ((pos + maxHoleDuration) >= start && pos < end) {
|
||||
// play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length
|
||||
bufferStart = start;
|
||||
bufferEnd = end + maxHoleDuration;
|
||||
bufferEnd = end;
|
||||
bufferLen = bufferEnd - pos;
|
||||
} else if ((pos + maxHoleDuration) < start) {
|
||||
bufferStartNext = start;
|
||||
|
@ -444,11 +447,14 @@ class StreamController extends EventHandler {
|
|||
}
|
||||
|
||||
getBufferRange(position) {
|
||||
var i, range;
|
||||
for (i = this.bufferRange.length - 1; i >=0; i--) {
|
||||
range = this.bufferRange[i];
|
||||
if (position >= range.start && position <= range.end) {
|
||||
return range;
|
||||
var i, range,
|
||||
bufferRange = this.bufferRange;
|
||||
if (bufferRange) {
|
||||
for (i = bufferRange.length - 1; i >=0; i--) {
|
||||
range = bufferRange[i];
|
||||
if (position >= range.start && position <= range.end) {
|
||||
return range;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -770,7 +776,8 @@ class StreamController extends EventHandler {
|
|||
if (this.startFragRequested === false) {
|
||||
// if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)
|
||||
if (newDetails.live) {
|
||||
this.startPosition = Math.max(0, sliding + duration - this.config.liveSyncDurationCount * newDetails.targetduration);
|
||||
let targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration;
|
||||
this.startPosition = Math.max(0, sliding + duration - targetLatency);
|
||||
}
|
||||
this.nextLoadPosition = this.startPosition;
|
||||
}
|
||||
|
@ -1014,7 +1021,7 @@ class StreamController extends EventHandler {
|
|||
logger.warn(`mediaController: ${data.details} while loading frag,switch to ${data.fatal ? 'ERROR' : 'IDLE'} state ...`);
|
||||
this.state = data.fatal ? State.ERROR : State.IDLE;
|
||||
break;
|
||||
case ErrorDetails.BUFFER_FULL:
|
||||
case ErrorDetails.BUFFER_FULL_ERROR:
|
||||
// trigger a smooth level switch to empty buffers
|
||||
// also reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
|
||||
this.config.maxMaxBufferLength/=2;
|
||||
|
@ -1060,7 +1067,7 @@ _checkBuffer() {
|
|||
}
|
||||
var bufferInfo = this.bufferInfo(currentTime,0),
|
||||
expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2),
|
||||
jumpThreshold = 0.2,
|
||||
jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end
|
||||
playheadMoving = currentTime > media.playbackRate*this.lastCurrentTime;
|
||||
|
||||
if (this.stalled && playheadMoving) {
|
||||
|
@ -1083,16 +1090,17 @@ _checkBuffer() {
|
|||
}
|
||||
// if we are below threshold, try to jump if next buffer range is close
|
||||
if(bufferInfo.len <= jumpThreshold) {
|
||||
// no buffer available @ currentTime, check if next buffer is close (more than 5ms diff but within a config.maxSeekHole second range)
|
||||
// no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)
|
||||
var nextBufferStart = bufferInfo.nextStart, delta = nextBufferStart-currentTime;
|
||||
if(nextBufferStart &&
|
||||
(delta < this.config.maxSeekHole) &&
|
||||
(delta > 0.005) &&
|
||||
(delta > 0) &&
|
||||
!media.seeking) {
|
||||
// next buffer is close ! adjust currentTime to nextBufferStart
|
||||
// this will ensure effective video decoding
|
||||
logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart}`);
|
||||
media.currentTime = nextBufferStart;
|
||||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue