Code Comments
Programming Forum and web based access to our favorite programming groups.Here's my site: http://www.motorcityrock.com I have a streaming audio feature set up using a M3u file and a bunch of MP3's: http://www.motorcityrock.com/mcr_radio/mcr_radio.html. When the visitor clicks on the link the M3u kicks in and the songs play in the pre-determined order. That works great, but everytime a visitor clicks the link the songs start from the beginning. Is there a simple way (using PHP or?) to keep the M3u "running" in the background all the time so that all visitors will hear the same song at the same time...just like a traditional radio station? Thanks! jp
Post Follow-up to this messageJohn Patrick wrote: > Here's my site: http://www.motorcityrock.com > > I have a streaming audio feature set up using a M3u file and a bunch of > MP3's: http://www.motorcityrock.com/mcr_radio/mcr_radio.html. When the > visitor clicks on the link the M3u kicks in and the songs play in the > pre-determined order. That works great, but everytime a visitor clicks th e > link the songs start from the beginning. Is there a simple way (using > PHP or?) to keep the M3u "running" in the background all the time so > that all visitors will hear the same song at the same time...just like a > traditional radio station? > MP3s don't stream. An M3U is just a playlist file, downloaded to the user's computer and used by Winamp or whatever to determine what files to play in what order. -- Oli
Post Follow-up to this messageI know that. I'm trying to make the M3U file dynamic somehow so that the songs are rotating. jp "Oli Filth" <catch@olifilth.co.uk> wrote in message news:ezyce.180$l37.55@newsfe4-gui.ntli.net... > John Patrick wrote: > > MP3s don't stream. An M3U is just a playlist file, downloaded to the > user's computer and used by Winamp or whatever to determine what files to > play in what order. > > > -- > Oli
Post Follow-up to this messageSure, that is possible.
Given that you generate an array "$songs" of the song "name", "length"
in seconds, and "location", then it is easy:
the M3U format is as follows:
1 header("Content-type: audio/x-mpegurl");
2
3 echo "#EXTM3U\n";
4 foreach($songs as $song)
5 {
4 echo "#EXTINF:".$song['length'].",".$song['name']."\n";
5 echo $song['location']."\n";
6 }
Post Follow-up to this messageOk, while that works, i have whipped up a more... "robust" example for you. I am not trying to show you how to generate the array, but rather how to make this playlist compatible for downloading. http://nerdfestlan.com/m3u.php.txt
Post Follow-up to this messagethanks. I'll give it a try. <SpoonfulofTactic@gmail.com> wrote in message news:1114821012.050959.19680@g14g2000cwa.googlegroups.com... > Ok, while that works, i have whipped up a more... "robust" example for > you. > > I am not trying to show you how to generate the array, but rather how > to make this playlist compatible for downloading. > > http://nerdfestlan.com/m3u.php.txt >
Post Follow-up to this messageOK, that works great...but it works basically the same as what I have here: http://www.motorcityrock.com/mcr_radio/mcr_radio.html I'd like it to act more like a regular radio station, whereas the songs continue to play (rotate) even if no one is listening. Everyone that is listening at the same time would be hearing the same thing...like live radio. Your example works good, but everyone still hears the first song first. Does that make sense? jp <SpoonfulofTactic@gmail.com> wrote in message news:1114821012.050959.19680@g14g2000cwa.googlegroups.com... > Ok, while that works, i have whipped up a more... "robust" example for > you. > > I am not trying to show you how to generate the array, but rather how > to make this playlist compatible for downloading. > > http://nerdfestlan.com/m3u.php.txt >
Post Follow-up to this messageJohn Patrick wrote: > OK, that works great...but it works basically the same as what I have here: > http://www.motorcityrock.com/mcr_radio/mcr_radio.html > > I'd like it to act more like a regular radio station, whereas the songs > continue to play (rotate) even if no one is listening. Everyone that is > listening at the same time would be hearing the same thing...like live > radio. Your example works good, but everyone still hears the first song > first. Does that make sense? > > jp Yes that makes sense but, as i said, my script assumes you generate the $songs array in the order you want. If you had a database set up with the song names, it would be easy to give you an example. But since I have no clue as to what all songs you will be using (other than those from your page) I am unable to give you a complete and functioning script. So, here is what I'll do: as soon as i get back to my development comp, i will try to whip up an example more tailored to your needs. (Even though, in doing this, I am violating my rule that i dont write whole scripts for people.)
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.