mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-18 19:16:42 +03:00
feat(player): always show camera names + add UI config toggle
This commit is contained in:
parent
c2cbb0fa87
commit
61f927c941
@ -43,3 +43,4 @@ class UIConfig(FrigateBaseModel):
|
|||||||
unit_system: UnitSystemEnum = Field(
|
unit_system: UnitSystemEnum = Field(
|
||||||
default=UnitSystemEnum.metric, title="The unit system to use for measurements."
|
default=UnitSystemEnum.metric, title="The unit system to use for measurements."
|
||||||
)
|
)
|
||||||
|
show_camera_names: Optional[bool] = Field(default=False, title="Show camera name")
|
||||||
|
|||||||
@ -18,6 +18,9 @@
|
|||||||
},
|
},
|
||||||
"unit_system": {
|
"unit_system": {
|
||||||
"label": "The unit system to use for measurements."
|
"label": "The unit system to use for measurements."
|
||||||
|
},
|
||||||
|
"show_camera_names": {
|
||||||
|
"label": "Show the camera name in the player"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,6 +35,7 @@ type LivePlayerProps = {
|
|||||||
streamName: string;
|
streamName: string;
|
||||||
preferredLiveMode: LivePlayerMode;
|
preferredLiveMode: LivePlayerMode;
|
||||||
showStillWithoutActivity?: boolean;
|
showStillWithoutActivity?: boolean;
|
||||||
|
alwaysShowCameraName?: boolean;
|
||||||
useWebGL: boolean;
|
useWebGL: boolean;
|
||||||
windowVisible?: boolean;
|
windowVisible?: boolean;
|
||||||
playAudio?: boolean;
|
playAudio?: boolean;
|
||||||
@ -59,6 +60,7 @@ export default function LivePlayer({
|
|||||||
streamName,
|
streamName,
|
||||||
preferredLiveMode,
|
preferredLiveMode,
|
||||||
showStillWithoutActivity = true,
|
showStillWithoutActivity = true,
|
||||||
|
alwaysShowCameraName = false,
|
||||||
useWebGL = false,
|
useWebGL = false,
|
||||||
windowVisible = true,
|
windowVisible = true,
|
||||||
playAudio = false,
|
playAudio = false,
|
||||||
@ -433,20 +435,26 @@ export default function LivePlayer({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="absolute right-2 top-2">
|
<div className="absolute right-2 top-2 flex items-center gap-3">
|
||||||
|
{(alwaysShowCameraName ||
|
||||||
|
(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"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{cameraName}
|
||||||
|
</Chip>
|
||||||
|
)}
|
||||||
{autoLive &&
|
{autoLive &&
|
||||||
!offline &&
|
!offline &&
|
||||||
activeMotion &&
|
activeMotion &&
|
||||||
((showStillWithoutActivity && !liveReady) || liveReady) && (
|
((showStillWithoutActivity && !liveReady) || liveReady) && (
|
||||||
<MdCircle className="mr-2 size-2 animate-pulse text-danger shadow-danger drop-shadow-md" />
|
<MdCircle className="mr-2 size-2 animate-pulse text-danger shadow-danger drop-shadow-md" />
|
||||||
)}
|
)}
|
||||||
{((offline && showStillWithoutActivity) || !cameraEnabled) && (
|
|
||||||
<Chip
|
|
||||||
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>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{showStats && (
|
{showStats && (
|
||||||
<PlayerStats stats={stats} minimal={cameraRef !== undefined} />
|
<PlayerStats stats={stats} minimal={cameraRef !== undefined} />
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export interface UiConfig {
|
|||||||
dashboard: boolean;
|
dashboard: boolean;
|
||||||
order: number;
|
order: number;
|
||||||
unit_system?: "metric" | "imperial";
|
unit_system?: "metric" | "imperial";
|
||||||
|
show_camera_names?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BirdseyeConfig {
|
export interface BirdseyeConfig {
|
||||||
|
|||||||
@ -610,6 +610,7 @@ export default function DraggableGridLayout({
|
|||||||
streamName={streamName}
|
streamName={streamName}
|
||||||
autoLive={autoLive ?? globalAutoLive}
|
autoLive={autoLive ?? globalAutoLive}
|
||||||
showStillWithoutActivity={showStillWithoutActivity ?? true}
|
showStillWithoutActivity={showStillWithoutActivity ?? true}
|
||||||
|
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
|
||||||
useWebGL={useWebGL}
|
useWebGL={useWebGL}
|
||||||
cameraRef={cameraRef}
|
cameraRef={cameraRef}
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
@ -654,6 +654,7 @@ export default function LiveCameraView({
|
|||||||
className={`${fullscreen ? "*:rounded-none" : ""}`}
|
className={`${fullscreen ? "*:rounded-none" : ""}`}
|
||||||
windowVisible
|
windowVisible
|
||||||
showStillWithoutActivity={false}
|
showStillWithoutActivity={false}
|
||||||
|
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
|
||||||
cameraConfig={camera}
|
cameraConfig={camera}
|
||||||
playAudio={audio}
|
playAudio={audio}
|
||||||
playInBackground={playInBackground ?? false}
|
playInBackground={playInBackground ?? false}
|
||||||
|
|||||||
@ -549,6 +549,7 @@ export default function LiveDashboardView({
|
|||||||
preferredLiveMode={preferredLiveModes[camera.name] ?? "mse"}
|
preferredLiveMode={preferredLiveModes[camera.name] ?? "mse"}
|
||||||
autoLive={autoLive ?? globalAutoLive}
|
autoLive={autoLive ?? globalAutoLive}
|
||||||
showStillWithoutActivity={showStillWithoutActivity ?? true}
|
showStillWithoutActivity={showStillWithoutActivity ?? true}
|
||||||
|
alwaysShowCameraName={config?.ui.show_camera_names ?? false}
|
||||||
useWebGL={useWebGL}
|
useWebGL={useWebGL}
|
||||||
playInBackground={false}
|
playInBackground={false}
|
||||||
showStats={statsStates[camera.name]}
|
showStats={statsStates[camera.name]}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user