On Dec 25, 1:23 am, "Cal Leeming [Simplicity Media Ltd]"
<cal.leem...@simplicitymedialtd.co.uk> wrote:
> This really is *not* a good way of doing things.

why?

> Unless you have a specific need to be streaming out via Python (for example,
> on the fly stream modification, in which case I'd argue those bits of code
> should be written as C extensions for performance), then I would advice
> using nginx with the appropriate mods for anything like this.

i'm not sure, why reading a part of a file and outputting a few
headers should
be such a performance issue with python, but even if it is, i had a
look into nginx and
i don't think i can use it for my purpose.

The reason why i don't want to have the files in the web root is, that
there should be
as user management. certain django users are allowed only to view
certain videos.

if i just put the videos into the public webroot, i still do not have
a media streaming server
installed but it works. as far as i can see, the browsers just handle
the streaming via
http range requests.

i tried the same thing with php, just as a proof of concept: this one
works:

$path=explode('/',$_SERVER['PATH_INFO']);
if (sizeof($path)>1) {
        $inf=explode('.',$path[1]);
        $id=intval($inf[0]);
        $type=$inf[1];
        $ctype='';
        if ($type=='ogv') {
                $ctype='video/ogg';
        } elseif ($type=='mp4') {
                $ctype='video/mp4';
        }
        $fname=sprintf('/var/www/videos/test.%s',$type);
        http_send_content_type($ctype);
        http_send_file($fname);
}

i used firefox plugin live http headers to check headers and it
produces
the same header output as my python script.

why is the php working and the python not?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to