mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-20 16:22:04 +00:00
cast modal fix
This commit is contained in:
parent
e98012862c
commit
73b56bad4b
2 changed files with 26 additions and 2 deletions
|
|
@ -162,6 +162,7 @@ const VideoPlayer: React.FC = () => {
|
||||||
const seekDebounceTimer = useRef<NodeJS.Timeout | null>(null);
|
const seekDebounceTimer = useRef<NodeJS.Timeout | null>(null);
|
||||||
const pendingSeekValue = useRef<number | null>(null);
|
const pendingSeekValue = useRef<number | null>(null);
|
||||||
const lastSeekTime = useRef<number>(0);
|
const lastSeekTime = useRef<number>(0);
|
||||||
|
const wasPlayingBeforeDragRef = useRef<boolean>(false);
|
||||||
const [isVideoLoaded, setIsVideoLoaded] = useState(false);
|
const [isVideoLoaded, setIsVideoLoaded] = useState(false);
|
||||||
const [videoAspectRatio, setVideoAspectRatio] = useState<number | null>(null);
|
const [videoAspectRatio, setVideoAspectRatio] = useState<number | null>(null);
|
||||||
const [is16by9Content, setIs16by9Content] = useState(false);
|
const [is16by9Content, setIs16by9Content] = useState(false);
|
||||||
|
|
@ -843,6 +844,8 @@ const VideoPlayer: React.FC = () => {
|
||||||
|
|
||||||
const handleSlidingStart = () => {
|
const handleSlidingStart = () => {
|
||||||
setIsDragging(true);
|
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
|
// Keep controls visible while dragging and cancel any hide timeout
|
||||||
if (!showControls) setShowControls(true);
|
if (!showControls) setShowControls(true);
|
||||||
if (controlsTimeout.current) {
|
if (controlsTimeout.current) {
|
||||||
|
|
@ -856,6 +859,14 @@ const VideoPlayer: React.FC = () => {
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
const seekTime = Math.min(value, duration - END_EPSILON);
|
const seekTime = Math.min(value, duration - END_EPSILON);
|
||||||
seekToTime(seekTime);
|
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;
|
pendingSeekValue.current = null;
|
||||||
}
|
}
|
||||||
// Restart auto-hide timer after interaction finishes
|
// Restart auto-hide timer after interaction finishes
|
||||||
|
|
@ -905,6 +916,14 @@ const VideoPlayer: React.FC = () => {
|
||||||
completeOpeningAnimation();
|
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)
|
// Periodic check for disabled audio track (every 3 seconds, max 3 attempts)
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now - lastAudioTrackCheck > 3000 && !paused && duration > 0 && audioTrackFallbackAttempts < 3) {
|
if (now - lastAudioTrackCheck > 3000 && !paused && duration > 0 && audioTrackFallbackAttempts < 3) {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import {
|
||||||
Dimensions,
|
Dimensions,
|
||||||
Platform,
|
Platform,
|
||||||
Alert,
|
Alert,
|
||||||
|
FlatList,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { FlashList } from '@shopify/flash-list';
|
|
||||||
import { MaterialIcons } from '@expo/vector-icons';
|
import { MaterialIcons } from '@expo/vector-icons';
|
||||||
import { Image } from 'expo-image';
|
import { Image } from 'expo-image';
|
||||||
import Animated, {
|
import Animated, {
|
||||||
|
|
@ -352,6 +352,7 @@ const CastMoviesScreen: React.FC = () => {
|
||||||
style={{
|
style={{
|
||||||
width: posterWidth,
|
width: posterWidth,
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
|
marginRight: (index + 1) % numColumns === 0 ? 0 : 12,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
|
@ -704,7 +705,7 @@ const CastMoviesScreen: React.FC = () => {
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<FlashList
|
<FlatList
|
||||||
data={displayedMovies}
|
data={displayedMovies}
|
||||||
renderItem={renderMovieItem}
|
renderItem={renderMovieItem}
|
||||||
keyExtractor={(item) => `${item.media_type}-${item.id}`}
|
keyExtractor={(item) => `${item.media_type}-${item.id}`}
|
||||||
|
|
@ -722,6 +723,10 @@ const CastMoviesScreen: React.FC = () => {
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
onEndReached={handleLoadMore}
|
onEndReached={handleLoadMore}
|
||||||
onEndReachedThreshold={0.8}
|
onEndReachedThreshold={0.8}
|
||||||
|
removeClippedSubviews={false}
|
||||||
|
initialNumToRender={30}
|
||||||
|
maxToRenderPerBatch={20}
|
||||||
|
windowSize={7}
|
||||||
ListFooterComponent={
|
ListFooterComponent={
|
||||||
displayLimit < filteredAndSortedMovies.length ? (
|
displayLimit < filteredAndSortedMovies.length ? (
|
||||||
<View style={{
|
<View style={{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue