From a515d928ab08cf63d88bd78a6b7ac9e4c6aa496a Mon Sep 17 00:00:00 2001 From: Ebony Louis <55366651+EbonyLouis@users.noreply.github.com> Date: Mon, 3 Feb 2025 19:30:36 -0500 Subject: [PATCH] removing auto play from video (#1058) --- .../src/components/HomepageFeatures/index.tsx | 43 +++---------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/documentation/src/components/HomepageFeatures/index.tsx b/documentation/src/components/HomepageFeatures/index.tsx index 544b6aa664..f8479d5bff 100644 --- a/documentation/src/components/HomepageFeatures/index.tsx +++ b/documentation/src/components/HomepageFeatures/index.tsx @@ -1,5 +1,4 @@ import type { ReactNode } from "react"; -import { useEffect, useRef, useState } from "react"; import clsx from "clsx"; import Heading from "@theme/Heading"; import styles from "./styles.module.css"; @@ -165,32 +164,6 @@ function Quote({ name, github, role, testimonial }: FeatureQuote) { } export default function HomepageFeatures(): ReactNode { - const videoRef = useRef(null); - const [videoLoaded, setVideoLoaded] = useState(false); - - useEffect(() => { - const observer = new IntersectionObserver( - (entries) => { - entries.forEach((entry) => { - if (entry.isIntersecting && !videoLoaded) { - setVideoLoaded(true); // Load video only when it first appears - } - }); - }, - { threshold: 0.5 } - ); - - if (videoRef.current) { - observer.observe(videoRef.current); - } - - return () => { - if (videoRef.current) { - observer.unobserve(videoRef.current); - } - }; - }, [videoLoaded]); - return (
@@ -217,29 +190,24 @@ export default function HomepageFeatures(): ReactNode {