import React, { useEffect, useRef, useState } from "react"; import VideoButton from "/home/clyde/Code/shiloh/Components/Buttons/video-button.jsx"; const Section = ({ videoUrl, text, videoId, buttonOneText, buttonTwoText }) => { const videoRef = useRef(null); const [isPlaying, setIsPlaying] = useState(false); useEffect(() => { const options = { root: null, rootMargin: "0px", threshold: 0.5, }; const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { setIsPlaying(true); videoRef.current.play(); } else { setIsPlaying(false); videoRef.current.pause(); } }); }, options); observer.observe(videoRef.current); return () => { observer.unobserve(videoRef.current); }; }, []); return (