Capítulo 725 de 988

Chapter 725: getPartialAudioData()

Core Idea

:::warning We are phasing out Remotion WebCodecs and are moving to Mediabunny!

Key Concepts

  • API
  • src
  • fromSeconds
  • toSeconds
  • channelIndex
  • signal
  • Return value
  • Notes

Code Examples

const audioData = await getPartialAudioData({
  src: 'https://remotion.media/audio.wav',
  fromSeconds: 10,
  toSeconds: 20,
  channelIndex: 0, // Left channel for stereo audio
  signal: new AbortController().signal,
});

console.log('Audio samples:', audioData.length);
console.log('First sample value:', audioData[0]);
  • What it demonstrates: Usage pattern for getPartialAudioData() from the official docs.

Key Takeaways

  1. Understand api when working with getPartialAudioData().
  2. Understand src when working with getPartialAudioData().
  3. Understand fromseconds when working with getPartialAudioData().
  4. Understand toseconds when working with getPartialAudioData().
  5. Understand channelindex when working with getPartialAudioData().

Connects To

  • Buffer Writer: related page in the WebCodecs (@remotion/webcodecs) section.
  • can Copy Audio Track: related page in the WebCodecs (@remotion/webcodecs) section.
  • can Copy Video Track: related page in the WebCodecs (@remotion/webcodecs) section.