Embeded Media player with playlist

dquez9

n00b
Joined
Jun 27, 2005
Messages
11
Please help, I trying to set-up a media player w/ playlist. I got the javascript part taken care of, I can't get the player to connect to the files... below is the code. tell me where I went wrong? :confused:
thanks....
Code:
<html>
<head>
<title>Homies PlayList.</title>
<script>

var songs = new Array(
  "File://Http://www.homiesworldwide.com/music/la Saporita-Jaime.mp3",
  "La Saporita-Jaime Y Los Chamacos"

);

function switchSongs(i)
{
  var file = songs[i * 2];
  var title = songs[i * 2 + 1];
  var element = document.getElementById('mysound_wrapper');
  element.innerHTML = embedSound(file);
  var element = document.getElementById('songtitle');
  element.innerHTML = title;
  var selector = document.getElementById('song_selector');  
  selector.selectedIndex = i;
  return;
}

function embedSound(sound)
{
  return '<embed src="' + sound + '" autostart="true" ' +
    'width="320" height="32">';
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #000000}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {
	font-family: "Times New Roman", Times, serif;
	font-style: italic;
	color: #FFFFCC;
	font-weight: bold;
	font-size: 24px;
}
.style4 {
	color: #FFFFCC;
	font-family: "Times New Roman", Times, serif;
	font-style: italic;
	font-size: 18px;
}
-->
</style>
</head>
<body bgcolor="#FFFFCC" text="#800000" onLoad="switchSongs(0)">

<div align="center">
  <center>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="340" height="200" id="AutoNumber1" background="mexico.gif">
  <tr>
    <td height="48" align="center" background="../dgrey047.jpg"><p align="center"><span class="style2">Homies' Music </span></p>
      <p align="center"></td>
  </tr>
  <tr>
    <td height="103" align="right" background="../dgrey047.jpg">
    
    
    
    <p align="center">
    
    
    
    <select name="song_selector" id="song_selector"
  onChange="switchSongs(selectedIndex)">
<script>
for (i = 0; (i < songs.length); i += 2) {
  var file = songs[i];
  var title = songs[i + 1];
  document.write('<option value="' +
    i + '">' +
    title + '</option>\n');
}
</script>
</select></p>
    <p align="center"><font face="Arial Black"><b><br>
          </b></font><b><span class="style4">Now Playing</span></b></p>
    <div id="mysound_wrapper" align="center">
<div align="center">
  <noscript>
  <span class="style1">The music player requires that you enable JavaScript in your
    web browser's preferences</span>.
  </noscript>
</div></td>
  </tr>
  
  
</table>
  </center>
</div>
</body>
</html>
 
If the file is not on your local computer, remove the File:// part from the location of the sound file. If it is, remove the Http:// part
 
Sweetness, thank you..fixed that part, now part 2 of the question..using the script above I was only able to have 8 songs on my playlist. Is there anyway I can change the script to have more?
I copied the script above off a .txt file then pasted to Dreamweaver.. Dreamweaver decided to change my script... don't really know how that happened?
 
I don't see anything in the script that limits the number of songs. There may be an error in your array around the 8th item.

Dreamweaver doesn't usually change scripts around unless maybe there's a function built in that has the same name, but that shouldn't be the case here. Not sure why it'd mess with it.
 
Back
Top