1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Java Music Player Code

Discussion in 'Web Design & Development' started by Mike46, Jul 30, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Mike46

    Mike46 Thread Starter

    Joined:
    Jul 5, 2005
    Messages:
    231
    I have found this to work very well on one of my websites, however I do not want it to auto start the music the page. I want to have the user start it.

    I have tried to edit the code on this line​
    Code:
    <param NAME="Autostart" VALUE="1">
    I have tried changing the value = to false which didn't work, I trying to find what and where in the code to stop the auto start feature. The code below is the same that I am using I just didn't add my titles and URL's. I also was wondering if there is a place in the code to change the color of the player.

    ----------------------------------------------------------------------------------------------------------------------------------

    Code:
    [<!-- Multi Music Player at www.rainbow.arch.scriptmania.com/scripts/music/ -->
    <!-- begin code multi music player -->
    <object id="multiplayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="0" standby="Loading Microsoft Windows Media Player components..." width="0" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">
    <param NAME VALUE>
    <param NAME="ShowControls" VALUE="0">
    <param NAME="ShowStatusBar" VALUE="0">
    <param NAME="ShowDisplay" VALUE="0">
    <param NAME="DefaultFrame" VALUE="Slide">
    <param NAME="Autostart" VALUE="1">
    <param NAME="Loop" VALUE="True">
    </object>
    <form name="form">
    <select name="playlist" size="1">
    
    <!-- Add song info here -->
    <option value="0">SONG TITLE-ARTIST NAME</option>
    <option value="1">SONG TITLE-ARTIST NAME</option>
    <option value="2">SONG TITLE-ARTIST NAME</option>
    <option value="3">SONG TITLE-ARTIST NAME</option>
    <option value="4">SONG TITLE-ARTIST NAME</option>
    <option value="5">SONG TITLE-ARTIST NAME</option>
    
    </select><br>
    <input TYPE="BUTTON" NAME="multiplay" VALUE="play" OnClick="play(document.forms['form'].playlist);">
    <input TYPE="BUTTON" NAME="multipause" VALUE="pause" OnClick="document.multiplayer.pause(); playstate=2;">
    <input TYPE="BUTTON" NAME="multistop" VALUE="stop" OnClick="document.multiplayer.stop(); playstate=2;"></p>
    </form>
    
    <script language="JavaScript">
    <!--
    var playstate = 1;
    shuffle = 1; // Set to 0 to always play first song in list
    // Set to 1 to randomly choose the first song to play
    songs=new Array();
    
    // Add song URLs here
    songs[0]="SONG URL";
    songs[1]="SONG URL";
    songs[2]="SONG URL";
    songs[3]="SONG URL";
    songs[4]="SONG URL";
    songs[5]="SONG URL";
    
    if (shuffle == 1) {
    var randsg = Math.floor(Math.random()*songs.length);
    document.multiplayer.FileName = songs[randsg];
    document.multiplayer.scr = songs[randsg];
    document.forms['form'].playlist.options[randsg].selected = true;
    }
    function play(list) {
    if (playstate == 2) {
    document.multiplayer.Play();
    } else {
    var snum = list.options[list.selectedIndex].value
    document.multiplayer.FileName = songs[snum];
    document.multiplayer.scr = songs[snum];
    }
    playstate = 1;
    }
    //-->
    </script>
    <!-- end code multi music player -->
    /CODE]
     
  2. Mike46

    Mike46 Thread Starter

    Joined:
    Jul 5, 2005
    Messages:
    231
    Just for those of you that might be interested setting the player to not auto start with Java Script the following code does not work.

    (0) - (-1) - (False)

    I am sure that the code is out there and someone with knowledge of Java surely knows it. I have chosen a different route to get done what I needed to do. If anyone wants to give a shot at this code and see if they can figure it out maybe it would help others that might want to use it.
     
  3. Chicon

    Chicon

    Joined:
    Jul 29, 2004
    Messages:
    6,650
    Hi Mike46,

    No, Java is a completely different language than Javascript. Also, your problem was related to the configuration of a Microsoft component embedded in a HTML document. It has nothing in common with Java.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/735478