introduce store with idle tracking

This commit is contained in:
Jorrin
2024-02-12 16:11:35 +01:00
parent 3d1a5a88f2
commit 094c0382a6
12 changed files with 234 additions and 176 deletions

View File

@@ -0,0 +1,25 @@
import type { AVPlaybackStatus, Video } from "expo-av";
import type { MakeSlice } from "./types";
export interface VideoSlice {
videoRef: Video | null;
status: AVPlaybackStatus | null;
setVideoRef(ref: Video | null): void;
setStatus(status: AVPlaybackStatus | null): void;
}
export const createVideoSlice: MakeSlice<VideoSlice> = (set) => ({
videoRef: null,
status: null,
setVideoRef: (ref) => {
set({ videoRef: ref });
},
setStatus: (status) => {
set((s) => {
s.status = status;
});
},
});