chore: add this for when I find media with tracks

This commit is contained in:
Adrian Castro
2024-02-15 12:03:43 +01:00
parent bbff23985b
commit bf19b1c8ed

View File

@@ -15,7 +15,7 @@ import { useLocalSearchParams, useRouter } from "expo-router";
import * as StatusBar from "expo-status-bar"; import * as StatusBar from "expo-status-bar";
import type { ScrapeMedia, Stream } from "@movie-web/provider-utils"; import type { ScrapeMedia, Stream } from "@movie-web/provider-utils";
import { findHighestQuality } from "@movie-web/provider-utils"; import { extractTracksFromHLS, findHighestQuality } from "@movie-web/provider-utils";
import type { ItemData } from "~/components/item/item"; import type { ItemData } from "~/components/item/item";
import type { HeaderData } from "~/components/player/Header"; import type { HeaderData } from "~/components/player/Header";
@@ -166,6 +166,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({ data }) => {
let highestQuality; let highestQuality;
let url; let url;
let tracks;
switch (stream.type) { switch (stream.type) {
case "file": case "file":
@@ -174,13 +175,12 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({ data }) => {
return url ?? null; return url ?? null;
case "hls": case "hls":
url = stream.playlist; url = stream.playlist;
tracks = await extractTracksFromHLS(url, { ...stream.preferredHeaders, ...stream.headers });
} }
// setTextTracks( if (tracks) {
// stream.captions && stream.captions.length > 0 console.log(tracks);
// ? convertCaptionsToTextTracks(stream.captions) }
// : [],
// );
setVideoSrc({ setVideoSrc({
uri: url, uri: url,