mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 07:05:24 +03:00
Fix buffering
This commit is contained in:
parent
44ad83dcb6
commit
56ed9b0fca
@ -268,11 +268,30 @@ export default function HlsVideoPlayer({
|
|||||||
onPlaying={onPlaying}
|
onPlaying={onPlaying}
|
||||||
onPause={() => {
|
onPause={() => {
|
||||||
setIsPlaying(false);
|
setIsPlaying(false);
|
||||||
|
clearTimeout(bufferTimeout);
|
||||||
|
|
||||||
if (isMobile && mobileCtrlTimeout) {
|
if (isMobile && mobileCtrlTimeout) {
|
||||||
clearTimeout(mobileCtrlTimeout);
|
clearTimeout(mobileCtrlTimeout);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
onWaiting={() => {
|
||||||
|
if (onError != undefined) {
|
||||||
|
if (videoRef.current?.paused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setBufferTimeout(
|
||||||
|
setTimeout(() => {
|
||||||
|
if (
|
||||||
|
document.visibilityState === "visible" &&
|
||||||
|
videoRef.current
|
||||||
|
) {
|
||||||
|
onError("stalled");
|
||||||
|
}
|
||||||
|
}, 3000),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
onProgress={() => {
|
onProgress={() => {
|
||||||
if (onError != undefined) {
|
if (onError != undefined) {
|
||||||
if (videoRef.current?.paused) {
|
if (videoRef.current?.paused) {
|
||||||
@ -283,18 +302,6 @@ export default function HlsVideoPlayer({
|
|||||||
clearTimeout(bufferTimeout);
|
clearTimeout(bufferTimeout);
|
||||||
setBufferTimeout(undefined);
|
setBufferTimeout(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBufferTimeout(
|
|
||||||
setTimeout(() => {
|
|
||||||
if (
|
|
||||||
document.visibilityState === "visible" &&
|
|
||||||
videoRef.current &&
|
|
||||||
!videoRef.current.paused
|
|
||||||
) {
|
|
||||||
onError("stalled");
|
|
||||||
}
|
|
||||||
}, 3000),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onTimeUpdate={() =>
|
onTimeUpdate={() =>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user