7

I am having some trouble trying to figure out what is causing HTML5 video to be extremely slow loading/playing in Safari. I have tested the same below code on Chrome, Firefox, IE (irrelevant as it uses the flash) and the load/play times are nearly instant. But on Safari, I need to wait pretty much a whole minute before it starts playing. I had tried removing the video's 'autobuffer' parameter, but made no difference. Any ideas?

<video id="video-window" autoplay="autoplay" autobuffer="autobuffer">
    <source src="testvideo.mp4" type='video/mp4' />
    <source src="testvideo.webm" type='video/webm' />
    <source src="testvideo.ogv" type='video/ogg; codecs="theora, vorbis"' />
    <object type="application/x-shockwave-flash" data="player.swf" width="640" height="480">
        <param name="allowfullscreen" value="true">
        <param name="allowscriptaccess" value="always">
        <param name="autoplay" value="true">
        <param name="flashvars" value="testvideo.mp4">
        <!--[if IE]><param name="movie" value="player.swf"><![endif]-->
        <p>Your browser can’t play HTML5 video.</p>
    </object>
</video>
SylvrFalkon
  • 176
  • 3
  • 11
  • 2
    I've had the same issue in Safari. If you (just for testing) remove the autoplay="autoplay" and autobuffer="autobuffer" and add preload="metadata" attribute does it improve the performance? This worked for me, but I was not trying to autoplay the video. Try experimenting with preload attribute. – jonathanbell Apr 18 '12 at 05:48
  • @jonny.milano Thanks for the suggestion, but unfortunately it still didn't seem to pick it up and play any faster, it's very strange. Did you use the mp4/webm/ogg for your's too? – SylvrFalkon Apr 18 '12 at 17:49
  • @SykvrFalkon What do you mean "not play any 'faster'"? The preload=metadata won't preload the video, 100%. Yes, I use mp4 (first) and webm most of the time. Do you have an example URL? – jonathanbell Apr 18 '12 at 17:58
  • @jonny.milano Sorry about that, I had meant there was still a delay before it started playing by almost a minute, and understand that the metadata is not preloading the video. I'm not able to access the test site I was using from where I am now, but will upload you a link when I get home a bit later. – SylvrFalkon Apr 18 '12 at 18:59
  • OK cool, hopefully we can sort it out. – jonathanbell Apr 18 '12 at 22:20
  • @jonny.milano http://falkonsolutions.com/sandbox/vidtest Thanks for your help! – SylvrFalkon Apr 19 '12 at 00:28
  • Perhaps the moov atom is not at the beginning of the video and Safari is loading the whole file before playing? This answer helped me in the past; I wound up here looking for it because I forgot to bookmark it: https://stackoverflow.com/questions/7614635/h264-mp4-index-to-front-command-line/31414747#31414747 – Matt Lima Apr 18 '19 at 00:33

1 Answers1

-1

You need to use Handbrake and check the Web optimized option when encoding. I have no clue why but this reduces Safari lag dramatically. Still not as speedy as other browsers but much better.

Slava Vedenin
  • 58,326
  • 13
  • 40
  • 59