Can't play wav file from Javascript in Firefox for Mac

Posted by Mike Royle on Stack Overflow See other posts from Stack Overflow or by Mike Royle
Published on 2010-03-22T12:20:48Z Indexed on 2010/03/22 12:31 UTC
Read the original article Hit count: 368

Filed under:
|
|
|
|

I have the following html file that plays a wav file when the user hovers over the 'Play' anchor tag. It works perfectly on IE, Chrome, Firefox, Opera, Safari on both Windows and Mac - except for Firefox on the Mac which does not play the file.

<html>
<head>
<title></title>
<script>
function PlayAudio() {
    var s = document.getElementById("soundFile");
    s.Play();
}
</script>
</head>
<body>
    <embed src="MySound.wav" enablejavascript="true" type="audio/wav" autostart="false" width="0" height="0" id="soundFile" />
    <a href="#" onmouseover="PlayAudio()">Play</a>     
</body>
</html>

If the autostart attribute of the embed tag is set to true then the wav file plays as expected in Firefox for Mac, but not on the mouseover of the anchor tag.

Any ideas?

© Stack Overflow or respective owner

Related posts about firefox

Related posts about mac