I am trying to play a sound in my javascript file
document.getElementById("sound").innerHTML = "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" id=\"beep\" loop=\"false\" />";
thissound=document.getElementById('beep');
thissound.Play();
but the thissound.Play() line gives me the error “Error calling method on NPObject”
Furthermore, if I add an alert("Played sound!") line right before the thissound.Play() line, there is no error and it works fine!
What is the problem with this? The sound does play, but then the program freezes.
This may be not pretty. If it is hard to detect when the sound is fully loaded, you can keep trying playing the sound until it works.