From 6dd6ca5de596ae6071f3c01ed97119e03fcd7af2 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 25 Mar 2024 14:56:13 -0600 Subject: [PATCH] Only allow visible cameras to go live on dashboard (#10671) * Only show live cameras that are currently visible * Add back black background * fix --- web/src/components/player/LivePlayer.tsx | 17 ++++--- web/src/components/player/PreviewPlayer.tsx | 6 +-- web/src/views/live/LiveDashboardView.tsx | 54 ++++++++++++++++++++- 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx index 8be3f71b9..a8fe5d3b1 100644 --- a/web/src/components/player/LivePlayer.tsx +++ b/web/src/components/player/LivePlayer.tsx @@ -10,10 +10,10 @@ import { useCameraActivity } from "@/hooks/use-camera-activity"; import { useRecordingsState } from "@/api/ws"; import { LivePlayerMode } from "@/types/live"; import useCameraLiveMode from "@/hooks/use-camera-live-mode"; -import { isDesktop } from "react-device-detect"; import CameraActivityIndicator from "../indicators/CameraActivityIndicator"; type LivePlayerProps = { + cameraRef?: (ref: HTMLDivElement | null) => void; className?: string; cameraConfig: CameraConfig; preferredLiveMode?: LivePlayerMode; @@ -26,6 +26,7 @@ type LivePlayerProps = { }; export default function LivePlayer({ + cameraRef = undefined, className, cameraConfig, preferredLiveMode, @@ -140,6 +141,8 @@ export default function LivePlayer({ return (
- {isDesktop && ( -
- {recording == "ON" && ( - - )} -
- )} +
+ {recording == "ON" && ( + + )} +
); } diff --git a/web/src/components/player/PreviewPlayer.tsx b/web/src/components/player/PreviewPlayer.tsx index 197986677..76a16fe9d 100644 --- a/web/src/components/player/PreviewPlayer.tsx +++ b/web/src/components/player/PreviewPlayer.tsx @@ -234,7 +234,7 @@ function PreviewVideoPlayer({ return (
{currentHourFrame && ( @@ -247,7 +247,7 @@ function PreviewVideoPlayer({ ref={canvasRef} width={videoWidth} height={videoHeight} - className={`absolute h-full left-1/2 -translate-x-1/2 bg-black ${!loaded && hasCanvas ? "" : "hidden"}`} + className={`absolute h-full left-1/2 -translate-x-1/2 ${!loaded && hasCanvas ? "" : "hidden"}`} />