[whatwg] Limiting the amount of downloaded but not watched video

Glenn Maynard glenn at zewt.org
Sun Jan 23 04:40:05 PST 2011

On Sun, Jan 23, 2011 at 6:32 AM, Philip Jägenstedt <philipj at opera.com>wrote:

> But presumably you want some kind of guarantee that the video will be able
> to keep playing without waiting for the network, right? So if you don't use
> preload=auto, you'll at least need preload=playthrough or similar. Maybe
> that's precisely what you mean by preload=buffer?

Yes, I think we all mean the same thing here: asking the browser to buffer
enough to avoid underruns and to begin playing immediately without blocking,
which is more than preload=metadata and less than preload=auto.

> I intend to make that impossible by only allowing scripts to increase the
> effective buffering strategy, because:
> 1. preload->none makes no sense.
> 2. I haven't seen any use cases for auto->preload other than working around
> browser buffering bugs.
> 3. It would be a silly API, because you can't reasonably mean "I need it
> all! No, I need only metadata! No, I need it all!", you're clearly trying to
> do something else.

I think it makes sense, with the right definitions.  preload=none means
"don't preload any more data than you already have".  preload=metadata means
"load metadata if you havn't already".  These make sense regardless of what
the state was previously.

By not catering to that, we can instead focus on fixing the
> API/implementations to support the actual use cases authors might have.

The most important unresolved use case is: how to allow limiting the amount
of prebuffered data, while also having a mechanism to disable that limit
when there isn't enough bandwidth.  The approaches I've seen proposed are 1:
have the browser try to guess statistically how big the buffer size needs to
be, and 2: disable the buffer limit when paused.

I don't trust #1.  It's impossible to predict bandwidth reliably.  If the
browser guesses too small, it'll be impossible to watch a video without
underruns.  Browsers should try to make a good guess, but there's got to be
an intuitive user override.

#2 is essentially that override, and it's what everyone is used to already:
if the video is underrunning, leave it paused until it buffers for a while.

However, there are cases where you'll want to pause the video without
triggering #2; for example, YouTube's pause captions, and after a
pause-and-rewind.  Simply having something like
preload=auto_only_when_paused wouldn't be enough.

That's why it seems like scripts should have some control over this.
Toggling between preload=metadata and preload=auto is one possible API to do
that.  Granted, browser-supplied controls should also be able to implement
this behavior, which suggests an attribute to allow it.  I'm not sure how to
get both cleanly.

Glenn Maynard

More information about the whatwg mailing list