mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix(MetaDetails): handle search for any episode and season
This commit is contained in:
parent
5e98355896
commit
6b30b90893
1 changed files with 5 additions and 10 deletions
|
|
@ -77,16 +77,11 @@ const MetaDetails = ({ urlParams, queryParams }) => {
|
|||
setSeason(event.value);
|
||||
}, [setSeason]);
|
||||
const handleEpisodeSearch = React.useCallback((season, episode) => {
|
||||
const searchVideoId = streamPath.id.replace(/(:\d+:\d+)$/, `:${season}:${episode}`);
|
||||
const videoFound = metaDetails.metaItem.content.content.videos.find((video) => video.id === searchVideoId);
|
||||
if (videoFound) {
|
||||
if (typeof videoFound.deepLinks.player === 'string') {
|
||||
window.location = videoFound.deepLinks.player;
|
||||
} else if (typeof videoFound.deepLinks.metaDetailsStreams === 'string') {
|
||||
window.location.replace(videoFound.deepLinks.metaDetailsStreams);
|
||||
}
|
||||
}
|
||||
}, [streamPath, metaDetails.metaItem]);
|
||||
const searchVideoHash = encodeURIComponent(`${urlParams.id}:${season}:${episode}`);
|
||||
const url = window.location.hash;
|
||||
const searchVideoPath = url.replace(encodeURIComponent(urlParams.videoId), searchVideoHash);
|
||||
window.location = searchVideoPath;
|
||||
}, [urlParams, window.location]);
|
||||
|
||||
const renderBackgroundImageFallback = React.useCallback(() => null, []);
|
||||
const renderBackground = React.useMemo(() => !!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue