<audio 
src="{{=URL('getme',args='track06.mp3<http://www.myserver.com/.../track06.mp3>
')}}" preload="auto"></audio>

def getme():
   import urllib
   response.headers['Content-Type'] = 'audio/mp3'   
   filename = '....'+request.args(0) # fix this!
   return response.stream(urllib.urlopen(filename))
  

On Thursday, 9 August 2012 03:54:43 UTC-5, Daniel Gonzalez wrote:
>
> Hello,
>
> I have some sound files in a couchdb database (not related to web2py). My 
> web2py application has access to this database, and I want to stream the 
> sound files so that they can be listened with the HTML audio tag, like this:
>
> <audio src="http://www.myserver.com/.../track06.mp3"; preload="auto"
> ></audio>
>
> I am planning to do this streaming as follows:
>
> response.stream(open(filename),chunk_size=4096)
>
> But I have some open questions:
>
>    1. My "filename" is not in the local filesystem, but in a couchdb 
>    database, accessible via REST. How can I "open" that?
>    2. What kind of request will the audio tag send when it is activated, 
>    GET/POST/...? Can this be handled with web2py?
>
> Thanks,
> Daniel
>

-- 



Reply via email to