[aida] response mp3 stream

Janko Mivšek janko.mivsek at eranova.si
Mon Jan 7 10:16:40 CET 2008

Hi Andreas,

Andreas Petermann wrote:

> how is it possible to response a mp3 stream with aida? I have tried out 
> a lot of things about the answer methods but all seems to be only a 
> workaround of the standard response method of aida. Is there a special 
> way to response a stream?

If you mean mp3 files, they are already streamed as all other static 
content. Just put them on a directory defined by #homeDirectory in AIDASite.

If you'd like to have a live streaming of mp3 content then look at how a 
FileProxy is done, specially #printHTMLPageOn:forSession:

printHTMLPageOn: aStream forSession: aSession
   | response |
   self isRespondingStreamed ifTrue:
     [response := aSession lastRequest streamedResponse.
     self site addResponseHeadersTo: response forPage: self on: aSession.
     self streamFileToResponse: response.
     response close]

streamFileToResponse: aHTTPStreamedResponse
    | stream |
    [stream := self filename asFilename readStream binary.
    [stream atEnd] whileFalse:
      [aHTTPStreamedResponse nextPut: stream next] ]
	ensure: [stream close]

So, I would make a class (say Streamer) and adjust above methods, 
especially last one, for live streaming.

I hope this will help you a bit

Janko Mivšek
Smalltalk Web Application Server

More information about the Aida mailing list