From beb9b83ff57f0afda081bc794c24579bab1ba27b Mon Sep 17 00:00:00 2001 From: tapframe Date: Wed, 13 Aug 2025 12:56:37 +0530 Subject: [PATCH] small ui changes for player --- src/components/player/AndroidVideoPlayer.tsx | 31 ++++++++++++++++---- src/components/player/VideoPlayer.tsx | 30 +++++++++++++++---- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index df8a6b3f..f5027245 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -200,7 +200,7 @@ const AndroidVideoPlayer: React.FC = () => { const shouldLoadMetadata = Boolean(id && type); const metadataResult = useMetadata({ id: id || 'placeholder', type: (type as any) }); const { settings: appSettings } = useSettings(); - const { metadata, loading: metadataLoading } = shouldLoadMetadata ? metadataResult : { metadata: null, loading: false }; + const { metadata, loading: metadataLoading, groupedEpisodes } = shouldLoadMetadata ? (metadataResult as any) : { metadata: null, loading: false, groupedEpisodes: {} }; // Logo animation values const logoScaleAnim = useRef(new Animated.Value(0.8)).current; @@ -209,6 +209,25 @@ const AndroidVideoPlayer: React.FC = () => { // Check if we have a logo to show const hasLogo = metadata && metadata.logo && !metadataLoading; + + // Resolve current episode description for series + const currentEpisodeDescription = (() => { + try { + if ((type as any) !== 'series') return ''; + const allEpisodes = Object.values(groupedEpisodes || {}).flat() as any[]; + if (!allEpisodes || allEpisodes.length === 0) return ''; + let match: any | null = null; + if (episodeId) { + match = allEpisodes.find(ep => ep?.stremioId === episodeId || String(ep?.id) === String(episodeId)); + } + if (!match && season && episode) { + match = allEpisodes.find(ep => ep?.season_number === season && ep?.episode_number === episode); + } + return (match?.overview || '').trim(); + } catch { + return ''; + } + })(); // Small offset (in seconds) used to avoid seeking to the *exact* end of the // file which triggers the `onEnd` callback and causes playback to restart. @@ -1694,9 +1713,9 @@ const AndroidVideoPlayer: React.FC = () => { /> You're watching @@ -1713,9 +1732,9 @@ const AndroidVideoPlayer: React.FC = () => { {episodeTitle} )} - {!!metadata?.description && ( + {(currentEpisodeDescription || metadata?.description) && ( - {metadata.description} + {(type as any) === 'series' ? (currentEpisodeDescription || metadata?.description || '') : (metadata?.description || '')} )} diff --git a/src/components/player/VideoPlayer.tsx b/src/components/player/VideoPlayer.tsx index a623f5d2..f96e5aba 100644 --- a/src/components/player/VideoPlayer.tsx +++ b/src/components/player/VideoPlayer.tsx @@ -223,7 +223,7 @@ const VideoPlayer: React.FC = () => { id: id || 'placeholder', type: type || 'movie' }); - const { metadata, loading: metadataLoading } = shouldLoadMetadata ? metadataResult : { metadata: null, loading: false }; + const { metadata, loading: metadataLoading, groupedEpisodes } = shouldLoadMetadata ? (metadataResult as any) : { metadata: null, loading: false, groupedEpisodes: {} }; const { settings } = useSettings(); // Logo animation values @@ -233,6 +233,24 @@ const VideoPlayer: React.FC = () => { // Check if we have a logo to show const hasLogo = metadata && metadata.logo && !metadataLoading; + // Resolve current episode description for series + const currentEpisodeDescription = (() => { + try { + if (type !== 'series') return ''; + const allEpisodes = Object.values(groupedEpisodes || {}).flat() as any[]; + if (!allEpisodes || allEpisodes.length === 0) return ''; + let match: any | null = null; + if (episodeId) { + match = allEpisodes.find(ep => ep?.stremioId === episodeId || String(ep?.id) === String(episodeId)); + } + if (!match && season && episode) { + match = allEpisodes.find(ep => ep?.season_number === season && ep?.episode_number === episode); + } + return (match?.overview || '').trim(); + } catch { + return ''; + } + })(); // Small offset (in seconds) used to avoid seeking to the *exact* end of the // file which triggers the `onEnd` callback and causes playback to restart. @@ -1616,9 +1634,9 @@ const VideoPlayer: React.FC = () => { /> You're watching @@ -1635,9 +1653,9 @@ const VideoPlayer: React.FC = () => { {episodeTitle} )} - {!!metadata?.description && ( + {(currentEpisodeDescription || metadata?.description) && ( - {metadata.description} + {type === 'series' ? (currentEpisodeDescription || metadata?.description || '') : (metadata?.description || '')} )}