small ui changes for player

This commit is contained in:
tapframe 2025-08-13 12:56:37 +05:30
parent 7a172f03d4
commit beb9b83ff5
2 changed files with 49 additions and 12 deletions

View file

@ -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 = () => {
/>
<Animated.View style={{
position: 'absolute',
left: 24 + (Platform.OS === 'ios' ? insets.left : 0),
right: 24 + (Platform.OS === 'ios' ? insets.right : 0),
bottom: 110 + (Platform.OS === 'ios' ? insets.bottom : 0),
left: 24 + insets.left,
right: 24 + insets.right,
bottom: 110 + insets.bottom,
transform: [{ translateY: pauseOverlayTranslateY }]
}}>
<Text style={{ color: '#B8B8B8', fontSize: 18, marginBottom: 8 }}>You're watching</Text>
@ -1713,9 +1732,9 @@ const AndroidVideoPlayer: React.FC = () => {
{episodeTitle}
</Text>
)}
{!!metadata?.description && (
{(currentEpisodeDescription || metadata?.description) && (
<Text style={{ color: '#D6D6D6', fontSize: 18, lineHeight: 24 }} numberOfLines={3}>
{metadata.description}
{(type as any) === 'series' ? (currentEpisodeDescription || metadata?.description || '') : (metadata?.description || '')}
</Text>
)}
</Animated.View>

View file

@ -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 = () => {
/>
<Animated.View style={{
position: 'absolute',
left: 24 + (Platform.OS === 'ios' ? insets.left : 0),
right: 24 + (Platform.OS === 'ios' ? insets.right : 0),
bottom: 110 + (Platform.OS === 'ios' ? insets.bottom : 0),
left: 24 + insets.left,
right: 24 + insets.right,
bottom: 110 + insets.bottom,
transform: [{ translateY: pauseOverlayTranslateY }]
}}>
<Text style={{ color: '#B8B8B8', fontSize: 18, marginBottom: 8 }}>You're watching</Text>
@ -1635,9 +1653,9 @@ const VideoPlayer: React.FC = () => {
{episodeTitle}
</Text>
)}
{!!metadata?.description && (
{(currentEpisodeDescription || metadata?.description) && (
<Text style={{ color: '#D6D6D6', fontSize: 18, lineHeight: 24 }} numberOfLines={3}>
{metadata.description}
{type === 'series' ? (currentEpisodeDescription || metadata?.description || '') : (metadata?.description || '')}
</Text>
)}
</Animated.View>