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