...

View Full Version : Help with MP3 player



RTS
11-05-2006, 08:36 PM
Hi, I'm very new to js, and found a cool simple mp3 player script online. I pasted it in to a document labeled testmus.php, but when I load it, all that shows up are the buttons, and when I click the play button nothing happens. I have a feeling I am missing something very simple, but cant figure it out. Any ideas? heres my script
testmus.php:

<html>
<body>
<head>
<script language="JavaScript">
var state;

//URL of song - Direct path
function playerinit()
{
player.url="test.mp3";
player.settings.autoStart = true ;
}

//Play Function
function play()
{
if (player.controls.isavailable('play'))
{
player.controls.play();
state=setInterval("updatetime()",1000);
}
}

//Pause Function
function pause()
{
if (player.controls.isavailable('pause'))
{
player.controls.pause();
clearInterval(state);
}
}

//Stop Function
function stop()
{
if (player.controls.isavailable('stop'))
{
player.controls.stop();
clearInterval(state);
}
}
</script>
</head>

<body onload="playerinit();">

<table align='center' width="100%">
<tr>
<td align="center">
<!-- START PLAYER -->
<!-- Default Player Settings -->
<object id="player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="0" height="0">
<param name="autoStart" value="0">
<param name="balance" value="0">
<param name="currentPosition" value="0">
<param name="currentMarker" value="0">
<param name="enableContextMenu" value="0">
<param name="enableErrorDialogs" value="0">
<param name="enabled" value="-1">
<param name="fullScreen" value="0">
<param name="invokeURLs" value="0">
<param name="playCount" value="1">
<param name="rate" value="1">
<param name="uiMode" value="invisible">
<param name="volume" value="100">
<param name="URL" value>
<param name="defaultFrame" value>
<param name="baseURL" value>
<param name="stretchToFit" value="0">
<param name="windowlessVideo" value="0">
<param name="SAMIStyle" value>
<param name="SAMILang" value>
<param name="SAMIFilename" value>
<param name="captioningID" value>
<embed id="player" type="application/x-mplayer2" src="music/test.mp3" height="0" width="0">
</object>
</head>
<!-- END Default Player Settings -->

<br />

<table align='center'>
<tr>
<td height="" width="" align="" background="">
<!-- Player Controls -->
<input TYPE="image" src="play.png" value="Play "name="play" onclick="play();"><input TYPE="image" src="play.png"
alt="Pause" value="Pause" name="pause" onclick="pause();"><input TYPE="image" src="stop.png" value="Stop" name="stop"
onclick="stop();">
<!-- END Player Controls -->
</td> </tr>
</table>
</body>
</html>

_Aerospace_Eng_
11-05-2006, 10:13 PM
What browser are you using? The above will only work in IE because it uses the WMP activex control. Firefox by default has activex support disabled.

RTS
11-05-2006, 10:24 PM
Ohhhh, that makes sense cos Im using firefox. How would I do this for all browsers?

_Aerospace_Eng_
11-05-2006, 10:41 PM
I would use a flash mp3 player. I like the one found here: http://www.*******************/?item=Flash+Mp3+Player
Its pretty customizable. You don't really need to know flash either. You just need notepad to edit the config files and basic hex color codes. You can use the single song mode or you can use a playlist for multiple songs.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum