Chapter 178: Importing Audio
Core Idea
Put an audio file into the public/ folder and use staticFile() to reference it. Add an <Audio/> tag to your component to add sound to it.
Key Concepts
- Importing Audio: Put an audio file into the public/ folder and use staticFile() to reference it.
Code Examples
export const MyComposition = () => {
return (
<AbsoluteFill>
<Audio src={staticFile('audio.mp3')} />
</AbsoluteFill>
);
};
- What it demonstrates: Usage pattern for Importing Audio from the official docs.
Key Takeaways
- Understand importing audio when working with Importing Audio.
Connects To
- Animatedimage: related page in the Assets & Media section.
- Delaying: related page in the Assets & Media section.
- Exporting: related page in the Assets & Media section.