mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-21 12:36:42 +03:00
Compare commits
4 Commits
6559c973bf
...
d15886e691
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d15886e691 | ||
|
|
b0527df3c7 | ||
|
|
301e0a1a3a | ||
|
|
793906bb68 |
@ -6,7 +6,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import Hls from "hls.js";
|
import Hls from "hls.js";
|
||||||
import { isAndroid, isDesktop, isMobile } from "react-device-detect";
|
import { isDesktop, isMobile } from "react-device-detect";
|
||||||
import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch";
|
import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch";
|
||||||
import VideoControls from "./VideoControls";
|
import VideoControls from "./VideoControls";
|
||||||
import { VideoResolutionType } from "@/types/live";
|
import { VideoResolutionType } from "@/types/live";
|
||||||
@ -22,7 +22,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import ObjectTrackOverlay from "@/components/overlay/ObjectTrackOverlay";
|
import ObjectTrackOverlay from "@/components/overlay/ObjectTrackOverlay";
|
||||||
|
|
||||||
// Android native hls does not seek correctly
|
// Android native hls does not seek correctly
|
||||||
const USE_NATIVE_HLS = !isAndroid;
|
const USE_NATIVE_HLS = false;
|
||||||
const HLS_MIME_TYPE = "application/vnd.apple.mpegurl" as const;
|
const HLS_MIME_TYPE = "application/vnd.apple.mpegurl" as const;
|
||||||
const unsupportedErrorCodes = [
|
const unsupportedErrorCodes = [
|
||||||
MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
|
MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
|
||||||
|
|||||||
@ -111,7 +111,7 @@ export default function DynamicVideoPlayer({
|
|||||||
const [loadingTimeout, setLoadingTimeout] = useState<NodeJS.Timeout>();
|
const [loadingTimeout, setLoadingTimeout] = useState<NodeJS.Timeout>();
|
||||||
const [source, setSource] = useState<HlsSource>({
|
const [source, setSource] = useState<HlsSource>({
|
||||||
playlist: `${apiHost}vod/${camera}/start/${timeRange.after}/end/${timeRange.before}/master.m3u8`,
|
playlist: `${apiHost}vod/${camera}/start/${timeRange.after}/end/${timeRange.before}/master.m3u8`,
|
||||||
startPosition: startTimestamp ? timeRange.after - startTimestamp : 0,
|
startPosition: startTimestamp ? startTimestamp - timeRange.after : 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
// start at correct time
|
// start at correct time
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import EnrichmentsSettingsView from "@/views/settings/EnrichmentsSettingsView";
|
|||||||
import UiSettingsView from "@/views/settings/UiSettingsView";
|
import UiSettingsView from "@/views/settings/UiSettingsView";
|
||||||
import FrigatePlusSettingsView from "@/views/settings/FrigatePlusSettingsView";
|
import FrigatePlusSettingsView from "@/views/settings/FrigatePlusSettingsView";
|
||||||
import { useSearchEffect } from "@/hooks/use-overlay-state";
|
import { useSearchEffect } from "@/hooks/use-overlay-state";
|
||||||
|
import { usePersistence } from "@/hooks/use-persistence";
|
||||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||||
import { useInitialCameraState } from "@/api/ws";
|
import { useInitialCameraState } from "@/api/ws";
|
||||||
import { useIsAdmin } from "@/hooks/use-is-admin";
|
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||||
@ -207,7 +208,21 @@ export default function Settings() {
|
|||||||
.sort((aConf, bConf) => aConf.ui.order - bConf.ui.order);
|
.sort((aConf, bConf) => aConf.ui.order - bConf.ui.order);
|
||||||
}, [config]);
|
}, [config]);
|
||||||
|
|
||||||
const [selectedCamera, setSelectedCamera] = useState<string>("");
|
const [persistedCamera, setPersistedCamera] = usePersistence(
|
||||||
|
"selectedCamera",
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
const [selectedCamera, setSelectedCamera] = useState(persistedCamera);
|
||||||
|
useEffect(() => {
|
||||||
|
if (persistedCamera) {
|
||||||
|
setSelectedCamera(persistedCamera);
|
||||||
|
}
|
||||||
|
}, [persistedCamera]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedCamera) {
|
||||||
|
setPersistedCamera(selectedCamera);
|
||||||
|
}
|
||||||
|
}, [selectedCamera, setPersistedCamera]);
|
||||||
|
|
||||||
const { payload: allCameraStates } = useInitialCameraState(
|
const { payload: allCameraStates } = useInitialCameraState(
|
||||||
cameras.length > 0 ? cameras[0].name : "",
|
cameras.length > 0 ? cameras[0].name : "",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user