🎥 Make videos programmatically with React
Use automatic canvas outlines in built-in components
JonnyBurger11b82ced5627
diff --git a/packages/brand/src/Compose/WhatIsRemotion.tsx b/packages/brand/src/Compose/WhatIsRemotion.tsxindex e685bdd691..c8ff8d955e 100644--- a/packages/brand/src/Compose/WhatIsRemotion.tsx+++ b/packages/brand/src/Compose/WhatIsRemotion.tsx@@ -84,10 +84,8 @@ const LabelInner = React.forwardRef<ref,) => {const opacity = useLabelOpacity();- const outlineRef = React.useRef<HTMLDivElement | null>(null);const callbackRef = React.useCallback((element: HTMLDivElement | null) => {- outlineRef.current = element;setRef(ref, element);},[ref],@@ -105,7 +103,6 @@ const LabelInner = React.forwardRef<showInTimeline={showInTimeline ?? true}controls={controls ?? undefined}_remotionInternalDocumentationLink="https://www.remotion.dev/docs/studio/make-component-interactive"- outlineRef={outlineRef}><divref={callbackRef}diff --git a/packages/brand/src/video-elements/Studio.tsx b/packages/brand/src/video-elements/Studio.tsxindex a0ffd04172..a044450f5c 100644--- a/packages/brand/src/video-elements/Studio.tsx+++ b/packages/brand/src/video-elements/Studio.tsx@@ -1712,7 +1712,6 @@ const StudioInner = React.forwardRef<hidden={hidden}layout="none"name={name ?? '<Studio>'}- outlineRef={outlineRef}showInTimeline={showInTimeline ?? true}trimBefore={trimBefore}>diff --git a/packages/codemods/src/basic-captions-element-source.ts b/packages/codemods/src/basic-captions-element-source.tsindex 7c155e5d3d..135d2c4a61 100644--- a/packages/codemods/src/basic-captions-element-source.ts+++ b/packages/codemods/src/basic-captions-element-source.ts@@ -139,7 +139,6 @@ const BasicCaptionsInner = forwardRef<from={from}durationInFrames={durationInFrames}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/core/src/AbsoluteFill.tsx b/packages/core/src/AbsoluteFill.tsxindex 9ebc95a417..d25e87fea8 100644--- a/packages/core/src/AbsoluteFill.tsx+++ b/packages/core/src/AbsoluteFill.tsx@@ -1,4 +1,4 @@-import React, {useCallback, useRef} from 'react';+import React, {useCallback} from 'react';import {AbsoluteFillElement,type AbsoluteFillElementProps,@@ -63,11 +63,9 @@ const setRef = <ElementType,>(const AbsoluteFillWithTiming: React.FC<AbsoluteFillProps & {readonly controls: SequenceControls | undefined;- readonly outlineRef: React.RefObject<HTMLDivElement | null>;}> = ({ref: callbackRef,- outlineRef: refForOutline,from,premountFor,postmountFor,@@ -118,7 +116,6 @@ const AbsoluteFillWithTiming: React.FC<controls={controls}_remotionInternalStack={stack}_remotionInternalDocumentationLink="https://www.remotion.dev/docs/absolute-fill"- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}@@ -158,10 +155,8 @@ const AbsoluteFillInner: React.FC<...divProps}) => {const videoConfig = useUnsafeVideoConfig();- const refForOutline = useRef<HTMLDivElement | null>(null);const callbackRef = useCallback((element: HTMLDivElement | null) => {- refForOutline.current = element;setRef(ref, element);},[ref],@@ -179,7 +174,6 @@ const AbsoluteFillInner: React.FC<<AbsoluteFillWithTiming{...divProps}ref={callbackRef}- outlineRef={refForOutline}from={from}premountFor={premountFor}postmountFor={postmountFor}diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsxindex 44ef404284..1d397f562a 100644--- a/packages/core/src/HtmlInCanvas.tsx+++ b/packages/core/src/HtmlInCanvas.tsx@@ -811,7 +811,6 @@ const HtmlInCanvasInner = forwardRef<_remotionInternalDocumentationLink="https://www.remotion.dev/docs/remotion/html-in-canvas"controls={controls}_remotionInternalEffects={memoizedEffectDefinitions}- outlineRef={actualRef}{...sequenceProps}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsxindex b8382363ec..95f392880d 100644--- a/packages/core/src/Img.tsx+++ b/packages/core/src/Img.tsx@@ -95,9 +95,7 @@ type ImgContentProps = Omit<| 'cropRight'| 'cropTop'| 'cropBottom'-> & {- readonly refForOutline: React.RefObject<HTMLElement | null>;-};+>;const ImgContent: React.FC<ImgContentProps> = ({onError,@@ -111,7 +109,6 @@ const ImgContent: React.FC<ImgContentProps> = ({crossOrigin,decoding,ref,- refForOutline,...props}) => {const imageRef = useRef<HTMLImageElement>(null);@@ -129,7 +126,6 @@ const ImgContent: React.FC<ImgContentProps> = ({const imageCallbackRef = useCallback((img: HTMLImageElement | null) => {imageRef.current = img;- refForOutline.current = img;if (typeof ref === 'function') {ref(img);@@ -137,7 +133,7 @@ const ImgContent: React.FC<ImgContentProps> = ({ref.current = img;}},- [ref, refForOutline],+ [ref],);const actualSrc = usePreload(src as string);@@ -356,7 +352,6 @@ const ImgContent: React.FC<ImgContentProps> = ({type NativeImgInnerProps = Omit<ImgProps, 'effects'> & {readonly controls: SequenceControls | undefined;- readonly outlineRef: React.RefObject<HTMLElement | null>;};const NativeImgInner: React.FC<NativeImgInnerProps> = ({@@ -378,7 +373,6 @@ const NativeImgInner: React.FC<NativeImgInnerProps> = ({cropTop,cropBottom,controls,- outlineRef: refForOutline,...props}) => {if (!src) {@@ -438,14 +432,8 @@ const NativeImgInner: React.FC<NativeImgInnerProps> = ({controls={controls}showInTimeline={showInTimeline ?? true}hidden={hidden}- outlineRef={refForOutline}>- <ImgContent- src={src}- refForOutline={refForOutline}- style={croppedStyle ?? undefined}- {...props}- />+ <ImgContent src={src} style={croppedStyle ?? undefined} {...props} /></Sequence></Freeze>);@@ -454,7 +442,6 @@ const NativeImgInner: React.FC<NativeImgInnerProps> = ({const CanvasImageWithPrivateProps = CanvasImage as React.ComponentType<CanvasImageProps & {readonly controls?: SequenceControls | undefined;- readonly outlineRef?: React.RefObject<HTMLElement | null> | null;}>;@@ -585,7 +572,6 @@ const ImgInner: React.FC<onImageError,...props}) => {- const refForOutline = useRef<HTMLElement | null>(null);const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);if (effects.length === 0) {@@ -620,7 +606,6 @@ const ImgInner: React.FC<delayRenderRetries={delayRenderRetries}delayRenderTimeoutInMilliseconds={delayRenderTimeoutInMilliseconds}onImageError={onImageError}- outlineRef={refForOutline}/>);}@@ -674,7 +659,6 @@ const ImgInner: React.FC<_remotionInternalDocumentationLink="https://www.remotion.dev/docs/img"_remotionInternalCropComponentName="<Img />"controls={controls}- outlineRef={refForOutline}{...canvasProps}/>);diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsxindex 3095ad8b86..371e4c5197 100644--- a/packages/core/src/Interactive.tsx+++ b/packages/core/src/Interactive.tsx@@ -1,4 +1,4 @@-import React, {forwardRef, useCallback, useRef} from 'react';+import React, {forwardRef, useCallback} from 'react';import type {JsxComponentIdentity,SequenceControls,@@ -289,10 +289,8 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(style: premountingStyle,componentName: displayName,});- const refForOutline = useRef<ElementType | null>(null);const callbackRef = useCallback((element: ElementType | null) => {- refForOutline.current = element;setRef(ref, element);},[ref],@@ -312,7 +310,6 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(showInTimeline={showInTimeline ?? true}controls={controls}_remotionInternalDocumentationLink="https://www.remotion.dev/docs/interactive"- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}diff --git a/packages/core/src/animated-image/AnimatedImage.tsx b/packages/core/src/animated-image/AnimatedImage.tsxindex 4cad3d2356..e75f36de98 100644--- a/packages/core/src/animated-image/AnimatedImage.tsx+++ b/packages/core/src/animated-image/AnimatedImage.tsx@@ -382,7 +382,6 @@ const AnimatedImageInner = ({_remotionInternalIsPremounting={premountingActive}_remotionInternalIsPostmounting={postmountingActive}{...sequenceProps}- outlineRef={actualRef}><AnimatedImageContent{...animatedImageProps}diff --git a/packages/core/src/canvas-image/CanvasImage.tsx b/packages/core/src/canvas-image/CanvasImage.tsxindex 34ec50c8e6..c20309ce46 100644--- a/packages/core/src/canvas-image/CanvasImage.tsx+++ b/packages/core/src/canvas-image/CanvasImage.tsx@@ -7,7 +7,6 @@ import {useMemo,useRef,useState,- type RefObject,} from 'react';import {calculateImageFit} from '../calculate-image-fit.js';import type {SequenceControls} from '../CompositionManager.js';@@ -203,7 +202,6 @@ type CanvasImageContentProps = Pick<> & {readonly effects: EffectsProp;readonly controls: SequenceControls | undefined;- readonly refForOutline: RefObject<HTMLElement | null> | null;} & CanvasImageCanvasProps;const CanvasImageContent = forwardRef<@@ -227,7 +225,6 @@ const CanvasImageContent = forwardRef<maxRetries = 2,delayRenderRetries,delayRenderTimeoutInMilliseconds,- refForOutline,...canvasProps},ref,@@ -279,9 +276,6 @@ const CanvasImageContent = forwardRef<const canvasRef = useCallback((canvas: HTMLCanvasElement | null) => {setOutputCanvas(canvas);- if (refForOutline) {- refForOutline.current = canvas;- }if (typeof ref === 'function') {ref(canvas);@@ -289,7 +283,7 @@ const CanvasImageContent = forwardRef<ref.current = canvas;}},- [ref, refForOutline],+ [ref],);useLayoutEffect(() => {@@ -558,7 +552,6 @@ const CanvasImageInner = forwardRef<controls,_remotionInternalDocumentationLink,_remotionInternalCropComponentName,- outlineRef,...canvasProps},ref,@@ -629,7 +622,6 @@ const CanvasImageInner = forwardRef<_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}_remotionInternalIsPostmounting={postmountingActive}- outlineRef={outlineRef ?? actualRef}><CanvasImageContentref={actualRef}@@ -648,7 +640,6 @@ const CanvasImageInner = forwardRef<maxRetries={maxRetries}delayRenderRetries={delayRenderRetries}delayRenderTimeoutInMilliseconds={delayRenderTimeoutInMilliseconds}- refForOutline={outlineRef ?? null}{...canvasProps}/></Sequence>diff --git a/packages/core/src/canvas-image/props.ts b/packages/core/src/canvas-image/props.tsindex 8fbcc7f8b4..211f82ff7a 100644--- a/packages/core/src/canvas-image/props.ts+++ b/packages/core/src/canvas-image/props.ts@@ -40,9 +40,4 @@ export type CanvasImageProps = CanvasImageSequenceProps &* @deprecated For internal use only.*/readonly _remotionInternalCropComponentName?: string;- /**- * A React ref pointing to the element that Remotion Studio should use for- * drawing the selection outline in the preview.- */- readonly outlineRef?: React.RefObject<HTMLElement | null> | null;};diff --git a/packages/core/src/effects/Solid.tsx b/packages/core/src/effects/Solid.tsxindex e0d8abda6a..e2df8c3f8e 100644--- a/packages/core/src/effects/Solid.tsx+++ b/packages/core/src/effects/Solid.tsx@@ -341,7 +341,6 @@ const SolidOuter = forwardRef<_remotionInternalEffects={memoizedEffectDefinitions}durationInFrames={durationInFrames}name={name ?? '<Solid>'}- outlineRef={actualRef}_remotionInternalDocumentationLink="https://www.remotion.dev/docs/solid"{...props}_remotionInternalPremountDisplay={effectivePremountFor || null}diff --git a/packages/core/src/test/canvas-image.test.tsx b/packages/core/src/test/canvas-image.test.tsxindex 8d29d9ffd4..2ee04006b6 100644--- a/packages/core/src/test/canvas-image.test.tsx+++ b/packages/core/src/test/canvas-image.test.tsx@@ -263,10 +263,10 @@ test('<CanvasImage> forwards a canvas ref', async () => {});});-test('<CanvasImage> registers its canvas as the outline ref', async () => {+test('<CanvasImage> registers an automatic canvas outline', async () => {const registeredSequences: TSequence[] = [];- render(+ const {container} = render(<SequenceRegistrationWrapperonRegisterSequence={(sequence) => {registeredSequences.push(sequence);@@ -276,11 +276,13 @@ test('<CanvasImage> registers its canvas as the outline ref', async () => {</SequenceRegistrationWrapper>,);- await waitFor(() => {- expect(registeredSequences[0]?.refForOutline?.current?.tagName).toBe(- 'CANVAS',- );- });+ await waitFor(() => expect(registeredSequences).toHaveLength(1));+ expect(container.querySelector('canvas')).not.toBeNull();+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});test('<CanvasImage> schema exposes src and non-keyframable premounting fields', () => {diff --git a/packages/core/src/test/html-in-canvas.test.tsx b/packages/core/src/test/html-in-canvas.test.tsxindex 3bbde5d0d3..d546a4f7b5 100644--- a/packages/core/src/test/html-in-canvas.test.tsx+++ b/packages/core/src/test/html-in-canvas.test.tsx@@ -300,7 +300,11 @@ test('<HtmlInCanvas> registers its canvas for outline selection', async () => {const canvas = container.querySelector('canvas');expect(canvas).not.toBeNull();expect(canvasRef.current).toBe(canvas);- expect(registeredSequences[0]?.refForOutline?.current).toBe(canvas);+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});test('<HtmlInCanvas> renders internal capture siblings directly in the canvas', () => {@@ -413,7 +417,11 @@ test('<HtmlInCanvas> keeps refs current when the canvas remounts', async () => {const nextCanvas = container.querySelector('canvas');expect(nextCanvas).not.toBeNull();expect(canvasRef.current).toBe(nextCanvas);- expect(registeredSequences[0]?.refForOutline?.current).toBe(nextCanvas);+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});test('<HtmlInCanvas> can use a higher backing density', async () => {diff --git a/packages/core/src/test/sequence-register-once.test.tsx b/packages/core/src/test/sequence-register-once.test.tsxindex 6f5eac2f24..dcfb739448 100644--- a/packages/core/src/test/sequence-register-once.test.tsx+++ b/packages/core/src/test/sequence-register-once.test.tsx@@ -963,7 +963,7 @@ test('Img with effects delegates premounting to one CanvasImage owner', async ()).toContain('display: none');});-test('AnimatedImage registers its canvas ref for the Studio outline', () => {+test('AnimatedImage registers an automatic Studio outline', () => {const registeredSequences: TSequence[] = [];const ref = React.createRef<HTMLCanvasElement>();@@ -977,11 +977,12 @@ test('AnimatedImage registers its canvas ref for the Studio outline', () => {</SequenceTestWrapper>,);- const refForOutline = registeredSequences[0]- ?.refForOutline as React.RefObject<HTMLCanvasElement | null>;-- expect(refForOutline.current).toBeInstanceOf(HTMLCanvasElement);- expect(ref.current).toBe(refForOutline.current);+ expect(ref.current).toBeInstanceOf(HTMLCanvasElement);+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});test('AnimatedImage exposes non-keyframable premounting schema fields', () => {@@ -1317,7 +1318,7 @@ test('Video media registration keeps frozen frame sequence-local for negative frexpect(videoSequence?.frozenMediaFrame).toBe(17);});-test('Img registers a refForOutline pointing to the rendered image element', () => {+test('Img registers an automatic outline for its image element', () => {const registeredSequences: TSequence[] = [];render(@@ -1330,10 +1331,14 @@ test('Img registers a refForOutline pointing to the rendered image element', ()</SequenceTestWrapper>,);- expect(registeredSequences[0]?.refForOutline?.current?.tagName).toBe('IMG');+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});-test('Interactive elements register their rendered element for Studio outlines', () => {+test('Interactive elements register automatic Studio outlines', () => {const registeredSequences: TSequence[] = [];const divRef = React.createRef<HTMLDivElement>();const rectRef = React.createRef<SVGRectElement>();@@ -1394,30 +1399,27 @@ test('Interactive elements register their rendered element for Studio outlines',(sequence) => sequence.displayName === displayName,);- expect(getByName('<Interactive.Div>')?.refForOutline?.current?.tagName).toBe(- 'DIV',- );- expect(getByName('<Interactive.Span>')?.refForOutline?.current?.tagName).toBe(- 'SPAN',- );- expect(getByName('<Interactive.Svg>')?.refForOutline?.current?.tagName).toBe(- 'svg',- );- expect(getByName('<Interactive.Rect>')?.refForOutline?.current?.tagName).toBe(- 'rect',- );- expect(getByName('<Interactive.Text>')?.refForOutline?.current?.tagName).toBe(- 'text',- );+ for (const displayName of [+ '<Interactive.Div>',+ '<Interactive.Span>',+ '<Interactive.Svg>',+ '<Interactive.Rect>',+ '<Interactive.Text>',+ ]) {+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ getByName(displayName)!.refForOutline!,+ ),+ ).toEqual([]);+ }+expect(getByName('<Interactive.Div>')?.documentationLink).toBe(documentationLink,);expect(getByName('<Interactive.Rect>')?.documentationLink).toBe(documentationLink,);- expect(getByName('<Interactive.Div>')?.refForOutline?.current).toBe(- divRef.current,- );+ expect(divRef.current?.tagName).toBe('DIV');expect(getByName('<Interactive.Div>')?.controls).not.toBe(null);expect(divRef.current?.style.clipPath).toBe('inset(30% 20% 40% 10%)');expect(divRef.current?.getAttributeNames()).not.toContain('cropleft');@@ -1541,7 +1543,11 @@ test('AbsoluteFill is an interactive sequence while preserving its div contract'duration: 12,showInTimeline: true,});- expect(registeredSequences[0]?.refForOutline?.current).toBe(element);+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);expect(registeredSequences[0]?.controls?.componentIdentity).toBe('dev.remotion.remotion.AbsoluteFill',);diff --git a/packages/docs/docs/interactive-with-schema.mdx b/packages/docs/docs/interactive-with-schema.mdxindex 865540719b..f52a5def74 100644--- a/packages/docs/docs/interactive-with-schema.mdx+++ b/packages/docs/docs/interactive-with-schema.mdx@@ -75,7 +75,6 @@ const CircleInner = forwardRef<{...sequenceProps}name={name ?? '<Circle>'}controls={controls}- outlineRef={outlineRef}><divref={outlineRef}@@ -102,7 +101,7 @@ export const Circle = Interactive.withSchema({The exported `Circle` component only accepts `CircleProps`. The `controls` prop is passed by `Interactive.withSchema()` to the inner component and should be forwarded unchanged to the [`<Sequence>`](/docs/sequence) that represents the component in the timeline. It also preserves the outer component's source location for Studio edits.-If you use `<Sequence layout="none">`, pass [`outlineRef`](/docs/sequence#outlineref) so the Studio can draw a canvas outline around the rendered element.+With `<Sequence layout="none">`, the Studio discovers the rendered element automatically. Pass [`outlineRef`](/docs/sequence#outlineref) when you need to select a specific element.## APIdiff --git a/packages/docs/docs/sequence.mdx b/packages/docs/docs/sequence.mdxindex 19f1af2463..502f161b1c 100644--- a/packages/docs/docs/sequence.mdx+++ b/packages/docs/docs/sequence.mdx@@ -336,9 +336,9 @@ export const MyVideo = () => {### `outlineRef?`<AvailableFrom v="4.0.479" />-A React ref pointing to the element that the Remotion Studio should use for drawing the selection outline in the preview.+A React ref pointing to the element that Remotion Studio should use for drawing the selection outline in the preview.-By default, the Studio outlines the wrapper created by `<Sequence>`. If you use `layout="none"`, no wrapper exists, so pass `outlineRef` to make the rendered element selectable in the preview.+By default, the Studio outlines the wrapper created by `<Sequence>`. With `layout="none"`, it outlines the rendered element or the bounds of multiple rendered roots. Pass `outlineRef` when you want to outline one specific element instead.```tsx twoslash title="MyVideo.tsx"import {useRef} from 'react';@@ -349,7 +349,8 @@ export const MyVideo = () => {return (<Sequence layout="none" outlineRef={outlineRef}>- <div ref={outlineRef}>Selectable in the Studio preview</div>+ <div ref={outlineRef}>Included in the outline</div>+ <div>Excluded from the outline</div></Sequence>);};diff --git a/packages/docs/docs/studio/make-component-interactive.mdx b/packages/docs/docs/studio/make-component-interactive.mdxindex 42da5b42a8..1f3b8afcf1 100644--- a/packages/docs/docs/studio/make-component-interactive.mdx+++ b/packages/docs/docs/studio/make-component-interactive.mdx@@ -143,7 +143,6 @@ const BadgeInner = forwardRef<{...sequenceProps}name={name ?? '<Badge>'}controls={controls}- outlineRef={outlineRef}><divref={outlineRef}@@ -167,7 +166,7 @@ const BadgeInner = forwardRef<The exported component should not expose `controls` as a public prop.-Pass [`outlineRef`](/docs/sequence#outlineref) when using `<Sequence layout="none">` so the Studio can draw an outline around the rendered element.+With `<Sequence layout="none">`, the Studio discovers the rendered element automatically. Pass [`outlineRef`](/docs/sequence#outlineref) when you need to select a specific element.## Wrap the component@@ -235,7 +234,6 @@ const BadgeInner = forwardRef<{...sequenceProps}name={name ?? '<Badge>'}controls={controls}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/audio/mirrored-spectrum/mirrored-spectrum.tsx b/packages/docs/elements/audio/mirrored-spectrum/mirrored-spectrum.tsxindex 25cbc7f8f1..27ead864a0 100644--- a/packages/docs/elements/audio/mirrored-spectrum/mirrored-spectrum.tsx+++ b/packages/docs/elements/audio/mirrored-spectrum/mirrored-spectrum.tsx@@ -153,7 +153,6 @@ const MirroredAudioSpectrumInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Mirrored audio spectrum'}- outlineRef={outlineRef}><MirroredAudioSpectrumContentaudioSrc={audioSrc}diff --git a/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx b/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsxindex 7eee9dea22..ecedd74b51 100644--- a/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx+++ b/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx@@ -179,7 +179,6 @@ const AudioOscilloscopeInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Audio oscilloscope'}- outlineRef={outlineRef}><AudioOscilloscopeContentamplitude={amplitude}diff --git a/packages/docs/elements/audio/waveform-progress/audio-waveform-progress.tsx b/packages/docs/elements/audio/waveform-progress/audio-waveform-progress.tsxindex 50c2b882b2..848dc19517 100644--- a/packages/docs/elements/audio/waveform-progress/audio-waveform-progress.tsx+++ b/packages/docs/elements/audio/waveform-progress/audio-waveform-progress.tsx@@ -206,7 +206,6 @@ const AudioWaveformProgressInner = forwardRef<controls={controls}durationInFrames={durationInFrames}name={name ?? 'Audio waveform progress'}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/captions/basic-captions/basic-captions.tsx b/packages/docs/elements/captions/basic-captions/basic-captions.tsxindex 6304eb5f7b..02209f2acd 100644--- a/packages/docs/elements/captions/basic-captions/basic-captions.tsx+++ b/packages/docs/elements/captions/basic-captions/basic-captions.tsx@@ -145,7 +145,6 @@ const BasicCaptionsInner = forwardRef<controls={controls}name={name ?? '<BasicCaptions>'}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsxindex e5ea6a9457..412d0c5103 100644--- a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx+++ b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx@@ -418,7 +418,6 @@ const MovingPillCaptionsInner = forwardRef<controls={controls}name={name ?? '<MovingPillCaptions>'}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsxindex 5e2ef933b0..cd3d430c46 100644--- a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx+++ b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx@@ -329,7 +329,6 @@ const PoppingWordCaptionsInner = forwardRef<controls={controls}name={name ?? '<PoppingWordCaptions>'}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/captions/rounded-captions/rounded-captions.tsx b/packages/docs/elements/captions/rounded-captions/rounded-captions.tsxindex 38114e8775..f1bfb34b13 100644--- a/packages/docs/elements/captions/rounded-captions/rounded-captions.tsx+++ b/packages/docs/elements/captions/rounded-captions/rounded-captions.tsx@@ -251,7 +251,6 @@ const RoundedCaptionsInner = forwardRef<controls={controls}name={name ?? '<RoundedCaptions>'}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsxindex 852610cb28..28a35d691e 100644--- a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx+++ b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx@@ -287,7 +287,6 @@ const WordHighlightCaptionsInner = forwardRef<controls={controls}name={name ?? '<WordHighlightCaptions>'}trimBefore={trimBefore}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/docs/elements/guidelines.mdx b/packages/docs/elements/guidelines.mdxindex 11c1af31de..6610eba2e7 100644--- a/packages/docs/elements/guidelines.mdx+++ b/packages/docs/elements/guidelines.mdx@@ -54,7 +54,7 @@ Export the schema-enabled component directly and wire up the common props:- Add [`Interactive.baseSchema`](/docs/interactive#interactivebaseschema) to every `Interactive.withSchema()` schema and pass `controls` unchanged to the component's `<Sequence>`.- Pass `from`, `durationInFrames`, `trimBefore`, `playbackRate`, `freeze`, `hidden`, `name`, and `showInTimeline` to that Sequence.-- Pass `style` and the ref to the rendered outline. When the Sequence uses `layout="none"`, pass [`outlineRef`](/docs/sequence#outlineref) to it. Set the dimensions in the component because Element metadata does not pass them as props.+- Pass `style` and the ref to the rendered element. With `layout="none"`, the Studio discovers the outline automatically; use [`outlineRef`](/docs/sequence#outlineref) to select a specific element. Set the dimensions in the component because Element metadata does not pass them as props.- Render frame-dependent animation in a child below the Sequence. This makes [`useCurrentFrame()`](/docs/use-current-frame) respect `from`, `trimBefore`, `playbackRate`, and `freeze`. If the component that returns the Sequence calls it, it reads the parent clock.Export the schema-enabled component directly, without a forwarding wrapper. See the [oscilloscope](/elements/audio/oscilloscope), [waveform progress](/elements/audio/waveform-progress), and [mirrored spectrum](/elements/audio/mirrored-spectrum) Elements.diff --git a/packages/docs/elements/maps/map-flyover/a-to-b-map-flyover.tsx b/packages/docs/elements/maps/map-flyover/a-to-b-map-flyover.tsxindex 21f66b1f62..6a272d4eb3 100644--- a/packages/docs/elements/maps/map-flyover/a-to-b-map-flyover.tsx+++ b/packages/docs/elements/maps/map-flyover/a-to-b-map-flyover.tsx@@ -636,7 +636,6 @@ const MapFlyoverLayerInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'A-to-B Map Flyover'}- outlineRef={outlineRef}><MapFlyoverContentdestination={destination}diff --git a/packages/docs/elements/maps/watercolor-map/watercolor-map.tsx b/packages/docs/elements/maps/watercolor-map/watercolor-map.tsxindex 150c54e3ca..d731d31e92 100644--- a/packages/docs/elements/maps/watercolor-map/watercolor-map.tsx+++ b/packages/docs/elements/maps/watercolor-map/watercolor-map.tsx@@ -433,7 +433,6 @@ const WatercolorMapInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Watercolor map'}- outlineRef={outlineRef}><WatercolorMapContentdestination={destination}diff --git a/packages/docs/elements/overlays/social-safe-zones/social-safe-zones.tsx b/packages/docs/elements/overlays/social-safe-zones/social-safe-zones.tsxindex 9789b995f0..64ebc42e23 100644--- a/packages/docs/elements/overlays/social-safe-zones/social-safe-zones.tsx+++ b/packages/docs/elements/overlays/social-safe-zones/social-safe-zones.tsx@@ -45,7 +45,6 @@ const SocialSafeZonesInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Social Safe Zones'}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/example/src/CaptionsTester/AnimatedCaptions.tsx b/packages/example/src/CaptionsTester/AnimatedCaptions.tsxindex b2e0d956d3..366f96f75f 100644--- a/packages/example/src/CaptionsTester/AnimatedCaptions.tsx+++ b/packages/example/src/CaptionsTester/AnimatedCaptions.tsx@@ -141,7 +141,6 @@ const AnimatedCaptionsInner = forwardRef<name={name ?? '<AnimatedCaptions>'}style={style}controls={controls}- outlineRef={outlineRef}>{pages.map((page, index) => {const nextPage = pages[index + 1];diff --git a/packages/example/src/mirrored-spectrum.element.tsx b/packages/example/src/mirrored-spectrum.element.tsxindex f31ad5f8ff..3381607976 100644--- a/packages/example/src/mirrored-spectrum.element.tsx+++ b/packages/example/src/mirrored-spectrum.element.tsx@@ -153,7 +153,6 @@ const MirroredAudioSpectrumInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Mirrored audio spectrum'}- outlineRef={outlineRef}><MirroredAudioSpectrumContentaudioSrc={audioSrc}diff --git a/packages/example/src/moving-pill-captions.element.tsx b/packages/example/src/moving-pill-captions.element.tsxindex 448da75150..6710071668 100644--- a/packages/example/src/moving-pill-captions.element.tsx+++ b/packages/example/src/moving-pill-captions.element.tsx@@ -421,7 +421,6 @@ const MovingPillCaptionsInner = forwardRef<{...interactiveProps}controls={controls}name={name ?? '<MovingPillCaptions>'}- outlineRef={outlineRef}><divref={outlineRef}diff --git a/packages/example/src/oscilloscope.element.tsx b/packages/example/src/oscilloscope.element.tsxindex 7e6da525a3..3d90c5186c 100644--- a/packages/example/src/oscilloscope.element.tsx+++ b/packages/example/src/oscilloscope.element.tsx@@ -179,7 +179,6 @@ const AudioOscilloscopeInner = forwardRef<{...sequenceProps}controls={controls}name={name ?? 'Audio oscilloscope'}- outlineRef={outlineRef}><AudioOscilloscopeContentamplitude={amplitude}diff --git a/packages/gif/src/Gif.tsx b/packages/gif/src/Gif.tsxindex 6086499d31..84fa899bb6 100644--- a/packages/gif/src/Gif.tsx+++ b/packages/gif/src/Gif.tsx@@ -73,7 +73,6 @@ const GifInner = ({readonly ref?: React.Ref<HTMLCanvasElement>;}) => {const env = useRemotionEnvironment();- const refForOutline = React.useRef<HTMLElement | null>(null);const {effectivePostmountFor,effectivePremountFor,@@ -127,7 +126,7 @@ const GifInner = ({const inner = env.isRendering ? (<GifForRendering {...gifProps} ref={ref} />) : (- <GifForDevelopment {...gifProps} ref={ref} refForOutline={refForOutline} />+ <GifForDevelopment {...gifProps} ref={ref} />);return (@@ -146,7 +145,6 @@ const GifInner = ({_remotionInternalIsPremounting={premountingActive}_remotionInternalIsPostmounting={postmountingActive}{...sequenceProps}- outlineRef={refForOutline}>{inner}</Sequence>diff --git a/packages/gif/src/GifForDevelopment.tsx b/packages/gif/src/GifForDevelopment.tsxindex 96a0f3e70b..769b8e402b 100644--- a/packages/gif/src/GifForDevelopment.tsx+++ b/packages/gif/src/GifForDevelopment.tsx@@ -1,5 +1,5 @@/* eslint-disable no-console */-import {forwardRef, useEffect, useRef, useState, type RefObject} from 'react';+import {forwardRef, useEffect, useRef, useState} from 'react';import type {EffectDefinitionAndStack} from 'remotion';import {Canvas} from './canvas';import {manuallyManagedGifCache, volatileGifCache} from './gif-cache';@@ -14,7 +14,6 @@ export const GifForDevelopment = forwardRef<HTMLCanvasElement,RemotionGifProps & {readonly effects: EffectDefinitionAndStack<unknown>[];- readonly refForOutline: RefObject<HTMLElement | null>;}>((@@ -29,7 +28,6 @@ export const GifForDevelopment = forwardRef<fit = 'fill',requestInit,effects,- refForOutline,...props},ref,@@ -135,7 +133,6 @@ export const GifForDevelopment = forwardRef<width={width}height={height}effects={effects}- refForOutline={refForOutline}{...props}ref={ref}/>diff --git a/packages/gif/src/canvas.tsx b/packages/gif/src/canvas.tsxindex 30347a9d06..1e4e7fcd40 100644--- a/packages/gif/src/canvas.tsx+++ b/packages/gif/src/canvas.tsx@@ -1,13 +1,11 @@/* eslint-disable react/require-default-props */import {forwardRef,- useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState,- type RefObject,} from 'react';import type {EffectDefinitionAndStack} from 'remotion';import {Internals, useDelayRender} from 'remotion';@@ -110,22 +108,11 @@ type Props = {readonly className?: string;readonly style?: React.CSSProperties;readonly effects: EffectDefinitionAndStack<unknown>[];- readonly refForOutline?: RefObject<HTMLElement | null>;};export const Canvas = forwardRef((- {- index,- frames,- width,- height,- fit,- className,- style,- effects,- refForOutline,- }: Props,+ {index, frames, width, height, fit, className, style, effects}: Props,ref,) => {const canvasRef = useRef<HTMLCanvasElement>(null);@@ -157,16 +144,6 @@ export const Canvas = forwardRef(useImperativeHandle(ref, () => {return canvasRef.current as HTMLCanvasElement;}, []);- const canvasCallbackRef = useCallback(- (canvas: HTMLCanvasElement | null) => {- canvasRef.current = canvas;- if (refForOutline) {- refForOutline.current = canvas;- }- },- [refForOutline],- );-useEffect(() => {if (!size) {return;@@ -312,7 +289,7 @@ export const Canvas = forwardRef(return (<canvas- ref={canvasCallbackRef}+ ref={canvasRef}className={className}style={style}width={width ?? size?.width}diff --git a/packages/gif/src/test/Gif.test.tsx b/packages/gif/src/test/Gif.test.tsxindex 31ea432363..75eca03efb 100644--- a/packages/gif/src/test/Gif.test.tsx+++ b/packages/gif/src/test/Gif.test.tsx@@ -228,7 +228,7 @@ test('<Gif> resolves media sources when its origin is opaque', async () => {expect(MockWorker.instances).toBe(0);});-test('<Gif> registers its canvas as the outline ref', async () => {+test('<Gif> registers an automatic canvas outline', async () => {const registeredSequences: RegisteredSequence[] = [];const ref = React.createRef<HTMLCanvasElement>();@@ -242,15 +242,12 @@ test('<Gif> registers its canvas as the outline ref', async () => {</SequenceRegistrationWrapper>,);- await waitFor(() => {- expect(registeredSequences[0]?.refForOutline?.current).toBeInstanceOf(- HTMLCanvasElement,- );- });-- const refForOutline = registeredSequences[0]- .refForOutline as React.RefObject<HTMLCanvasElement | null>;- expect(ref.current).toBe(refForOutline.current);+ await waitFor(() => expect(ref.current).toBeInstanceOf(HTMLCanvasElement));+ expect(+ Internals.SequenceOutlineInternals.getNodes(+ registeredSequences[0].refForOutline!,+ ),+ ).toEqual([]);});test('<Gif> exposes non-keyframable premounting schema fields', () => {expect(gifSchema.premountFor).toMatchObject({keyframable: false});diff --git a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx b/packages/jonnys-videos/src/components/AnimatedCaptions.tsxindex 6bd99538ac..a1bd9fc1ab 100644--- a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx+++ b/packages/jonnys-videos/src/components/AnimatedCaptions.tsx@@ -460,7 +460,6 @@ const AnimatedCaptionsInner = forwardRef<{...interactiveProps}controls={controls}name={name ?? '<AnimatedCaptions>'}- outlineRef={outlineRef}><AbsoluteFill ref={outlineRef}>{captions ? (diff --git a/packages/mac-cursors/src/MacOSCursor.tsx b/packages/mac-cursors/src/MacOSCursor.tsxindex de81318e8f..4ec6a21565 100644--- a/packages/mac-cursors/src/MacOSCursor.tsx+++ b/packages/mac-cursors/src/MacOSCursor.tsx@@ -77,7 +77,6 @@ const MacOSCursorInner: React.FC<? resolveCursor(customCursor): null: resolveCursor(cursor);- const refForOutline = React.useRef<SVGSVGElement | null>(null);const width = resolved?.width ?? undefined;const height = resolved?.height ?? undefined;const currentScale = useCurrentScale({dontThrowIfOutsideOfRemotion: true});@@ -113,7 +112,6 @@ const MacOSCursorInner: React.FC<name={name ?? '<MacOSCursor>'}showInTimeline={showInTimeline ?? true}controls={controls}- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}@@ -121,7 +119,6 @@ const MacOSCursorInner: React.FC<>{resolved ? (<svg- ref={refForOutline}className={className}width={width}height={height}diff --git a/packages/maptiler/src/MapOverlay.tsx b/packages/maptiler/src/MapOverlay.tsxindex 53a78f0290..abd308fa82 100644--- a/packages/maptiler/src/MapOverlay.tsx+++ b/packages/maptiler/src/MapOverlay.tsx@@ -141,7 +141,7 @@ const MapOverlayRefForwardingFunction: ForwardRefRenderFunction<ref,) => {const {map} = useContext(MapTilerContext);- const refForOutline = useRef<HTMLDivElement>(null);+ const elementRef = useRef<HTMLDivElement>(null);const point = map?.project([longitude, latitude]);const horizontalAnchor = anchor.includes('left')? 0@@ -154,7 +154,7 @@ const MapOverlayRefForwardingFunction: ForwardRefRenderFunction<? -100: -50;- useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);+ useImperativeHandle(ref, () => elementRef.current as HTMLDivElement, []);const {effectivePremountFor,@@ -187,14 +187,13 @@ const MapOverlayRefForwardingFunction: ForwardRefRenderFunction<name={name ?? '<MapOverlay>'}showInTimeline={showInTimeline ?? true}controls={controls}- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}_remotionInternalIsPostmounting={postmountingActive}><div- ref={refForOutline}+ ref={elementRef}style={{left: (point?.x ?? 0) + offsetX,opacity,diff --git a/packages/maptiler/src/MapRegion.tsx b/packages/maptiler/src/MapRegion.tsxindex 7a3e43f950..c835cb1840 100644--- a/packages/maptiler/src/MapRegion.tsx+++ b/packages/maptiler/src/MapRegion.tsx@@ -310,15 +310,15 @@ const MapRegionDrawing = ({const MapRegionBounds = ({feature,- refForOutline,+ boundsRef,}: {readonly feature: MapRegionFeature;- readonly refForOutline: RefObject<HTMLDivElement | null>;+ readonly boundsRef: RefObject<HTMLDivElement | null>;}) => {const {map} = useContext(MapTilerContext);if (!map) {- return <div ref={refForOutline} />;+ return <div ref={boundsRef} />;}const points = feature.geometry.coordinates@@ -331,7 +331,7 @@ const MapRegionBounds = ({return (<div- ref={refForOutline}+ ref={boundsRef}style={{height: bottom - top,left,@@ -373,9 +373,9 @@ const MapRegionRefForwardingFunction: ForwardRefRenderFunction<},ref,) => {- const refForOutline = useRef<HTMLDivElement>(null);+ const boundsRef = useRef<HTMLDivElement>(null);- useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);+ useImperativeHandle(ref, () => boundsRef.current as HTMLDivElement, []);const {effectivePremountFor,@@ -407,7 +407,6 @@ const MapRegionRefForwardingFunction: ForwardRefRenderFunction<name={name ?? `<${feature.properties.name}>`}showInTimeline={showInTimeline ?? true}controls={controls}- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}@@ -424,7 +423,7 @@ const MapRegionRefForwardingFunction: ForwardRefRenderFunction<strokeColor={strokeColor}strokeWidth={strokeWidth}/>- <MapRegionBounds feature={feature} refForOutline={refForOutline} />+ <MapRegionBounds feature={feature} boundsRef={boundsRef} /></></Sequence></Freeze>diff --git a/packages/maptiler/src/MapRoute.tsx b/packages/maptiler/src/MapRoute.tsxindex 7b974982dd..d2de8d2f76 100644--- a/packages/maptiler/src/MapRoute.tsx+++ b/packages/maptiler/src/MapRoute.tsx@@ -241,15 +241,15 @@ const MapRouteDrawing = ({const MapRouteBounds = ({feature,- refForOutline,+ boundsRef,}: {readonly feature: MapRouteFeature;- readonly refForOutline: RefObject<HTMLDivElement | null>;+ readonly boundsRef: RefObject<HTMLDivElement | null>;}) => {const {map} = useContext(MapTilerContext);if (!map) {- return <div ref={refForOutline} />;+ return <div ref={boundsRef} />;}const points = feature.geometry.coordinates.map(([longitude, latitude]) =>@@ -262,7 +262,7 @@ const MapRouteBounds = ({return (<div- ref={refForOutline}+ ref={boundsRef}style={{height: bottom - top,left,@@ -302,9 +302,9 @@ const MapRouteRefForwardingFunction: ForwardRefRenderFunction<},ref,) => {- const refForOutline = useRef<HTMLDivElement>(null);+ const boundsRef = useRef<HTMLDivElement>(null);- useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);+ useImperativeHandle(ref, () => boundsRef.current as HTMLDivElement, []);const {effectivePremountFor,@@ -336,7 +336,6 @@ const MapRouteRefForwardingFunction: ForwardRefRenderFunction<name={name ?? `<${feature.properties.name}>`}showInTimeline={showInTimeline ?? true}controls={controls}- outlineRef={refForOutline}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}@@ -351,7 +350,7 @@ const MapRouteRefForwardingFunction: ForwardRefRenderFunction<strokeColor={strokeColor}strokeWidth={strokeWidth}/>- <MapRouteBounds feature={feature} refForOutline={refForOutline} />+ <MapRouteBounds feature={feature} boundsRef={boundsRef} /></></Sequence></Freeze>diff --git a/packages/media/src/video/video-for-preview.tsx b/packages/media/src/video/video-for-preview.tsxindex d66e278b1d..6b7e9b7fda 100644--- a/packages/media/src/video/video-for-preview.tsx+++ b/packages/media/src/video/video-for-preview.tsx@@ -1,5 +1,4 @@import React, {- useCallback,useContext,useEffect,useLayoutEffect,@@ -79,7 +78,6 @@ type VideoForPreviewProps = NativeVideoProps & {readonly setMediaDurationInSeconds: (durationInSeconds: number) => void;readonly _experimentalInitiallyDrawCachedFrame: boolean;readonly effects: EffectDefinitionAndStack<unknown>[];- readonly refForOutline: React.RefObject<HTMLElement | null>;};type VideoForPreviewAssertedShowingProps = VideoForPreviewProps;@@ -114,7 +112,6 @@ const VideoForPreviewAssertedShowing: React.FC<_experimentalInitiallyDrawCachedFrame,effects,setMediaDurationInSeconds,- refForOutline,...props}) => {const src = usePreload(unpreloadedSrc);@@ -139,21 +136,6 @@ const VideoForPreviewAssertedShowing: React.FC<const sharedAudioContext = useContext(SharedAudioContext);const buffer = useBufferState();- const canvasRefCallback = useCallback(- (canvas: HTMLCanvasElement | null) => {- canvasRef.current = canvas;- refForOutline.current = canvas;- },- [refForOutline],- );-- const fallbackVideoRef = useCallback(- (video: HTMLVideoElement | null) => {- refForOutline.current = video;- },- [refForOutline],- );-const [mediaVolume] = useMediaVolumeState();const unloopedVolumePropFrame = useFrameForVolumeProp(@@ -268,8 +250,9 @@ const VideoForPreviewAssertedShowing: React.FC<return;}+ const currentCanvasRef = canvasRef;return () => {- const canvas = canvasRef.current;+ const canvas = currentCanvasRef.current;if (!canvas ||@@ -574,7 +557,6 @@ const VideoForPreviewAssertedShowing: React.FC<return (<Html5Video{...props}- ref={fallbackVideoRef}src={src}style={actualStyle}className={className}@@ -601,7 +583,7 @@ const VideoForPreviewAssertedShowing: React.FC<return (<canvas{...props}- ref={canvasRefCallback}+ ref={canvasRef}// Don't set width and height here.// Width is set in the video iterator manager, if props are being updated, they are being applied again by React.// This will lead to inefficient resizes.diff --git a/packages/media/src/video/video.tsx b/packages/media/src/video/video.tsxindex c480ed035f..183360a1ec 100644--- a/packages/media/src/video/video.tsx+++ b/packages/media/src/video/video.tsx@@ -75,7 +75,6 @@ const InnerVideo: React.FC<InnerVideoProps & {readonly controls: SequenceControls | undefined;readonly setMediaDurationInSeconds: (durationInSeconds: number) => void;- readonly refForOutline: React.RefObject<HTMLElement | null>;}> = ({src,@@ -108,7 +107,6 @@ const InnerVideo: React.FC<_experimentalInitiallyDrawCachedFrame,effects,setMediaDurationInSeconds,- refForOutline,...props}) => {const environment = useRemotionEnvironment();@@ -208,7 +206,6 @@ const InnerVideo: React.FC<_experimentalInitiallyDrawCachedFrame={_experimentalInitiallyDrawCachedFrame}- refForOutline={refForOutline}/>);};@@ -347,7 +344,6 @@ const VideoInner: React.FC<const memoizedEffectDefinitions = Internals.useMemoizedEffectDefinitions(effects ?? [],);- const refForOutline = React.useRef<HTMLElement | null>(null);const {effectivePostmountFor,effectivePremountFor,@@ -400,7 +396,6 @@ const VideoInner: React.FC<controls={controls}_remotionInternalLoopDisplay={loopDisplay}_remotionInternalEffects={memoizedEffectDefinitions}- outlineRef={refForOutline}showInTimeline={showInTimeline ?? true}hidden={hidden}>@@ -442,7 +437,6 @@ const VideoInner: React.FC<}effects={memoizedEffects}setMediaDurationInSeconds={setMediaDurationInSeconds}- refForOutline={refForOutline}/></Sequence></Freeze>diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsxindex 7203fb4ce3..ef2f453c5e 100644--- a/packages/rive/src/RemotionRiveCanvas.tsx+++ b/packages/rive/src/RemotionRiveCanvas.tsx@@ -512,7 +512,6 @@ const RemotionRiveCanvasInnerForwardRefFunction: React.ForwardRefRenderFunction<durationInFrames={durationInFrames}controls={controls}_remotionInternalEffects={memoizedEffectDefinitions}- outlineRef={canvasRef}{...props}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}diff --git a/packages/rough-notation/src/Annotation.tsx b/packages/rough-notation/src/Annotation.tsxindex c507ce8945..940396eb91 100644--- a/packages/rough-notation/src/Annotation.tsx+++ b/packages/rough-notation/src/Annotation.tsx@@ -392,7 +392,6 @@ const makeAnnotationComponent = ({const annotation = useMemo(() => {return createAnnotation();}, []);- const outlineRef = React.useRef<HTMLSpanElement | null>(null);const config = (disabled ? {type: 'none'} : {...configProps, type}) as AnnotationConfig;@@ -444,14 +443,12 @@ const makeAnnotationComponent = ({showInTimeline={showInTimeline ?? true}controls={controls}_remotionInternalDocumentationLink={`https://www.remotion.dev/docs/rough-notation/${documentationSlug}`}- outlineRef={outlineRef}_remotionInternalPremountDisplay={effectivePremountFor || null}_remotionInternalPostmountDisplay={effectivePostmountFor || null}_remotionInternalIsPremounting={premountingActive}_remotionInternalIsPostmounting={postmountingActive}><span- ref={outlineRef}style={{display: 'inline-block',position: 'relative',diff --git a/packages/shapes/src/components/render-svg.tsx b/packages/shapes/src/components/render-svg.tsxindex f6199c204c..b6a41ee10e 100644--- a/packages/shapes/src/components/render-svg.tsx+++ b/packages/shapes/src/components/render-svg.tsx@@ -1,5 +1,5 @@import type {Instruction} from '@remotion/paths';-import React, {useCallback, useMemo, useRef} from 'react';+import React, {useMemo} from 'react';import {version} from 'react-dom';import {HtmlInCanvas,@@ -53,7 +53,6 @@ const RenderSvgWithTiming = ({durationInFrames,name,defaultName,- outlineRef,documentationLink,memoizedEffectDefinitions,content,@@ -63,7 +62,6 @@ const RenderSvgWithTiming = ({readonly documentationLink: string;readonly content: React.ReactElement<Pick<AllShapesProps, 'style'>>;readonly actualStyle: React.CSSProperties;- readonly outlineRef: React.RefObject<Element | null>;readonly memoizedEffectDefinitions: ReturnType<typeof Internals.useMemoizedEffectDefinitions>;@@ -100,7 +98,6 @@ const RenderSvgWithTiming = ({_remotionInternalEffects={memoizedEffectDefinitions}durationInFrames={durationInFrames}name={name ?? defaultName}- outlineRef={outlineRef}_remotionInternalDocumentationLink={name === undefined ? documentationLink : undefined}@@ -165,15 +162,6 @@ export const RenderSvg = ({};}, [pathStyle]);- const outlineRef = useRef<Element | null>(null);- const setSvgRef = useCallback((node: SVGSVGElement | null) => {- outlineRef.current = node;- }, []);-- const setCanvasRef = useCallback((canvas: HTMLCanvasElement | null) => {- outlineRef.current = canvas;- }, []);-const memoizedEffectDefinitions =Internals.useMemoizedEffectDefinitions(effects);const videoConfig = Internals.useUnsafeVideoConfig();@@ -183,7 +171,6 @@ export const RenderSvg = ({const svg = (<svg- ref={effects.length === 0 || !videoConfig ? setSvgRef : undefined}width={width}height={height}viewBox={`0 0 ${width} ${height}`}@@ -276,7 +263,6 @@ export const RenderSvg = ({svg) : (<HtmlInCanvasWithPrivateProps- ref={setCanvasRef}width={Math.ceil(width)}height={Math.ceil(height)}effects={effects}@@ -309,7 +295,6 @@ export const RenderSvg = ({durationInFrames={durationInFrames}name={name}defaultName={defaultName}- outlineRef={outlineRef}documentationLink={documentationLink}memoizedEffectDefinitions={memoizedEffectDefinitions}content={content}