Sound with JavaScript but not Flash
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.
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;
}
}
Article, Sound, JavaScript, JS, HTML, Browser, Embeding, Embed, Flash

Leave a comment »