mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Add special casing for android preview scrubbing (#10398)
* Add special casing for android scrubbing * Fix motion data
This commit is contained in:
parent
483a95b06b
commit
8c0275fe2f
@ -12,6 +12,7 @@ import { Preview } from "@/types/preview";
|
|||||||
import { PreviewPlayback } from "@/types/playback";
|
import { PreviewPlayback } from "@/types/playback";
|
||||||
import { isCurrentHour } from "@/utils/dateUtil";
|
import { isCurrentHour } from "@/utils/dateUtil";
|
||||||
import { baseUrl } from "@/api/baseUrl";
|
import { baseUrl } from "@/api/baseUrl";
|
||||||
|
import { isAndroid } from "react-device-detect";
|
||||||
|
|
||||||
type PreviewPlayerProps = {
|
type PreviewPlayerProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -235,7 +236,7 @@ class PreviewVideoController extends PreviewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override scrubToTimestamp(time: number): boolean {
|
override scrubToTimestamp(time: number): boolean {
|
||||||
if (!this.preview || !this.timeRange) {
|
if (!this.previewRef.current || !this.preview || !this.timeRange) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,14 +247,12 @@ class PreviewVideoController extends PreviewController {
|
|||||||
if (this.seeking) {
|
if (this.seeking) {
|
||||||
this.timeToSeek = time;
|
this.timeToSeek = time;
|
||||||
} else {
|
} else {
|
||||||
if (this.previewRef.current) {
|
|
||||||
this.previewRef.current.currentTime = Math.max(
|
this.previewRef.current.currentTime = Math.max(
|
||||||
0,
|
0,
|
||||||
time - this.preview.start,
|
time - this.preview.start,
|
||||||
);
|
);
|
||||||
this.seeking = true;
|
this.seeking = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -263,12 +262,25 @@ class PreviewVideoController extends PreviewController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.timeToSeek) {
|
||||||
if (
|
if (
|
||||||
this.timeToSeek &&
|
Math.round(this.previewRef.current.currentTime + this.preview.start) !=
|
||||||
this.timeToSeek != this.previewRef.current?.currentTime
|
Math.round(this.timeToSeek)
|
||||||
) {
|
) {
|
||||||
|
if (isAndroid) {
|
||||||
|
const currentTs =
|
||||||
|
this.previewRef.current.currentTime + this.preview.start;
|
||||||
|
this.previewRef.current.currentTime =
|
||||||
|
this.previewRef.current.currentTime +
|
||||||
|
(this.timeToSeek - currentTs) / 2;
|
||||||
|
} else {
|
||||||
this.previewRef.current.currentTime =
|
this.previewRef.current.currentTime =
|
||||||
this.timeToSeek - this.preview.start;
|
this.timeToSeek - this.preview.start;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.seeking = false;
|
||||||
|
this.timeToSeek = undefined;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.seeking = false;
|
this.seeking = false;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ export function DesktopRecordingView({
|
|||||||
const { data: motionData } = useSWR<MotionData[]>(
|
const { data: motionData } = useSWR<MotionData[]>(
|
||||||
severity == "significant_motion"
|
severity == "significant_motion"
|
||||||
? [
|
? [
|
||||||
"review/activity",
|
"review/activity/motion",
|
||||||
{
|
{
|
||||||
before: timeRange.end,
|
before: timeRange.end,
|
||||||
after: timeRange.start,
|
after: timeRange.start,
|
||||||
@ -351,7 +351,7 @@ export function MobileRecordingView({
|
|||||||
const { data: motionData } = useSWR<MotionData[]>(
|
const { data: motionData } = useSWR<MotionData[]>(
|
||||||
severity == "significant_motion"
|
severity == "significant_motion"
|
||||||
? [
|
? [
|
||||||
"review/activity",
|
"review/activity/motion",
|
||||||
{
|
{
|
||||||
before: timeRange.end,
|
before: timeRange.end,
|
||||||
after: timeRange.start,
|
after: timeRange.start,
|
||||||
|
Loading…
Reference in New Issue
Block a user