Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Need urgent help for a uni project!
We have to design an eccomerce site that sells cd's. One of the functions of the site is that, when the user searches for a song/artist, it will bring up the results. Ok so this is not so bad to do, bit of php and mysql. But it also needs to bring up a 30 second sample of the track.
My question is:
How do I store 30 sec samples in my mysql database, so that a user can click on them when they do a seach etc...?
How do I stream these 30 sec samples. Do I need to set up a streaming server (e.g. shoutcast, icecast), or can i convert the 30sec mp3's to say realmedia (.ram) format?
It's not that I have left this till the last minute, but that we have only been taught very basic stuff, for a project that requires a little more than the basics. Being new to php and mysql, it has taken me time to set up the database and forms etc...
Any help will be much appreciated.

You *could* store the 30 second clip in the database, but why make it more complicated than it has to be. instead, for each track in the database include a field for the path to the clip.
There are several options for the format of the clip. I don't have much experience with streaming. But, if you use MP3s your link to play the clip should dynamically create a playlist with the path of the clip.
Hope this helps.
Michael J

I agree with Michael. Don't bother trying to put binary audio data in the database, just store the file someplace that makes sense.
Does the audio have to be streaming? Why not just use the MP3 files? If you encode the file at about 96kbps you can get 30 seconds of "not too bad" audio for about 350KB. I believe this is what Amazon uses for their MP3 previews. These files are small enough that they should download pretty quick even on a modern connection.
Personally, I think streaming is overrated unless you're dealing with fairly large files. I'd suggest just giving them the 30 second MP3 sample.

I think the idea our tutor suggested streaming was the idea of stopping people from downloading them. I don't really know who would want to download a 30 sec sample, seems a bit pointless, but it's the principle.
I think Michael' suggestions makes more sense though, so cheers.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |