[whatwg] More YouTube response

Philip Jägenstedt philipj at opera.com
Wed Jul 7 01:36:21 PDT 2010


On Tue, 06 Jul 2010 23:19:42 +0200, Marques Johansson  
<marques at displague.com> wrote:

> On Tue, Jul 6, 2010 at 4:37 PM, Aryeh Gregor
> <Simetrical+w3c at gmail.com<Simetrical%2Bw3c at gmail.com>
>> wrote:
>
>> On Tue, Jul 6, 2010 at 10:24 AM, Marques Johansson
>> <marques at displague.com> wrote:
>> > The benefit to the user is that they could have less open network
>> > connections while streaming video from server controlled sites and  
>> those
>> > sites will have the ability to meter their usage more accurately.
>> > Inserting an extra clip at the end is more of a playlist or scripting
>> > answer.  Or perhaps a a live re-encoding answer.   I'm looking for a  
>> way
>> to
>> > give the user the raw video file in a metered way.
>>
>> It sounds like your use-case is very special, and best handled by
>> script.  I suggested server-side script -- you could do that today.
>> Just cut off the HTTP connection when the user has used up their
>> allotted time.  Alternatively, it might be reasonable to have
>> client-side scripting for video that's flexible enough to do what you
>> want.  But a dedicated declarative feature is just not reasonable for
>> such a specific purpose.
>
>
> I tested cutting off the HTTP connection and browsers didn't handle  
> this.  I
> realize I may need to test a deeper sever than a php exit() can  
> provide.  I
> have essentially tested this (but not this exactly - filehandles,  
> sessions,
> additional code, etc):
> <?php
> header("HTTP/1.1 206 partial");
> header("Accept-Ranges: bytes");
> header("Content-Range: bytes 0-999999/1000000");
> header("Content-Length: 1000000");  // report 1000k
> echo str_repeat(" ", 1000); // return 1k
> exit();
>
> and found that browsers do not attempt to refetch the data or continue  
> with
> a 206 for the next block.
>
> Shouldn't something like this be be worked into the protocol or the  
> language

One thing that you mustn't lie about is Content-Length, so I assume that  
the real size of this resource if 1000k. If you're trying to return a too  
short range, you should say so in the Content-Range header. In other  
words, in the above you should have used

header("Content-Range: bytes 0-999/1000000");

I'm not sure it will work anyway, though.

-- 
Philip Jägenstedt
Core Developer
Opera Software



More information about the whatwg mailing list