Skip to content

🎥 Make videos programmatically with React

display audio error

Jonny Burgerb7a09d76206e
diff --git a/packages/core/src/audio/Audio.tsx b/packages/core/src/audio/Audio.tsx
index cb0f5ee081..1955a0f66c 100644
--- a/packages/core/src/audio/Audio.tsx
+++ b/packages/core/src/audio/Audio.tsx
@@ -13,9 +13,14 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
> = (props, ref) => {
const {startFrom, endAt, ...otherProps} = props;
- const onError = useCallback(() => {
- throw new Error(`Could not play audio with src ${otherProps.src}`);
- }, [otherProps.src]);
+ const onError: React.ReactEventHandler<HTMLAudioElement> = useCallback(
+ (e) => {
+ throw new Error(
+ `Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}`
+ );
+ },
+ [otherProps.src]
+ );
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
validateStartFromProps(startFrom, endAt);