Is there a way to use say XML to stream mp3's from a blob field? I've tried other ways but it doesn't seam to work. I can get them to download from blob but not stream. Does anyone have any suggestions?
Elfmuse
| SitePoint Sponsor |
Is there a way to use say XML to stream mp3's from a blob field? I've tried other ways but it doesn't seam to work. I can get them to download from blob but not stream. Does anyone have any suggestions?
Elfmuse
Flash!
make a flash mp3 player and pass the mp3 blob data to it. You can set the mp3 to stream in the actionscript.
Fast Fwd Multimedia
Web, IT & Cloud Computing Consultancy
Currently looking for web freelancers. Get in touch!


Like Kish said flash would be your best bet since it's low resource overhead.Iam almost certain xml can't stream anything at all without using windoze mediaplayer.All though flash makes an annoying clicking sound on some comps it's still the better way to stream it.
Pixel Engineer
Well that's the thing I've tried using the flash and it doesn't seem to work that way. You can use a database to point to the file in a file folder to stream it but it won't stream directly out of the database. I was wondering if you could use xml to grab the mp3 from the blob then send it too the flash player? I don't know a thing about xml but was trying to hunt for this solution since I want to keep the files stored safe.
Any other suggestions?
hmm, i have done that too in the past and its very simple. have never tried it with blobs though. just out of interest, why are you storing the mp3s as blobs... sound like its more trouble than its worth.Originally Posted by Elfmuse
still i'd be interested to know a simple method for feeding the mp3 blob to a swf mp3 player...
Fast Fwd Multimedia
Web, IT & Cloud Computing Consultancy
Currently looking for web freelancers. Get in touch!
With the help of a PHP programmer I found here I have created a site for independent musicians to sell their mp3's. The PHP guy talked me into storing them as blobs for the best security. The only problem is that in doing so steaming was lost. So I have to make artists upload an additional sample for stream. Now a couple months later I'm regretting giving into it and I am dreading converting the blobs over to a folder for storing the mp3's. And I agree there most be a simple method for feeding the blobs to the player but how?LOL.
ok elfmuse, have a solution for you.
I was chatting about it with a programmer friend of mine and here's what we came up with...
You already know that you can't stream the blob becaue the query to the DB will deliver the file data en masse which is no good for streaming because that only requires a bit of data at a time.
So what you need is this: 2 PHP scripts and one flash mp3 player with some well thought out actionscript.
When the user clicks "play" on the flash mp3 player, the actionscript should call the first PHP script which will create a temporary file from the blob data. The player can stream from that temp file. When the track finishes or the user clicks "stop", the actionscript will call the second PHP script which will delete the temp file.
Problem's will arise when a user closes the browser window or navigates away from the page before the track finishes or without clicking "stop" because the 2nd PHP script won't have been called on to delete the temp file. So you'll end up with a whole load of redundant temp files.
I guess you may be able to use some Javascript to call the PHP script when the user navigates away from the page or closes the window but that's likely to be very problematic.
The other option (if its a windows server) is to use the Task Scheduler to routinely delete old temp files. However you'll need ur own server or a friendly host to sort this out for you. If you're using a linux box then there are similar schedulers available.
If you can do all this then it could be a pretty good way, however i think it'd be easier to just use actual mp3 files rather than blobs. I reckon it'll greatly save server resources and also save you a lot of headache.
good luck; let us know what you decide and how it goes!
Fast Fwd Multimedia
Web, IT & Cloud Computing Consultancy
Currently looking for web freelancers. Get in touch!
Simple sollution, write the blobs out to files, storing data like that in a DB is such a waste of resources it's unreal. I remember when SPF stopped storing Avatars in the vBulletin DB, the server was good for another 50 or 60 online users at a time after that.
Karl Austin :: Profile :: KDA Web Services Ltd.
Business Web Hosting :: Managed Dedicated Hosting :: From £250/m
Personal Web Hosting :: Budget Web Hosting :: From £50/y
Call 0800 542 9764 today and ask about our Cloud Hosting Platform
Well I'm gonna write the blobs out to files, in which case their is only about 160 which isn't too bad in my opinion.
Bottom line you should always do what your gut tells you.lol
I'll let you all know how everything is when I finally get done.
Thanks
Elfmuse
aww you mean i typed all that for nuthin?!
j/k
Fast Fwd Multimedia
Web, IT & Cloud Computing Consultancy
Currently looking for web freelancers. Get in touch!


You should be able to make it fairly secure in the sense of preventing people from directly DLing the files... either move them out from under the webroot path, or store them in a directory starting with a period (assuming a unix host) ".daStuff" and use .htaccess to ensure no requests can be made to it. Etc, etc, there are a bunch of ways....Originally Posted by Elfmuse
Cheers,
Keith.
Bookmarks