Skip to content

🎥 Make videos programmatically with React

cool cool cool

Jonny Burger667e51fa1143
diff --git a/packages/bundler/renderEntry.tsx b/packages/bundler/renderEntry.tsx
index 32ef0d5621..355b7254fa 100644
--- a/packages/bundler/renderEntry.tsx
+++ b/packages/bundler/renderEntry.tsx
@@ -14,6 +14,7 @@ import type {
VideoConfigWithSerializedProps,
} from 'remotion';
import {
+ AbsoluteFill,
Internals,
VERSION,
continueRender,
@@ -46,6 +47,38 @@ const isInHeadlessBrowser = () => {
return typeof window.remotion_puppeteerTimeout !== 'undefined';
};
+const DelayedSpinner: React.FC = () => {
+ const [show, setShow] = useState(false);
+
+ useEffect(() => {
+ const timeout = setTimeout(() => {
+ setShow(true);
+ }, 2000);
+ return () => {
+ clearTimeout(timeout);
+ };
+ }, []);
+
+ if (!show) {
+ return null;
+ }
+
+ return (
+ <AbsoluteFill
+ style={{
+ justifyContent: 'center',
+ alignItems: 'center',
+ fontSize: 13,
+ opacity: 0.6,
+ color: 'white',
+ fontFamily: 'Helvetica, Arial, sans-serif',
+ }}
+ >
+ Loading Studio
+ </AbsoluteFill>
+ );
+};
+
const GetVideo: React.FC<{state: BundleState}> = ({state}) => {
const video = Internals.useVideo();
const compositions = useContext(Internals.CompositionManager);
@@ -205,7 +238,11 @@ const renderContent = (Root: React.FC) => {
return;
}
- renderToDOM(<div>Loading Remotion Studio...</div>);
+ renderToDOM(
+ <div>
+ <DelayedSpinner />
+ </div>,
+ );
import('@remotion/studio')
.then(({Studio}) => {
renderToDOM(<Studio readOnly rootComponent={Root} />);