How do I make my video autoplay and how can I make the video full screen?

How do I make my video autoplay and how can I make the video full screen? This is really annoying so pls can someone help me.

My repl

It should be under video controls, no?

You would use the autoplay attribute, as you did. This may not work in all browsers and potentially not in iframes. I believe allowing autoplay for videos is usually a browser setting which users can opt-in or out of at any time. The default may vary so on some browsers users may be automatically opted in to autoplay, while on others they may be opted-out. Depending again, some browsers may not allow autoplay within iframes. I haven’t searched to double check this, these are just possible reasons why autoplay may not work.

1 Like

Add the autoplay attribute to your <video> tag. For fullscreen, you can’t automatically set it to fullscreen, but you can use JavaScript. Check out this stackoverflow for more.

Yeah for fullscreen, I would personally select the video element, add an onload function, and then do video.requestFullScreen() but not sure if that function works. I’m pretty sure it should though, but you might need the user to interact before you can run things like that.

Example code:

const videoElement = document.querySelector("video") // select video element
videoElement.onload = function() {

And other people have talked about the autoplay part already.