diff --git a/src/components/player/VideoPlayer.tsx b/src/components/player/VideoPlayer.tsx index e033b13..2df3e6b 100644 --- a/src/components/player/VideoPlayer.tsx +++ b/src/components/player/VideoPlayer.tsx @@ -162,6 +162,7 @@ const VideoPlayer: React.FC = () => { const seekDebounceTimer = useRef(null); const pendingSeekValue = useRef(null); const lastSeekTime = useRef(0); + const wasPlayingBeforeDragRef = useRef(false); const [isVideoLoaded, setIsVideoLoaded] = useState(false); const [videoAspectRatio, setVideoAspectRatio] = useState(null); const [is16by9Content, setIs16by9Content] = useState(false); @@ -843,6 +844,8 @@ const VideoPlayer: React.FC = () => { const handleSlidingStart = () => { setIsDragging(true); + // Remember if we were playing before the user started dragging + wasPlayingBeforeDragRef.current = !paused; // Keep controls visible while dragging and cancel any hide timeout if (!showControls) setShowControls(true); if (controlsTimeout.current) { @@ -856,6 +859,14 @@ const VideoPlayer: React.FC = () => { if (duration > 0) { const seekTime = Math.min(value, duration - END_EPSILON); seekToTime(seekTime); + // If the video was playing before the drag, ensure we remain in playing state after the seek + if (wasPlayingBeforeDragRef.current) { + setTimeout(() => { + if (isMounted.current) { + setPaused(false); + } + }, 350); + } pendingSeekValue.current = null; } // Restart auto-hide timer after interaction finishes @@ -905,6 +916,14 @@ const VideoPlayer: React.FC = () => { completeOpeningAnimation(); } + // If time is advancing right after seek and we previously intended to play, + // ensure paused state is false to keep UI in sync + if (wasPlayingBeforeDragRef.current && paused && !isDragging) { + setPaused(false); + // Reset the intent once corrected + wasPlayingBeforeDragRef.current = false; + } + // Periodic check for disabled audio track (every 3 seconds, max 3 attempts) const now = Date.now(); if (now - lastAudioTrackCheck > 3000 && !paused && duration > 0 && audioTrackFallbackAttempts < 3) { diff --git a/src/screens/CastMoviesScreen.tsx b/src/screens/CastMoviesScreen.tsx index 7cc2d3c..e74862b 100644 --- a/src/screens/CastMoviesScreen.tsx +++ b/src/screens/CastMoviesScreen.tsx @@ -8,8 +8,8 @@ import { Dimensions, Platform, Alert, + FlatList, } from 'react-native'; -import { FlashList } from '@shopify/flash-list'; import { MaterialIcons } from '@expo/vector-icons'; import { Image } from 'expo-image'; import Animated, { @@ -352,6 +352,7 @@ const CastMoviesScreen: React.FC = () => { style={{ width: posterWidth, marginBottom: 20, + marginRight: (index + 1) % numColumns === 0 ? 0 : 12, }} > { ) : ( - `${item.media_type}-${item.id}`} @@ -722,6 +723,10 @@ const CastMoviesScreen: React.FC = () => { showsVerticalScrollIndicator={false} onEndReached={handleLoadMore} onEndReachedThreshold={0.8} + removeClippedSubviews={false} + initialNumToRender={30} + maxToRenderPerBatch={20} + windowSize={7} ListFooterComponent={ displayLimit < filteredAndSortedMovies.length ? (