Fix html video autoplay in some cases
This commit is contained in:
+5
-3
@@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user