mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
tv shows work now
todo: fix subs on episodes
This commit is contained in:
parent
38c6b15f9e
commit
150b8de8e8
2 changed files with 10 additions and 11 deletions
|
@ -48,13 +48,13 @@ export function VideoElement({ streamUrl, loading, setProgress, videoRef, startT
|
||||||
|
|
||||||
if (!streamUrl.endsWith('.mp4')) {
|
if (!streamUrl.endsWith('.mp4')) {
|
||||||
return (
|
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}` } />) }
|
{ 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>
|
</video>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return (
|
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}` } />) }
|
{ 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" />
|
<source src={streamUrl} type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
|
@ -61,20 +61,17 @@ async function getVideoUrl(config) {
|
||||||
if (config.type === 'movie') {
|
if (config.type === 'movie') {
|
||||||
url = `${CORS_URL}/api/v1/security/movie-access?id_movie=${config.id}&token=1&sk=&step=1`;
|
url = `${CORS_URL}/api/v1/security/movie-access?id_movie=${config.id}&token=1&sk=&step=1`;
|
||||||
} else if (config.type === 'show') {
|
} 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, {
|
const data = await fetch(url, {
|
||||||
headers: { phpsessid },
|
headers: { phpsessid },
|
||||||
}).then((d) => d.json());
|
}).then((d) => d.json());
|
||||||
|
|
||||||
let subs;
|
const subs = data?.subtitles.filter((sub) => {
|
||||||
|
if (typeof sub.file === 'object') return false;
|
||||||
if (config.type === "show") {
|
return true;
|
||||||
subs = await getEpisodeSubs(config);
|
})
|
||||||
} else if (config.type === "movie") {
|
|
||||||
subs = data?.data?.subtitles;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find video URL and return it (with a check for a full url if needed)
|
// Find video URL and return it (with a check for a full url if needed)
|
||||||
const opts = ["1080p", "1080", "720p", "720", "480p", "480", "auto"];
|
const opts = ["1080p", "1080", "720p", "720", "480p", "480", "auto"];
|
||||||
|
@ -86,9 +83,11 @@ async function getVideoUrl(config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(subs);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
videoUrl: videoUrl.startsWith("/") ? `${BASE_URL}${videoUrl}` : videoUrl,
|
videoUrl: videoUrl.startsWith("/") ? `${BASE_URL}${videoUrl}` : videoUrl,
|
||||||
subs,
|
subs: subs,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue