Live video on the AT Protocol

replace touch-to-show-ui with hover-to-show-ui

+10 -12
+10 -12
js/app/components/mobile/desktop-ui.tsx
··· 6 6 Toast, 7 7 useAvatars, 8 8 useCameraToggle, 9 - useKeyboardSlide, 10 9 useLivestreamInfo, 11 10 usePlayerDimensions, 12 11 usePlayerStore, ··· 23 22 VolumeX, 24 23 } from "lucide-react-native"; 25 24 import { useCallback, useEffect, useRef, useState } from "react"; 26 - import { 27 - Image, 28 - Platform, 29 - Pressable, 30 - TouchableWithoutFeedback, 31 - } from "react-native"; 25 + import { Image, Platform, Pressable } from "react-native"; 26 + import { Gesture, GestureDetector } from "react-native-gesture-handler"; 32 27 import Animated, { 28 + runOnJS, 33 29 useAnimatedStyle, 34 30 useSharedValue, 35 31 withTiming, ··· 147 143 const { width, height } = usePlayerDimensions(); 148 144 const { doSetIngestCamera } = useCameraToggle(); 149 145 const avatars = useAvatars(profile?.did ? [profile?.did] : []); 150 - const { slideKeyboard } = useKeyboardSlide(); 151 146 const { safeAreaInsets, shouldShowFloatingMetrics } = useResponsiveLayout(); 152 147 153 148 const fullscreen = usePlayerStore((state) => state.fullscreen); ··· 157 152 const [isChatOpen, setIsChatOpen] = useState(false); 158 153 const fadeOpacity = useSharedValue(1); 159 154 const fadeTimeout = useRef<NodeJS.Timeout | null>(null); 160 - const FADE_OUT_DELAY = 4000; 155 + const FADE_OUT_DELAY = 2500; 161 156 162 157 const isSelfAndNotLive = ingest === "new"; 163 158 const isActivelyLive = ingest !== null && ingest !== "new"; ··· 173 168 }, FADE_OUT_DELAY); 174 169 }, [fadeOpacity]); 175 170 176 - const onPressPlayer = useCallback(() => { 171 + const onPlayerHover = useCallback(() => { 172 + console.log("player hovered"); 177 173 resetFadeTimer(); 178 174 }, [resetFadeTimer]); 179 175 ··· 196 192 opacity: shouldShowFloatingMetrics ? 1 : fadeOpacity.value, 197 193 })); 198 194 195 + const hover = Gesture.Hover().onStart((_) => runOnJS(onPlayerHover)()); 196 + 199 197 return ( 200 - <TouchableWithoutFeedback onPress={onPressPlayer}> 198 + <GestureDetector gesture={hover}> 201 199 <View style={[layout.position.absolute, h.percent[100], w.percent[100]]}> 202 200 <Animated.View 203 201 style={[ ··· 378 376 duration={5} 379 377 /> 380 378 </View> 381 - </TouchableWithoutFeedback> 379 + </GestureDetector> 382 380 ); 383 381 }