1

Sound doesn't play when I use Firefox.

If plays with IE and Safari! Here is the code:

<embed src="http://www.myWebSite.com/Play/Sound/someSound.wav" autostart="false" width="1" height="1" 
    id="someSound" enablejavascript="true" />

Somewhere in the JS, I have this: playSound("someSound");

function playSound(mySound) {

var snd = document.getElementById(mySound);
try {
    snd.Play();
}
catch (e) {
    try {
        snd.DoPlay();           // Some browsers doesn't understand the Play() command
    }
    catch (e) {
        // Do nothing if no Windows Media Player nor Quicktime installed
    }
}

}

Besides, when I try some other website with embedded sound, it plays! Why? Any clue welcome :-)

Didier Levy
  • 3,393
  • 9
  • 35
  • 57

1 Answers1

0

You are probably missing a Quicktime or WMP plugin for Firefox!

Firefox 3.5+ supports the <audio> tag so your could alternatively look into that.

Eganr
  • 660
  • 4
  • 11
  • Thanks Eganr, but: 1 - Since some other webpages are playing their sound using the embed tag, I think I do not miss the necessary plugin. - 2 - I cannot use both the audio tag and the embed tag onto the same page! I need a cross-browser solution. – Didier Levy Oct 07 '11 at 10:25
  • @DidierLevy Hmmm well you always consider a different approach. Check out this StackOverflow question: [link](http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript) – Eganr Oct 07 '11 at 12:10