Working on a language lesson that has a bunch of audio clips in it. I'd been using a QuickTime-based method of inserting the audio clips in the page to date, but figured this was a perfect job for HTML5 audio, with the added bonus of making iPhones and iPads happy.
Problem: I don't want to preload the audio. Aside from chewing up bandwidth and slowing the browser unnecessarily if the person isn't interested in playing the sound clips, it REALLY slows down loading of the page as Safari tries to prep and preload two dozen short audio files simultaneously.
Bigger problem: You SHOULD be able to just set preload="none" ... but currently Safari and Chrome completely ignore that property and preload anyway. Eventually this won't be a problem (I hope), but right now it is.
Potential solution: The famed Gruber of Daring Fireball had the suggestion of just using a bit of Javascript to have a link (he used a poster image, I just want a text link since it's audio) that, when clicked, replaces itself with the appropriate <video> or <audio> element. Bingo, no preload until user action:
http://daringfireball.net/misc/2009/12/user_guide_demos
Tragic flaw: His solution uses JQuery, which I am already using, so that was quite convienent. Except there's some sort of bug in either Firefox or JQuery that, when you do exactly this, you get TWO copies of the video (or audio) file playing at the same time (at least as of FF 3.6.3). Try it on the DF link above, or the example linked from this question:
http://stackoverflow.com/questions/...-playing-duplicate-videos-after-jquery-insert
...both work perfectly with Safari, but in Firefox you'll hear a weird echo and if you pause the video the second invisible copy will continue playing. Does the same with audio:
http://tinderbox.animeworld.com/japanese/lesson1-1.html
Question: Anybody have either a workaround for this JQuery/FF issue or a better suggestion for keeping <audio> from preloading?
Problem: I don't want to preload the audio. Aside from chewing up bandwidth and slowing the browser unnecessarily if the person isn't interested in playing the sound clips, it REALLY slows down loading of the page as Safari tries to prep and preload two dozen short audio files simultaneously.
Bigger problem: You SHOULD be able to just set preload="none" ... but currently Safari and Chrome completely ignore that property and preload anyway. Eventually this won't be a problem (I hope), but right now it is.
Potential solution: The famed Gruber of Daring Fireball had the suggestion of just using a bit of Javascript to have a link (he used a poster image, I just want a text link since it's audio) that, when clicked, replaces itself with the appropriate <video> or <audio> element. Bingo, no preload until user action:
http://daringfireball.net/misc/2009/12/user_guide_demos
Tragic flaw: His solution uses JQuery, which I am already using, so that was quite convienent. Except there's some sort of bug in either Firefox or JQuery that, when you do exactly this, you get TWO copies of the video (or audio) file playing at the same time (at least as of FF 3.6.3). Try it on the DF link above, or the example linked from this question:
http://stackoverflow.com/questions/...-playing-duplicate-videos-after-jquery-insert
...both work perfectly with Safari, but in Firefox you'll hear a weird echo and if you pause the video the second invisible copy will continue playing. Does the same with audio:
http://tinderbox.animeworld.com/japanese/lesson1-1.html
Question: Anybody have either a workaround for this JQuery/FF issue or a better suggestion for keeping <audio> from preloading?