Repository navigation
fix(web): keep the audio in every trim, not just the first - #3433
Open
patrickballard wants to merge 1 commit into
Open
patrickballard wants to merge 1 commit into
patrickballard wants to merge 1 commit into
Conversation
The trim tool connected the preview video to a new MediaElementAudioSourceNode on every trim, but an element can only ever have one, so from the second trim on the call threw, the catch logged it and the trim was recorded without audio. Create the connection once per preview element and reuse it.
Contributor
|
@patrickballard is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Closes #3432.
processTrimnow creates the preview'sMediaElementAudioSourceNodeand itsMediaStreamDestinationonce, keeps them in a ref, and adds that destination's audio track to each recording. Before, every trim calledcreateMediaElementSourceon the same always-mounted preview<video>, which browsers allow only once per element, so from the second trim on it threwInvalidStateError, thecatchlogged it, and the trim was recorded silent.Tests
trimming-tool-audio.test.ts, added to CI's web test list. It trims, then trims again after Trim Again and after choosing a different video, with anAudioContextstand-in that, like browsers, allows oneMediaElementAudioSourceNodeper element, and checks that each recording gets an audio track. Both cases fail without the change (the second recording has none).bun run typecheck: no errors. Biome: the test is clean, and the component's existing lint errors are unchanged.

Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR reuses the preview’s audio destination so repeated trims retain audio.
Reviews (1) · Last reviewed commit: "fix(web): keep the audio in every trim, ..." · Reviewed by Greptile