imrpoved android videoplayer logic

This commit is contained in:
tapframe 2025-09-12 23:09:38 +05:30
parent fa03d4455f
commit 67648ea6db
2 changed files with 7 additions and 5 deletions

View file

@ -647,7 +647,7 @@ const AndroidVideoPlayer: React.FC = () => {
const handleSliderValueChange = (value: number) => {
if (isDragging && duration > 0) {
const seekTime = Math.min(value, duration - END_EPSILON);
setCurrentTime(seekTime);
pendingSeekValue.current = seekTime;
}
};

View file

@ -5,6 +5,7 @@ import { LinearGradient } from 'expo-linear-gradient';
import Slider from '@react-native-community/slider';
import { styles } from '../utils/playerStyles';
import { getTrackDisplayName } from '../utils/playerUtils';
import { useTheme } from '../../../contexts/ThemeContext';
interface PlayerControlsProps {
showControls: boolean;
@ -74,6 +75,7 @@ export const PlayerControls: React.FC<PlayerControlsProps> = ({
buffered,
formatTime,
}) => {
const { currentTheme } = useTheme();
return (
<Animated.View
style={[StyleSheet.absoluteFill, { opacity: fadeAnim }]}
@ -93,12 +95,12 @@ export const PlayerControls: React.FC<PlayerControlsProps> = ({
onValueChange={onSliderValueChange}
onSlidingStart={onSlidingStart}
onSlidingComplete={onSlidingComplete}
minimumTrackTintColor="#FFFFFF"
maximumTrackTintColor="rgba(255, 255, 255, 0.3)"
thumbTintColor={Platform.OS === 'android' ? '#FFFFFF' : undefined}
minimumTrackTintColor={currentTheme.colors.primary}
maximumTrackTintColor={currentTheme.colors.mediumEmphasis}
thumbTintColor={Platform.OS === 'android' ? currentTheme.colors.white : undefined}
tapToSeek={Platform.OS === 'ios'}
/>
<View style={styles.timeDisplay}>
<View style={[styles.timeDisplay, { paddingHorizontal: 14 }]}>
<Text style={styles.duration}>{formatTime(currentTime)}</Text>
<Text style={styles.duration}>{formatTime(duration)}</Text>
</View>