RE: Video DOM API

Wouldn't it be easier to have play take an optional src parameter?

var a=new Audio();
a.onended = function() { if(a.src=='foo') a.play('bar'); }
a.play('foo');

internally play could do this check:
if( inSrc !== src) src=inSrc ... load and play video
else if at end of audio, rewind and play
else play forward from where the playback head is at.

Art C

-----Original Message-----
From: public-html-comments-request@w3.org
[mailto:public-html-comments-request@w3.org] On Behalf Of Gervase Markham
Sent: Thursday, October 08, 2009 5:54 AM
To: Simon Pieters; public-html-comments@w3.org
Subject: Re: Video DOM API

On 08/10/09 13:29, Simon Pieters wrote:
> Maybe we could remove the networkState check when the src attribute is
> set or changed. Should the "in a Document" check be removed, too? That
> is, do you want to be able to do
>
> var a = new Audio('foo');
> a.play();
> a.onended = function() { a.src = 'bar'; a.onended = null; }

That seems like the obvious way one would implement the chaining of 
videos, isn't it? Although it doesn't allow for pre-loading and 
therefore seamless linking unless you've loaded 'bar' in another <audio> 
somewhere else previously. Hmm...

I think I want to be able to do:

var a = new Audio('foo');
a.play();
a.src = 'bar';
a.load();
a.onended = function() { a.play(); a.onended = null; }

which gives me the preloading as well without needing an extra element.

> What do you think should happen when using <source> elements?

Good question. I think that if I add a <source> element, it should be 
automatically load()ed. But if I call play(), then the resource 
selection algorithm should be used at that point to tell which video 
actually plays.

Gerv

Received on Thursday, 8 October 2009 21:31:25 UTC