Added recovery for bufferStalledError, updated readme

This commit is contained in:
Trevor Mears
2025-12-29 21:06:01 -08:00
parent 59bc6d4a46
commit 0513016f6c
2 changed files with 68 additions and 6 deletions
+8 -1
View File
@@ -296,8 +296,15 @@ class VideoPlayer {
console.error('Fatal HLS error:', data);
}
} else if (data.type === Hls.ErrorTypes.MEDIA_ERROR) {
// Non-fatal media error - just log it (auto-recovery can cause black screens)
// Non-fatal media error - handle specific cases
console.log('Non-fatal media error:', data.details);
if (data.details === 'bufferStalledError') {
// Buffer stalled - seek forward to unstick
console.log('[HLS] Buffer stalled, seeking to recover...');
if (!this.video.paused && this.video.currentTime > 0) {
this.video.currentTime += 0.5;
}
}
}
});