🎥 Make videos programmatically with React
`remotion`: Default premounting to zero inside `<HtmlInCanvas>`
JonnyBurgercb1f4b0ab26a
diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsxindex 53f000a711..1a83e2cd35 100644--- a/packages/core/src/HtmlInCanvas.tsx+++ b/packages/core/src/HtmlInCanvas.tsx@@ -8,6 +8,7 @@ import React, {useRef,} from 'react';import type {SequenceControls} from './CompositionManager.js';+import {DefaultPremountContext} from './DefaultPremountContext.js';import type {EffectsProp, EffectsOutputSize} from './effects/effect-types.js';import {runEffectChain} from './effects/run-effect-chain.js';import {useEffectChainState} from './effects/use-effect-chain-state.js';@@ -986,7 +987,9 @@ const HtmlInCanvasContent = forwardRef<: innerStyle}>- {children}+ <DefaultPremountContext.Provider value={0}>+ {children}+ </DefaultPremountContext.Provider></div>{canvasSiblings}</canvas>diff --git a/packages/docs/docs/remotion/html-in-canvas.mdx b/packages/docs/docs/remotion/html-in-canvas.mdxindex 81d05f5fd5..6eb75ed648 100644--- a/packages/docs/docs/remotion/html-in-canvas.mdx+++ b/packages/docs/docs/remotion/html-in-canvas.mdx@@ -50,6 +50,28 @@ Returns `true` when HTML-in-canvas is enabled and the browser supports nesting.From Remotion <AvailableFrom v="4.0.534" inline />, the bundled server-side browser is Chromium 157.0.8080.0, so this method also returns `true` during server-side rendering.+## Premounting<AvailableFrom v="4.0.537" />++Children inside `<HtmlInCanvas>` default to no [premounting](/docs/player/premounting), even when you configure a nonzero [`defaultPremountInSeconds`](/docs/options/default-premount-in-seconds). This avoids a [Chrome 157 crash involving premounted content](https://github.com/remotion-dev/remotion/issues/12369).++You can opt in by passing [`premountFor`](/docs/sequence#premountfor) explicitly to a child. Explicit premounting may still trigger the browser crash. Without premounting, videos may buffer when they become visible.++```tsx twoslash title="Opt in to premounting a child"+import {HtmlInCanvas, Sequence} from 'remotion';++export const MyComp: React.FC = () => {+ return (+ <HtmlInCanvas width={1280} height={720}>+ <Sequence from={60} durationInFrames={90} premountFor={15}>+ <div>Hello</div>+ </Sequence>+ </HtmlInCanvas>+ );+};+```++This changes the default for children only. The `<HtmlInCanvas>` component itself continues to inherit the surrounding premount default and honors its own `premountFor` prop.+## Using WebGL and WebGPU during rendersSee [Using WebGL and WebGPU during renders](/docs/webgl).