Skip to content

🎥 Make videos programmatically with React

`remotion`: More solid ramp up of audio (#7288)

Jonny Burger81b7f5d608d7
diff --git a/packages/core/src/audio/shared-audio-tags.tsx b/packages/core/src/audio/shared-audio-tags.tsx
index 1e5c2d59ac..ab1dbd049c 100644
--- a/packages/core/src/audio/shared-audio-tags.tsx
+++ b/packages/core/src/audio/shared-audio-tags.tsx
@@ -337,26 +337,24 @@ export const SharedAudioContextProvider: React.FC<{
ctxAndGain.gainNode.gain.cancelScheduledValues(
ctxAndGain.audioContext.currentTime,
);
- ctxAndGain.gainNode?.gain.setValueAtTime(
+ ctxAndGain.gainNode.gain.setValueAtTime(
0,
ctxAndGain.audioContext.currentTime,
);
- ctxAndGain.gainNode?.gain.linearRampToValueAtTime(
+ ctxAndGain.gainNode.gain.linearRampToValueAtTime(
1,
ctxAndGain.audioContext.currentTime + 0.03,
);
- return resumePromise
- .then(() => {
- nodesToResume.current.forEach((r, node) =>
- node.start(r.scheduledTime, r.offset, r.duration),
- );
- nodesToResume.current.clear();
- })
- .catch(() => {
- // Already logged above; swallow to avoid unhandled rejection
- // since callers (e.g. use-playback.ts) do not await this.
- });
+ nodesToResume.current.forEach((r, node) =>
+ node.start(r.scheduledTime, r.offset, r.duration),
+ );
+ nodesToResume.current.clear();
+
+ return resumePromise.catch(() => {
+ // Already logged above; swallow to avoid unhandled rejection
+ // since callers (e.g. use-playback.ts) do not await this.
+ });
}, [ctxAndGain, logLevel]);
const getIsResumingAudioContext = useCallback(() => {