Skip to content

Commit 9713556

Browse files
committed
fix(docs): fall back to eager video loading without IntersectionObserver
The lazy-load gate from the previous commit threw before isInView could ever become true in environments lacking IntersectionObserver (older browsers, some embedded webviews), leaving videos permanently source-less instead of falling back to eager loading.
1 parent fef9274 commit 9713556

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/docs/components/ui/video.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export function Video({
3939
// `autoPlay` forces browsers to fetch the full file immediately on mount
4040
// regardless of `preload` - gate the actual load behind the viewport so a
4141
// page with several of these doesn't pull down every video up front.
42+
// Fall back to eager loading where IntersectionObserver isn't available
43+
// (older browsers, some embedded webviews) rather than leave the video
44+
// permanently source-less.
45+
if (typeof IntersectionObserver === 'undefined') {
46+
setIsInView(true)
47+
return
48+
}
49+
4250
const observer = new IntersectionObserver(
4351
([entry]) => {
4452
if (entry.isIntersecting) {

0 commit comments

Comments
 (0)