0

Straightforward HTML5 video tag with several video types, but only the poster displays in Mac/Safari. What am I missing?

<video poster="~/images/image.jpg" preload="none">
    <source src="myvideo.mp4" type="video/mp4" />
    <source src="myvideo.webm" type="video/webm" />
    <source src="myvideo.ogv" type="video/ogg" />
</video>

UPDATE - I know the tag is missing autoplay, but this is stuck in after the fact using JQuery. "viewport" is my variable that knows pixel width of the browser window.

if (viewport >= 768 && $(".videoInline video")[0]) {
    $(".videoInline video")[0].load();
    $(".videoInline video")[0].autoplay = true;
    $(".videoInline video")[0].loop = true;
    $(".videoInline video").get(0).play();
}

UPDATE 2 - to clarify, this is NOT iOS, it is Mac/Safari as stated above. So, desktop only.

R-D
  • 566
  • 6
  • 13
  • you should add the attribute autoplay=true to enable to autoplaying
    https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html
    – Meher Jebali Sep 17 '15 at 14:28
  • Duplicate of http://stackoverflow.com/questions/4259928/how-can-i-autoplay-media-in-ios-4-2-1-mobile-safari (see also http://stackoverflow.com/a/12496184/1475148). TLDR; It’s not possible to autoplay in iOS. Playing media requires user input. – Aaron Gustafson Sep 17 '15 at 15:46

1 Answers1

1

I think you are missing the autoplay attribute:

<video controls autoplay>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>
Marc K
  • 56
  • 4