Websites v4 docs v5.2.5
    Preparing search index...

    Function useFillHeight

    • Takes a ref of a video container and returns true if the aspect ratio is less than 16:9. Can be used to make video iframes behave like object-fit: cover does for images.

      Parameters

      • containerRef: RefObject<HTMLElement | null>

      Returns boolean

      const containerRef = useRef<HTMLDivElement>(null);
      const fillHeight = useFillHeight(containerRef);

      ...

      <div className="relative overflow-hidden h-[100vh] w-full" ref={containerRef}>
      <SectionVideoIframe
      // Adjust width and height values as needed
      className={`
      absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
      ${fillHeight ? 'h-full w-[178vh]' : 'w-full h-[192vh]'}
      `}
      autoplay={1}
      controls={0}
      muted={1}
      loop={1}
      url={formatVideoUrl(property.virtualTours[0].url)}
      />
      </div>