Skip to content

🎥 Make videos programmatically with React

don't log autoplay error if audio is muted

Jonny Burger13405c050082
diff --git a/packages/core/src/play-and-handle-not-allowed-error.ts b/packages/core/src/play-and-handle-not-allowed-error.ts
index 18885e7622..5b87ffdbfd 100644
--- a/packages/core/src/play-and-handle-not-allowed-error.ts
+++ b/packages/core/src/play-and-handle-not-allowed-error.ts
@@ -52,6 +52,14 @@ export const playAndHandleNotAllowedError = (
return;
}
+ // Audio tag got unmounted
+ if (
+ err.message.includes("user didn't interact with the document") &&
+ current.muted
+ ) {
+ return;
+ }
+
// eslint-disable-next-line no-console
console.log(`Could not play ${mediaType} due to following error: `, err);
if (!current.muted) {