Skip to content

🎥 Make videos programmatically with React

example for hugepayload

Jonny Burger5fabf2630cce
diff --git a/packages/example/src/HugePayload.tsx b/packages/example/src/HugePayload.tsx
new file mode 100644
index 0000000000..4ae0fc9b69
--- /dev/null
+++ b/packages/example/src/HugePayload.tsx
@@ -0,0 +1,20 @@
+import {z} from 'zod';
+
+export const hugePayloadSchema = z.object({
+ str: z.string(),
+});
+
+export const HugePayload: React.FC<z.infer<typeof hugePayloadSchema>> = ({
+ str,
+}) => {
+ return (
+ <div
+ style={{
+ color: 'red',
+ fontSize: 80,
+ }}
+ >
+ Wow this payload is huge! {str.length}
+ </div>
+ );
+};
diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsx
index 8666ac8767..5fb50488c6 100644
--- a/packages/example/src/Video.tsx
+++ b/packages/example/src/Video.tsx
@@ -52,6 +52,7 @@ import {WarpDemoOuter} from './WarpText';
import {WarpDemo2} from './WarpText/demo2';
import {Tailwind} from './Tailwind';
import {DynamicDuration, dynamicDurationSchema} from './DynamicDuration';
+import {HugePayload, hugePayloadSchema} from './HugePayload';
if (alias !== 'alias') {
throw new Error('should support TS aliases');
@@ -123,6 +124,23 @@ export const Index: React.FC = () => {
schema={dynamicDurationSchema}
defaultProps={{duration: 50}}
/>
+ <Composition
+ id="huge-payload"
+ component={HugePayload}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={100}
+ calculateMetadata={() => {
+ return {
+ props: {
+ str: 'potato'.repeat(10000000),
+ },
+ };
+ }}
+ schema={hugePayloadSchema}
+ defaultProps={{str: 'st'}}
+ />
<Composition
id="sync-dynamic-length"
component={DynamicDuration}