html
<video id=”intro-video” autoplay muted>
<source src=”https://youtu.be/XHOmBV4js_E” type=”video/mp4″>
Your browser does not support the video tag.
</video>
<script>
document.getElementById(‘intro-video’).addEventListener(‘ended’, function() {
this.parentNode.removeChild(this);
});
document.addEventListener(‘DOMContentLoaded’, function() {
const video = document.getElementById(‘intro-video’);
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.mozRequestFullScreen) { // Firefox
video.mozRequestFullScreen();
} else if (video.webkitRequestFullscreen) { // Chrome, Safari, and Opera
video.webkitRequestFullscreen();
} else if (video.msRequestFullscreen) { // IE/Edge
video.msRequestFullscreen();
}
});
</script>