feat(settings): add toggle for displaying camera names in multi-camera views

This commit is contained in:
Thibault JUNIN 2025-10-29 14:25:31 +01:00
parent 61f927c941
commit 2fa7a5a7b2
9 changed files with 29 additions and 13 deletions

View File

@ -43,4 +43,3 @@ class UIConfig(FrigateBaseModel):
unit_system: UnitSystemEnum = Field(
default=UnitSystemEnum.metric, title="The unit system to use for measurements."
)
show_camera_names: Optional[bool] = Field(default=False, title="Show camera name")

View File

@ -18,9 +18,6 @@
},
"unit_system": {
"label": "The unit system to use for measurements."
},
"show_camera_names": {
"label": "Show the camera name in the player"
}
}
}

View File

@ -47,6 +47,10 @@
"playAlertVideos": {
"label": "Play Alert Videos",
"desc": "By default, recent alerts on the Live dashboard play as small looping videos. Disable this option to only show a static image of recent alerts on this device/browser."
},
"displayCameraNames": {
"label": "Display Camera Names",
"desc": "Displays the camera name in the top-right corner at all times, not just when offline or disabled. Useful for quick identification in multi-camera views."
}
},
"storedLayouts": {

View File

@ -440,11 +440,7 @@ export default function LivePlayer({
(offline && showStillWithoutActivity) ||
!cameraEnabled) && (
<Chip
className={`z-0 flex items-start justify-between space-x-1 text-xs capitalize ${
(offline && showStillWithoutActivity) || !cameraEnabled
? "bg-red-500 bg-gradient-to-br from-red-400 to-red-500"
: "bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500"
}`}
className={`z-0 flex items-start justify-between space-x-1 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500 text-xs capitalize`}
>
{cameraName}
</Chip>

View File

@ -10,7 +10,6 @@ export interface UiConfig {
dashboard: boolean;
order: number;
unit_system?: "metric" | "imperial";
show_camera_names?: boolean;
}
export interface BirdseyeConfig {

View File

@ -95,6 +95,7 @@ export default function DraggableGridLayout({
} = useCameraLiveMode(cameras, windowVisible);
const [globalAutoLive] = usePersistence("autoLiveView", true);
const [displayCameraNames] = usePersistence("displayCameraNames", false);
const { allGroupsStreamingSettings, setAllGroupsStreamingSettings } =
useStreamingSettings();
@ -610,7 +611,7 @@ export default function DraggableGridLayout({
streamName={streamName}
autoLive={autoLive ?? globalAutoLive}
showStillWithoutActivity={showStillWithoutActivity ?? true}
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
alwaysShowCameraName={displayCameraNames}
useWebGL={useWebGL}
cameraRef={cameraRef}
className={cn(

View File

@ -654,7 +654,7 @@ export default function LiveCameraView({
className={`${fullscreen ? "*:rounded-none" : ""}`}
windowVisible
showStillWithoutActivity={false}
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
alwaysShowCameraName={false}
cameraConfig={camera}
playAudio={audio}
playInBackground={playInBackground ?? false}

View File

@ -211,6 +211,7 @@ export default function LiveDashboardView({
} = useCameraLiveMode(cameras, windowVisible);
const [globalAutoLive] = usePersistence("autoLiveView", true);
const [displayCameraNames] = usePersistence("displayCameraNames", false);
const { allGroupsStreamingSettings, setAllGroupsStreamingSettings } =
useStreamingSettings();
@ -549,7 +550,7 @@ export default function LiveDashboardView({
preferredLiveMode={preferredLiveModes[camera.name] ?? "mse"}
autoLive={autoLive ?? globalAutoLive}
showStillWithoutActivity={showStillWithoutActivity ?? true}
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
alwaysShowCameraName={displayCameraNames}
useWebGL={useWebGL}
playInBackground={false}
showStats={statsStates[camera.name]}

View File

@ -92,6 +92,10 @@ export default function UiSettingsView() {
// settings
const [autoLive, setAutoLive] = usePersistence("autoLiveView", true);
const [cameraNames, setCameraName] = usePersistence(
"displayCameraNames",
false,
);
const [playbackRate, setPlaybackRate] = usePersistence("playbackRate", 1);
const [weekStartsOn, setWeekStartsOn] = usePersistence("weekStartsOn", 0);
const [alertVideos, setAlertVideos] = usePersistence("alertVideos", true);
@ -142,6 +146,21 @@ export default function UiSettingsView() {
<p>{t("general.liveDashboard.playAlertVideos.desc")}</p>
</div>
</div>
<div className="space-y-3">
<div className="flex flex-row items-center justify-start gap-2">
<Switch
id="camera-names"
checked={cameraNames}
onCheckedChange={setCameraName}
/>
<Label className="cursor-pointer" htmlFor="auto-live">
{t("general.liveDashboard.displayCameraNames.label")}
</Label>
</div>
<div className="my-2 max-w-5xl text-sm text-muted-foreground">
<p>{t("general.liveDashboard.displayCameraNames.desc")}</p>
</div>
</div>
</div>
<div className="my-3 flex w-full flex-col space-y-6">