Width=0 and height=0 not working in firefox
Hi,
I use the below code for playing a notify sound. When I use width=0 and height=0, it doesn't play sound.
<embed type="audio/wav" src="notify.wav" autostart="true" width="0" height="0" enablejavascript="true">
If I change width and height to a non-zero number, it play the sound.
<embed type="application/x-mplayer2" src="/audio/newticketnotify.mp3" autostart="true" width="1" height="1" enablejavascript="true">
Why is it so? How can I play the sound with width and height to 0.
כל התגובות (7)
Firefox often does not fire up objects that are invisible (<object> or <embed>), whether that is due to width/height or display:none. You already know a workaround; that might be the best you can do.
It works in current releases (possibly 24 and later), but there has been a bug in older versions that was about the hidden attribute and that caused sound not to get played when the player is hidden. So the Firefox 20 version that you use is likely still affected by this and won't play the sound.
The problem exist in my Firefox 30.
Can you post a link to a test page?
This is the link I try:
No problems here on Linux with that website with the Gecko Media Player plugin (Windows Media Player). Works in the current release and in releases like 24.6.0esr and 17.0.11esr and 10.0.12esr versions that I tested.
In Firefox 30 on Windows 7 I get the attached plugin crash. If this is your site, consider trying to use HTML5 media and only if that doesn't work, fall back to a plugin.
You can experiment with HTML5 audio format support here: http://hpr.dogphilosophy.net/test/