-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6efb536
commit f4e192e
Showing
10 changed files
with
244 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Video from 'react-native-video'; | ||
|
||
export const VideoPlayer = ({ | ||
videoURI, | ||
isPaused = true, | ||
}: { | ||
videoURI: string; | ||
isPaused?: boolean; | ||
}) => { | ||
return ( | ||
<Video | ||
className="w-full h-full rounded-md" | ||
paused={isPaused} | ||
bufferConfig={{minBufferMs: 1000}} | ||
fullscreen={true} | ||
pictureInPicture={true} | ||
controls | ||
source={{uri: videoURI}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export * from './hooks/useCameraEvents'; | ||
export * from './hooks/useConfig'; | ||
export * from './getLatestCameraFrame'; | ||
|
||
//? Types | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export interface FrigateEvent { | ||
//? Unsure what the non null types should be here | ||
area: null | any; | ||
box: null | any; | ||
plus_id: null | any; | ||
false_positive: null | any; | ||
ratio: null | any; | ||
camera: string; | ||
end_time: number; | ||
has_clip: boolean; | ||
has_snapshot: boolean; | ||
id: string; | ||
label: string; | ||
region: null | string; | ||
retain_indefinitely: boolean; | ||
start_time: number; | ||
sub_label: null | string; | ||
thumbnail: string; | ||
top_score: number; | ||
zones?: string[]; | ||
snapshotURL?: string; | ||
vodURL: string; | ||
} | ||
|
||
export interface CameraEventParams extends Record<string, string | undefined> { | ||
before?: string; | ||
after?: string; | ||
cameras?: string; | ||
labels?: string; | ||
zones?: string; | ||
limit?: string; | ||
has_snapshot?: string; | ||
has_clip?: string; | ||
include_thumbnails?: string; | ||
in_progress?: string; | ||
} | ||
|
||
export interface SnapshotQueryParams | ||
extends Record<string, string | undefined> { | ||
h?: string; | ||
bbox?: string; | ||
timestamp?: string; | ||
crop?: string; | ||
quality?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './config'; | ||
export * from './events'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {ViewProps} from 'react-native'; | ||
|
||
import {FrigateEvent} from '@api'; | ||
import {BaseText, BaseView} from '@components'; | ||
import {toTitleCase} from '@utils'; | ||
|
||
const Row = (props: ViewProps) => ( | ||
<BaseView | ||
className="flex-row justify-between mx-6 px-2 py-1 rounded-sm my-[2px] border border-accent dark:border-accent-dark" | ||
{...props} | ||
/> | ||
); | ||
|
||
export const EventDetails = ({camEvent}: {camEvent: FrigateEvent}) => { | ||
const startDate = new Date(camEvent.start_time * 1000); | ||
const endDate = new Date(camEvent.end_time * 1000); | ||
// TODO: format minutes here too. | ||
const eventDuration = Math.round(camEvent.end_time - camEvent.start_time); | ||
|
||
return ( | ||
<BaseView className="flex-1"> | ||
<BaseText className="self-center text-lg mb-1">Event Details</BaseText> | ||
<Row> | ||
<BaseText>Start Time</BaseText> | ||
<BaseText> | ||
{startDate.toLocaleDateString() + | ||
' @ ' + | ||
startDate.toLocaleTimeString()} | ||
</BaseText> | ||
</Row> | ||
<Row> | ||
<BaseText>End Time</BaseText> | ||
<BaseText> | ||
{endDate.toLocaleDateString() + ' @ ' + endDate.toLocaleTimeString()} | ||
</BaseText> | ||
</Row> | ||
<Row> | ||
<BaseText>Event Duration</BaseText> | ||
<BaseText>{eventDuration} seconds</BaseText> | ||
</Row> | ||
<Row> | ||
<BaseText>Object Label</BaseText> | ||
<BaseText>{toTitleCase(camEvent.label)}</BaseText> | ||
</Row> | ||
<Row> | ||
<BaseText>Confidence</BaseText> | ||
<BaseText>{Math.round(camEvent.top_score * 10000) / 100}%</BaseText> | ||
</Row> | ||
{!!camEvent?.zones?.length && ( | ||
<Row> | ||
<BaseText>Zones</BaseText> | ||
<BaseText>LABEL</BaseText> | ||
</Row> | ||
)} | ||
{!!camEvent.region && ( | ||
<Row> | ||
<BaseText>Region</BaseText> | ||
<BaseText>LABEL</BaseText> | ||
</Row> | ||
)} | ||
</BaseView> | ||
); | ||
}; |