mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-12 10:07:36 +03:00
probe metadata and snapshot separately
This commit is contained in:
parent
7e3be76c9a
commit
f388b4c45a
@ -16,7 +16,6 @@
|
|||||||
"ui": "UI",
|
"ui": "UI",
|
||||||
"enrichments": "Enrichments",
|
"enrichments": "Enrichments",
|
||||||
"cameraManagement": "Management",
|
"cameraManagement": "Management",
|
||||||
"cameraReview": "Review",
|
|
||||||
"masksAndZones": "Masks / Zones",
|
"masksAndZones": "Masks / Zones",
|
||||||
"motionTuner": "Motion Tuner",
|
"motionTuner": "Motion Tuner",
|
||||||
"triggers": "Triggers",
|
"triggers": "Triggers",
|
||||||
@ -188,6 +187,10 @@
|
|||||||
"testSuccess": "Connection test successful!",
|
"testSuccess": "Connection test successful!",
|
||||||
"testFailed": "Connection test failed. Please check your input and try again.",
|
"testFailed": "Connection test failed. Please check your input and try again.",
|
||||||
"streamDetails": "Stream Details",
|
"streamDetails": "Stream Details",
|
||||||
|
"testing": {
|
||||||
|
"probingMetadata": "Probing camera metadata...",
|
||||||
|
"fetchingSnapshot": "Fetching camera snapshot..."
|
||||||
|
},
|
||||||
"warnings": {
|
"warnings": {
|
||||||
"noSnapshot": "Unable to fetch a snapshot from the configured stream."
|
"noSnapshot": "Unable to fetch a snapshot from the configured stream."
|
||||||
},
|
},
|
||||||
@ -197,8 +200,9 @@
|
|||||||
"nameLength": "Camera name must be 64 characters or less",
|
"nameLength": "Camera name must be 64 characters or less",
|
||||||
"invalidCharacters": "Camera name contains invalid characters",
|
"invalidCharacters": "Camera name contains invalid characters",
|
||||||
"nameExists": "Camera name already exists",
|
"nameExists": "Camera name already exists",
|
||||||
|
"customUrlRtspRequired": "Custom URLs must begin with \"rtsp://\". Manual configuration is required for non-RTSP camera streams.",
|
||||||
"brands": {
|
"brands": {
|
||||||
"reolink-rtsp": "Reolink RTSP is not recommended. It is recommended to enable http in the camera settings and restart the camera wizard."
|
"reolink-rtsp": "Reolink RTSP is not recommended. Enable HTTP in the camera's firmware settings and restart the wizard."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
|
|||||||
@ -65,6 +65,7 @@ export default function Step1NameCamera({
|
|||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [isTesting, setIsTesting] = useState(false);
|
const [isTesting, setIsTesting] = useState(false);
|
||||||
|
const [testStatus, setTestStatus] = useState<string>("");
|
||||||
const [testResult, setTestResult] = useState<TestResult | null>(null);
|
const [testResult, setTestResult] = useState<TestResult | null>(null);
|
||||||
|
|
||||||
const existingCameraNames = useMemo(() => {
|
const existingCameraNames = useMemo(() => {
|
||||||
@ -88,7 +89,13 @@ export default function Step1NameCamera({
|
|||||||
username: z.string().optional(),
|
username: z.string().optional(),
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
brandTemplate: z.enum(CAMERA_BRAND_VALUES).optional(),
|
brandTemplate: z.enum(CAMERA_BRAND_VALUES).optional(),
|
||||||
customUrl: z.string().optional(),
|
customUrl: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.refine(
|
||||||
|
(val) => !val || val.startsWith("rtsp://"),
|
||||||
|
t("cameraWizard.step1.errors.customUrlRtspRequired"),
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
(data) => {
|
(data) => {
|
||||||
@ -204,24 +211,17 @@ export default function Step1NameCamera({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setIsTesting(true);
|
setIsTesting(true);
|
||||||
|
setTestStatus("");
|
||||||
setTestResult(null);
|
setTestResult(null);
|
||||||
|
|
||||||
// First get probe data for metadata
|
|
||||||
const probePromise = axios.get("ffprobe", {
|
|
||||||
params: { paths: streamUrl, detailed: true },
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Then get snapshot for preview
|
|
||||||
const snapshotPromise = axios.get("ffprobe/snapshot", {
|
|
||||||
params: { url: streamUrl },
|
|
||||||
responseType: "blob",
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// First get probe data for metadata
|
// First get probe data for metadata
|
||||||
const probeResponse = await probePromise;
|
setTestStatus(t("cameraWizard.step1.testing.probingMetadata"));
|
||||||
|
const probeResponse = await axios.get("ffprobe", {
|
||||||
|
params: { paths: streamUrl, detailed: true },
|
||||||
|
timeout: 10000,
|
||||||
|
});
|
||||||
|
|
||||||
let probeData = null;
|
let probeData = null;
|
||||||
if (
|
if (
|
||||||
probeResponse.data &&
|
probeResponse.data &&
|
||||||
@ -234,8 +234,13 @@ export default function Step1NameCamera({
|
|||||||
// Then get snapshot for preview (only if probe succeeded)
|
// Then get snapshot for preview (only if probe succeeded)
|
||||||
let snapshotBlob = null;
|
let snapshotBlob = null;
|
||||||
if (probeData) {
|
if (probeData) {
|
||||||
|
setTestStatus(t("cameraWizard.step1.testing.fetchingSnapshot"));
|
||||||
try {
|
try {
|
||||||
const snapshotResponse = await snapshotPromise;
|
const snapshotResponse = await axios.get("ffprobe/snapshot", {
|
||||||
|
params: { url: streamUrl },
|
||||||
|
responseType: "blob",
|
||||||
|
timeout: 10000,
|
||||||
|
});
|
||||||
snapshotBlob = snapshotResponse.data;
|
snapshotBlob = snapshotResponse.data;
|
||||||
} catch (snapshotError) {
|
} catch (snapshotError) {
|
||||||
// Snapshot is optional, don't fail if it doesn't work
|
// Snapshot is optional, don't fail if it doesn't work
|
||||||
@ -321,6 +326,7 @@ export default function Step1NameCamera({
|
|||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setIsTesting(false);
|
setIsTesting(false);
|
||||||
|
setTestStatus("");
|
||||||
}
|
}
|
||||||
}, [form, generateStreamUrl, t]);
|
}, [form, generateStreamUrl, t]);
|
||||||
|
|
||||||
@ -610,7 +616,9 @@ export default function Step1NameCamera({
|
|||||||
className="flex items-center justify-center gap-2 sm:flex-1"
|
className="flex items-center justify-center gap-2 sm:flex-1"
|
||||||
>
|
>
|
||||||
{isTesting && <ActivityIndicator className="size-4" />}
|
{isTesting && <ActivityIndicator className="size-4" />}
|
||||||
{t("cameraWizard.step1.testConnection")}
|
{isTesting && testStatus
|
||||||
|
? testStatus
|
||||||
|
: t("cameraWizard.step1.testConnection")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user