mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-28 06:39:01 +03:00
Support timezones (#11434)
* Handle offset timezones * Fix previews loading * Cleanup * remove unused
This commit is contained in:
@@ -12,6 +12,7 @@ import ActivityIndicator from "@/components/indicators/activity-indicator";
|
||||
import { VideoResolutionType } from "@/types/live";
|
||||
import axios from "axios";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getUTCOffset } from "@/utils/dateUtil";
|
||||
|
||||
/**
|
||||
* Dynamically switches between video playback and scrubbing preview player.
|
||||
@@ -148,9 +149,12 @@ export default function DynamicVideoPlayer({
|
||||
// state of playback player
|
||||
|
||||
const recordingParams = useMemo(() => {
|
||||
const timeRangeOffset =
|
||||
(getUTCOffset(new Date(timeRange.before * 1000)) % 60) * 60;
|
||||
|
||||
return {
|
||||
before: timeRange.before,
|
||||
after: timeRange.after,
|
||||
before: timeRange.before + timeRangeOffset,
|
||||
after: timeRange.after + timeRangeOffset,
|
||||
};
|
||||
}, [timeRange]);
|
||||
const { data: recordings } = useSWR<Recording[]>(
|
||||
@@ -168,7 +172,7 @@ export default function DynamicVideoPlayer({
|
||||
}
|
||||
|
||||
setSource(
|
||||
`${apiHost}vod/${camera}/start/${timeRange.after}/end/${timeRange.before}/master.m3u8`,
|
||||
`${apiHost}vod/${camera}/start/${recordingParams.after}/end/${recordingParams.before}/master.m3u8`,
|
||||
);
|
||||
setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user