February 1, 2007
3:18 pm

Reinier Zwitserloot’s effort to add sound support without embedding a Flash bridge in HTML is successful, he managed to run sound using just JS+HTML. Test Page.

[java]
function sound2Play() {
if ( !sound2Embed ) {
sound2Embed = document.createElement(”embed”);
sound2Embed.setAttribute(”src”, “machinegun.wav”);
sound2Embed.setAttribute(”hidden”, true);
sound2Embed.setAttribute(”autostart”, true);
} else sound2Stop();
sound2Embed.removed = false;
document.body.appendChild(sound2Embed);
}

function sound2Stop() {
if ( sound2Embed && !sound2Embed.removed ) {
document.body.removeChild(sound2Embed);
sound2Embed.removed = true;
}
}[/java]

Reinier’s Blog

Article, Sound, JavaScript, JS, HTML, Browser, Embeding, Embed, Flash

Related Posts:

No followup yet

Leave a Response

Comment Preview
« How to access Outlook contacts from a web applicationGoogle Go’s Crazy »
Feed Icon

Subscribe via RSS or email: