Hi
Here is my code to download files (big and small, config.largfile=10Mb) actfile come from mongo gridfs, but you can change to use filesystem
.....
if filesize > config.largefile:
                      uzenet=u'nagy fájl mód'
                      wlog(mname,0,uzenet,4)
                      web.header("Content-Type", curmime) # Set the Header
web.header("Content-Disposition", "attachment;") # if you want to open save as dialog
                      for data in chunked(actfile, actfile.chunk_size):
                         yield data
else:
                    uzenet=u'kis fájl mód'
                    wlog(mname,0,uzenet,4)
                    web.header("Content-Type", curmime) # Set the Header
                    web.header("Content-Disposition", "attachment;")
                    buf=actfile.read()
                    actfile.close()
                    yield buf

def chunked(fileobj, chunk_size):
     return iter(lambda: fileobj.read(chunk_size), '')
......

Tóni

2012.11.30. 7:51 keltezéssel, [email protected] írta:
Today's Topic Summary

Group: http://groups.google.com/group/webpy/topics

  * Streaming video <#group_thread_0> [1 Update]

Streaming video <http://groups.google.com/group/webpy/t/5726cb8d0c016767>

    Dan Loman <[email protected]> Nov 28 10:10AM -0800

    Hi -

    I'm attempting to build a site which can stream video over http to
    an ipad
    app (Azul). The app streams videos (.mp4 and .avi) perfectly if I
    simply
    share the directory from apache. When I serve the same files via
    web.py,
    they have to download completely before playing. A link to the
    video files
    resides in the static folder. I've read through the 'Streaming
    Large Files'
    tutorial, but I can't figure out how that applies to video files.

    Any help would be appreciated.

    Thanks

You received this message because you are subscribed to the Google Group webpy.
You can post via email <mailto:[email protected]>.
To unsubscribe from this group, send <mailto:[email protected]> an empty message. For more options, visit <http://groups.google.com/group/webpy/topics> this group.

--
You received this message because you are subscribed to the Google Groups "web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to