Click to See Complete Forum and Search --> : creating streaming music playlists


Igpajo
04-16-2003, 01:20 AM
First post so forgive me if this is the wrong place for this question.

What I'm trying to figure out how to do is be able to create a sort of streaming music playlist for RealPlayer. I want to be able to create a collection of songs encoded into seperate RealMedia files (.rm's) and then on my website have a single link that will stream them in the order I want. I'm basically trying to do a cheap simulation of something like ShoutCast where I can create the song files seperately, maybe create a couple voice files to insert here and there and then decide what order I want them to be in and then create a file which when clicked on will launch the RealPlayer program and then stream the files to the user in the order I tell it to.

Is this possible(?), and if so, can someone please tell me where I can find more information on how to achieve this.

PeOfEo
04-16-2003, 08:10 AM
<EMBED SRC="peanuts.wav,mid,mp3 whatever" AUTOSTART=FALSE LOOP=FALSE WIDTH=145 HEIGHT=55 ALIGN="CENTER">
</EMBED>
Thats how you embed a song, it will play with whatever your default media player is. To make a play list its going to use some java script to rotate that src.

Igpajo
04-16-2003, 10:04 PM
Thanks for the advice PeOfEo. That's not exactly what I was talking about.
I actually figured this out last night and figured I'd come back and post the solution here. I found the following explanation on This Website (http://faq.all2all.org/cgi-bin/fom?_recurse=1&file=35).
Many media types (Real Audio/Video, MP3, Windows Media) require a separate file,
called a metafile, to tell the server "send this as streaming media, don't just
start a download." Metafiles are sometimes also called playlists.

Media and metafiles have to be put into the public/ folder of your site. The
Media file is the file you want to stream, the metafile is just a simple text
file. Macintosh users should be aware to save it with Unix linefeeds. This can
be done with the BBEdit utility: save as: options: Unix linefeeds.

MPEG video files (.mpg, .mpeg, .mpa) stream themselves by default, without the
need for a metafile. This doesn't give you the ability to set up playlists,
however. There's a new metafile spec (.mxu) for MPEG video playlists; it's not
very widely supported, but you can give it a try if you like. Syntax is the same
as for .m3u audio metafiles.


RAM File (Realmedia streaming format) :
----------------------------------------

Name of metafile to create: example.ram

Content of metafile: http://www.my_site.org/example.rm

The link in your refering HTML file: <A HREF="example.ram">Streaming Sample</A>To make multiple-clip playlists, just put the links to your files on separate lines in the RAM file.
That last part is exactly what I was looking for. All you have to do in the RAM file is list all the tracks you want to stream in your playlist on seperate lines. So with one click RealPlayer will launch and play all the tracks you list in the RAM one after another. Works like a charm.
I Appreciate the reply though.

MjhLkwd
05-21-2003, 04:38 PM
1. The following is a COMPLETE HTML "Jukebox" or "Video Album" document. Use NotePad to create a document which contains the following.

<HTML>
<head>
<SCRIPT LANGUAGE="JavaScript">

function PlaySong(url){

document.Player.filename = url;
document.Player.play();
}

function GetSelection (selSelectObject){
var data=selSelectObject.options[selSelectObject.selectedIndex].value
PlaySong(data);
}

</script>
</head>
<Body BGColor="lightyellow">

<Table Width ="650" Border="0" Align="center" Cellspacing="2" Cellpadding="1" Height=50">
<TR>
<TD>
<center>
<a ref="JavaScript:PlaySong'PlayList.wax')"><img src="PlayMusic.gif">
</center>
</TD>
<TD>
<center>
<SELECT name=SongList onChange=GetSelection(this)>
<option selected value="null">Or, Choose A Song</option>
<option value="song1.mp3">Title 1</option>
<option value="song2.mp3">Title 2</option>
<option value="song3.mp3">Title 3</option>
<option value="song4.mp3">Title 4</option>
<option value="song5.mp3">Title 5</option>
</select>
</center>
</TD>
<TD>
<center>
<Object ID="Player" width=170 height=45
ClassID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
Type="applicaton/x-oleobject">
<Embed Type ="application/x-mplayer2"
Src="null.wax"
Name="Player"
</Embed>
</center>
</TD>
</TR>
</Table>
</Body>
</HTML>

2. Save the file with with any name of your choosing, but making sure to give it the .html extension.

