From 6d55a81d3d8897e454cf90e7ccef0a20a14216e7 Mon Sep 17 00:00:00 2001 From: Trevor Mears Date: Tue, 30 Dec 2025 23:28:07 -0800 Subject: [PATCH] Added seeking after frag parsing errors --- public/js/components/VideoPlayer.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/public/js/components/VideoPlayer.js b/public/js/components/VideoPlayer.js index 3e2d200..ce4631f 100644 --- a/public/js/components/VideoPlayer.js +++ b/public/js/components/VideoPlayer.js @@ -141,11 +141,20 @@ class VideoPlayer { } } else if (data.type === Hls.ErrorTypes.MEDIA_ERROR) { // Non-fatal media error - try to recover (handles audio codec issues) - console.log('Non-fatal media error, attempting recovery...'); + console.log('Non-fatal media error:', data.details); this.hls.recoverMediaError(); - } else if (data.details === 'bufferAppendError' || data.details === 'fragParsingError') { - // Buffer/parsing errors during ad transitions - try recovery - console.log('Buffer/parsing error during segment, recovering...'); + // If fragParsingError, also seek forward slightly to skip corrupted segment + if (data.details === 'fragParsingError' && !this.video.paused && this.video.currentTime > 0) { + console.log('[HLS] Seeking past corrupted segment...'); + setTimeout(() => { + if (this.video && !this.video.paused) { + this.video.currentTime += 0.5; + } + }, 100); + } + } else if (data.details === 'bufferAppendError') { + // Buffer errors during ad transitions - try recovery + console.log('Buffer append error, recovering...'); this.hls.recoverMediaError(); } });