mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-13 08:15:06 +01:00
tv shows work now
todo: fix subs on episodes
This commit is contained in:
parent
38c6b15f9e
commit
150b8de8e8
@ -48,13 +48,13 @@ export function VideoElement({ streamUrl, loading, setProgress, videoRef, startT
|
||||
|
||||
if (!streamUrl.endsWith('.mp4')) {
|
||||
return (
|
||||
<video crossorigin="anonymous" className="videoElement" ref={videoRef} controls autoPlay onProgress={setProgress} onLoadedData={onLoad}>
|
||||
<video crossOrigin="anonymous" className="videoElement" ref={videoRef} controls autoPlay onProgress={setProgress} onLoadedData={onLoad}>
|
||||
{ streamData.subtitles && streamData.subtitles.map((sub, index) => <track key={index} kind="captions" label={sub.language} src={`${process.env.REACT_APP_CORS_PROXY_URL}https://lookmovie.io${sub.file}` } />) }
|
||||
</video>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<video crossorigin="anonymous" className="videoElement" ref={videoRef} controls autoPlay onProgress={setProgress} onLoadedData={onLoad}>
|
||||
<video crossOrigin="anonymous" className="videoElement" ref={videoRef} controls autoPlay onProgress={setProgress} onLoadedData={onLoad}>
|
||||
{ streamData.subtitles && streamData.subtitles.map((sub, index) => <track key={index} kind="captions" label={sub.language} src={`${process.env.REACT_APP_CORS_PROXY_URL}https://lookmovie.io${sub.file}` } />) }
|
||||
<source src={streamUrl} type="video/mp4" />
|
||||
</video>
|
||||
|
@ -61,20 +61,17 @@ async function getVideoUrl(config) {
|
||||
if (config.type === 'movie') {
|
||||
url = `${CORS_URL}/api/v1/security/movie-access?id_movie=${config.id}&token=1&sk=&step=1`;
|
||||
} else if (config.type === 'show') {
|
||||
url = `${CORS_URL}/api/v1/security/show-access?slug=${config.slug}&token=&step=2`;
|
||||
url = `${CORS_URL}/api/v1/security/episode-access?id_episode=${config.id}`;
|
||||
}
|
||||
|
||||
const data = await fetch(url, {
|
||||
headers: { phpsessid },
|
||||
}).then((d) => d.json());
|
||||
|
||||
let subs;
|
||||
|
||||
if (config.type === "show") {
|
||||
subs = await getEpisodeSubs(config);
|
||||
} else if (config.type === "movie") {
|
||||
subs = data?.data?.subtitles;
|
||||
}
|
||||
const subs = data?.subtitles.filter((sub) => {
|
||||
if (typeof sub.file === 'object') return false;
|
||||
return true;
|
||||
})
|
||||
|
||||
// Find video URL and return it (with a check for a full url if needed)
|
||||
const opts = ["1080p", "1080", "720p", "720", "480p", "480", "auto"];
|
||||
@ -86,9 +83,11 @@ async function getVideoUrl(config) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(subs);
|
||||
|
||||
return {
|
||||
videoUrl: videoUrl.startsWith("/") ? `${BASE_URL}${videoUrl}` : videoUrl,
|
||||
subs,
|
||||
subs: subs,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user