Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    RTS
    RTS is offline
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with MP3 player

    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:
    Code:
    <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>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    RTS
    RTS is offline
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ohhhh, that makes sense cos Im using firefox. How would I do this for all browsers?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •