feat: autoplay

This commit is contained in:
Adrian Castro
2024-03-25 20:20:07 +01:00
parent 37e61d1296
commit 0aa9c9d8f7
5 changed files with 134 additions and 43 deletions

View File

@@ -1,8 +1,6 @@
import type { AVPlaybackSourceObject, AVPlaybackStatus, Video } from "expo-av";
import type { Asset } from "expo-media-library";
import type { ScrapeMedia } from "@movie-web/provider-utils";
import type { MakeSlice } from "./types";
import { PlayerStatus } from "./interface";
@@ -43,30 +41,6 @@ export interface VideoSlice {
resetVideo(): void;
}
export const convertMetaToScrapeMedia = (meta: PlayerMeta): ScrapeMedia => {
if (meta.type === "movie") {
return {
title: meta.title,
releaseYear: meta.releaseYear,
type: "movie",
tmdbId: meta.tmdbId,
imdbId: meta.imdbId,
};
}
if (meta.type === "show") {
return {
title: meta.title,
releaseYear: meta.releaseYear,
type: "show",
tmdbId: meta.tmdbId,
season: meta.season!,
episode: meta.episode!,
imdbId: meta.imdbId,
};
}
throw new Error("Invalid meta type");
};
export const createVideoSlice: MakeSlice<VideoSlice> = (set) => ({
videoRef: null,
videoSrc: null,