HTML5 video autoplaying without autoplay attribute

10,345

Try adding this code: autoplay="false".

Share:
10,345
Justin
Author by

Justin

Just a developer with questions.

Updated on June 05, 2022

Comments

  • Justin
    Justin almost 2 years

    I have an embedded HTML5 video that is autoplaying on iOs6.0.1 in mobile Safari without the autoplay attribute being present. Any ideas on what is going on or how to stop the autoplaying?

    <video width="640" height="480" controls="controls" preload="metadata">
      <source src="movie.mp4" type="video/mp4">
      <source src="movie.ogg" type="video/ogg">
      Your browser does not support the video tag.
    </video>
    

    Thanks!

  • TheBlackBenzKid
    TheBlackBenzKid over 11 years
    autoplay="false" preload="none" according to w3schools.com/tags/tag_video.asp they're not fully supported...
  • Jules
    Jules over 11 years
    I know that this is a very bad approach, but partial support is better than no support. I'll look into some fallbacks and get back to you, but this should be enough to get the code to work on iOS 6.0.1, no problem.
  • TheBlackBenzKid
    TheBlackBenzKid over 11 years
    I am using the code above but I am also using Flash fallback stackoverflow.com/questions/13840792/…
  • Jules
    Jules over 11 years
    No, as in, HTML fallbacks. If you're using Flash on an iOS device, you're missing the point, as iOS and Flash don't tend to play nice. You can use <embed src="../MyVideoSource.mov"/>, which is compatible with HTML4.01-Transitional and HTML4.01-Strict, as well as XHTML. It's a bit of a useless precaution, as maybe 1-2% of you visitors will have iOS devices without HTML5 support; Apple is a big player in the HTML5 game.
  • Harshit Shah
    Harshit Shah over 4 years
    According to MDN, the presence of the autoplay attribute, no matter the value, will cause videos to autoplay. developer.mozilla.org/en-US/docs/Web/HTML/Element/video