3. Next, Use NotePad to create a document which contains the following:

<ASX version = "3.0">
<Entry>
<Ref href = "song1.mp3"/>
</Entry>
<Entry>
<Ref href = "song2.mp3"/>
</Entry>
<Entry>
<Ref href = "song3.mp3"/>
</Entry>
<Entry>
<Ref href = "song4.mp3"/>
</Entry>
<Entry>
<Ref href = "song5.mp3"/>
</Entry>
</ASX>

4. Save this file as PlayList.wax. It's essential that you give the file the .wax extension. When creating a VIDEO playlist, give the file a .wvx extension instead of .wax.

5. Create or use an existing image that when clicked, the entire song list will be played, from first to last. Rename this image PlayList.gif.

6. Select 5 .mp3 files for your Jukebox. Rename them song1.mp3, song2.mp3, etc.

7. Make sure all of the above files are in the same folder (directory).

8. Use it! The above, with proper modifications, works equally well for .wav, .wma, .mpg files. For a "Video Album," you'll obviously need to modify the height, and possibly the width, of the embedded MediaPlayer.

missp
05-21-2003, 06:07 PM
Awesome awesome awesome

but ... the play music link to play the entire songlist does not work? Goes to a blank page and nothing happens? Should there be a closing </a> tag or something?

This is a very very cool set up thanks for posting it :D

MjhLkwd
05-21-2003, 07:13 PM
I don't know. Maybe you need the image that you click upon to play the entire list. I'm attaching it. I hope this works for you. I'll provide whatever help I can to fix it.

MjhLkwd
05-21-2003, 07:17 PM
Another thing to check is that you properly created the SongList.wax file. When done correctly, Windows will display a little film clip icon for the file. Hope this helps.

MjhLkwd
05-21-2003, 07:23 PM
No. There is NO closing </a> tag with a JavaScript image link. I'm baffled as to why it won't work for you. Let me know if it still won't work.

MjhLkwd
05-21-2003, 07:50 PM
I think I found the problem.

In the reply I posted, the following line has a SPACE between the "java" and the "script." It's not that way in the original, but the line should look like this:

<a href="javascript:PlaySong('PlayList.wax')"><img src="PlayMusic.jpg">

I think this will solve it.

missp
05-21-2003, 07:50 PM
Thanks for the image.

The songs play individually just fine, so I'm assuming that I got the .wax file created ok. But when I click the image I get this error:

Not Found
The requested URL /test/jukebox/java script:PlaySong('PlayList.wax') was not found on this server.

EDITED HERE:
OOPS Just now saw your next message and I edited the javascript into one word. Now it stays on the page, but shows a javascript error ... so I'll keep playin' with it ... more important that the individual songs play for me right now. And THANK YOU so much again.

missp
05-21-2003, 08:00 PM
Well ... just for fun I tried adding back the closing </a> tag after the image. On my local drive it worked, but on the server it still shows a javascript error. Must be a server issue or something maybe.


go figger :o

MjhLkwd
05-21-2003, 08:41 PM
Well, Okay. You might want to try this: on your local disk, just click the PlayList.wax icon. Windows should open the media player and begin to play the entire list.

If that doesn't work, I'm at a loss. If it does work, there still must be an error in the line you just fixed, with the "java" and "script."

Other than that, without more information, I'm at a loss. I have absoltely no problem with .WAX files.

MjhLkwd
05-21-2003, 09:00 PM
You could try substituting the following code for the code
that links to PlayList.wax.

The only difference is that the .jpg image (PlayMusic.jpg) will
not be outlined in blue like any other link. But clicking
on the image will exectute the necessary JavaScript function.


<input type="image" src="PlayMusic.jpg" onClick="PlaySong('PlayList.wax')"/>

Hope this helps. I'm happy that my work has been useful for you. Can't tell you how many hours... And it turns out to be pretty simple, don't you think?

MjhLkwd
05-21-2003, 09:31 PM
<HTML>
<Head>
<Script Language="JavaScript">

function PlaySong(url){

document.Player.filename = url;
document.Player.play();
}

</script>
</Head>

<Body>
<input type="button" value="Play 1" onClick="PlaySong('song1.mp3')"><BR>
<input type="button" value="Play 2" onClick="PlaySong('song2.mp3')">
<center>
<Object ID="Player" width=170 height=45
ClassID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
Type="applicaton/x-oleobject">
<Embed Type ="application/x-mplayer2"
Src="null.wax"
Name="Player"
</Embed>
</center>

