mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
c6e1a3e747
commit
62ca7d2ffd
16 changed files with 98 additions and 49 deletions
|
@ -113,7 +113,8 @@ class LevelController extends EventHandler {
|
|||
}
|
||||
|
||||
set level(newLevel) {
|
||||
if (this._level !== newLevel || this._levels[newLevel].details === undefined) {
|
||||
if (this._levels && this._levels.length > newLevel &&
|
||||
(this._level !== newLevel || this._levels[newLevel].details === undefined)) {
|
||||
this.setLevelInternal(newLevel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1018,6 +1018,7 @@ _checkBuffer() {
|
|||
// check buffer upfront
|
||||
// if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving,
|
||||
// and we have a new buffer range available upfront, let's seek to that one
|
||||
let configSeekHoleNudgeDuration = this.config.seekHoleNudgeDuration;
|
||||
if(expectedPlaying && bufferInfo.len <= jumpThreshold) {
|
||||
if(playheadMoving) {
|
||||
// playhead moving
|
||||
|
@ -1031,7 +1032,7 @@ _checkBuffer() {
|
|||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});
|
||||
this.stalled = true;
|
||||
} else {
|
||||
this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;
|
||||
this.seekHoleNudgeDuration += configSeekHoleNudgeDuration;
|
||||
}
|
||||
}
|
||||
// if we are below threshold, try to jump if next buffer range is close
|
||||
|
@ -1050,10 +1051,30 @@ _checkBuffer() {
|
|||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false, hole : hole});
|
||||
}
|
||||
}
|
||||
// in any case reset stalledInBuffered
|
||||
this.stalledInBuffered = 0;
|
||||
} else {
|
||||
if (targetSeekPosition && media.currentTime !== targetSeekPosition) {
|
||||
logger.log(`adjust currentTime from ${media.currentTime} to ${targetSeekPosition}`);
|
||||
media.currentTime = targetSeekPosition;
|
||||
} else if (expectedPlaying && !playheadMoving) {
|
||||
// if we are in this condition, it means that currentTime is in a buffered area, but playhead is not moving
|
||||
// if that happens, we wait for a couple of cycle (config.stalledInBufferedNudgeThreshold), then we nudge
|
||||
// media.currentTime to try to recover that situation.
|
||||
if (this.stalledInBuffered !== undefined) {
|
||||
this.stalledInBuffered++;
|
||||
} else {
|
||||
this.stalledInBuffered = 1;
|
||||
}
|
||||
if (this.stalledInBuffered >= this.config.stalledInBufferedNudgeThreshold) {
|
||||
logger.log(`playback stuck @ ${media.currentTime}, in buffered area, nudge currentTime by ${configSeekHoleNudgeDuration}`);
|
||||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_STUCK_IN_BUFFERED, fatal: false});
|
||||
media.currentTime+=configSeekHoleNudgeDuration;
|
||||
this.stalledInBuffered = 0;
|
||||
}
|
||||
} else {
|
||||
// currentTime is buffered, playhead is moving or playback not expected... everything is fine
|
||||
this.stalledInBuffered = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ export const ErrorDetails = {
|
|||
BUFFER_FULL_ERROR: 'bufferFullError',
|
||||
// Identifier for a buffer seek over hole event
|
||||
BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',
|
||||
// Identifier for a seek triggered to workaround a playback stuck although currentTime is buffered
|
||||
BUFFER_SEEK_STUCK_IN_BUFFERED : 'bufferSeekStuckInBuffered',
|
||||
// Identifier for an internal exception happening inside hls.js while handling an event
|
||||
INTERNAL_EXCEPTION: 'internalException'
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import {logger} from './utils/logger';
|
||||
import {ErrorTypes, ErrorDetails} from './errors';
|
||||
import Event from './events';
|
||||
|
||||
class EventHandler {
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ class Hls {
|
|||
maxBufferHole: 0.5,
|
||||
maxSeekHole: 2,
|
||||
seekHoleNudgeDuration : 0.01,
|
||||
stalledInBufferedNudgeThreshold: 10,
|
||||
maxFragLookUpTolerance : 0.2,
|
||||
liveSyncDurationCount:3,
|
||||
liveMaxLatencyDurationCount: Infinity,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue