🎥 Make videos programmatically with React
Update shared-audio-tags.tsx
Jonny Burger71ee2d5b6667
diff --git a/packages/core/src/audio/shared-audio-tags.tsx b/packages/core/src/audio/shared-audio-tags.tsxindex 950c2b7c4d..1004bdd80a 100644--- a/packages/core/src/audio/shared-audio-tags.tsx+++ b/packages/core/src/audio/shared-audio-tags.tsx@@ -84,6 +84,10 @@ export const SharedAudioContextProvider: React.FC<{id,el: ref,};+ // We need a timeout because this state setting is triggered by another state being set, causing React to throw an error.+ // By setting a timeout, we are bypassing the error and allowing the state+ // to be updated in the next tick.+ // This can lead to a tiny delay of audio playback, improvement ideas are welcome.setTimeout(() => {setAudios((prevAudios) => [...prevAudios, newElem]);}, 4);