mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
introduce store with idle tracking
This commit is contained in:
25
apps/expo/src/stores/player/slices/video.ts
Normal file
25
apps/expo/src/stores/player/slices/video.ts
Normal 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;
|
||||
});
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user