Remove live mode from config (#11618)

* Use preferred mode as default

* Remove live mode from config

* Add deer icon

* remove from config schema
This commit is contained in:
Nicolas Mowen 2024-05-29 12:06:48 -06:00 committed by GitHub
parent 9245c5cb56
commit 9e8202874e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 17 deletions

View File

@ -645,8 +645,6 @@ cameras:
# Optional
ui:
# Optional: Set the default live mode for cameras in the UI (default: shown below)
live_mode: mse
# Optional: Set a timezone to use in the UI (default: use browser local time)
# timezone: America/Denver
# Optional: Set the time format used.

View File

@ -100,9 +100,6 @@ class DateTimeStyleEnum(str, Enum):
class UIConfig(FrigateBaseModel):
live_mode: LiveModeEnum = Field(
default=LiveModeEnum.mse, title="Default Live Mode."
)
timezone: Optional[str] = Field(default=None, title="Override UI timezone.")
time_format: TimeFormatEnum = Field(
default=TimeFormatEnum.browser, title="Override UI time format."

View File

@ -87,8 +87,12 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]:
if not new_config["record"]:
del new_config["record"]
if new_config.get("ui", {}).get("use_experimental"):
del new_config["ui"]["experimental"]
if new_config.get("ui"):
if new_config["ui"].get("use_experimental"):
del new_config["ui"]["experimental"]
if new_config["ui"].get("live_mode"):
del new_config["ui"]["live_mode"]
if not new_config["ui"]:
del new_config["ui"]

View File

@ -6,7 +6,7 @@ import { LivePlayerMode } from "@/types/live";
export default function useCameraLiveMode(
cameraConfig: CameraConfig,
preferredMode?: string,
preferredMode?: LivePlayerMode,
): LivePlayerMode | undefined {
const { data: config } = useSWR<FrigateConfig>("config");
@ -23,18 +23,16 @@ export default function useCameraLiveMode(
);
}, [config, cameraConfig]);
const defaultLiveMode = useMemo<LivePlayerMode | undefined>(() => {
if (config && cameraConfig) {
if (config) {
if (restreamEnabled) {
return cameraConfig.ui.live_mode || config.ui.live_mode;
return preferredMode || "mse";
}
return "jsmpeg";
}
return undefined;
// config will be updated if camera config is updated
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [cameraConfig, restreamEnabled]);
}, [config, preferredMode, restreamEnabled]);
const [viewSource] = usePersistence<LivePlayerMode>(
`${cameraConfig.name}-source`,
defaultLiveMode,

View File

@ -1,5 +1,4 @@
import { IconName } from "@/components/icons/IconPicker";
import { LivePlayerMode } from "./live";
export interface UiConfig {
timezone?: string;
@ -7,8 +6,6 @@ export interface UiConfig {
date_style?: "full" | "long" | "medium" | "short";
time_style?: "full" | "long" | "medium" | "short";
strftime_fmt?: string;
live_mode?: LivePlayerMode;
use_experimental?: boolean;
dashboard: boolean;
order: number;
}

View File

@ -12,7 +12,7 @@ import {
FaFire,
FaUps,
} from "react-icons/fa";
import { GiHummingbird } from "react-icons/gi";
import { GiDeer, GiHummingbird } from "react-icons/gi";
import { LuBox, LuLassoSelect } from "react-icons/lu";
import * as LuIcons from "react-icons/lu";
import { MdRecordVoiceOver } from "react-icons/md";
@ -38,6 +38,8 @@ export function getIconForLabel(label: string, className?: string) {
return <FaCarSide key={label} className={className} />;
case "cat":
return <FaCat key={label} className={className} />;
case "deer":
return <GiDeer key={label} className={className} />;
case "animal":
case "bark":
case "dog":