beau Posted May 10, 2016 Share Posted May 10, 2016 I have an mp4 video in a modal window, and the video auto-plays when the first time the modal window is opened.My HTML is:<video controls autoplay> <source src="filename.mp4" type="video/mp4">But if the user closes the modal window then re-opens it, the mp4 doesn't auto play, you have to click the "Play" buttonWhat code can be added to cause it to always auto-play? Link to comment Share on other sites More sharing options...
Ingolme Posted May 10, 2016 Share Posted May 10, 2016 You can have Javascript play the video when the modal opens. The simplest way is to give an ID to your video element. <video id="my-video" controls autoplay> In the function that opens the modal window add this line: document.getElementById("my-video").play(); Link to comment Share on other sites More sharing options...
RumelBD.Com Posted May 22, 2016 Share Posted May 22, 2016 How To Us It For Wapka Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now