</Body>

</HTML>

missp
05-21-2003, 09:36 PM
:eek: I am such an idiot sometimes .... the problem was that I inadvertently named the file playlist.wax instead of PlayList.wax DUH DUH DUH It worked fine on my local disk, but on the Unix server is case-sensitive LOL

Thank you again ... I feel like I've taken great advantage of your work and kindness in helping me out here. Believe me it is greatly appreciated :) I'm just embarrassed that both issue turned out to be nothing more than typographical LOL

Thanks again
:D

MjhLkwd
05-21-2003, 10:09 PM
Well, you are very welcome. It does my heart good to know that someone made use of my little contribution.

I never would have thought about the UNIX case sensitive issue.

I am very glad it works for you now.

missp
05-21-2003, 10:12 PM
how 'bout this:

<HTML>
<Head>
<Script Language="JavaScript">

function PlaySong(url){

document.Player.filename = url;
document.Player.play();
}

</script>
</Head>

<Body>
<table width="225" border="1" cellpadding="2" cellspacing="2" bordercolor="#666666" bgcolor="#CCCCCC">
<tr valign="middle">
<td>
<p>
<input name="button" type="button" onClick="PlaySong('song1.mp3')" value=" Play 1 ">
<input name="button2" type="button" onClick="PlaySong('song2.mp3')" value=" Play 2 ">
<input name="button3" type="button" onClick="PlaySong('song3.mp3')" value=" Play 3 ">
</p></td>
<td valign="bottom" bordercolor="#666666" bgcolor="#CCCCCC">
<p align="center"><b><font size="2" face="Arial, Helvetica, sans-serif">Name of Jukebox</font></b></p>
<p>
<Object ID="Player" width=170 height=45
ClassID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
Type="applicaton/x-oleobject">
<center>
<Embed Type ="application/x-mplayer2"
Src="null.wax"
Name="Player"
></Embed>
</center>
</object>
</td>
<td>
<input name="button4" type="button" onClick="PlaySong('song4.mp3')" value=" Play 4 ">
<input name="button5" type="button" onClick="PlaySong('song5.mp3')" value=" Play 5 ">
<input name="button6" type="button" onClick="PlaySong('PlayList.wax')" value="PlayAll"></td>
</tr>
</table>
</Body>

</HTML>

MjhLkwd
05-21-2003, 10:23 PM
Wow. That is very, very nice. Very. I see that you did prefer buttons. The only thing I would do, is put an image in the table cell that has "Name of Jukebox." A colorful image would be great in there. Either way, I like what you did. Very professional looking.

MjhLkwd
05-21-2003, 10:49 PM
1. The following is a COMPLETE HTML document which contains a slideshow with user selectable timing delay, and a pause feature, for use with 640x480 .jpg files. Easily modifiable!
Use NotePad to create a file that contains the following:

<html xmlns:t ="urn:schemas-microsoft-com:time" >

