From ce61d5759c6dceccc154f811f0ea3ccc52cd756b Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sat, 8 Jul 2023 09:30:32 +0300 Subject: [PATCH] Fix html video autoplay in some cases --- www/video-rtc.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/video-rtc.js b/www/video-rtc.js index 9bbbfd65..19150ddb 100644 --- a/www/video-rtc.js +++ b/www/video-rtc.js @@ -157,10 +157,12 @@ export class VideoRTC extends HTMLElement { * https://developer.chrome.com/blog/autoplay/ */ play() { - this.video.play().catch(er => { - if (er.name === "NotAllowedError" && !this.video.muted) { + this.video.play().catch(() => { + if (!this.video.muted) { this.video.muted = true; - this.video.play().catch(() => console.debug); + this.video.play().catch(er => { + console.warn(er); + }); } }); }