Skip to content

🎥 Make videos programmatically with React

handle exception in play() when using shared audio tags

Jonny Burgerf6a5ae9ce311
diff --git a/packages/core/src/audio/shared-audio-tags.tsx b/packages/core/src/audio/shared-audio-tags.tsx
index ab0b2ff248..acbd9e0038 100644
--- a/packages/core/src/audio/shared-audio-tags.tsx
+++ b/packages/core/src/audio/shared-audio-tags.tsx
@@ -9,6 +9,7 @@ import React, {
useRef,
useState,
} from 'react';
+import {playAndHandleNotAllowedError} from '../play-and-handle-not-allowed-error.js';
import type {RemotionAudioProps} from './props.js';
/**
@@ -236,7 +237,7 @@ export const SharedAudioContextProvider: React.FC<{
const playAllAudios = useCallback(() => {
refs.forEach((ref) => {
- ref.ref.current?.play();
+ playAndHandleNotAllowedError(ref.ref, 'audio');
});
}, [refs]);