diff --git a/src/screens/VideoFeed/index.tsx b/src/screens/VideoFeed/index.tsx index 480ecb476a..ad2ff78674 100644 --- a/src/screens/VideoFeed/index.tsx +++ b/src/screens/VideoFeed/index.tsx @@ -1044,16 +1044,25 @@ function PlayPauseTapArea({ const {isPlaying} = useEvent(player, 'playingChange', { isPlaying: player.playing, }) + const isMounted = useRef(false) - const togglePlayPause = () => { - if (!player) return + useEffect(() => { + isMounted.current = true + return () => { + isMounted.current = false + } + }, []) + + const togglePlayPause = useNonReactiveCallback(() => { + // gets called after a timeout, so guard against being called after unmount -sfn + if (!player || !isMounted.current) return doubleTapRef.current = null if (player.playing) { player.pause() } else { player.play() } - } + }) const onPress = () => { if (doubleTapRef.current) {