Skip to content

Commit 86ff026

Browse files
authored
Create load-video-and-autoplay.js
1 parent 309b088 commit 86ff026

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

load-video-and-autoplay.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
document.getElementById("background-video").addEventListener("loadeddata", function(event) {
2+
this.play().catch(error => {
3+
if (error.name === "NotAllowedError" || error.name === "NotSupportedError") {
4+
console.error("Autoplay is not allowed or not supported");
5+
}
6+
});
7+
});

0 commit comments

Comments
 (0)