Play Sounds in Firefox Extension

Possible duplicate:
Play sound in Firefox add-on

I am creating a firefox extension and I need to play a sound file (local) when I click a button.

I am new to extension development and have no idea how to do this.

+5
source share
1 answer

You are using the HTML5 tag <audio>. For instance. if you have an XUL document, you add it like this:

<audio xmlns="http://www.w3.org/1999/xhtml" id="clickSound" src="click.ogg" />

When you need to play the sound you make:

document.getElementById("clickSound").play();

In other words, it is exactly the same as on the web page . Just that you must specify the XHTML namespace if you are in an XUL document.

0
source

All Articles