This behavior is observable here https://uw-media.ydr.com/video-wrap/embed?videoid=100991728 (video stops playing with ~5 seconds left).
Things to note:
hls.recoverMediaError() and by using the technique here https://github.com/video-dev/hls.js/blob/master/demo/index.html#L739 to no avail. When I use this technique, playback restarts from the beginning and still fails when playback reaches the last fragment that is failing to buffer.Any direction would be greatly appreciated.
Uninterrupted playback, all fragments load and play
Last piece (~last 5 seconds) fails to play
[warn] > playback stalling in low buffer @62.6753
(anonymous) @ hls.js:13218
_checkBuffer @ hls.js:4659
doTick @ hls.js:3621
tick @ hls.js:3578
Sample integration code (attempting to handle error) that is not helping resolve this issue.
/**
* Attempt to recover HLS playback, if all else fails revert to mp4
*/
handleHlsError: function (event, data) {
let errorType = data.type;
let isFatal = data.fatal;
this.errorCount++;
if (this.errorCount <= 2) {
if (isFatal) {
switch (errorType) {
case this.Hls.ErrorTypes.NETWORK_ERROR:
// try to recover network error
this.hls.startLoad();
break;
case this.Hls.ErrorTypes.MEDIA_ERROR:
// try to recover media error
this.handleMediaError();
break;
default:
// cannot recover
this.killHls(true);
break;
}
}
} else {
this.killHls(true);
}
},
handleMediaError: function () {
var now = performance.now();
if(!this.recoverDecodingErrorDate || (now - this.recoverDecodingErrorDate) > 3000) {
this.recoverDecodingErrorDate = performance.now();
console.log(",try to recover media Error ...");
this.hls.recoverMediaError();
} else {
if(!this.recoverSwapAudioCodecDate || (now - this.recoverSwapAudioCodecDate) > 3000) {
this.recoverSwapAudioCodecDate = performance.now();
console.log(",try to swap Audio Codec and recover media Error ...");
this.hls.swapAudioCodec();
this.hls.recoverMediaError();
} else {
console.log(",cannot recover, last media error recovery failed ...");
}
}
},
@harbinha it should be fixed now, could you recheck ?
@mangui Looks good! Thanks for fixing this. What is the release cycle like for getting this patch out? We're requiring hls.js from npm in our integration.
I just issued a new release (v0.7.8)
enjoy !
Most helpful comment
I just issued a new release (v0.7.8)
enjoy !