🎥 Make videos programmatically with React
Merge remote-tracking branch 'origin/main' into codex/interactive-absolute-fill
Jonny Burgerf0b10a467b07
diff --cc packages/docs/docs/interactive-with-schema.mdxindex 1cfe3c9a94,eddcdf6b66..4e46f10917--- a/packages/docs/docs/interactive-with-schema.mdx+++ b/packages/docs/docs/interactive-with-schema.mdx@@@ -90,55 -89,6 +90,55 @@@ Wraps the component in a [`<Sequence>`]Set this to `true`, unless you already have components from previous examples which handle wrapping in a `<Sequence>` manually.If set to false, you need to manually forward all props.+### `layout`?<AvailableFrom v="4.0.535" />++Requires `wrapInSequence: true`. Defaults to `'none'`, which forwards styles to `Component` without adding a container.++Set to `'absolute-fill'` to give the component a full-size, absolutely positioned container. Styles, transforms, cropping, and premount styles apply to this container. It shares the component's timeline item, so no extra layout layer appears in Studio. The returned component also accepts `width` and `height` to size the container and set the dimensions reported by `useVideoConfig()`.++The inner component can return a fragment and does not need to forward styles:++```tsx twoslash title="Scene.tsx"+import React from 'react';+import {Video} from '@remotion/media';+import {Interactive, useVideoConfig} from 'remotion';++const SceneInner: React.FC = () => {+ const {fps} = useVideoConfig();++ return (+ <>+ <Video+ src="https://remotion.media/jonnys-videos/roller-skis-new/footage/IMG_0466.mp4"+ premountFor={fps}+ objectFit="cover"+ style={{width: '100%', height: '100%'}}+ />+ <Interactive.Div+ name="Title"+ style={{position: 'absolute', left: 80, bottom: 80, color: 'white', fontSize: 80}}+ >+ Under the trees+ </Interactive.Div>+ </>+ );+};++export const Scene = Interactive.withSchema({+ Component: SceneInner,- componentName: '<Scene>',++ componentName: 'Scene',+ schema: {},+ wrapInSequence: true,+ layout: 'absolute-fill',+});++const Example = () => (+ <Scene from={30} durationInFrames={90} premountFor={30} style={{opacity: 0.5}} />+);+```++Keep `'none'` when styles need to apply directly to an element with its own size or layout, such as a text box, SVG, or button.+### Return valueReturns a React component.diff --cc packages/docs/docs/miscellaneous/snippets/freeze-portions.mdxindex d08d25693d,64c353980e..ab2d30585d--- a/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx+++ b/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx@@@ -30,10 -31,9 +30,10 @@@ const CounterInner: React.FC = () =>export const Counter = Interactive.withSchema({Component: CounterInner,- componentName: '<Counter>',+ componentName: 'Counter',schema: {},wrapInSequence: true,+ layout: 'absolute-fill',});const FREEZES = [diff --cc packages/skills/skills/remotion-interactivity/SKILL.mdindex 691598cd74,9330836b13..a6d7dbe235--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@@ -57,16 -66,20 +57,16 @@@ const SceneInner: React.FC<SceneProps>);};-const lowerThirdSchema = {- ...Interactive.childrenSchema,- accentColor: {- type: 'color',- default: '#0b84f3',- description: 'Accent color',- },+const sceneSchema = {+ title: {type: 'string', default: '', description: 'Title'},} as const satisfies InteractivitySchema;-export const LowerThird = Interactive.withSchema({- Component: LowerThirdInner,- componentName: 'LowerThird',- schema: lowerThirdSchema,+export const Scene = Interactive.withSchema({+ Component: SceneInner,- componentName: '<Scene>',++ componentName: 'Scene',+ schema: sceneSchema,wrapInSequence: true,+ layout: 'absolute-fill',});```diff --cc packages/skills/skills/remotion-markup/connected-compositions.mdindex 6b5c86340b,5436356ff4..a17010c5c1--- a/packages/skills/skills/remotion-markup/connected-compositions.md+++ b/packages/skills/skills/remotion-markup/connected-compositions.md@@@ -77,10 -78,9 +77,10 @@@ const chapterSchema =export const Chapter = Interactive.withSchema({Component: ChapterInner,- componentName: '<Chapter>',+ componentName: 'Chapter',schema: chapterSchema,wrapInSequence: true,+ layout: 'absolute-fill',});```