[whatwg] More YouTube response
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>
>> 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
>> > 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
>> > 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,
> additional code, etc):
> 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
> and found that browsers do not attempt to refetch the data or continue
> a 206 for the next block.
> Shouldn't something like this be be worked into the protocol or the
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.
More information about the whatwg