返回 html-video
Root.tsx
1 // Root — registers the single generic bridge composition. render.ts overrides
2 // width/height/fps/durationInFrames per call via selectComposition(), and passes
3 // the HTML frame path + size through inputProps. (RFC-08 §5)
4 import React from 'react';
5 import { Composition } from 'remotion';
6 import { HtmlFrameDriver, type HtmlFrameDriverProps } from './HtmlFrameDriver';
7
8 const DEFAULTS: HtmlFrameDriverProps = { html: '<!doctype html><html><body></body></html>', width: 1920, height: 1080 };
9
10 export const RemotionRoot: React.FC = () => {
11 return (
12 <Composition
13 id="HtmlFrame"
14 component={HtmlFrameDriver}
15 // Placeholder metadata; render.ts overrides all of these at render time.
16 durationInFrames={150}
17 fps={30}
18 width={1920}
19 height={1080}
20 defaultProps={DEFAULTS}
21 // Let inputProps.width/height drive the canvas so a 9:16 / 1:1 frame isn't
22 // squashed into 16:9. duration/fps come from selectComposition overrides.
23 calculateMetadata={({ props }) => ({
24 width: props.width ?? 1920,
25 height: props.height ?? 1080,
26 })}
27 />
28 );
29 };
30
30 lines Plain Text