Skip to content

Honour asset.speed in preview playback#147

Merged
dazzatronus merged 2 commits into
mainfrom
derk/asset-speed-preview
Jul 22, 2026
Merged

Honour asset.speed in preview playback#147
dazzatronus merged 2 commits into
mainfrom
derk/asset-speed-preview

Conversation

@dazzatronus

Copy link
Copy Markdown
Contributor

Closes #145.

asset.speed round-tripped through updateClip/getEdit and rendered correctly, but canvas preview always played at 1x. This makes preview playback, the toolbar, and timeline resizing speed-aware so preview matches the rendered output.

Playback parity. Renders map clip time to source time as speed × (trim + t) — trim is scaled by speed too, and audio is resampled (pitch shifts). Preview now uses the same mapping: playbackRate/Howler rate() set from asset.speed, all seeks and drift correction target the speed-adjusted source time, preservesPitch disabled to match the resampled render. speed: 0 previews as a frozen frame with no audio, as rendered. Applies to video and audio clips.

Toolbar speed control. New control in the media toolbar (video/audio): log-scaled slider centred on 1x, presets 0.25x–4x, editable value input, range 0.1–10. Changing speed rescales clip length and trim by oldSpeed/newSpeed so the clip keeps the same source window at the new pace; auto/end length intents are preserved. One undo entry per change.

Speed-aware resize cap. Timeline resize stops where source media runs out (duration/speed − trim, via new Player.getMaxLength()). Growth-only: clips already longer than the source window keep their length (renders freeze the last frame past source end, so over-long clips stay valid).

Verify: load src/templates/speed.json, play — segment pace and pitch should match a render of the same JSON. Change speed on a clip via the toolbar and confirm the clip rescales; drag a video clip's right edge and confirm it stops at the source end. npx jest (1886 tests) covers the mapping, max-length maths, and toolbar rescale.

@dazzatronus
dazzatronus merged commit 18b7cd9 into main Jul 22, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Studio SDK ignores asset.speed during live preview / playback

1 participant