@remotion/studio: Guard timeline waveform draw against zero-width canvas#7293
Merged
JonnyBurger merged 1 commit intoMay 7, 2026
Merged
Conversation
`drawBars` in draw-peaks.ts calls `ctx.createImageData(w, height)` without checking dimensions. `createImageData` throws a DOMException when either dimension is 0, which surfaces in Studio's console while the timeline lays out audio rows on compositions with many audio sequences (some segments are 0 px wide at certain zoom levels). Early-return when there is nothing to draw. The same source is inlined into audio-waveform-worker.ts, so this one change covers both call sites.
Contributor
There was a problem hiding this comment.
Reviewed — no issues found.
Claude Opus | 𝕏
@remotion/studio: Guard timeline waveform draw against zero-width canvas
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Studio's timeline waveform painter throws
whenever an audio sequence is laid out at 0 px — for example when the timeline is mid-resize, a track is collapsed, or many short audio sequences are stacked at a low zoom level. The error is non-fatal but spams the console.
Repro
A composition with ~30+
<Audio>sequences. Open it in Studio; the error fires intermittently while the timeline lays out the audio rows.Fix
drawBarsinpackages/studio/src/components/draw-peaks.tscallsctx.createImageData(w, height)without checking dimensions.createImageDatathrows a DOMException when either dimension is 0. Add an early return when there's nothing to draw. The same source is inlined intoaudio-waveform-worker.ts, so this one change fixes both call sites.Test plan
<Audio>composition in Studio — console stays clean while scrubbing/zooming the timeline.