diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index ea5089ac..0051df6b 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -2968,7 +2968,7 @@ const AndroidVideoPlayer: React.FC = () => { duration={duration} zoomScale={zoomScale} currentResizeMode={resizeMode} - vlcAudioTracks={rnVideoAudioTracks} + ksAudioTracks={rnVideoAudioTracks} selectedAudioTrack={selectedAudioTrack?.type === SelectedTrackType.INDEX && selectedAudioTrack.value !== undefined ? Number(selectedAudioTrack.value) : null} availableStreams={availableStreams} togglePlayback={togglePlayback} @@ -3607,7 +3607,7 @@ const AndroidVideoPlayer: React.FC = () => { @@ -3620,7 +3620,7 @@ const AndroidVideoPlayer: React.FC = () => { isLoadingSubtitles={isLoadingSubtitles} customSubtitles={customSubtitles} availableSubtitles={availableSubtitles} - vlcTextTracks={rnVideoTextTracks} + ksTextTracks={rnVideoTextTracks} selectedTextTrack={selectedTextTrack} useCustomSubtitles={useCustomSubtitles} subtitleSize={subtitleSize} diff --git a/src/components/player/VideoPlayer.tsx b/src/components/player/VideoPlayer.tsx index 3e4322b8..61097ed0 100644 --- a/src/components/player/VideoPlayer.tsx +++ b/src/components/player/VideoPlayer.tsx @@ -51,9 +51,9 @@ const VideoPlayer: React.FC = () => { // Detect if stream is MKV format const isMkvFile = isMkvStream(uri, headers); - // Use AndroidVideoPlayer for Android devices - // Use KSPlayer for iOS devices - const shouldUseAndroidPlayer = Platform.OS === 'android'; + // Use AndroidVideoPlayer for Android devices and non-MKV files on iOS + // Use KSPlayer only for MKV files on iOS + const shouldUseAndroidPlayer = Platform.OS === 'android' || (Platform.OS === 'ios' && !isMkvFile); safeDebugLog("Player selection logic", { platform: Platform.OS, @@ -248,23 +248,6 @@ const VideoPlayer: React.FC = () => { const [brightness, setBrightness] = useState(1.0); const [showVolumeOverlay, setShowVolumeOverlay] = useState(false); const [showBrightnessOverlay, setShowBrightnessOverlay] = useState(false); - const [showKsVolumeWarning, setShowKsVolumeWarning] = useState(false); - const [hasShownKsWarning, setHasShownKsWarning] = useState(false); - - // Load KSPlayer warning state from storage - useEffect(() => { - const loadWarningState = async () => { - try { - const warningShown = await AsyncStorage.getItem('ks_volume_warning_shown'); - if (warningShown === 'true') { - setHasShownKsWarning(true); - } - } catch (error) { - // Ignore storage errors - } - }; - loadWarningState(); - }, []); const volumeOverlayOpacity = useRef(new Animated.Value(0)).current; const brightnessOverlayOpacity = useRef(new Animated.Value(0)).current; const volumeOverlayTimeout = useRef(null); @@ -426,20 +409,44 @@ const VideoPlayer: React.FC = () => { // Volume gesture handler (right side of screen) const onVolumeGestureEvent = async (event: PanGestureHandlerGestureEvent) => { const { translationY, state } = event.nativeEvent; - + const screenHeight = screenDimensions.height; + const sensitivity = 0.002; // Reduced for finer control + if (state === State.ACTIVE) { - // Show KSPlayer volume warning only once per session - if (!showKsVolumeWarning && !hasShownKsWarning) { - setShowKsVolumeWarning(true); - setHasShownKsWarning(true); - - // Save to storage that warning has been shown - AsyncStorage.setItem('ks_volume_warning_shown', 'true').catch(() => {}); - - // Hide warning after 4 seconds - setTimeout(() => { - setShowKsVolumeWarning(false); - }, 4000); + const deltaY = -translationY; // Invert for natural feel (up = increase) + const volumeChange = deltaY * sensitivity; + const newVolume = Math.max(0, Math.min(100, volume + volumeChange)); + + if (Math.abs(newVolume - volume) > 0.5) { // Reduced threshold for smoother updates + setVolume(newVolume); + lastVolumeChange.current = Date.now(); + + // Show overlay with smoother animation + if (!showVolumeOverlay) { + setShowVolumeOverlay(true); + Animated.spring(volumeOverlayOpacity, { + toValue: 1, + tension: 100, + friction: 8, + useNativeDriver: true, + }).start(); + } + + // Clear existing timeout + if (volumeOverlayTimeout.current) { + clearTimeout(volumeOverlayTimeout.current); + } + + // Hide overlay after 1.5 seconds + volumeOverlayTimeout.current = setTimeout(() => { + Animated.timing(volumeOverlayOpacity, { + toValue: 0, + duration: 250, + useNativeDriver: true, + }).start(() => { + setShowVolumeOverlay(false); + }); + }, 1500); } } }; @@ -3147,73 +3154,6 @@ const VideoPlayer: React.FC = () => { )} - {/* KSPlayer Volume Warning Overlay */} - {showKsVolumeWarning && ( - - - - - - Volume Control Not Available - - - - KSPlayer doesn't support volume gestures.{'\n'}Use your device volume buttons instead. - - - - This message won't be shown again - - - - )} {/* Resume overlay removed when AlwaysResume is enabled; overlay component omitted */}