- From: Ian Hickson <ian@hixie.ch>
- Date: Mon, 23 Feb 2009 08:14:22 +0000 (UTC)
On Tue, 3 Feb 2009, Philip J?genstedt wrote: > On Tue, 03 Feb 2009 05:44:07 +0100, Ian Hickson <ian at hixie.ch> wrote: > > On Tue, 3 Feb 2009, Chris Pearce wrote: > > > > > > (2) Why don't we invoke load() whenever a media element's src > > > attribute or <source> children are changed, regardless of > > > networkState? That way changes to the media's src/source other than > > > the first change would have the same effect as first change, i.e. > > > they'd have an immediate effect, causing load() to be invoked. > > > > Doing this would cause the first file to be downloaded multiple times > > in a row, leading to excessive network usage. > > Surely this can't be the only reason? User agents are free to > speculatively keep the current source loading when src/source changes > and to stop loading it only if the "current media resource" does change. > That, and caching, should be enough. It seems rather unclean to require that kind of hack. It would also make the actual exact detectable behaviour dependent on a variety of timing and race conditions, which I generally try to avoid. Anyway, the way the spec has been changed now solves this -- dynamic additions are used, without needing a reload of the previous sources. > I have always imagined that the reason for the conditioned load() is to > not interrupt playback by fiddling with the DOM or doing something like > v.src=v.src (although I'm quite sure that doesn't count as changing the > attribute). Yes, that's the intent. We can't just rely on waiting for the script to end because the list of <source> elements might not be known right away -- e.g. it might be drip fed by the parser. > Related, since load() is async it depends on timing whether or not > > <video id=v></video> > <script> > v = document.getElementById('v'); > v.src = 'test'; > </script> > > causes the source 'test' to be loaded, as the network state may not be > NETWORK_EMPTY when the src attribute is set. This is addressed now. > The same goes for adding source child elements of course. This too. On Wed, 4 Feb 2009, Philip J?genstedt wrote: > > I also had this "avoid accidental reloads" theory before, but it doesn't > strike me as very reasonable after thinking more about it. Can anyone > give an example of a use case where the DOM src attribute or <source> > elements are added/changed "accidentally" so that it would cause an > unwanted reload? The parser: <video> <source> <!-- network lag inserts a pause here... --> <source> -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 23 February 2009 00:14:22 UTC