packages/docs/docs/audio/muting.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import {AvailableFrom} from '../../src/components/AvailableFrom';
You may pass in the muted prop to <Audio>, <Video>, <OffthreadVideo>, <Html5Audio> and <Html5Video> and even change it over time.
When muted is true, audio will be omitted at that time. In the following example, we are muting the track between seconds 2 and 4.
import {AbsoluteFill, staticFile, useCurrentFrame, useVideoConfig} from 'remotion';
import {Html5Audio} from 'remotion';
export const MyComposition = () => {
const frame = useCurrentFrame();
const {fps} = useVideoConfig();
return (
<AbsoluteFill>
<Html5Audio src={staticFile('audio.mp3')} muted={frame >= 2 * fps && frame <= 4 * fps} />
</AbsoluteFill>
);
};