Skip to content

🎥 Make videos programmatically with React

Update use-audio-data.md

Jonny Burger191317f67026
diff --git a/packages/docs/docs/use-audio-data.md b/packages/docs/docs/use-audio-data.md
index 93f65d173b..0b3dae5ed6 100644
--- a/packages/docs/docs/use-audio-data.md
+++ b/packages/docs/docs/use-audio-data.md
@@ -62,6 +62,14 @@ export const MyComponent: React.FC = () => {
};
```
+## Errors
+
+If you pass in a file that has no audio track, this hook will throw an error.
+
+To determine if a file has an audio track, you may use the [`getVideoMetadata()`](/docs/renderer/get-video-metadata#audiocodec) function on the server to reject a file if it has no audio track. To do so, check if the `audioCodec` field is `null`.
+
+If you want to catch the error in the component, you need to make your own inline hook by taking the source code from the bottom of this page.
+
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/media-utils/src/use-audio-data.ts)