The Sea King Posted November 7, 2007 Share Posted November 7, 2007 how do I do a Java music player for 6 songs?(It doesn't autostart and we have to select the song in order to listen to it) Link to comment Share on other sites More sharing options...
justsomeguy Posted November 7, 2007 Share Posted November 7, 2007 Java and Javascript aren't the same thing, not even related. If you are trying to use a player that you downloaded you might want to check if there is documentation that tells you how to make it do what you want. Link to comment Share on other sites More sharing options...
Synook Posted November 8, 2007 Share Posted November 8, 2007 Remember, the Java in JavaScript is only due to a marketing deal done between Netscape Communcations and Sun Microsystems, but the actual languages are very different. Are you thinking of a applet control or a JavaScript script? Link to comment Share on other sites More sharing options...
The Sea King Posted November 8, 2007 Author Share Posted November 8, 2007 Opps! Edits question.how do I do a Javascript music player for 6 songs? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 8, 2007 Share Posted November 8, 2007 Do you already have something set up that you're trying to modify? I guess I would have an embedded object that would play the song in the user's player and use Javascript to change the source of the file to play. It would be better to use a Flash music player though, there are several of them available online to use. Link to comment Share on other sites More sharing options...
Azim Posted November 16, 2007 Share Posted November 16, 2007 Do you want to use a javascript to open files to play?I have this cool javascript to play music files in a separate blank window of desired size. Users can download music file currently playing or you can even disable this feature. here is the code of script:======================var UniqueID = 314 // Make each link open in a new window.var newWinOffset = 0 // Position of first pop-upfunction PlayerOpen(soundfiledesc,soundfilepath) {PlayWin = window.open('',UniqueID,'width=320,height=200,top=' + newWinOffset +',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');PlayWin.focus(); var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc + "</TITLE></HEAD><BODY bgcolor='#FFFFFF'>";winContent += "<B style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + soundfiledesc + "</B>";winContent += "<OBJECT width='300' height='42'>";winContent += "<param name='SRC' value='" + soundfilepath + "'>";winContent += "<param name='AUTOPLAY' VALUE='true'>";winContent += "<param name='CONTROLLER' VALUE='true'>";winContent += "<param name='BGCOLOR' VALUE='#FFFFFF'>";winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='TRUE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#FFFFFF'></EMBED>";winContent += "</OBJECT>";winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='"+soundfilepath+"'>Download this file</a> <SPAN style='font-size:10px'>(Right click to download)</SPAN></p>";winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onClick='java script:window.close();'></DIV></FORM>";winContent += "</BODY></HTML>";PlayWin.document.write(winContent);PlayWin.document.close(); // "Finalizes" new windowUniqueID = UniqueID + 1// newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower.}===========================Now you can save this script as music.js and add link to your html website head. like this, <script language="JavaScript" type="text/JavaScript" src="http://www.site.com/music.js"></script> make sure the JS file path is exactly as on your server.And now you can display files on your site as thiscode: <a href="example.mp3" target="_blank" onClick="java script:PlayerOpen('My Music',this.href); return false"> And when u click on it, it will play in a separatre window and you can select other file to open without closing the window.Hope this script helps ya all. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.