<HEAD>
<style>.time { behavior: url(#default#time2) }
</style>
<?IMPORT namespace="t" implementation="#default#time2">
<TITLE>Photo Album</TITLE>

<script language="javascript">

var setDefaultErrImg="BlankMsg.jpg";
var setDefaultErrTxt="Blank";
var empty = 0;
var Nx = 0;
nextimage = new Image();
nextimage.src = " ";
var userdelay = "";
var tick = ""
var msg = " ";
var count = 0;
var savecount = 0;
var imgcount = 0;


function haltshow(){
if (savecount == 0){savecount = count;
count = imgcount};
}


function displayit(){
window.open(nextimage.src,"SlideShow","toolbar=0,status=1,width=640,height= 480,top=0,left=0").status = "This is " + count + " of " +imgcount;

}

function getnextimage() {
if (count < imgcount){++count};
nextimage.src = document.images[count-1].src;
displayit();
if (count < imgcount){countdown()};
}

function countdown(){
if (tick > 0){msg = tick} else{msg = "Fetching Next Image..."};
if (tick >= 0){tick = tick -1
window.status = msg;
if (savecount > 0){tick = userdelay -1;runshow()}
else{setTimeout("countdown()", 1000)}; }
else{tick = userdelay -1;
runshow(); }

}

function runshow() {
if (count < imgcount){getnextimage()};
if (savecount > 0){window.status="The Slideshow Is Paused at Image "
+savecount + " of " +imgcount + "."}
if (count == imgcount){convert();
if (savecount > 0){count=savecount-1;
savecount=0
window.open("pausemsg.html","SlideShow");}
else{count=0
window.status="The Slideshow Is Complete."};
}

}

function initShow(ImgCnt,Blank,Dn){
imgcount = ImgCnt-Blank;
userdelay = Dn;
tick = userdelay-1;
convert();
runshow();
}





function convert() {
var inputColl = document.all.tags("INPUT");
if (inputColl!=null && inputColl.length>0) {
var range = inputColl[0].createTextRange();
if (savecount > 0){range.text = "Resume"}
else{range.text ="Start Slideshow"};
}
}


function FillBlank(n){
document.images[n].src = setDefaultErrImg;
document.images[n].setAttribute("alt",setDefaultErrTxt);
++empty
}

function statusmsg(){
window.status="Done"
}


function getInterval(){
if (document.IGroup.interval[0].checked=="1"){Nx = document.IGroup.interval[0].value};
if (document.IGroup.interval[1].checked=="1"){Nx = document.IGroup.interval[1].value};
if (document.IGroup.interval[2].checked=="1"){Nx = document.IGroup.interval[2].value};
if (document.IGroup.interval[3].checked=="1"){Nx = document.IGroup.interval[3].value};
if (document.IGroup.interval[4].checked=="1"){Nx = document.IGroup.interval[4].value};
if (document.IGroup.interval[5].checked=="1"){Nx = document.IGroup.interval[5].value};
if (document.IGroup.interval[6].checked=="1"){Nx = document.IGroup.interval[6].value};
if (document.IGroup.interval[7].checked=="1"){Nx = document.IGroup.interval[7].value};
if (document.IGroup.interval[8].checked=="1"){Nx = document.IGroup.interval[8].value};
}

function startShow(){
getInterval()
initShow(PixCount,empty,Nx);
}

</script>

</head>

<BODY onLoad="statusmsg()" vlink="Gray" alink="Lime" BGColor="lightyellow">
<center>
<name ="top"><font face="arial,helvetica" color="Blue" size="5">Click On An Image To Enlarge It</font>
<br>

<t:seq repeatCount="indefinite">
<t:par>
<div class="time" begin="0" dur="3" timeAction="display">Doing This Will RESET The Slideshow</div>
</t:par>
<div class="time" dur="3" timeAction="display">- ! -</div>
</t:par>
</t:seq>

<hr>
</center>

<Table width="650" Border="0" Align="center" Cellspacing="0" Cellpadding="0" >
<TR>
<TD align="center" BGCOLOR="orange">
<h3>Use The <font color="Red">BACK</font> Button To Return<br>
From The Full View</h3>
</TD>
<TD align="center" BGColor="tan">
<input type="button" name="null" value="Start Slideshow" onClick="startShow()"/>
</TD>
<TD width="3%" align="right" BGColor="yellow">
<input type="image" name="pausebtn" src="pausebtn.gif"
onclick="haltshow()" border="0" />
</TD>
</TR>
</Table>

<form name="IGroup">
<Table Width="500" align="center" Border="0" BGColor="LightBlue" Border="1">
<TR>
<TD>
Slideshow Interval:
<TD>
<input type="radio" name="interval" value="2">2
</TD>
<TD>
<input type="radio" name="interval" value="3">3
</TD>
<TD>
<input type="radio" name="interval" value="4" >4
</TD>
<TD>
<input type="radio" name="interval" value="5" checked>5
</TD>
<TD>
<input type="radio" name="interval" value="6">6
</TD>
<TD>
<input type="radio" name="interval" value="7">7
</TD>
<TD>
<input type="radio" name="interval" value="8">8
</TD>
<TD>
<input type="radio" name="interval" value="9">9
</TD>
<TD>
<input type="radio" name="interval" value="10">10
</TD>
</TR>
</Table>
</form>


<TABLE WIDTH="650" BORDER="2" ALIGN="center" CELLSPACING="2" CELLPADDING="1"
HEIGHT="113">
<!-- Row 1 -->
<TR>
<TD WIDTH="20%">
<a href="1.jpg" Name="Viewer1"><img src="1.jpg" onError="FillBlank(0)" width="120" height="90" alt ="Click to enlarge"
/></a></TD>
<TD WIDTH="20%">
<a href="2.jpg" Name="Viewer1"><img src="2.jpg" onError="FillBlank(1)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="3.jpg" Name="Viewer1"><img src="3.jpg" onError="FillBlank(2)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="4.jpg" Name="Viewer1"><img src="4.jpg" onError="FillBlank(3)" width="120" height="90" alt ="Click to enlarge" />
</a> </TD>
<TD WIDTH="20%">
<a href="5.jpg" Name="Viewer1"><img src="5.jpg" onError="FillBlank(4)" width="120" height="90" alt ="Click to enlarge"
/></a> </TD>
</TR>

<!-- Row 2 -->
<TR>
<TD WIDTH="20%">
<a href="6.jpg" Name="Viewer1"><img src="6.jpg" onError="FillBlank(5)" width="120" height="90" alt ="Click to enlarge"
/></a> </TD>
<TD WIDTH="20%">
<a href="7.jpg" Name="Viewer1"><img src="7.jpg" onError="FillBlank(6)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="8.jpg" Name="Viewer1"><img src="8.jpg" onError="FillBlank(7)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="9.jpg" Name="Viewer1"><img src="9.jpg" onError="FillBlank(8)" width="120" height="90" alt ="Click to enlarge" />
</a> </TD>
<TD WIDTH="20%">
<a href="10.jpg"Name="Viewer1"><img src="10.jpg" onError="FillBlank(9)" width="120" height="90" alt ="Click to enlarge"
/></a> </TD>
</TR>

<!-- Row 3 -->
<TR>
<TD WIDTH="20%">
<a href="11.jpg"Name="Viewer1"><img src="11.jpg" onError="FillBlank(10)" width="120" height="90" alt ="Click to enlarge"
/></a> </TD>
<TD WIDTH="20%">
<a href="12.jpg"Name="Viewer1"><img src="12.jpg" onError="FillBlank(11)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="13.jpg"Name="Viewer1"><img src="13.jpg" onError="FillBlank(12)" width="120" height="90" alt ="Click to enlarge" />
</a></TD>
<TD WIDTH="20%">
<a href="14.jpg"Name="Viewer1"><img src="14.jpg" onError="FillBlank(13)" width="120" height="90" alt ="Click to enlarge" />
</a> </TD>
<TD WIDTH="20%">
<a href="15.jpg"Name="Viewer1"><img src="15.jpg" onError="FillBlank(14)" width="120" height="90" alt ="Click to enlarge"
/></a> </TD>
</TR>
</TABLE>

<Script language="JavaScript">
var PixCount = document.images.length;
</Script>

</Body>
</HTML>

2. Save the file with a name of your choosing, making sure to give it the .html extension.

3. Use NotePad to create an HTML file which contains the following:

<HTML>
<BODY onLoad="ToFront()">
<Img SRC = "pausemsg.gif">
<script language="javascript">
function ToFront(){
window.focus();
}
</script>

</Body>
</HTML>

4. Save this file as PauseMsg.html.

5. There are three files attached:

1. 640x480 image named PauseMsg.gif
2. PauseBtn.gif
3. BlankMsg.jpg

All of these are required for the SlideShow to function properly.

6. Copy your photos to the same folder that contains the above files, and giving them consecutive names, e.g. 1.jpg, 2.jpg, etc. You must not skip any number, and you must not use a leading zero.

7. Use it!

mjh.lkwd@highstream.net
Sorry, it won't let me attach more than one file.

MjhLkwd
05-21-2003, 10:54 PM
It looks like this website displays smileys for the letter v in certain instances. Be advised of that. Now that I have the opportunity, I'll attach another file.

MjhLkwd
05-22-2003, 07:56 AM
It's important to have this small image, otherwise you will get a stack overflow error message on opening the document.

MjhLkwd
05-30-2003, 11:46 AM
I forgot to include one last file. It's the document that is brought to the front and displays the pausemsg.jpg file. Here is the entire HTML document, and its filename is PauseMsg.html.

<HTML>
<BODY onLoad="ToFront()">
<Img SRC = "pausemsg.gif">
<script language="javascript">
function ToFront(){
window.focus();
}
</script>

</Body>
</HTML>

bmcc81
04-22-2008, 04:43 PM
Just wondering,
Can these links be turned into text links? and I get a realPlayer that shows up that I don't want to see. Is there away to hide that 2.

Thanks,