mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-03 08:49:07 +00:00
soem ui changes
This commit is contained in:
parent
face30c163
commit
b5d92e5887
2 changed files with 48 additions and 7 deletions
|
|
@ -699,7 +699,7 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
|
||||||
const [trailerLoading, setTrailerLoading] = useState(false);
|
const [trailerLoading, setTrailerLoading] = useState(false);
|
||||||
const [trailerError, setTrailerError] = useState(false);
|
const [trailerError, setTrailerError] = useState(false);
|
||||||
const [trailerMuted, setTrailerMuted] = useState(true);
|
const [trailerMuted, setTrailerMuted] = useState(true);
|
||||||
const [trailerPlaying, setTrailerPlaying] = useState(false);
|
const [isTrailerPlaying, setIsTrailerPlaying] = useState(false);
|
||||||
const imageOpacity = useSharedValue(1);
|
const imageOpacity = useSharedValue(1);
|
||||||
const imageLoadOpacity = useSharedValue(0);
|
const imageLoadOpacity = useSharedValue(0);
|
||||||
const shimmerOpacity = useSharedValue(0.3);
|
const shimmerOpacity = useSharedValue(0.3);
|
||||||
|
|
@ -961,10 +961,8 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
|
||||||
logger.warn('HeroSection', 'Trailer playback failed, falling back to image');
|
logger.warn('HeroSection', 'Trailer playback failed, falling back to image');
|
||||||
setTrailerError(true);
|
setTrailerError(true);
|
||||||
}}
|
}}
|
||||||
onProgress={() => {
|
onPlaybackStatusUpdate={(status) => {
|
||||||
if (!trailerPlaying) {
|
setIsTrailerPlaying(status.isLoaded && !status.didJustFinish);
|
||||||
setTrailerPlaying(true);
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : shouldLoadSecondaryData && imageSource && !loadingBanner ? (
|
) : shouldLoadSecondaryData && imageSource && !loadingBanner ? (
|
||||||
|
|
@ -977,6 +975,21 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{/* Unmute button for trailer */}
|
||||||
|
{isTrailerPlaying && trailerUrl && (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={styles.unmuteButton}
|
||||||
|
onPress={() => setTrailerMuted(!trailerMuted)}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
>
|
||||||
|
<MaterialIcons
|
||||||
|
name={trailerMuted ? 'volume-off' : 'volume-up'}
|
||||||
|
size={24}
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
|
||||||
<Animated.View style={styles.backButtonContainer}>
|
<Animated.View style={styles.backButtonContainer}>
|
||||||
<TouchableOpacity style={styles.backButton} onPress={handleBack}>
|
<TouchableOpacity style={styles.backButton} onPress={handleBack}>
|
||||||
<MaterialIcons
|
<MaterialIcons
|
||||||
|
|
@ -1017,7 +1030,9 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
|
||||||
style={styles.bottomFadeGradient}
|
style={styles.bottomFadeGradient}
|
||||||
pointerEvents="none"
|
pointerEvents="none"
|
||||||
/>
|
/>
|
||||||
<View style={[styles.heroContent, isTablet && { maxWidth: 800, alignSelf: 'center' }]}>
|
<View style={[styles.heroContent, isTablet && { maxWidth: 800, alignSelf: 'center' }, {
|
||||||
|
opacity: isTrailerPlaying && !trailerMuted ? 0.3 : 1
|
||||||
|
}]}>
|
||||||
{/* Optimized Title/Logo */}
|
{/* Optimized Title/Logo */}
|
||||||
<View style={styles.logoContainer}>
|
<View style={styles.logoContainer}>
|
||||||
<Animated.View style={[styles.titleLogoContainer, logoAnimatedStyle]}>
|
<Animated.View style={[styles.titleLogoContainer, logoAnimatedStyle]}>
|
||||||
|
|
@ -1103,6 +1118,15 @@ const styles = StyleSheet.create({
|
||||||
textShadowOffset: { width: 0, height: 2 },
|
textShadowOffset: { width: 0, height: 2 },
|
||||||
textShadowRadius: 3,
|
textShadowRadius: 3,
|
||||||
},
|
},
|
||||||
|
unmuteButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: Platform.OS === 'android' ? 40 : 50,
|
||||||
|
right: width >= 768 ? 32 : 16,
|
||||||
|
zIndex: 10,
|
||||||
|
padding: 8,
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
|
borderRadius: 20,
|
||||||
|
},
|
||||||
heroGradient: {
|
heroGradient: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ interface TrailerPlayerProps {
|
||||||
onLoad?: () => void;
|
onLoad?: () => void;
|
||||||
onError?: (error: string) => void;
|
onError?: (error: string) => void;
|
||||||
onProgress?: (data: OnProgressData) => void;
|
onProgress?: (data: OnProgressData) => void;
|
||||||
|
onPlaybackStatusUpdate?: (status: { isLoaded: boolean; didJustFinish: boolean }) => void;
|
||||||
style?: any;
|
style?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,6 +43,7 @@ const TrailerPlayer: React.FC<TrailerPlayerProps> = memo(({
|
||||||
onLoad,
|
onLoad,
|
||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
|
onPlaybackStatusUpdate,
|
||||||
style,
|
style,
|
||||||
}) => {
|
}) => {
|
||||||
const { currentTheme } = useTheme();
|
const { currentTheme } = useTheme();
|
||||||
|
|
@ -143,7 +145,19 @@ const TrailerPlayer: React.FC<TrailerPlayerProps> = memo(({
|
||||||
const handleProgress = useCallback((data: OnProgressData) => {
|
const handleProgress = useCallback((data: OnProgressData) => {
|
||||||
setPosition(data.currentTime * 1000); // Convert to milliseconds
|
setPosition(data.currentTime * 1000); // Convert to milliseconds
|
||||||
onProgress?.(data);
|
onProgress?.(data);
|
||||||
}, [onProgress]);
|
|
||||||
|
if (onPlaybackStatusUpdate) {
|
||||||
|
onPlaybackStatusUpdate({
|
||||||
|
isLoaded: data.currentTime > 0,
|
||||||
|
didJustFinish: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [onProgress, onPlaybackStatusUpdate]);
|
||||||
|
|
||||||
|
// Sync internal muted state with prop
|
||||||
|
useEffect(() => {
|
||||||
|
setIsMuted(muted);
|
||||||
|
}, [muted]);
|
||||||
|
|
||||||
// Cleanup timeout on unmount
|
// Cleanup timeout on unmount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -189,6 +203,9 @@ const TrailerPlayer: React.FC<TrailerPlayerProps> = memo(({
|
||||||
paused={!isPlaying}
|
paused={!isPlaying}
|
||||||
repeat={true}
|
repeat={true}
|
||||||
muted={isMuted}
|
muted={isMuted}
|
||||||
|
volume={isMuted ? 0 : 1}
|
||||||
|
mixWithOthers="duck"
|
||||||
|
ignoreSilentSwitch="ignore"
|
||||||
onLoadStart={handleLoadStart}
|
onLoadStart={handleLoadStart}
|
||||||
onLoad={handleLoad}
|
onLoad={handleLoad}
|
||||||
onError={(error: any) => handleError(error?.error?.message || 'Unknown error')}
|
onError={(error: any) => handleError(error?.error?.message || 'Unknown error')}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue