fix(core,player,studio): bound trimmed audio playback to the clip window#1430
Open
vanceingalls wants to merge 2 commits into
Open
fix(core,player,studio): bound trimmed audio playback to the clip window#1430vanceingalls wants to merge 2 commits into
vanceingalls wants to merge 2 commits into
Conversation
When iframe autoplay is blocked, audible playback is promoted to a parent-frame audio proxy. The proxy read the clip's data-start/data-duration once at adopt time and mirrorTime() only skipped (never paused) the element outside that window — so a trimmed/moved music clip kept playing the full source past its on-timeline end, even though the iframe element was correctly paused. Fix: the proxy keeps a reference to its source iframe element and re-reads data-start/data-duration each mirror tick (live trims/moves apply), pauses the proxy when the playhead leaves [start, start+duration), and resumes it when the playhead re-enters during parent-owned playback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Trimmed audio played to the source file's natural end instead of stopping at the clip edge, on every audio path: - WebAudio (the audible path in Studio): schedulePlayback now passes the clip's data-duration as the third start() arg, so the decoded buffer stops at the trimmed edge instead of running to the file end. - Runtime element gating: the duration resolver caps each clip by its own data-duration (min of source length, host window, authored duration), so a trimmed <audio>/<video> element pauses at its edge. Studio trim UX: - Resize live-patches the media-start/playback-start offset, so a start-edge drag trims into the source instead of only repositioning the clip. - AudioWaveform windows the rendered peaks to the trimmed slice so the waveform tracks the clip edges. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
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
Trimmed audio clips kept playing past the clip edge — the audio ran on to the source file's natural end even though the timeline clip ended earlier. This happened across every audio path, so fixing one didn't fix the symptom in the Studio.
Root cause
Three independent paths each ignored the clip's authored window (
data-duration/media-start):<hyperframes-player>when iframe autoplay is blocked) — the proxy played to the source end and never re-read live trims.core/runtime) — the duration resolver computed clip length only from source-file length capped by host-composition duration, never consulting the element's owndata-duration.<audio>is muted while WebAudio plays the decoded buffer).schedulePlaybackcalledAudioBufferSourceNode.start(when, offset)with no duration, so the buffer played from the trim offset to the file's natural end regardless of the clip length.Confirmed live:
audioOwner: "runtime", the iframe<audio>wasmuted: true+paused: trueat its trimmed edge (element gating worked), but WebAudio kept the buffer running — so the trim never bound the audible output.Fix
webAudioTransport.ts+init.ts):schedulePlaybacknow takes the clip'sdata-durationand passes a boundeddurationtostart(when, offset, duration), so the buffer stops at the trimmed edge. Past-end schedules are skipped.init.ts): the duration resolver caps each clip bymin(sourceLength, hostWindow, ownDataDuration), so a trimmed<audio>/<video>element pauses at its edge.parent-media.ts): the proxy re-reads its source clip's livedata-start/data-durationeach tick and pauses outside the clip window, resuming on re-entry.Studio trim UX (same root area)
useTimelineEditing.ts): a start-edge drag now live-patches themedia-start/playback-startoffset to the iframe, so dragging the left edge trims into the source instead of only repositioning the clip.AudioWaveform.tsx+useRenderClipContent.ts): the rendered peaks are windowed to the trimmed slice[mediaStart, mediaStart + duration·rate], so the waveform tracks the clip edges instead of squeezing the whole file into the clip width.Tests
webAudioTransport.test.ts: 5 new cases for the clip-duration bound (in-progress, future, past-end skip, rate scaling, unbounded-when-omitted).parent-media.test.ts: pause past trimmed end; re-read livedata-duration.Verification
In Studio: trim the music clip, play past the trimmed edge → audio now goes silent at the edge (previously ran to the source end). Untrimmed playback unchanged.
🤖 Generated with Claude Code