Playing sounds and manipulating sound files
Posted on 2006-10-29
Firstly, this is for audible alerts so is a valid reason for having sound on a page :)
I have 2 basic questions.
1. I am getting the name of the particular sound file required by reading an external file. I need this sound to play just once and to be totally embedded in the page and invisible. When it needs to sound i want to use something like
document.getElementById('soundfile').src = "'sounds/"+thissound+".wav'";
to alter the sound according to the value of 'thissound' retreived. I just can't figure out IE/FF code where the required src can be swapped at will. This must be fully cross-browser compatible.
2. Is there any way to retreive a combination of sound files and play one after the other? eg get a file for sound 'Hello' and then another for 'John' and then play them back to back to create 'Hello John'? Obviously I'm simplifying here but just wondered if possible to do.