fix: play/pause gesture should affect alternate audio tracks

This commit is contained in:
Adrian Castro
2024-03-09 11:37:54 +01:00
parent b6b8f34d70
commit bfa0c2b71e

View File

@@ -64,6 +64,8 @@ export const VideoPlayer = () => {
const setVideoRef = usePlayerStore((state) => state.setVideoRef); const setVideoRef = usePlayerStore((state) => state.setVideoRef);
const setStatus = usePlayerStore((state) => state.setStatus); const setStatus = usePlayerStore((state) => state.setStatus);
const setIsIdle = usePlayerStore((state) => state.setIsIdle); const setIsIdle = usePlayerStore((state) => state.setIsIdle);
const playAudio = usePlayerStore((state) => state.playAudio);
const pauseAudio = usePlayerStore((state) => state.pauseAudio);
const checkGestureInSliderVicinity = (x: number, y: number) => { const checkGestureInSliderVicinity = (x: number, y: number) => {
isGestureInSliderVicinity.value = isPointInSliderVicinity(x, y); isGestureInSliderVicinity.value = isPointInSliderVicinity(x, y);
@@ -85,6 +87,11 @@ export const VideoPlayer = () => {
const togglePlayback = () => { const togglePlayback = () => {
setShouldPlay(!shouldPlay); setShouldPlay(!shouldPlay);
if (shouldPlay) {
void pauseAudio();
} else {
void playAudio();
}
}; };
const doubleTapGesture = Gesture.Tap() const doubleTapGesture = Gesture.Tap()