MozillaZine

Background music does not play

From MozillaZine Knowledge Base

This article explains why Firefox and Mozilla Suite users may not hear any sound on sites that are supposed to include background music and offers some possible solutions.

Contents

Nonstandard coding

Some web pages use the nonstandard bgsound element that doesn't work in Mozilla browsers. To work around this problem:

  • The BGMConductor extension will convert bgsound tags so that they work. While this extension will work in Firefox 1.5.x.x, it needs to be modified slightly before it will install. See this article.
  • The Greasemonkey script IE Media Mimic also can convert bgsound tags, among other things.

Plugins

Background music usually needs a plugin to work in Mozilla browsers. The Windows Media Player plugin is designed to play Microsoft’s proprietary audio formats such as Windows Media Audio (.wma) files, but not wav, .mid or .mp3 files. (Internet Explorer does not use the Windows Media Player plugin; instead it uses an ActiveX control which provides much more functionality than the plugin.) For Mozilla Suite and Firefox users, Quicktime is often the required plugin. Make sure you have Quicktime installed and that the Quicktime browser settings are configured to enable the plugin for the type of media the page uses.

Webpage authors

To make your site play background music in Mozilla applications using the Windows Media Player plugin, add (MIME) type "application/x-mplayer2", set height and width to "0" to hide it, and set the "autostart" value to "1" (explanation). Here is a standards-compliant, cross-browser object example:

<object data="music.mp3" type="application/x-mplayer2" width="0" height="0">
  <param name="filename" value="music.mp3">
  <param name="autostart" value="1">
  <param name="playcount" value="true"> 
</object>

In the above example, the audio will be hidden, play automatically and loop forever.

Note: The next generation Firefox 3.5 and SeaMonkey 2 browsers (Gecko 1.9.1) will introduce support for the HTML 5 audio and video elements, offering the ability to easily embed media into HTML documents. Currently, only Ogg and WAV format media is supported. See Using audio and video in Firefox - MDC for more information.

See also