Random after play time huh? This isn't easy, ... you would need to know the length of each song, because this length will be the deciding factor on when the function song() needs to run again. Look into the random function and how it is used. Also look into the setTimeout() in javascript.
If random isnt easy is it possible to start mediaplayer with a different video each time it starts up ie at a different place in a list? Whilst not random it produces the same effect if the list is long.
If random isnt easy is it possible to start mediaplayer with a different video each time it starts up ie at a different place in a list? Whilst not random it produces the same effect if the list is long.
This code already picks a different song to play on start. I am looking for a different (random) song to be played after the first. Currently you have to pick a song after the first song is played.
Michele
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Random mp3 Music Player</title>
<style type="text/css">
<!--
#jukebox {
text-align:center;
}
-->
</style>
<script type="text/javascript">
<!--
nummp3 = 10
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummp3,10) + 1
if (x == (1))
mp3=("song1.mp3")
if (x == (2))
mp3=("song2.mp3")
if (x == (3))
mp3=("song3.mp3")
if (x == (4))
mp3=("song4.mp3")
if (x == (5))
mp3=("song5.mp3")
if (x == (6))
mp3=("song6.mp3")
if (x == (7))
mp3=("song7.mp3")
if (x == (8))
mp3=("song8.mp3")
if (x == (9))
mp3=("song9.mp3")
if (x == (10))
mp3=("song10.mp3")
function song(){
document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+document.getElementById('cancion').value+"' name='MediaPlayer1' width='300' height='69' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
}
//-->
</script>
</head>
<body>
<div id="jukebox">JUKEBOX<br><br>
<select id="cancion" onchange="song()" size="1">
<option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>
<option value="http://song1.mp3">Song 1</option>
<option value="http://song2.mp3">Song 2</option>
<option value="http://song3.mp3">Song 3</option>
<option value="http://song4.mp3">Song 4</option>
<option value="http://song5.mp3">Song 5</option>
<option value="http://song6.mp3">Song 6</option>
<option value="http://song7.mp3">Song 7</option>
<option value="http://song8.mp3">Song 8</option>
<option value="http://song9.mp3">Song 9</option>
<option value="http://song10.mp3">Song 10</option>
</select><br><br>
<span id="music1">
<script type="text/javascript">
<!--
document.write('<embed type="application/x-mplayer2" '
+'pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" '
+'src="'+mp3+'" '
+'name="MediaPlayer1" '
+'width="300" '
+'height="69" '
+'controltype="2" '
+'showcontrols="1" '
+'showstatusbar="1" '
+'autostart="true">'
+'</embed>');
//-->
</script>
</span>
</div>
</body>
</html>
Last edited by bluedoglov; 05-20-2005 at 12:28 PM..
I have been reading this section and saw someone was asking about a random player. Below is the code for 2 pages i use on my private intranet and also have a link from my homepage so I can listen at work.
First I am by no means a programmer. A friend and I have been working on this on our lunch hours and have used public code we found on the internet and made some modifications.
I am sure there are much better ways to do this but this is working for me.
This random player will allow you to play a random file from a database. I have also included a song select page where you can search your mp3 files and list by artist and title.
I am working on adding a couple of features, first a play list that you build from the song select page and will be adding a random play by genre when I get all my mp3s tagged correctly.
Enjoy.....
Copy and paste this code into a webpage and name it wmp1.asp
Code:
<%@ LANGUAGE="VBScript" %>
<%response.buffer=true%>
<%
'*******************************************************************************************
' create a database titled readdrives.mdb and a table titled list2
' Access database format:
' vfile = actual path to song (e.g. http://www.domain.com/virtual drive/folder/song title.mp3)
' counter = number each song in the database (e.g. 1,2,3,... etc.)
' artist = artist title (e.g. grateful_dead)
' title = song title without extension (e.g.truckin')
' title1 = song title with extension (e.g. truckin'.mp3)
' my songs are formated artist-song_title.mp3
' my mp3s are one a windows 2000 Pro box and my webserver is on a windows 2000 server box
' this is why I show the virtual path in the example
' modify to meet your needs
' This is the button I have on my homepage to start the player
' <form>
' <input type="button"
' value="JeMP3Player"
' onclick="openwindow3()">
' </form>
' This is the javascript I call up with the button
' <script type="text/javascript">
' function openwindow3()
' {
' window.open('http://www.yourdomain.net/wmp1.asp','JeMP3Player','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=350, height=175')
'}
'</script>
'*******************************************************************************************
Function ChkString(string)
if string = "" then string = " "
string = Replace(string, chr(34), """")
string = trim(Replace(string, "'", "''"))
ChkString = string
End Function
vf1 = request.querystring("song")
va1 = request.querystring("artist")
RANDOMIZE
SET MY_CONN= SERVER.CREATEOBJECT("ADODB.Connection")
MYDSN="DRIVER={Microsoft Access Driver (*.mdb)};"
MYDSN=MYDSN & "DBQ=" & "h:\mp3\mp3_uploads\readdrives.mdb" '<------be sure to change this
MY_CONN.OPEN MYDSN
SET RECORDSET = SERVER.CREATEOBJECT("ADODB.Recordset")
if request.querystring("song") <> "" then
vf1 = ChkString(request.querystring("song"))
SQL = "SELECT * FROM list2 where vfile = '" & vf1 & "'"
relode_flg = "false"
elseif request.querystring("artist") <> "" then
va1 = ChkString(request.querystring("artist"))
SQL = "SELECT * FROM list2 where artist = '" & va1 & "'"
relode_flg = "true"
else
relode_flg = "true"
SQL = "SELECT * FROM list2"
end if
RECORDSET.OPEN SQL, MY_CONN, 3,1
INTTOTALRECORDS = RECORDSET.RECORDCOUNT
if INTTOTALRECORDS > 1 then
RANDNO = INT(RND*INTTOTALRECORDS)
RECORDSET.MOVEFIRST
RECORDSET.MOVE RANDNO
end if
RandomLineItem = TRIM(RECORDSET("vfile"))
artist = trim(recordset("artist"))
title = trim(recordset("title"))
RECORDSET.CLOSE
SET RECORDSET = NOTHING
MY_CONN.CLOSE
SET MY_CONN = NOTHING
Song2Play = RandomLineItem
songname = artist & " - " & title
%>
<html>
<head>
<title>JeMP3Player</title>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<script language="JavaScript">
//Song title scroller
var behavior = "scroll" // can be alternate or slide
var direction = "left" // can be right, left , up or down
var ScrollDelay = 500; // speed of scroller
function scrollMe(text,width,height)
{
document.write('<div style="border: thin inset rgb(225,225,225); font: 11px arial bold; width: '+width+'px; height: '+height+'px; background: #000000; color: #ffff99;" ><marquee behavior='+behavior+' direction='+direction+' scrolldelay='+ScrollDelay+'>'+text+'</marquee></div>');
}
</script>
<script language="JavaScript">
var state;
//URL of song - Direct path
function playerinit()
{
player.url="<% = Song2Play %>";
player.settings.autoStart = true ;
}
// start the section if you want to use your own buttons
//Play Function
function play()
{
if (player.controls.isavailable('play'))
{
player.controls.play();
state=setInterval("updatetime()",1000);
playerinfo.innerHTML = "Play";
}
}
//Pause Function
function pause()
{
if (player.controls.isavailable('pause'))
{
player.controls.pause();
clearInterval(state);
playerinfo.innerHTML = "Paused";
}
}
//Stop Function
function stop()
{
if (player.controls.isavailable('stop'))
{
player.controls.stop();
clearInterval(state);
playerinfo.innerHTML = "Stopped";
}
}
//Step Function
function step()
{
if (player.controls.isavailable( 'step' ))
player.controls.step( 1 );
}
//Volume down function
function voldown()
{
if ( player.settings.volume < 5 )
{
player.settings.volume = 0;
playerinfo.innerHTML = "0";
}
else
{
player.settings.volume -= 20;
playerinfo.innerHTML = "Volume " + player.settings.volume +"%";
}
}
//Volume up function
function volup()
{
if ( player.settings.volume > 90 )
{
player.settings.volume = 10;
playerinfo.innerHTML = "Volume 50%";
}
else
{
player.settings.volume += 20;
playerinfo.innerHTML = "Volume " + player.settings.volume +"%";
}
}
//Mute Function
function mute()
{
player.settings.mute = !player.settings.mute;
playerinfo.innerHTML = "Mute";
}
//Fast Forward function (NOT USED - FIX)
function fastforward()
{
player.settings.rate = 2.0;
playerinfo.innerHTML = "Fastforwording";
}
//Rewind function (NOT USED - FIX)
function rewind()
{
player.settings.rate = -0.0;
playerinfo.innerHTML = "Rewinding";
}
//Balance Function
function balance()
{
switch (player.settings.balance)
{
case 0:
player.settings.balance = 100;
playerinfo.innerHTML = 'Balance: Right';
break;
case 100:
player.settings.balance = -100;
playerinfo.innerHTML = 'Balance: Left';
break;
case -100:
player.settings.balance = 0;
playerinfo.innerHTML = 'Balance: Center';
break;
default :
player.settings.balance = 0;
playerinfo.innerHTML = '???';
break;
}
}
//Time Function
function updatetime()
{
playerinfo.innerHTML = " <font color='#3A445C' size='1' face=verdana> " + player.controls.currentPositionString + " | " + player.currentMedia.durationString +" <font color='#3A445C' size='1' face=verdana>" + player.status + "</font>";
}
// end the use your own button section
</script>
</head>
<body bgcolor="#9BA4BF" text="#555555" link="#555555" alink="#555555" vlink="#555555"onload="playerinit();">
<!-- START PLAYER -->
<table width='100%' cellpadding=5 cellspacing=0 style='border: 0px solid #566494' >
<td>
<div align='center'>
<!-- Default Player Settings -->
<div id="layer1" style="position:absolute; left:0; width:0; height:0; top:0; visibility:visible;">
<table>
<tr>
<td>
</td>
</tr>
</table>
</div>
<!-- END Default Player Settings -->
<%
' my file format is artist-song_title.mp3
songname = replace(songname,"_"," ")
%>
<!-- Title Scroller -->
<div id="layer1" style="position:absolute; left:25; width:150; height:10; top:10; visibility:visible;">
<table background='musicplayer_bg.gif' style="FILTER: alpha(opacity=90);" bgcolor='#9BA4BF' align='center' width='308' cellpadding=3 cellspacing=0 style='border: 1px solid #566494' >
<td>
<script>scrollMe("<%= SONGNAME %>",300,15);</script>
<!--<MARQUEE BEHAVIOR="slide" DIRECTION="left" SCROLLDELAY="1000" ALIGN="middle" WIDTH="100%"><font color='#0000C0' size='1' face=verdana><b><% = songname %></b></font></MARQUEE>-->
<br>
<br>
</td>
</table>
</div>
<!-- END Title Scroller -->
<!-- Player info & statistics -->
<div id="layer1" style="position:absolute; left:25; width:225; height:10; top:54; visibility:visible;">
<table bgcolor='#919BB9' style="FILTER: alpha(opacity=100);" bgcolor='#9BA4BF' align='center' width='308' cellpadding=3 cellspacing=0 style='border: 1px solid #566494' >
<td>
<font color='#3A445C' size='2' face=verdana><b> <span id="playerinfo"></span></b></font>
</td>
</table>
</div>
<!-- END Player info & statistics -->
<!-- Player Controls -->
<div id="layer4" style="position:absolute; left:25; width:300; height:10; top:73; visibility:visible;">
<table style="FILTER: alpha(opacity=100);" bgcolor='#8A95B5' width='300' cellpadding=3 cellspacing=0 style='border: 1px solid #566494' >
<!-- bgcolor='#8A95B5' bgcolor='#9BA4BF' -->
<td align=center>
<object id="player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="300" height="42">
<param name="autoStart" value="true">
<param name="balance" value="0">
<param name="currentPosition" value="0">
<param name="currentMarker" value="0">
<param name="enableContextMenu" value="false">
<param name="enableErrorDialogs" value="false">
<param name="enabled" value="true">
<param name="fullScreen" value="false">
<param name="invokeURLs" value="false">
<param name="mute" value="false">
<param name="playCount" value="1">
<param name="rate" value="1">
<param name="uiMode" value="full">
<param name="volume" value="50">
<embed autostart="true" loop="false" width="200" height="30" controller="true" bgcolor="#FF9900" name="player"></embed></object>
<!-- if you want to use your own buttons instead of the Windows Media Player controls
you'll need to add your own buttons and possibly css file
<input TYPE="image" src="volmax_button.gif" class="" onmouseover=""; onmouseout=""; value="" name="" onclick="location.reload(true);">
<input TYPE="image" src="play_button.gif" class="but21" onmouseover=this.className="but22"; onmouseout=this.className="but21"; value="Play " name="play" onclick="play();">
<input TYPE="image" src="stop_button.gif" class="but41" onmouseover=this.className="but42"; onmouseout=this.className="but41"; value="Stop" name="stop" onclick="stop();">
<input TYPE="image" src="pause_button.gif" class="but31" onmouseover=this.className="but32"; onmouseout=this.className="but31"; value="Pause" name="pause" onclick="pause();">
<input TYPE="image" src="mute_button.gif" class="but61" onmouseover=this.className="but62"; onmouseout=this.className="but61"; value="Mute" name="mute" onclick="mute();">
<input TYPE="image" src="bal_button.gif" class="but61" onmouseover=this.className="but62"; onmouseout=this.className="but61"; value="Balance" name="balance" onclick="balance();"> -->
<TABLE bgcolor='#8A95B5' align='center' width='100%'>
<TR>
<!-- You'll need to add small button gifs mine are
.gif files 12 pix wide by 10 pix height
-->
<FORM action=wmp1.asp>
<TD bgcolor='#8A95B5' align=center><INPUT TYPE=IMAGE SRC="small_button.gif"></TD>
</FORM>
<TD bgcolor='#8A95B5' align=center><A href=# onclick="location.reload(true);"><IMG src="small_button.gif" border="0"></A></TD>
<TD bgcolor='#8A95B5' align=center><A href=songselect.asp target="_new" onClick="javascript:window.close();"><IMG src="small_button.gif" border="0"></A></TD>
<TD bgcolor='#8A95B5' align=center><A href=# onClick="javascript:window.close();"><IMG src="small_button.gif" border="0"></a></TD>
</TR><TR>
<TD bgcolor='#8A95B5' align=center><font color='#3A445C' size='1' face=verdana>Random<BR>Play</TD>
<TD bgcolor='#8A95B5' align=center><font color='#3A445C' size='1' face=verdana>Skip<BR>Song</TD>
<TD bgcolor='#8A95B5' align=center><font color='#3A445C' size='1' face=verdana>Select<BR>Song</TD>
<TD bgcolor='#8A95B5' align=center><font color='#3A445C' size='1' face=verdana>Close<BR>Player</TD>
</TR>
</TABLE>
<!--
more buttons for the volume if you want to use your own
</td>
<td width='52' bgcolor='#8A95B5' align=center>
<input TYPE="image" src="volmax_button.gif" class="" onmouseover=""; onmouseout=""; value="" name="" onclick="location.reload(true);">
<input TYPE="image" src="volmax_button.gif" class="but61" onmouseover=this.className="but62"; onmouseout=this.className="but61"; value="+" name="volup" onclick="volup();"><BR>
<input TYPE="image" src="volmin_button.gif" class="but61" onmouseover=this.className="but62"; onmouseout=this.className="but61"; value="-" name="voldown" onclick="voldown();">
<form action="wmp1.asp">
<button type="submit">Rand</button>
-->
</td>
</table>
</div>
<!-- END Player Controls -->
<!-- Player New State -->
<script language = "JavaScript" for = player event = playstatechange(newstate)>
switch (newstate){
case 1:
playerinfo.innerHTML = "<font color='#3A445C' size='1' face=verdana>Loading..</font>";
break;
case 2:
playerinfo.innerHTML = "<font color='#3A445C' size='1' face=verdana>Loading...</font>";
break;
case 3:
playerinfo.innerHTML = "<font color='#3A445C' size='1' face=verdana>Loading....</font>";
{
player.controls.play();
state=setInterval("updatetime()",1000);
playerinfo.innerHTML = "<font color='#3A445C' size='1' face=verdana>Play</font>";
}
break;
case 10:
playerinfo.innerHTML = "<font color='#3A445C' size='2' face=verdana>Press play button to load song</font>";
case 8:
<% if relode_flg = "true" then%>
location.reload(true);
<% end if %>
break;
}
</script>
<!-- END Player New State -->
</body>
Be sure to read each file and make the necessary changes.
I have to post the songselect.asp webpage as a separate reply because of the length limits
Copy and paste this code into a webpage and name it songselect.asp
Code:
<%
' ***************************************************************************
' This is the song select section webpage, it has the the same features as the player
' webpage. You'll need to make a few changes in here also.
' This page will display when you click the Song Select button on the player
' Because I am having problems passing variables from this page to the player
' webpage when you click the Song Select button on the player the player
' webpage will close and this one will open.
' Using this webpage:
' If you click on the song title it will play just that single file.
' If you click the artist then you will play all the songs you have by that artist
' randomly. To return to Random mode click the random button on the player.
' ***************************************************************************
Function ChkString(string)
if string = "" then string = " "
string = Replace(string, chr(34), "\""")
string = trim(Replace(string, "'", "\'"))
ChkString = string
End Function
set my_conn= Server.CreateObject("ADODB.Connection")
myDSN="DRIVER={Microsoft Access Driver (*.mdb)};"
myDSN=myDSN & "DBQ=" & "H:\mp3\mp3_uploads\readdrives.mdb" ' <-----change this
my_conn.Open myDSN
if Request.QueryString("B1") = "Search" then
Set recordset = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM list2"
recordset.Open sql, my_conn, 3,1
intTotalRecords = recordset.RecordCount
recordset.Movefirst
If Request.QueryString("TypeSearch") = "FirstName" Then
if Request.QueryString("DaInBox2") <> "" then
sql = sql & " WHERE artist LIKE '%" & _
Request.QueryString("DaInBox2") & "%' order by artist asc, title asc"
End If
if Request.QueryString("DaInBox") <> "" then
sql = sql & " WHERE artist LIKE '" & _
Request.QueryString("DaInBox") & "%' order by artist asc, title asc"
End If
End if
If Request.QueryString("TypeSearch") = "LastName" Then
if Request.QueryString("DaInBox2") <> "" then
sql = sql & " WHERE title LIKE '%" & _
Request.QueryString("DaInBox2") & "%' order by title asc, artist asc"
End If
if Request.QueryString("DaInBox") <> "" then
sql = sql & " WHERE title LIKE '" & _
Request.QueryString("DaInBox") & "%' order by title asc, artist asc"
End If
End If
set rsSQL = Server.CreateObject("ADODB.Recordset")
rsSQL.open sql, my_conn
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Song Selection</TITLE>
<META NAME="GENERATOR" CONTENT="WebPad Pro">
<script type="text/javascript">
// this script is currently not being used
function changeURL(winName, newURL) {
win = window.open(newURL, winName,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=350, height=175');
win.location.href = newURL;
}
</script>
<script type="text/javascript">
function openwindow3(winName, newURL) {
win = window.open(newURL, winName,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=350, height=175');
win.location.href = newURL;
}
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FONT face=arial size=3 color=#000000>
<CENTER>
<P><B>Welcome to the JeMP3Player Select Song webpage.</B>
<P><IMG src=JeMP3Player.jpg> <!-- Here I have a picture of the player -->
<FONT face=arial size=2 color=#000000>
</CENTER>
<P>You have several choices listed below:
<BR>
<BR>
<TABLE width=75%>
<TR>
<TD valign=top><FONT face=arial size=2 color=#000000><B>Play Songs from a Given Artist Randomly</B></TD>
<TD valign=top><FONT face=arial size=2 color=#000000>Select the letter of the Artist from the list below
and when the list appears click their name under the Artist column and just those from the
selected artist will play Randomly.<BR><BR></td>
</TR><TR>
<td valign=top><FONT face=arial size=2 color=#000000><B>Play Select Song</B></TD>
<TD valign=top><FONT face=arial size=2 color=#000000>Select the letter of the Title from the list below
of a song and when the list appears click on he song title under the Title column and just the
selected song will play.<BR><BR></td>
</TR><TR>
<TD valign=top><FONT face=arial size=2 color=#000000><B>Play List Feature</B></TD>
<TD valign=top><FONT face=arial size=2 color=#000000>Currently under construction.<BR><BR></td>
</TR><TR>
<td valign=top><FONT face=arial size=2 color=#000000><B>Return to Random Play</B></TD>
<TD valign=top><FONT face=arial size=2 color=#000000>Click the Random button on the player to
return to random mode at any time.<BR><BR></td>
</TABLE>
<CENTER>
</CENTER>
<!--artist-->
<P><FONT face=arial size=3 color=#000000><B>Select a song by Artist First Name</B></P>
<FONT face=arial size=2 color=#000000><P>Click on a letter to see all songs where the artist name begins with the letter selected. When you click on the Artist Name you will play randomly all the songs we have by that artist.<FONT face=arial size=1 color=#000000>(example: Grateful Dead, or Jerry Garcia, or Jerry)</P>
<FONT face=arial size=2 color=#000000>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=a&B1=Search" >A</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=b&B1=Search" >B</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=c&B1=Search" >C</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=d&B1=Search" >D</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=e&B1=Search" >E</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=f&B1=Search" >F</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=g&B1=Search" >G</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=h&B1=Search" >H</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=i&B1=Search" >I</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=j&B1=Search" >J</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=k&B1=Search" >K</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=l&B1=Search" >L</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=m&B1=Search" >M</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=n&B1=Search" >N</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=o&B1=Search" >O</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=p&B1=Search" >P</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=q&B1=Search" >Q</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=r&B1=Search" >R</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=s&B1=Search" >S</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=t&B1=Search" >T</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=u&B1=Search" >U</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=v&B1=Search" >V</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=w&B1=Search" >W</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=x&B1=Search" >X</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=y&B1=Search" >Y</A>
<A href="songselect.asp?TypeSearch=FirstName&DaInBox=&B1=Search" >Z</A>
<!--title-->
<P><HR ALIGN="left" WIDTH="75%" COLOR="#000000">
<P><FONT face=arial size=3 color=#000000><B>Select a song by the Song Title</B></P>
<FONT face=arial size=2 color=#000000><P>Click on a letter to see all songs where the title of the song begins with the letter selected. <FONT face=arial size=1 color=#000000>(example: Truckin)</P>
<FONT face=arial size=2 color=#000000>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=a&B1=Search" >A</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=b&B1=Search" >B</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=c&B1=Search" >C</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=d&B1=Search" >D</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=e&B1=Search" >E</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=f&B1=Search" >F</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=g&B1=Search" >G</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=h&B1=Search" >H</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=i&B1=Search" >I</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=j&B1=Search" >J</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=k&B1=Search" >K</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=l&B1=Search" >L</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=m&B1=Search" >M</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=n&B1=Search" >N</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=o&B1=Search" >O</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=p&B1=Search" >P</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=q&B1=Search" >Q</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=r&B1=Search" >R</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=s&B1=Search" >S</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=t&B1=Search" >T</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=u&B1=Search" >U</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=v&B1=Search" >V</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=w&B1=Search" >W</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=x&B1=Search" >X</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=y&B1=Search" >Y</A>
<A href="songselect.asp?TypeSearch=LastName&DaInBox=&B1=Search" >Z</A>
<P><font face="arial,helvetica" color="#000000" size="3"><B>Search our Song Database</B>
<font face="arial,helvetica" color="#000000" size="2">
<P>If you would rather search for an artist name, song title or part of a artist name or song title, use the search box below:</P>
<font face="arial,helvetica" color="#000000" size="2">
<OL type="1" start="1">
<LI>Select Artist or Title<BR></LI>
<LI>Type Search Criteria<BR></LI>
<LI>Click Search button<BR><BR></LI>
</OL>
</center>
<form action="songselect.asp" method="get" name="DaForm" align="center">
<select name="TypeSearch" size="1">
<option selected value="FirstName">Artist Name</option>
<option value="LastName">Song Name </option>
</select>
<input type="text" size="20" name="DaInBox2">
<input type="submit" name="B1" value="Search"><input type="reset" name="B2" value="Clear">
</form>
<% if Request.QueryString("B1") = "Search" then
If Not rsSQL.BOF Then %>
<table BORDER="0" cellpadding="3" cellspacing="8">
<tr>
<td bgcolor="#3366cc"><font face="Arial" color="#FFFFFF">Artist Name </font></td>
<td bgcolor="#3366cc"><font face="Arial" color="#FFFFFF">Song Title </font></td>
</tr>
<%
counter = 0
Do While Not rsSQL.EOF
artist = rsSQL("artist")
artist =replace(artist, "_", " ")
title = rsSQL("title")
title = replace(title, "_", " ")
song = ChkString(rsSQL("vfile"))
song2 = "http://www.yourdomain.net/mp3-1/website/wmp1.asp?song=" & song '<---------change this
song3 = "'JeMP3Player' , " & "'" & song2 & "'"
song4 = "http://www.yourdomain.net/mp3-1/website/wmp1.asp?artist=" & ChkString(rsSQL("artist")) '<--------------change this
song5 = "'JeMP3Player' , " & "'" & song4 & "'"
'response.write("song3 = " & song3 & "<BR>")
%>
<% IF COUNTER = 0 THEN %>
<tr>
<td bgcolor="#FFFFCC"><A href="songselect.asp?TypeSearch=<% = Request.QueryString("TypeSearch") %>&DaInBox=<% = Request.QueryString("DaInBox") %>&B1=<% = Request.QueryString("B1") %>" onclick="openwindow3(<% = song5 %>)"><%=artist%></A></TD>
<TD bgcolor="#EFEFEF"><A href="songselect.asp?TypeSearch=<% = Request.QueryString("TypeSearch") %>&DaInBox=<% = Request.QueryString("DaInBox") %>&B1=<% = Request.QueryString("B1") %>" onclick="openwindow3(<% = song3 %>)"><%=title%></A></td>
</td>
<% counter = counter + 1
END IF %>
<% IF COUNTER = 1 THEN %>
<tr>
<td bgcolor="#EFEFEF"><A href="songselect.asp?TypeSearch=<% = Request.QueryString("TypeSearch") %>&DaInBox=<% = Request.QueryString("DaInBox") %>&B1=<% = Request.QueryString("B1") %>" onclick="openwindow3(<% = song5 %>)"><%=artist%></A></TD>
<TD bgcolor="#EFEFEF"><A href="songselect.asp?TypeSearch=<% = Request.QueryString("TypeSearch") %>&DaInBox=<% = Request.QueryString("DaInBox") %>&B1=<% = Request.QueryString("B1") %>" onclick="openwindow3(<% = song3 %>)"><%=title%></A></td>
</td>
<% counter = 0
END IF %>
</tr>
<% rsSQL.MoveNext
Loop
End If
%>
<%If rsSQL.BOF and rsSQL.EOF Then%>
<TR>
<TD>
<h2 align="center"><font face="arial,helvetica" color="#000080" size="3">We did not find a match for your search</h2>
</TD>
</TR>
</table>
<%End If
rsSQL.Close
End if
my_conn.Close
%>
</TR>
</table>
</BODY>
</HTML>
I am so confused trying to catch up with this whole thing...but basically I need to have my embedded mp3 player, play continuous music as different pages are being clicked on the website I am working on it. I have the basic coding and don't write html.....can anyone help.
Thats not going to happen using only one page, you are going to need to use frames or iframes. www.w3schools.com is a good place to learn. seems like you are taking on more than your plate can handle. Learn the html first then move on to the more advanced multimedia stuff.
I have been reading this section and saw someone was asking about a random player. Below is the code for 2 pages i use on my private intranet and also have a link from my homepage so I can listen at work.
First I am by no means a programmer. A friend and I have been working on this on our lunch hours and have used public code we found on the internet and made some modifications.
I am sure there are much better ways to do this but this is working for me.
This random player will allow you to play a random file from a database. I have also included a song select page where you can search your mp3 files and list by artist and title.
I am working on adding a couple of features, first a play list that you build from the song select page and will be adding a random play by genre when I get all my mp3s tagged correctly.
Enjoy.....
Copy and paste this code into a webpage and name it wmp1.asp
Be sure to read each file and make the necessary changes.
I have to post the songselect.asp webpage as a separate reply because of the length limits
Stewball
Thanks but I am looking for the embedded media player to play random songs and not one that will play in another window. Since my page has frames they can listen to the songs no matter what page they are at.
Its not as bulky, and it should work in other browsers as well. Also the option values might have to be exact urls or it might not work properly, at least this is what I discovered after testing.
Its not as bulky, and it should work in other browsers as well. Also the option values might have to be exact urls or it might not work properly, at least this is what I discovered after testing.
1. how to make automatic play song1 on page load ?
2. how to make this script play song automatic.. start play from song1 --> song2 ---> song 3... automaticly like play list
Quote:
Originally Posted by _Aerospace_Eng_
you almost had it, u need to use onclick for this one
So you aren't going to want to use the drop down menu correct, but you are going to want to allow the users to skip back and forth to other songs right? It sounds like you want a playlist, read the last post on this page and follow the link there to find out how to make an m3u playlist. Then you can just use the following code which is far less bulkier than the version you found.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
text-align:center;
}
-->
</style>
</head>
<body>
<object id="mediaPlayer" width="270" height="45"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="fileName" value="http://url-to-your-playerlist.m3u">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="loop" value="true">
<embed type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"
bgcolor="darkblue" showcontrols="true" width="270" height="45"
src="http://url-to-your-playerlist.m3u" autostart="true" designtimesp="5311" loop="true">
</object>
</body>
</html>
You will want to change the filename value to match your playlist location, and you will also want to change the src in the embed tag to match your playlist location. Autostart is set to true so it should start playing onload.
i know how to use play list (ASX)
but i have some reason that canot use asx and mu3 playlist
are there anyway to make java script
onload and play song from start from 1234567 ?
and user can select song to start to play from?
ie..start to play from song 2-3-4-5-6-7
or song 5-6-7
---
---
Quote:
Originally Posted by _Aerospace_Eng_
So you aren't going to want to use the drop down menu correct, but you are going to want to allow the users to skip back and forth to other songs right? It sounds like you want a playlist, read the last post on this page and follow the link there to find out how to make an m3u playlist. Then you can just use the following code which is far less bulkier than the version you found.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
text-align:center;
}
-->
</style>
</head>
<body>
<object id="mediaPlayer" width="270" height="45"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="fileName" value="http://url-to-your-playerlist.m3u">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="loop" value="true">
<embed type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"
bgcolor="darkblue" showcontrols="true" width="270" height="45"
src="http://url-to-your-playerlist.m3u" autostart="true" designtimesp="5311" loop="true">
</object>
</body>
</html>
You will want to change the filename value to match your playlist location, and you will also want to change the src in the embed tag to match your playlist location. Autostart is set to true so it should start playing onload.
if in playlist has 100 songs
if user want to play song number 50 they have to click next button 49 times
take long time to get song number 50.
-----------------
but if use your java scripts code
user can just click or tick radio button at song50 just one time
it's fast access to song number 50
and will automatic play from song 50 -song 100
Hi I'm a new member and stumbled upon this page while trying to find out how to have a drop down list and a media player and thanks to _Aerospace_Eng_
for this wonderful code! but can I ask someone...can you edit this code to play like the first song on the list automaticaly so ppl don't have to click play when they come to my page. (I'm using music links from sites that offer free music links and midi so they aren't downloaded) I've tried changing this line to <PARAM NAME="AutoStart" value="true"> but I'm stumped...I don't know too much about HTML......MUCH THANKS!