Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Width=0 and height=0 not working in firefox

more options

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.

Hi, I use the below code for playing a notify sound. When I use width=0 and height=0, it doesn't play sound. <html> <head> </head> <body> <embed type="audio/wav" src="notify.wav" autostart=true width=0 height=0 enablejavascript="true" /> </body> </html> If I change width and height to a non-zero number, it play the sound. <html> <head> </head> <body> <embed type="application/x-mplayer2" src="/audio/newticketnotify.mp3" autostart=true width=1 height=1 enablejavascript="true" /> </body> </html> Why is it so? How can I play the sound with width and height to 0.

Toutes les réponses (7)

more options

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.

more options

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.

more options

The problem exist in my Firefox 30.

more options

Can you post a link to a test page?

more options

This is the link I try:

http://fabinm.com/soundtest.html

more options

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.

more options

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/