+ {enabled ? (
+
+ ) : (
+
+ Camera is disabled in config, no stream or snapshot available!
+
+ )}
+ {!hasLoaded && enabled ? (
+
+ ) : null}
+
+ );
+}
diff --git a/web-new/src/components/player/LivePlayer.tsx b/web-new/src/components/player/LivePlayer.tsx
new file mode 100644
index 000000000..adbeef2b7
--- /dev/null
+++ b/web-new/src/components/player/LivePlayer.tsx
@@ -0,0 +1,175 @@
+import WebRtcPlayer from "./WebRTCPlayer";
+import { CameraConfig } from "@/types/frigateConfig";
+import AutoUpdatingCameraImage from "../camera/AutoUpdatingCameraImage";
+import ActivityIndicator from "../ui/activity-indicator";
+import { Button } from "../ui/button";
+import { LuSettings } from "react-icons/lu";
+import { useCallback, useMemo, useState } from "react";
+import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";
+import { Switch } from "../ui/switch";
+import { Label } from "../ui/label";
+import { usePersistence } from "@/context/use-persistence";
+
+const emptyObject = Object.freeze({});
+
+type LivePlayerProps = {
+ cameraConfig: CameraConfig;
+ liveMode: string;
+};
+
+type Options = { [key: string]: boolean };
+
+export default function LivePlayer({
+ cameraConfig,
+ liveMode,
+}: LivePlayerProps) {
+ const [showSettings, setShowSettings] = useState(false);
+
+ const [options, setOptions] = usePersistence(
+ `${cameraConfig.name}-feed`,
+ emptyObject
+ );
+
+ const handleSetOption = useCallback(
+ (id: string, value: boolean) => {
+ console.log("Setting " + id + " to " + value);
+ const newOptions = { ...options, [id]: value };
+ setOptions(newOptions);
+ },
+ [options, setOptions]
+ );
+
+ const searchParams = useMemo(
+ () =>
+ new URLSearchParams(
+ Object.keys(options).reduce((memo, key) => {
+ //@ts-ignore we know this is correct
+ memo.push([key, options[key] === true ? "1" : "0"]);
+ return memo;
+ }, [])
+ ),
+ [options]
+ );
+
+ const handleToggleSettings = useCallback(() => {
+ setShowSettings(!showSettings);
+ }, [showSettings, setShowSettings]);
+
+ if (liveMode == "webrtc") {
+ return (
+
+
+ {
+ handleSetOption("bbox", isChecked);
+ }}
+ />
+
+
+
+ {
+ handleSetOption("timestamp", isChecked);
+ }}
+ />
+
+
+
+ {
+ handleSetOption("zones", isChecked);
+ }}
+ />
+
+
+
+ {
+ handleSetOption("mask", isChecked);
+ }}
+ />
+
+
+
+ {
+ handleSetOption("motion", isChecked);
+ }}
+ />
+
+
+
+ {
+ handleSetOption("regions", isChecked);
+ }}
+ />
+
+
+
+ );
+}
diff --git a/web-new/src/components/player/WebRTCPlayer.tsx b/web-new/src/components/player/WebRTCPlayer.tsx
new file mode 100644
index 000000000..7d6ff0985
--- /dev/null
+++ b/web-new/src/components/player/WebRTCPlayer.tsx
@@ -0,0 +1,161 @@
+import { baseUrl } from "@/api/baseUrl";
+import { useCallback, useEffect, useRef } from "react";
+
+type WebRtcPlayerProps = {
+ camera: string;
+ width?: number;
+ height?: number;
+};
+
+export default function WebRtcPlayer({
+ camera,
+ width,
+ height,
+}: WebRtcPlayerProps) {
+ const pcRef = useRef