1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-02-04 13:19:10 -05:00
parent 5973359f39
commit 4c2a7ed02d
23 changed files with 228 additions and 129 deletions

View file

@ -1224,28 +1224,28 @@ var MSEMediaController = (function (_EventHandler) {
break;
case State.PARSED:
case State.APPENDING:
if (this.sourceBuffer) {
var sourceBuffer = this.sourceBuffer,
mp4segments = this.mp4segments;
if (sourceBuffer) {
if (this.media.error) {
_utilsLogger.logger.error('trying to append although a media error occured, switch to ERROR state');
this.state = State.ERROR;
return;
}
// if MP4 segment appending in progress nothing to do
else if (this.sourceBuffer.audio && this.sourceBuffer.audio.updating || this.sourceBuffer.video && this.sourceBuffer.video.updating) {
else if (sourceBuffer.audio && sourceBuffer.audio.updating || sourceBuffer.video && sourceBuffer.video.updating) {
//logger.log('sb append in progress');
// check if any MP4 segments left to append
} else if (this.mp4segments.length) {
var segment = this.mp4segments.shift();
} else if (mp4segments.length) {
var segment = mp4segments.shift();
try {
//logger.log(`appending ${segment.type} SB, size:${segment.data.length});
this.sourceBuffer[segment.type].appendBuffer(segment.data);
sourceBuffer[segment.type].appendBuffer(segment.data);
this.appendError = 0;
} catch (err) {
// in case any error occured while appending, put back segment in mp4segments table
_utilsLogger.logger.error('error while trying to append buffer:' + err.message + ',try appending later');
this.mp4segments.unshift(segment);
// just discard QuotaExceededError for now, and wait for the natural browser buffer eviction
//http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror
mp4segments.unshift(segment);
if (err.code !== 22) {
if (this.appendError) {
this.appendError++;
@ -1253,9 +1253,6 @@ var MSEMediaController = (function (_EventHandler) {
this.appendError = 1;
}
var event = { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_APPEND_ERROR, frag: this.fragCurrent };
/* with UHD content, we could get loop of quota exceeded error until
browser is able to evict some data from sourcebuffer. retrying help recovering this
*/
if (this.appendError > this.config.appendErrorMaxRetry) {
_utilsLogger.logger.log('fail ' + this.config.appendErrorMaxRetry + ' times to append segment in sourceBuffer');
event.fatal = true;
@ -1266,6 +1263,15 @@ var MSEMediaController = (function (_EventHandler) {
event.fatal = false;
hls.trigger(_events2['default'].ERROR, event);
}
} else {
// handle QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror
// let's stop appending any segments, and 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 ...
mp4segments = [];
this.config.maxMaxBufferLength /= 2;
_utilsLogger.logger.warn('reduce max buffer length to ' + this.config.maxMaxBufferLength + 's and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError');
this.nextLevelSwitch();
return;
}
}
this.state = State.APPENDING;
@ -1859,7 +1865,7 @@ var MSEMediaController = (function (_EventHandler) {
start = fragCurrent.start,
level = fragCurrent.level,
sn = fragCurrent.sn,
audioCodec = currentLevel.audioCodec;
audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec;
if (this.audioCodecSwap) {
_utilsLogger.logger.log('swapping playlist audio codec');
if (audioCodec === undefined) {
@ -1962,8 +1968,17 @@ var MSEMediaController = (function (_EventHandler) {
key: 'onFragParsed',
value: function onFragParsed() {
if (this.state === State.PARSING) {
this.state = State.PARSED;
this.stats.tparsed = performance.now();
var sb = this.sourceBuffer,
appending = sb.audio && sb.audio.updating || sb.video && sb.video.updating;
// if fragment parsed, and all segments appended, and no appending in progress, we are done with this fragment
if (this.mp4segments.length === 0 && !appending) {
this.state = State.IDLE;
} else {
this.state = State.PARSED;
}
//trigger handler right now
this.tick();
}