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/
|
* https://developer.chrome.com/blog/autoplay/
|
||||||
*/
|
*/
|
||||||
play() {
|
play() {
|
||||||
this.video.play().catch(er => {
|
this.video.play().catch(() => {
|
||||||
if (er.name === "NotAllowedError" && !this.video.muted) {
|
if (!this.video.muted) {
|
||||||
this.video.muted = true;
|
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