?
Solved

PHP/MySQL audio streaming script

Posted on 2005-02-24
10
Medium Priority
?
4,438 Views
Last Modified: 2013-12-12
I am looking for a good PHP script program that streams audio mp3's from a MySQL database. I'm need the script that is versatile enough to play a file when selected then stop if another file is selected for play. Any ideas ?
Thanks,
0
Comment
Question by:mhoggatt1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 25

Accepted Solution

by:
Marcus Bointon earned 2000 total points
ID: 13401595
I wouldn't try streaming the data directly from PHP - you're better off retrieving the file and passing it to a streaming server for delivery; Take a look at Darwin streaming server and shoutcast/icecast. You also need to embed some kind of client-side player plugin that can cope with the stream, such as QuickTime, Real etc. If you don't need real streaming, just embedded audio, just embed a plugin and point it at a script which pulls the MP3 data from your DB.

You might like to look at Andromeda: http://www.turnstyle.com/andromeda/

These may be of interest too: http://php.resourceindex.com/Complete_Scripts/Audio_Management/

It's also quite easy to hand off playback to iTunes or WinAmp instead of a plugin.
0
 

Author Comment

by:mhoggatt1
ID: 13405270
Thanks for the information. I may need some clarification as I walk through the steps you gave. I would like to code the program so it works like Rhapsody. I don't want a pop-up type player, just want the audio to start straming. Does what you've suggested allow for this type of setup ?
Thanks,
0
 

Author Comment

by:mhoggatt1
ID: 13405854
I didn't see where Andromeda uses a DB. Will it work for my application ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 25

Assisted Solution

by:Marcus Bointon
Marcus Bointon earned 2000 total points
ID: 13410492
Last time I looked, Andromeda just uses the file system rather than a DB. Any particular reason you're keeping your audio files in the DB? Andromeda can use different playback engines (Real, QuickTime, etc.). icecast/shoutcast streams are the most effective way of delivering existing content without re-encoding, and of the servers I mentioned, Darwin is the most straightforward.

If you don't want a separate player app, it's just a matter of embedding the player in your web page and making use of whatever features it has available via its plugin, e.g. displays, controls, volume, playlist etc, and pointing it at a source of media, either static files from your server (could be from a DB) or via a streaming sevrer. One big difference with a streaming server is that it can act like internet radio than a manually selected playback, so the playlists are set up on the server side.
0
 

Author Comment

by:mhoggatt1
ID: 13411071
I've increased the points because I may have more questions for you on this topic. I am not familiar with some of these concepts. I am a retired Assembly languare programmer from years back.

I have purchased a file management system called DLMan. The author uses MySQL to store the data. I suppose it's because it may be more secure than a file system. I also like a database because I need visitors to be able to search for what they need. Is there an effective way to do this with a file systm such as Shoutcast/Icecast ?

How many connections can the Darwin server handle at one time ? Which program would you recommend to go with the Darwin server - Shoutcast or Icecast ? Does the Darwin server hasve anything to do with wheter or not it accepts data form a database ?

I need a system that can hpefully handle lots of visitors at one time. I don't want to have to do a lot of recoding to handle more traffic.
Thanks,
0
 
LVL 25

Assisted Solution

by:Marcus Bointon
Marcus Bointon earned 2000 total points
ID: 13411144
It's important to separate 2 concepts: data and metadata. MP3 metadata tends to be small, spread across many fields and ideal for searching, things like track and album name, genre, artist etc. The actual audio data is extremely boring, and is on the whole better left in an external file - it's quite inefficient to keep it all in the DB. There's no particular reason to keep the audio data in the DB just because you have meta data in there. It's pretty easy to maintain the two separately, driving it from the files (which usually also contain the metadata in the form of ID3 tags). It's inefficient to search through the tags stored in the files themselves, so you just maintain a mirror of the data in your DB. FWIW, this is exactly the arrangement that iTunes uses. PHP has good support for ID3 tags, so you can scan your file library and build your searchable DB from them. It's easy enough to attach timestamps to that data so you can update it if the metadata in the files changes.

One source of confusion: icecast and shoutcast are both server products AND protocols - they both wrap MP3 audio data into a stream suitable for continuous delivery. Darwin has support for both protocols built-in, so you just point it at your files, and it streams them using ice/shoutcast protocols. FYI, nearly all the radio stations in iTuens use these protocols.

The primary limitation of connections is available bandwidth. If you're on ADSL and using your standard encoded MP3s at say 128kbits, then you'll probably only be able to stream to one client at once before you run out of bandwidth. If you want to serve more streams, you need either more bandwidth, lower data rates, or both. Darwin on a basic PC will stream to hundreds at once before it runs out of steam - streaming is easy on the CPU, but it's very hard on your uplink. lower data rats doesn't necessarily mean lower quality - you can use  better codec, such as MPEG-4's AAC, if you can rely on your clients having support for it.
0
 

Author Comment

by:mhoggatt1
ID: 13411939
Ok let me clarify what I think I understand. I should install Darwin, then do I also need Shoutcast/Icecast also or does Darwin do everything since it uses the same protocols ? If I understand properly Darwin is the middle man between the mp3 files and Shoutcast/Icecast. Am I on the right track ?

I'm fixing to download Darwin. Any suggestions you could give me in the installation process would be helpful. Then I'll close this request and start new ones.
Thanks,
0
 

Author Comment

by:mhoggatt1
ID: 13412039
I may have a problem. Is it true that DSS only runs on a Windows 2000/2003 server ? My home machine has XP SP2 with IIS 5.1.
Thanks,
Michael
0
 
LVL 25

Assisted Solution

by:Marcus Bointon
Marcus Bointon earned 2000 total points
ID: 13414045
Hum. The download page does say that, but I'd just give it a try. Darwin can do the lot, though you might find that shoutcast etc is easier as Darwin is much more capable, and thus more complicated. Returning to one of my previous points - if you want to simply click and play a single track on demand, then straightforward embedding without a streaming server is probably the best route, particularly with QuickTime because of it's excellent 'fast start' handling (playback while downloading is not the same as streaming). Darwin/shoutcast etc will give you something more like an internet radio station (e.g. playback progresses at the server end even while you're not listening).
0
 

Author Comment

by:mhoggatt1
ID: 13423567
Ok I think I'm getting things straight. I do need only the download and playback of my mp3 files. I was confusing 'streaming' and 'playback'. I am using Windows XP so I don't think QuickTime will work for me as it's for Mac users. What would you suggest I use instead and can you send an example of how a Player is embedded into PHP code ?
Thanks,
Michael
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question