Component : no idea Chrome version : 5.0.375.55 Hi, Thank you for you great work. I am making games and I need to play several short sounds. I first try with : <audio id="audiochrome"> </audio> And in the javascript : var mson=document.getElementById("audiochrome"); mson.src="somesound.ogg" mson.play(); This works fine the first time, but if I call it again : var mson=document.getElementById("audiochrome"); mson.src="anothersound.ogg" mson.play(); The first sound is played instead of "anothersound.ogg" ========================================================= To workaround the problem, I then created an audio at each new sound : // Works on Mac also var mson=document.getElementById("audiochrome"); if (mson) { document.body.removeChild(mson); // to be clean... } mson=document.createElement("audio"); mson.id="audiochrome"; mson.src="sound1.ogg"; document.body.appendChild(mson); This works fine for exactly 50 times. After that it becomes silent. When I try to debug, sounds come back ! So Im stuck ! I would like to be able to say for my games : "Sounds are supported with IE AND Chome !" instead of "Sounds are only supported with IE" ;-) Is ther any other way ? (I use wav with IE) Michel
Does this happen for you in Safari 5?
Created attachment 58179 [details] simple Html file for test. Need four audio files in the folder I give you the test html file hoping I will be able in the next seconds tou give you the 4 audio file that comes with. Sorry if I cannot.
Created attachment 58180 [details] audio file needed for the html test case
Created attachment 58181 [details] audio file needed for the html test case
Created attachment 58182 [details] audio file needed for the html test case (for Safari)
Created attachment 58183 [details] audio file needed for the html test case (for Safari)
Created attachment 58184 [details] audio file needed for the html test case (for Safari)
(my answer to your question seems to have dissapear...) Thanks for your quick answer. I just downloaded the latest Safari to make the test : No, Safari 5 behaves correctly. I clicked over 200 times and the sound is still there. Also the first method do work properly and the sound changes everytime .src is changed. The only thing is that I had to go back to .wav to make it work. I wonder if .wav will be heared on a Mac and if there is a chance that Chrome will (soon) support .wav... This would prevent me of distributing 2 sets of audio files (1 set in .wav and another set for Chrome .ogg).
This doesn't work the way you expect in Safari 4 because at the time it was written, the HTML5 spec required a UA to ignore a src attribute change until the "load()" method was called. This part of the spec was changed, so now WebKit loads new files as soon as the src attribute is changed.
Thank you Eric, I must say that execution of the code is veryyyyyyyy loooooong in Safari 5 (PC) and some sounds are skipped if clicked too fast... (I sould say not slow enough) but it works. I see you are from Apple, do you know if wav are played correctly in Safari on a Mac ? Does it need extra plugin (QT,...) ? The 'bug' still exist for Chrome (execution is much more faster however) and this is where I reported it.
(In reply to comment #10) > I see you are from Apple, do you know if wav are played correctly in Safari on a Mac ? Does it need extra plugin (QT,...) ? > The <audio> (and <video>) elements in Safari on Mac and Windows should play WAV files. > The 'bug' still exist for Chrome (execution is much more faster however) and this is where I reported it. > If the bug is specific t to Chrome you should probably report it in the Chrome bug base. You should probably try a Chrome nightly build first to make sure the version you are testing doesn't just have the old WebKit behavior.
Thanks for everything, I think this could be closed from the WebKit side as it looks specific to Chrome only.