···1111import {VideoEmbedInnerNative} from '#/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative'
1212import {atoms as a} from '#/alf'
1313import {Button} from '#/components/Button'
1414+import {useIsWithinMessage} from '#/components/dms/MessageContext'
1415import {Loader} from '#/components/Loader'
1516import {PlayButtonIcon} from '#/components/video/PlayButtonIcon'
1617import {VisibilityView} from '../../../../../modules/expo-bluesky-swiss-army'
···6869 const [isMuted, setIsMuted] = useState(player.muted)
6970 const [isFullscreen, setIsFullscreen] = React.useState(false)
7071 const [timeRemaining, setTimeRemaining] = React.useState(0)
7171- const disableAutoplay = useAutoplayDisabled()
7272+ const isWithinMessage = useIsWithinMessage()
7373+ const disableAutoplay = useAutoplayDisabled() || isWithinMessage
7274 const isActive = embed.playlist === activeSource && activeViewId === viewId
7375 // There are some different loading states that we should pay attention to and show a spinner for
7476 const isLoading =
+17-16
src/view/com/util/post-embeds/VideoEmbed.web.tsx
···1212 VideoNotFoundError,
1313} from '#/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerWeb'
1414import {atoms as a} from '#/alf'
1515+import {useIsWithinMessage} from '#/components/dms/MessageContext'
1516import {useFullscreen} from '#/components/hooks/useFullscreen'
1617import {ErrorBoundary} from '../ErrorBoundary'
1718import {useActiveVideoWeb} from './ActiveVideoWebContext'
···4243 return () => observer.disconnect()
4344 }, [sendPosition, isFullscreen])
44454646+ // In case scrolling hasn't started yet, send up the position
4747+ const isAnyViewActive = currentActiveView !== null
4848+ useEffect(() => {
4949+ if (ref.current && !isAnyViewActive) {
5050+ const rect = ref.current.getBoundingClientRect()
5151+ const position = rect.y + rect.height / 2
5252+ sendPosition(position)
5353+ }
5454+ }, [isAnyViewActive, sendPosition])
5555+4556 const [key, setKey] = useState(0)
4657 const renderError = useCallback(
4758 (error: unknown) => (
···7384 style={{display: 'flex', flex: 1, cursor: 'default'}}
7485 onClick={evt => evt.stopPropagation()}>
7586 <ErrorBoundary renderError={renderError} key={key}>
7676- <ViewportObserver
7777- sendPosition={sendPosition}
7878- isAnyViewActive={currentActiveView !== null}>
8787+ <ViewportObserver sendPosition={sendPosition}>
7988 <VideoEmbedInnerWeb
8089 embed={embed}
8190 active={active}
···96105function ViewportObserver({
97106 children,
98107 sendPosition,
9999- isAnyViewActive,
100108}: {
101109 children: React.ReactNode
102110 sendPosition: (position: number) => void
103103- isAnyViewActive?: boolean
104111}) {
105112 const ref = useRef<HTMLDivElement>(null)
106113 const [nearScreen, setNearScreen] = useState(false)
107114 const [isFullscreen] = useFullscreen()
115115+ const isWithinMessage = useIsWithinMessage()
108116109117 // Send position when scrolling. This is done with an IntersectionObserver
110118 // observing a div of 100vh height
···126134 return () => observer.disconnect()
127135 }, [sendPosition, isFullscreen])
128136129129- // In case scrolling hasn't started yet, send up the position
130130- useEffect(() => {
131131- if (ref.current && !isAnyViewActive) {
132132- const rect = ref.current.getBoundingClientRect()
133133- const position = rect.y + rect.height / 2
134134- sendPosition(position)
135135- }
136136- }, [isAnyViewActive, sendPosition])
137137-138137 return (
139138 <View style={[a.flex_1, a.flex_row]}>
140139 {nearScreen && children}
141140 <div
142141 ref={ref}
143142 style={{
143143+ // Don't escape bounds when in a message
144144+ ...(isWithinMessage
145145+ ? {top: 0, height: '100%'}
146146+ : {top: 'calc(50% - 50vh)', height: '100vh'}),
144147 position: 'absolute',
145145- top: 'calc(50% - 50vh)',
146148 left: '50%',
147147- height: '100vh',
148149 width: 1,
149150 pointerEvents: 'none',
150151 }}