The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Streaming audio via AJAX?

Here's a real world challenge. I've got some 32Kbps MP3 files on a hosting provider, and I've got Perl support. (I'm more than willing to move on to another hosting provider but for the sake of this exercise assume I'm not willing.) I want to serve these files as streaming audio.

The solution must be free of serious browser compatibility or security issues. It should be OS independent on the client side. It should not require the user to enable popup ads. And it should use AJAX exclusively. No Flash or Java or ActiveX. Nothing that requires a plugin.

Can it be done?
Rowland
Monday, March 06, 2006
 
 
I don't think Javascript has any access to system audio functionality.

This can be done VERY well with Flash, and it's reasonable to assume that most people probably have the Flash plugin if it's important for them to have multimedia capabilities.

Beyond that, your best option without requiring plugins would be to embed the audio file within the page.
Marco Arment Send private email
Monday, March 06, 2006
 
 
"Can it be done?"

No, not as you described it. What is required for streaming is some king of persistent socket connection which is (currently) not possible with Javascript. "ajax", like any other HTTP application, uses request/response model to fetch data from the server.

Both Java applets and Flash (and I presume ActiveX, but I might be wrong) allow for that; I can imagine sooner or later some kind of socket connections will be included in the browsers themselves, and controllable by Javascript, but we haven't seen that yet.
Berislav Lopac Send private email
Monday, March 06, 2006
 
 
Hmmm... aren't both Java applets and Flash implemented via ActiveX plug-ins in IE?
Artad Gobeski
Monday, March 06, 2006
 
 
Java applets are certainly not an ActiveX plug-in.
John Topley Send private email
Tuesday, March 07, 2006
 
 
Ahh, but doesn't the JVM plug into IE via ActiveX?
Artad Gobeski
Tuesday, March 07, 2006
 
 
Not that I'm aware of. I just disabled all the ActiveX options in IE 6.0 and visited http://java.sun.com/applets/jdk/1.4/demo/applets/Fractal/example1.html and was able to run the applet without any problems.
John Topley Send private email
Tuesday, March 07, 2006
 
 
Browser plug-in specification was first implemented by Netscape, and Microsoft took over the API, IIRC. ActiveX is a separate attempt to a similar functionality.
Berislav Lopac Send private email
Tuesday, March 07, 2006
 
 
The solution must be free of serious browser compatibility or security issues.

Then why not Flash?  That's what it's designed for.

If you need it to 'look and feel' like AJAX, put it in an iframe.
ejustice Send private email
Tuesday, March 07, 2006
 
 
My Bet?

Server chops mp3 into a bunch of 2 second mp3 files,
you use AJAX to grab these. You use embed and change the innerHTML of a small div to play each chunk.. not sure if the embed objects have an "on done" or if you have to use the timer... I have no idea if it would work, but it *might*

Wednesday, March 08, 2006
 
 
Keep in mind also AJAX can only play by Javascript's rules.  By itself, Javascript can't play movies, mp3s, browse the user's harddrive or change setting in the OS or the browser.   

It can be used to call a 3rd party application to do these things, but it can't do it itself.

Before you start writing specs that demand AJAX do this or that, spend some time researching what it can and can't do.  It won't solve world hunger or make a poorly designed application run better.  However, it can fill in the blanks left by traditional web application development and make the overall experience better on users and servers.
ejustice Send private email
Wednesday, March 08, 2006
 
 
I don't know if AJAX is really usefull for audio streaming...

I use this flash script, it works very well:

http://www.estvideo.com/dew/index/2005/12/03/603-dewplayer-reloaded

You only have to type a line into your HTML code with the path of the MP3 file...
Geek En París Send private email
Monday, March 13, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz