Skip to content

🎥 Make videos programmatically with React

fix homepage jumping down immediately

Jonny Burgera0110c14bd92
diff --git a/packages/docs/components/3DPhonePlayer.tsx b/packages/docs/components/3DPhonePlayer.tsx
index db2e1926b2..f998f44250 100644
--- a/packages/docs/components/3DPhonePlayer.tsx
+++ b/packages/docs/components/3DPhonePlayer.tsx
@@ -12,7 +12,6 @@ export const ThreeDPlayer: React.FC = () => {
durationInFrames={300}
controls
loop
- autoPlay
style={{
width: "100%",
}}
@@ -21,6 +20,6 @@ export const ThreeDPlayer: React.FC = () => {
videoSrc: phone,
baseScale: 1,
}}
- />
+ />
);
};
diff --git a/packages/docs/components/LandingPage/Programmatic.tsx b/packages/docs/components/LandingPage/Programmatic.tsx
index 7cb3cccdca..8aeca6cd88 100644
--- a/packages/docs/components/LandingPage/Programmatic.tsx
+++ b/packages/docs/components/LandingPage/Programmatic.tsx
@@ -1,6 +1,6 @@
import type { PlayerRef } from "@remotion/player";
import { Player } from "@remotion/player";
-import React, { useCallback, useEffect, useRef, useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
import type { GithubResponse } from "./GithubDemo";
import { GithubDemo } from "./GithubDemo";
import styles from "./mobileplayer.module.css";
@@ -11,38 +11,38 @@ export const ProgrammaticContent: React.FC<{ data: GithubResponse | null }> = ({
const containerRef = useRef<HTMLDivElement>(null);
const playerRef = useRef<PlayerRef>(null);
- const [isIntersecting, setIsIntersecting] = useState(false);
+ const [isIntersecting] = useState(false);
- const callback: IntersectionObserverCallback = useCallback(
- (newData) => {
- setIsIntersecting(newData[0].isIntersecting);
- if (isIntersecting) {
- playerRef.current?.play();
- } else {
- playerRef.current?.pause();
- }
- },
- [isIntersecting]
- );
+ // const callback: IntersectionObserverCallback = useCallback(
+ // (newData) => {
+ // setIsIntersecting(newData[0].isIntersecting);
+ // if (isIntersecting) {
+ // playerRef.current?.play();
+ // } else {
+ // playerRef.current?.pause();
+ // }
+ // },
+ // [isIntersecting]
+ // );
- useEffect(() => {
- const { current } = containerRef;
- if (!current) {
- return;
- }
+ // useEffect(() => {
+ // const { current } = containerRef;
+ // if (!current) {
+ // return;
+ // }
- const observer = new IntersectionObserver(callback, {
- root: null,
- threshold: 1,
- });
- // Docusaurus sometimes has a layout shift that immediately focuses
- // the video on page load
- setTimeout(() => {
- observer.observe(current);
- }, 2000);
+ // const observer = new IntersectionObserver(callback, {
+ // root: null,
+ // threshold: 1,
+ // });
+ // // Docusaurus sometimes has a layout shift that immediately focuses
+ // // the video on page load
+ // setTimeout(() => {
+ // observer.observe(current);
+ // }, 2000);
- return () => observer.unobserve(current);
- }, [callback]);
+ // return () => observer.unobserve(current);
+ // }, [callback]);
useEffect(() => {
if (isIntersecting) {