This commit is contained in:
Josh Hawkins 2024-08-14 14:35:40 -05:00
parent c8af135869
commit 96251b2fb2

View File

@ -308,8 +308,10 @@ function MSEPlayer({
if (!videoRef.current) return; if (!videoRef.current) return;
const now = Date.now(); const now = Date.now();
// we either recently just started streaming or recently
// jumped to live, so don't jump to live again right away
if (now - lastJumpTimeRef.current < BUFFERING_COOLDOWN_TIMEOUT) { if (now - lastJumpTimeRef.current < BUFFERING_COOLDOWN_TIMEOUT) {
console.log("Cooldown period active, skipping jump");
return; return;
} }
@ -319,7 +321,6 @@ function MSEPlayer({
// Jump to the live edge // Jump to the live edge
videoRef.current.currentTime = liveEdge; videoRef.current.currentTime = liveEdge;
lastJumpTimeRef.current = now; lastJumpTimeRef.current = now;
console.log("Jumped to live");
} }
}; };
@ -413,7 +414,6 @@ function MSEPlayer({
onPause={() => videoRef.current?.play()} onPause={() => videoRef.current?.play()}
onProgress={() => { onProgress={() => {
const bufferTime = getBufferedTime(videoRef.current); const bufferTime = getBufferedTime(videoRef.current);
console.log(bufferTime);
// if we have > 3 seconds of buffered data and we're still not playing, // if we have > 3 seconds of buffered data and we're still not playing,
// something might be wrong - maybe codec issue, no audio, etc // something might be wrong - maybe codec issue, no audio, etc
@ -424,7 +424,7 @@ function MSEPlayer({
onPlaying?.(); onPlaying?.();
} }
// if we have > 1 second of buffered data and we're playing, we may have // if we have > 2 seconds of buffered data and we're playing, we may have
// drifted from actual live time, so seek to the end of buffered data // drifted from actual live time, so seek to the end of buffered data
if ( if (
videoRef.current && videoRef.current &&