Add an option to TldrawOptions to control whether videos autoplay
#8.915 geöffnet am 21. Mai 2026
Beschreibung
Problem
Today, video shapes autoplay by default. The behavior is configurable in two places:
- Per shape, via
TLVideoShape['props'].autoplay(set on the shape record itself). - As a default for newly created video shapes, via
VideoShapeOptions.autoplayonVideoShapeUtil(seepackages/tldraw/src/lib/shapes/video/VideoShapeUtil.tsx).
The shape-util option was added in #5716, but it can only be set by subclassing VideoShapeUtil. There is no way to disable video autoplay at the <Tldraw /> component level without writing a custom shape util — which is a lot of ceremony for a single boolean.
Proposed solution
Add a video autoplay option to TldrawOptions (packages/editor/src/lib/options.ts) so SDK consumers can do:
<Tldraw options={{ videoAutoplay: false }} />
The default should be true so current behavior is preserved. VideoShapeUtil should read this value when computing the autoplay default for new video shapes (or when deciding whether to set autoPlay on the rendered <video> element — the issue is which behavior we want; see below).
Naming suggestion: videoAutoplay, to match the existing shape.props.autoplay and VideoShapeOptions.autoplay and to leave room for a future audioAutoplay if needed.
Open questions
- Should this option control the default
autoplayprop on new video shapes, or whether any video plays automatically regardless of the shape's prop? The first matches the existingVideoShapeOptions.autoplaysemantics; the second is a stronger guarantee that a host app can disable autoplay across the board, including for pasted/restored shapes. - Does it need to interact with the existing
prefers-reduced-motioncheck atVideoShapeUtil.tsx:213? Probably not — that should keep behaving as it does today.
Alternatives considered
- Subclassing
VideoShapeUtiland overridingoptions.autoplay— works but is overkill for a single flag. - Setting
shape.props.autoplay = falseon every video at creation time — requires hooking into shape creation and doesn't help for pasted/loaded shapes.