[Project_owners] Play Wav sound

Gary Johnson gary.johnson.53 at gmail.com
Wed Feb 20 12:42:36 PST 2008


Once upon a time I tried to get

var sound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
sound.play((pathin).toURI());

to work on non chrome wav files.  I wanted folks to be able to select
any sound to play as a notification.

I switched to this, because it does not require chrome

function playFileWav(wavin)
{
	var	embedRef;
	try
	{
		var deleteME = getElement("myGJCBEmbed09");
		if(deleteME)
		{
			document.body.removeChild(deleteME);
		}

	}
	catch(err)
	{
	}

	embedRef =document.createElement('embed');
	if( embedRef != null	)
	{
		embedRef.setAttribute("id","myGJCBEmbed09");
		embedRef.setAttribute("width","0");
		embedRef.setAttribute("height","0");
		embedRef.setAttribute("hidden","true");
		embedRef.setAttribute("src", wavin);
		document.body.appendChild(embedRef);
	}
	else
	{
		alert("playFileWav document.createElement embedRef not created");
	}
}


and I assume there is by default a plugin to play wavs.


-- 
No act of kindness is ever wasted.

Don't worry about people stealing your ideas. If your ideas are any
good, you'll have to ram them down people's throats. -Howard Aiken

So far as I can remember, there is not one word in the Gospels in
praise of intelligence. -Bertrand Russell

It's not that I mind your dishonesty so much, it's that you think I'm
stupid -Charlie Brown , It's the Great Pumpkin.


www.CookDotCom.com


More information about the Project_owners mailing list