Welcome to WebmasterWorld Guest from 18.206.48.142

Forum Moderators: ocean10000

Message Too Old, No Replies

classic asp - mp3 streaming

     
8:25 pm on Jan 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 20, 2007
posts:588
votes: 0


Anyone know about the client/server interactions when playing mp3s? I've always assumed its just like raw data page but with a content type of audio/mpeg.

I've written an ASP script as to stream out mp3's at a controlled speed. It basically uses a ADODB to read the file then binary write's it out with some calculated pausing.

Everything seems perfect. It sends out the file with the same headers just as the IIS would normally send a mp3. However, even though I've strickly sent the content as an audio type, the browser just wants to download it as a file.

If I type the URL in to Quick Time is works perfectly. But if I type the URL in to the Windows Media Player, the server sends out the regulated stream to the client, but Media Player timeouts saying it failed to connect!

What else does Windows need to know as treat this as a playable mp3.

8:37 pm on Jan 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2641
votes: 5


Is your goal is to have it play in a browser or do you want it to play in the media player (winamp, wmp, etc) of the user's choice?

[edited by: Demaestro at 8:51 pm (utc) on Jan. 11, 2010]

8:45 pm on Jan 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 20, 2007
posts:588
votes: 0


Ideally the browser, but thats the second half of the plan. Just want it treated as regular mp3 that windows media player can handle, as I'm guessing the browser wont be able to handle it either at the moment.

I'm wondering if its anything to do with some hidden DRM data somewhere. Is the IIS modifing the output of the mp3 file?

8:52 pm on Jan 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2641
votes: 5


Basically the issue is that you are presenting it as an MP3 so the user's browser treats it like any other file.

If the user has the "helper app" set in IE or FF that the browser is to open all MP3s in Winamp or automatically save to desktop... or whatever they have as the default action that is what will happen when they encounter your MP3.

For example, I have my parents computer set up to open any .doc or .docx file in MS Word, on my computer I have it set to save files to desktop and never open them. It works the same with MP3s.

Some alternatives:

You may want to look at using a windows streaming file extension which is .asx or you can use a standard one like .pls..

Or you can do this in flash... create a flash player and place it in your site, then make the audio file a .flv and stream that to the embedded flash player.

You can also embed a player like WMP into your site, but it can cause issues with different OSs... like if you embedded windows media player and someone on Linux or Mac visits your site they will have issues using the player.

Once HTML 5 becomes more used in IE you can look at using the audio element.

8:58 pm on Jan 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 20, 2007
posts:588
votes: 0


Good idea. I know a little about the .asx format, think I was try the file referenced via asx.

My browser does open the mp3 correctly if I link directly to the mp3 file. I just cant see how my browser can tell the difference between a direct link and my simulated direct link - as I have set identical header information.

9:37 pm on Jan 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2641
votes: 5


Seb, I am not sure why it would see them as different.

It could be a security thing and it doesn't want to execute it since it can't "see" the whole file, I am guessing here though.

9:48 pm on Jan 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 20, 2007
posts:588
votes: 0


asx failed!

It appears MS does some clever DRM which is unnecessary for my application. - its a complete mine field.

audio via the web is so rubbish! Dont like having to use different types of non-standard embed's. and flash files slow down page loading times too much. html5 handles things a lot better, but I would like to be compatible back to IE6.

I want a cross browser solution to streaming music whilst minimising copy'ing and bandwidth. Most current methods still streams the music far faster than its being played. MS Media streamer says it controls this - but I know for a fact it doesnt.

Still hoping to avoid using 3rd party stuff - off to look at Java methods now.

9:58 pm on Jan 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2641
votes: 5


Check out if Darwin media streamer is installable on your server. It should be, it plays nice with most everything. I have never tried it with ASP though.

It should do what you want, I know people who use it and rave about it.

I know it slows sites down, but if you have a really light weight player it shouldn't be too bad. Remember that you can set it up so that the only flash on the page is a small player a few KB (I have one on a site that is 55KB).

Then you can stream the audio in an .flv and that will be the bulk of the file size, but it won't slow down your page loads if you don't queue the song until they click or until the page load is complete.

clever DRM

Is there such a thing?

11:22 pm on Jan 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 20, 2007
posts:588
votes: 0


Sounds like the same 55k miniplayer.swf I use on a different site - It seem to load an un-cached version for every single instance its required. It doesnt have any bandwidth control either as it downloads the whole track as fast as the connection will allow it.

Havent heard of Darwin, I will look it up.

7:51 pm on Jan 12, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2641
votes: 5


Seb,

You are right there is no built in stream control in flash. I think you need Flash MX to gain that level of control and it isn't free or even cheap.

I will dig around a bit more when I have time and see if there is something simple being missed.

Let me know if you have any Darwin questions also.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members