Skip to content

🎥 Make videos programmatically with React

emit audio

Jonny Burger87f3bd67513f
diff --git a/packages/media/src/audio/audio-for-rendering.tsx b/packages/media/src/audio/audio-for-rendering.tsx
index 27910c482f..1c744a40bd 100644
--- a/packages/media/src/audio/audio-for-rendering.tsx
+++ b/packages/media/src/audio/audio-for-rendering.tsx
@@ -81,6 +81,8 @@ export const AudioForRendering: React.FC<AudioProps> = ({
logLevel ?? window.remotion_logLevel,
);
+ const audioEnabled = Internals.useAudioEnabled();
+
useLayoutEffect(() => {
const timestamp = frame / fps;
const durationInSeconds = 1 / fps;
@@ -95,7 +97,7 @@ export const AudioForRendering: React.FC<AudioProps> = ({
});
const shouldRenderAudio = (() => {
- if (!window.remotion_audioEnabled) {
+ if (!audioEnabled) {
return false;
}
@@ -257,6 +259,7 @@ export const AudioForRendering: React.FC<AudioProps> = ({
trimBefore,
replaceWithHtml5Audio,
maxCacheSize,
+ audioEnabled,
]);
if (replaceWithHtml5Audio) {