tags:

views:

31

answers:

1

I am working with html5 audio and running into some troubles with the buffer. This works splendidly in Chrome, however in Safari (and SafMob) there is noticeable latency. The idea is simple. A user clicks an img link and the img "jumps" and makes a sound. Here is an example.

Is there a way to preload the sound file so that it plays quicker? Again, my main concern is in the Safari/Safari Mobile browser.

The jQuery I am using:

$("#bell a").click(function() {
  var snd = new Audio("ping.mp3");
  snd.play();
  $(this).stop().animate({ marginTop: "-10px" }, 200).animate({ marginTop: "18px" }, 200).animate({ marginTop: "1px" }, 300); 
return false;
});

This is the code for the button:

<ul id="bell">
  <li class="button"><a href="#" title="Pling">Link Text</a></li>
</ul>
A: 

preload actually takes a value, one of auto, meta or automatic. Although I think the default behaviour is to download the entire file.

There's a bit more at: Playing with audio files or from the specification itself: preload attribute.

Not sure if this helps at all.

Ian Devlin