mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Video] Fix web autoplay (#5274)

authored by samuel.fm and committed by

GitHub 99120296 dd2d0e62

+14 -11
+14 -11
src/view/com/util/post-embeds/VideoEmbed.web.tsx
··· 43 43 return () => observer.disconnect() 44 44 }, [sendPosition, isFullscreen]) 45 45 46 - // In case scrolling hasn't started yet, send up the position 47 - const isAnyViewActive = currentActiveView !== null 48 - useEffect(() => { 49 - if (ref.current && !isAnyViewActive) { 50 - const rect = ref.current.getBoundingClientRect() 51 - const position = rect.y + rect.height / 2 52 - sendPosition(position) 53 - } 54 - }, [isAnyViewActive, sendPosition]) 55 - 56 46 const [key, setKey] = useState(0) 57 47 const renderError = useCallback( 58 48 (error: unknown) => ( ··· 84 74 style={{display: 'flex', flex: 1, cursor: 'default'}} 85 75 onClick={evt => evt.stopPropagation()}> 86 76 <ErrorBoundary renderError={renderError} key={key}> 87 - <ViewportObserver sendPosition={sendPosition}> 77 + <ViewportObserver 78 + sendPosition={sendPosition} 79 + isAnyViewActive={currentActiveView !== null}> 88 80 <VideoEmbedInnerWeb 89 81 embed={embed} 90 82 active={active} ··· 105 97 function ViewportObserver({ 106 98 children, 107 99 sendPosition, 100 + isAnyViewActive, 108 101 }: { 109 102 children: React.ReactNode 110 103 sendPosition: (position: number) => void 104 + isAnyViewActive: boolean 111 105 }) { 112 106 const ref = useRef<HTMLDivElement>(null) 113 107 const [nearScreen, setNearScreen] = useState(false) ··· 133 127 observer.observe(ref.current) 134 128 return () => observer.disconnect() 135 129 }, [sendPosition, isFullscreen]) 130 + 131 + // In case scrolling hasn't started yet, send up the position 132 + useEffect(() => { 133 + if (ref.current && !isAnyViewActive) { 134 + const rect = ref.current.getBoundingClientRect() 135 + const position = rect.y + rect.height / 2 136 + sendPosition(position) 137 + } 138 + }, [isAnyViewActive, sendPosition]) 136 139 137 140 return ( 138 141 <View style={[a.flex_1, a.flex_row]}>