Remove seeking logic from play method

This commit is contained in:
Trevor Mears
2025-12-31 01:07:47 -08:00
parent 7592702137
commit bec1b74208
+4 -10
View File
@@ -386,23 +386,17 @@ class VideoPlayer {
} }
}); });
// Detect discontinuity changes (ad transitions) and help decoder reset // Detect discontinuity changes (ad transitions) for logging only
this.lastDiscontinuity = -1; this.lastDiscontinuity = -1;
this.hls.on(Hls.Events.FRAG_CHANGED, (event, data) => { this.hls.on(Hls.Events.FRAG_CHANGED, (event, data) => {
const frag = data.frag; const frag = data.frag;
if (frag && frag.sn !== 'initSegment') { if (frag && frag.sn !== 'initSegment') {
// Check if we crossed a discontinuity boundary using CC (Continuity Counter) // Log discontinuity changes for debugging
if (frag.cc !== undefined && frag.cc !== this.lastDiscontinuity) { if (frag.cc !== undefined && frag.cc !== this.lastDiscontinuity) {
const wasFirstDetection = this.lastDiscontinuity === -1;
console.log(`[HLS] Discontinuity detected: CC ${this.lastDiscontinuity} -> ${frag.cc}`); console.log(`[HLS] Discontinuity detected: CC ${this.lastDiscontinuity} -> ${frag.cc}`);
this.lastDiscontinuity = frag.cc; this.lastDiscontinuity = frag.cc;
// Note: maxAudioFramesDrift: 4 handles audio sync naturally
// Skip on first detection (initial load) // No manual seeking needed - it can cause more issues than it solves
if (!wasFirstDetection && !this.video.paused && this.video.currentTime > 0) {
// Seek forward slightly to skip past any corrupted audio frames
console.log('[HLS] Seeking past discontinuity boundary');
this.video.currentTime += 1;
}
} }
} }
}); });