MP3 Player (or other audio format)

[Total: 0    Average: 0/5]

This script enables the playing of MP3 or other audio files via javascript.

Head Code:

<script language="JavaScript">

<!--

function radioStatus(){

var status=document.apradio.GetPlayState()
var title=document.apradio.GetTitle()
var author=document.apradio.GetAuthor()
var copyright=document.apradio.GetCopyright()
var showVolume=document.apradio.GetVolume()
var position=document.apradio.GetPosition()
var length=document.apradio.GetLength()
var songname=document.apradio.GetSource()
var buftime=document.apradio.GetBufferingTimeRemaining()



if (status==2){
status="Buffering"
myStatus="<font face='Helvetica,Arial' size=-2><b>Status:"+status+"</b>"
}
else{
myStatus=""
}

if (document.layers){
document.layers.realStatus.document.write(myStatus)
document.layers.realStatus.document.close()
}
else if (document.all)
realStatus.innerHTML=myStatus
setTimeout("radioStatus();",1000)
}

function start(){
document.apradio.DoPlay();
}

function stop(){
document.apradio.DoStop();
}

function pause(){
if (navigator.userAgent.indexOf("IE") == "-1") {
document.apradio.DoPause();
}
else{
apradio.DoPause()
}
}

function upVolume_one(){volume=document.apradio.GetVolume();

if (volume==10){
document.images["volumeButton"].src= "/data/ex_1010/volume1.jpg";
}
else{
document.apradio.SetVolume(volume=10);
document.images["volumeButton"].src= "/data/ex_1010/volume1.jpg";
}
}

function upVolume_two(){
volume=document.apradio.GetVolume()

if (volume==30){
document.images["volumeButton"].src= "/data/ex_1010/volume2.jpg";
}
else{
document.apradio.SetVolume(volume=30);
document.images["volumeButton"].src= "/data/ex_1010/volume2.jpg";
}
}

function upVolume_three(){
volume=document.apradio.GetVolume()

if (volume==50){
document.images["volumeButton"].src= "/data/ex_1010/volume3.jpg";
}
else{
document.apradio.SetVolume(volume=50);
document.images["volumeButton"].src= "/data/ex_1010/volume3.jpg";
}
}

function upVolume_four(){
volume=document.apradio.GetVolume()

if (volume==80){
document.images["volumeButton"].src= "/data/ex_1010/volume4.jpg";
}
else{
document.apradio.SetVolume(volume=80);
document.images["volumeButton"].src= "/data/ex_1010/volume4.jpg";
}
}

function upVolume_five(){
volume=document.apradio.GetVolume()

if (volume=100){
document.images["volumeButton"].src= "/data/ex_1010/volume5.jpg";
}
else{
document.apradio.SetVolume(volume=100);
document.images["volumeButton"].src= "/data/ex_1010/volume5.jpg";
}
}

//-->
</SCRIPT>


<script LANGUAGE="JavaScript">
function playclip1(){
document.apradio.SetSource('/data/ex_1010/file.mp3');
document.apradio.DoPlay();
document.images["songtitle"].src= "/data/ex_1010/song1.jpg";
}
</script> 

Body Code:

<BODY BGCOLOR="#FFFFFF" marginheight=0 marginheight=0 topmargin=0 leftmargin=0 onload="document.apradio.SetVolume(80);radioStatus();" TEXT="#000000" LINK="#CC0000">
<div id="realStatus" style="position:absolute;left:455; top:361;"></div><script
LANGUAGE="JavaScript"><!--
if (navigator.appName.indexOf('Microsoft Internet Explorer') != -1){
if (navigator.userAgent.indexOf('Mac_PowerPC') != -1){
window.location="sound-IEmac.html";
}
}
else{

}

//--></script>
<OBJECT ID=apradio CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
       HEIGHT=4 WIDTH=4 vspace="0">
       <PARAM NAME="controls" VALUE="none">
       <PARAM NAME="console" VALUE="Clip1">
       <PARAM NAME="autostart" VALUE="true">
       <PARAM NAME="src" VALUE="/data/ex_1010/file.mp3">
       <PARAM NAME="type" VALUE="audio/x-pn-realaudio-plugin">
       <EMBED SRC="/data/ex_1010/file.mp3" name=apradio WIDTH=3 HEIGHT=3 type=audio/x-pn-realaudio-plugin CONSOLE=one CONTROLS=None AUTOSTART=TRUE CENTER=true></EMBED>
</OBJECT>

<script LANGUAGE="JavaScript"><!--
if (navigator.userAgent.indexOf("IE")== "-1") {
document.write('<MAP NAME="VolControl">');
document.write('<AREA SHAPE=RECT COORDS="117,1,143,42" HREF="javascript:upVolume_five()">');
   document.write('<AREA SHAPE=RECT COORDS="92,0,116,43" HREF="javascript:upVolume_four()">');
   document.write('<AREA SHAPE=RECT COORDS="65,2,90,43" HREF="javascript:upVolume_three()">');
   document.write('<AREA SHAPE=RECT COORDS="34,2,64,43" HREF="javascript:upVolume_two()">');
   document.write('<AREA SHAPE=RECT COORDS="2,2,33,43" HREF="javascript:upVolume_one()">');
document.write('</MAP>');
} else {
document.write('<MAP NAME="VolControl">');
document.write('<AREA SHAPE=RECT COORDS="117,1,143,42" onclick="javascript:upVolume_five()">');
   document.write('<AREA SHAPE=RECT COORDS="92,0,116,43" onclick="javascript:upVolume_four()">');
   document.write('<AREA SHAPE=RECT COORDS="65,2,90,43" onclick="javascript:upVolume_three()">');
   document.write('<AREA SHAPE=RECT COORDS="34,2,64,43" onclick="javascript:upVolume_two()">');
   document.write('<AREA SHAPE=RECT COORDS="2,2,33,43" onclick="javascript:upVolume_one()">');
document.write('</MAP>');
}
//--></script>

Times Viewed: 5

Leave a Reply

Your email address will not be published. Required fields are marked *