Only set stalled error when player is visible

This commit is contained in:
Josh Hawkins 2024-06-10 07:15:21 -05:00
parent 30b86271ea
commit dc907ed197
2 changed files with 7 additions and 2 deletions

View File

@ -328,7 +328,10 @@ function MSEPlayer({
setBufferTimeout( setBufferTimeout(
setTimeout(() => { setTimeout(() => {
onError("stalled"); // only error and fallback if player is visible
if (document.visibilityState === "visible") {
onError("stalled");
}
}, 3000), }, 3000),
); );
} }

View File

@ -238,7 +238,9 @@ export default function WebRtcPlayer({
setBufferTimeout( setBufferTimeout(
setTimeout(() => { setTimeout(() => {
onError("stalled"); if (document.visibilityState === "visible") {
onError("stalled");
}
}, 3000), }, 3000),
); );
} }