Carox
11-17-2010, 01:56 PM
Hi,
I a newbie in creating website, although I am a java guy.
I am creating a website for showcasing the audio and vedio clips of a singer.
I have done research on internet since few days but not able to come up with the way to show the audio on the website. Few of the things I have found which is not working on all browsers and all operating systems:
1. embed tag:
<embed src="music.mp3" height="45" width="170"
type="audio/mpeg" autostart="0" loop="0" controlbar="true"></embed>
or
<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701" STANDBY="Loading
Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" width="280" height="46">
<param name="fileName" value="music.m3u">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="Volume" value="-300">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="music.m3u"
name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
</OBJECT>
Above two ways of code shows the music controller on IE but not in Mozilla Firefox, it just shows a black colored rectangle box. How can I make this work in all browsers and on all operating systems.
2. This code:
<html>
<script language="JavaScript" type="text/javascript">
function setEmbed(ID) {
var element = document.getElementById(ID);
document.write("hello");
element.innerHTML = '<embed src="'ID+'.m3u" autostart="0" loop="0" height="45" width="170" ></embed>';
}
function getMimeType(){
var mimeType = "application/x-mplayer2"; //default
var agt=navigator.userAgent.toLowerCase();
if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
//non-IE, no-Windows
var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
}//end no-Windows
return mimeType
}//end function getMimeType
</script>
<body onload="setEmbed('sample')">
<span id="sample">Finding plugin...</span>
</body>
</html>
This code is not working. But on a certain website it was written that on some browsers this works.
I want a way through which I can show audio on the website so that the user can listen, play, stop, pause the audio.
-
Regards,
Carox
I a newbie in creating website, although I am a java guy.
I am creating a website for showcasing the audio and vedio clips of a singer.
I have done research on internet since few days but not able to come up with the way to show the audio on the website. Few of the things I have found which is not working on all browsers and all operating systems:
1. embed tag:
<embed src="music.mp3" height="45" width="170"
type="audio/mpeg" autostart="0" loop="0" controlbar="true"></embed>
or
<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701" STANDBY="Loading
Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" width="280" height="46">
<param name="fileName" value="music.m3u">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="Volume" value="-300">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="music.m3u"
name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
</OBJECT>
Above two ways of code shows the music controller on IE but not in Mozilla Firefox, it just shows a black colored rectangle box. How can I make this work in all browsers and on all operating systems.
2. This code:
<html>
<script language="JavaScript" type="text/javascript">
function setEmbed(ID) {
var element = document.getElementById(ID);
document.write("hello");
element.innerHTML = '<embed src="'ID+'.m3u" autostart="0" loop="0" height="45" width="170" ></embed>';
}
function getMimeType(){
var mimeType = "application/x-mplayer2"; //default
var agt=navigator.userAgent.toLowerCase();
if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
//non-IE, no-Windows
var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
}//end no-Windows
return mimeType
}//end function getMimeType
</script>
<body onload="setEmbed('sample')">
<span id="sample">Finding plugin...</span>
</body>
</html>
This code is not working. But on a certain website it was written that on some browsers this works.
I want a way through which I can show audio on the website so that the user can listen, play, stop, pause the audio.
-
Regards,
Carox