Skip to content

Audio

Adds audio that syncs with the Framely timeline.

Usage

jsx
import { Audio, AbsoluteFill } from 'framely';

function MyVideo() {
  return (
    <AbsoluteFill>
      <Audio src="/music.mp3" />
      <h1>My Video</h1>
    </AbsoluteFill>
  );
}

Props

PropTypeDescription
srcstringAudio source URL
startFromnumberStart playback from this frame
endAtnumberEnd playback at this frame
volumenumber | functionVolume (0-1) or a function of frame

Volume Fade

jsx
import { interpolate, useCurrentFrame, Audio } from 'framely';

function WithFade() {
  const frame = useCurrentFrame();

  return (
    <Audio
      src="/music.mp3"
      volume={(f) => interpolate(f, [0, 30], [0, 1], { extrapolateRight: 'clamp' })}
    />
  );
}

Released under the MIT License.