mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-20 16:22:04 +00:00
Merge pull request #328 from AdityasahuX07/patch-15
Minor UI changes and Bug fix.
This commit is contained in:
commit
a794e27235
3 changed files with 73 additions and 20 deletions
|
|
@ -234,6 +234,33 @@ const AndroidVideoPlayer: React.FC = () => {
|
||||||
}).start();
|
}).start();
|
||||||
}, [playerState.showControls]);
|
}, [playerState.showControls]);
|
||||||
|
|
||||||
|
// Auto-hide controls after 3 seconds of inactivity
|
||||||
|
useEffect(() => {
|
||||||
|
// Clear any existing timeout
|
||||||
|
if (controlsTimeout.current) {
|
||||||
|
clearTimeout(controlsTimeout.current);
|
||||||
|
controlsTimeout.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only set timeout if controls are visible and video is playing
|
||||||
|
if (playerState.showControls && !playerState.paused) {
|
||||||
|
controlsTimeout.current = setTimeout(() => {
|
||||||
|
// Don't hide if user is dragging the seek bar
|
||||||
|
if (!playerState.isDragging.current) {
|
||||||
|
playerState.setShowControls(false);
|
||||||
|
}
|
||||||
|
}, 2000); // 2 seconds delay
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup on unmount or when dependencies change
|
||||||
|
return () => {
|
||||||
|
if (controlsTimeout.current) {
|
||||||
|
clearTimeout(controlsTimeout.current);
|
||||||
|
controlsTimeout.current = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [playerState.showControls, playerState.paused, playerState.isDragging]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
openingAnimation.startOpeningAnimation();
|
openingAnimation.startOpeningAnimation();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -459,7 +486,10 @@ const AndroidVideoPlayer: React.FC = () => {
|
||||||
}, [playerState.currentTime, useCustomSubtitles, customSubtitles]);
|
}, [playerState.currentTime, useCustomSubtitles, customSubtitles]);
|
||||||
|
|
||||||
const toggleControls = useCallback(() => {
|
const toggleControls = useCallback(() => {
|
||||||
playerState.setShowControls(prev => !prev);
|
playerState.setShowControls(prev => {
|
||||||
|
// If we're showing controls, the useEffect will handle the auto-hide timer
|
||||||
|
return !prev;
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const hideControls = useCallback(() => {
|
const hideControls = useCallback(() => {
|
||||||
|
|
@ -881,6 +911,7 @@ const AndroidVideoPlayer: React.FC = () => {
|
||||||
visible={speedControl.showSpeedActivatedOverlay}
|
visible={speedControl.showSpeedActivatedOverlay}
|
||||||
opacity={speedControl.speedActivatedOverlayOpacity}
|
opacity={speedControl.speedActivatedOverlayOpacity}
|
||||||
speed={speedControl.holdToSpeedValue}
|
speed={speedControl.holdToSpeedValue}
|
||||||
|
screenDimensions={playerState.screenDimensions}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PauseOverlay
|
<PauseOverlay
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,57 @@
|
||||||
/**
|
|
||||||
* Shared Speed Activated Overlay Component
|
|
||||||
* Used by both Android (VLC) and iOS (KSPlayer) players
|
|
||||||
*/
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text, Animated } from 'react-native';
|
import { View, Text, Animated } from 'react-native';
|
||||||
import { MaterialIcons } from '@expo/vector-icons';
|
import { MaterialIcons } from '@expo/vector-icons';
|
||||||
import { styles } from '../utils/playerStyles';
|
|
||||||
|
|
||||||
interface SpeedActivatedOverlayProps {
|
interface SpeedActivatedOverlayProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
opacity: Animated.Value;
|
opacity: Animated.Value | number;
|
||||||
speed: number;
|
speed: number;
|
||||||
|
screenDimensions: { width: number; height: number };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SpeedActivatedOverlay: React.FC<SpeedActivatedOverlayProps> = ({
|
export const SpeedActivatedOverlay: React.FC<SpeedActivatedOverlayProps> = ({
|
||||||
visible,
|
visible,
|
||||||
opacity,
|
opacity,
|
||||||
speed
|
speed,
|
||||||
|
screenDimensions
|
||||||
}) => {
|
}) => {
|
||||||
if (!visible) return null;
|
// Safety check to prevent the 'height' of undefined error
|
||||||
|
if (!visible || !screenDimensions) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={{
|
||||||
styles.speedActivatedOverlay,
|
position: 'absolute',
|
||||||
{ opacity: opacity }
|
top: screenDimensions.height * 0.06,
|
||||||
]}
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
alignItems: 'center',
|
||||||
|
opacity: opacity,
|
||||||
|
zIndex: 1000,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<View style={styles.speedActivatedContainer}>
|
<View style={{
|
||||||
<MaterialIcons name="fast-forward" size={32} color="#FFFFFF" />
|
flexDirection: 'row',
|
||||||
<Text style={styles.speedActivatedText}>{speed}x Speed</Text>
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
|
borderRadius: 35,
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
paddingVertical: 10,
|
||||||
|
alignItems: 'center',
|
||||||
|
elevation: 5,
|
||||||
|
}}>
|
||||||
|
<MaterialIcons
|
||||||
|
name="fast-forward"
|
||||||
|
size={20}
|
||||||
|
color="white"
|
||||||
|
style={{ marginRight: 6 }}
|
||||||
|
/>
|
||||||
|
<Text style={{
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: '600',
|
||||||
|
}}>
|
||||||
|
{speed}x
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -274,8 +274,8 @@ export const styles = StyleSheet.create({
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
||||||
borderRadius: 24,
|
borderRadius: 24,
|
||||||
paddingVertical: 8,
|
paddingVertical: 8,
|
||||||
paddingHorizontal: 14,
|
paddingHorizontal: 8,
|
||||||
gap: 8,
|
gap: 4,
|
||||||
},
|
},
|
||||||
iconWrapper: {
|
iconWrapper: {
|
||||||
width: 28,
|
width: 28,
|
||||||
|
|
@ -289,7 +289,7 @@ export const styles = StyleSheet.create({
|
||||||
color: '#FFFFFF',
|
color: '#FFFFFF',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
minWidth: 48,
|
minWidth: 38,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1218,4 +1218,4 @@ export const styles = StyleSheet.create({
|
||||||
fontSize: skipTextFont,
|
fontSize: skipTextFont,
|
||||||
marginTop: 2,
|
marginTop: 2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue