mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
feat: play downloads
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { AVPlaybackStatus, Video } from "expo-av";
|
||||
import type { Asset } from "expo-media-library";
|
||||
|
||||
import type { ScrapeMedia } from "@movie-web/provider-utils";
|
||||
|
||||
@@ -31,10 +32,12 @@ export interface VideoSlice {
|
||||
videoRef: Video | null;
|
||||
status: AVPlaybackStatus | null;
|
||||
meta: PlayerMeta | null;
|
||||
asset: Asset | null;
|
||||
|
||||
setVideoRef(ref: Video | null): void;
|
||||
setStatus(status: AVPlaybackStatus | null): void;
|
||||
setMeta(meta: PlayerMeta | null): void;
|
||||
setAsset(asset: Asset | null): void;
|
||||
resetVideo(): void;
|
||||
}
|
||||
|
||||
@@ -66,6 +69,7 @@ export const createVideoSlice: MakeSlice<VideoSlice> = (set) => ({
|
||||
videoRef: null,
|
||||
status: null,
|
||||
meta: null,
|
||||
asset: null,
|
||||
|
||||
setVideoRef: (ref) => {
|
||||
set({ videoRef: ref });
|
||||
@@ -81,8 +85,13 @@ export const createVideoSlice: MakeSlice<VideoSlice> = (set) => ({
|
||||
s.meta = meta;
|
||||
});
|
||||
},
|
||||
setAsset: (asset) => {
|
||||
set((s) => {
|
||||
s.asset = asset;
|
||||
});
|
||||
},
|
||||
resetVideo() {
|
||||
set({ videoRef: null, status: null, meta: null });
|
||||
set({ videoRef: null, status: null, meta: null, asset: null });
|
||||
set((s) => {
|
||||
s.interface.playerStatus = PlayerStatus.SCRAPING;
|
||||
});
|
||||
|
Reference in New Issue
Block a user