forked from Github/frigate
UI tweaks (#12297)
* Use full resolution aspect for main camera style in history view * Only check for offline cameras after 60s of uptime * only call onPlaying when loadeddata is fired or after timeout * revert to inline funcs * Portal frigate plus alert dialog * remove duplicated logic * increase onplaying timeout * Use a ref instead of a state and clear timeout in AutoUpdatingCameraImage * default to the selected month for selectedDay * Use buffered time instead of timeout * Use default cursor when not editing polygons
This commit is contained in:
@@ -297,6 +297,11 @@ function MSEPlayer({
|
||||
};
|
||||
};
|
||||
|
||||
const getBufferedTime = (video: HTMLVideoElement | null) => {
|
||||
if (!video || video.buffered.length === 0) return 0;
|
||||
return video.buffered.end(video.buffered.length - 1) - video.currentTime;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!playbackEnabled) {
|
||||
return;
|
||||
@@ -385,9 +390,15 @@ function MSEPlayer({
|
||||
muted={!audioEnabled}
|
||||
onPause={() => videoRef.current?.play()}
|
||||
onProgress={() => {
|
||||
if (!isPlaying) {
|
||||
// if we have > 3 seconds of buffered data and we're still not playing,
|
||||
// something might be wrong - maybe codec issue, no audio, etc
|
||||
// so mark the player as playing so that error handlers will fire
|
||||
if (
|
||||
!isPlaying &&
|
||||
playbackEnabled &&
|
||||
getBufferedTime(videoRef.current) > 3
|
||||
) {
|
||||
setIsPlaying(true);
|
||||
handleLoadedMetadata?.();
|
||||
onPlaying?.();
|
||||
}
|
||||
if (onError != undefined) {
|
||||
|
||||
Reference in New Issue
Block a user