Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Streaming MP3's like a radio station?
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



Report this thread to moderator Post Follow-up to this message
Old Post
John Patrick
04-30-05 01:56 AM


Re: Streaming MP3's like a radio station?
John 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

Report this thread to moderator Post Follow-up to this message
Old Post
Oli Filth
04-30-05 01:56 AM


Re: Streaming MP3's like a radio station?
I 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



Report this thread to moderator Post Follow-up to this message
Old Post
John Patrick
04-30-05 08:57 AM


Re: Streaming MP3's like a radio station?
Sure, 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    }


Report this thread to moderator Post Follow-up to this message
Old Post
SpoonfulofTactic@gmail.com
04-30-05 08:57 AM


Re: Streaming MP3's like a radio station?
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


Report this thread to moderator Post Follow-up to this message
Old Post
SpoonfulofTactic@gmail.com
04-30-05 08:57 AM


Re: Streaming MP3's like a radio station?
thanks.  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
>



Report this thread to moderator Post Follow-up to this message
Old Post
John Patrick
04-30-05 08:57 AM


Re: Streaming MP3's like a radio station?
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


<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
>



Report this thread to moderator Post Follow-up to this message
Old Post
John Patrick
04-30-05 08:57 AM


Re: Streaming MP3's like a radio station?
John 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.)


Report this thread to moderator Post Follow-up to this message
Old Post
SpoonfulofTactic@gmail.com
04-30-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:20 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.