PDA

View Full Version : sound and mimeTypes


Alias
05-04-2003, 10:40 PM
This is my solution for development of sound in html:

<script language="JavaScript"><!--
var aySound = new Array();
aySound[0] = "websound.wav";

var navA=navigator.userAgent;
var op=(navA.indexOf("Opera")>-1 && dom);

if (document.all && !op)
document.write('<bgsound src="#" id="bgmusic" loop="infinite" autostart="true">');
else
document.write('<embed src="websound.wav" name="embmusic" hidden="true" autostart="false" loop="true" MASTERSOUND></embed>');

//-->
</script>



<script language="JavaScript">

var navA=navigator.userAgent;
var op=(navA.indexOf("Opera")>-1 && dom);

function stopp() {
if (document.all && !op) {
document.execCommand('Stop');
}
else {
document.embmusic.stop();
}
}

function playmusic() {
if (document.all && !op) {
document.all.bgmusic.src='websound.wav';
}


else {
if (navigator.mimeTypes["audio/x-wav"]) {
document.embmusic.play();
}
else {
if (confirm("AUDIO PLUGIN NOT FOUND. \n\nTo listen to the music from this website you need to \ndownload and install audio plugin for your browser. \n\n\nDo you want to download it now? \nhttp://plugins.netscape.com"))
window.open("http://plugins.netscape.com","_blank")
}
}
}
</script>

<a href="java script:stopp();">stop</a> <a href="java script:playmusic();">play</a>
(note: onclick="stopp();" for IE 4.0 doesn't work! - must be - href="java script:stopp();") (???)

This works fine in IE 4.0 +, Netscape 4.07 and Netscape 4.6 (where to download version 4.7?)
but it not works for Netscape 6.0, Netscape 7.02 and Mozila 1.0 + ...
well, I know that I don't have a plugins for NS 6.0 and 7.0 ...
my problem and question is -
to leave this:

if (navigator.mimeTypes["audio/x-wav"] || navigator.mimeTypes["audio/wav"])

or to remove it ?


What is your opinion about all this approach ...

Best Regards
(sorry for english)

Alias
05-05-2003, 03:31 PM
In fact ... question is:

Can somebody have some audio program wich can play my script from browser and to not have audio/x-wav or audio/wav installed?


Best Regards
(sorry for my english)

Alias
05-07-2003, 11:02 PM
suggestion ??? :(

chrismiceli
05-08-2003, 12:20 AM
i think you should leave that line, but what is the second question you are asking?