[whatwg] single step v.play();

Biju bijumaillist at gmail.com
Mon Apr 20 18:58:20 PDT 2009


On Mon, Apr 20, 2009 at 7:01 AM, Philip Jägenstedt <philipj at opera.com> wrote:
> element). Given the already ridiculous complexity of media element's
> loading behavior I'm not sure adding more equivalent syntax will help
> matters.

I am sorry if I am missing something, how do adding it make spec complex.
Already spec for play, load and assign to src attribute exist
So remaining logic is only

HTMLVideoElement.prototype.newPlay =
function newPlay(url){
  if(arguments.length) this.src = url;
  this.load();
  this.play();
}


I dont know how other do
But for me watching CNN is
1. goto http://www.cnn.com/video/
2. selected and add videos I wish to see to playlist
3. click first one in the playlist to play
4. Continue watching
5. if you dont like one, skip by clicking the next one


I rarely use volume control or scroll bar.
So basically most of the days I only do
   v.src = newurl;
   v.load();
   v.play();
for every video I watch, hence this is going to most used functionality for me.


======
PS: here is how the usage of the new play method
it plays 2 times for 30 sec.

var firsttime = 1;
var v = document.createElement('video');;
v.newPlay("http://tinyvid.tv/file/hk9gmeag5hla.ogg");
v.addEventListener("play", onplay, false);
function onplay(){
  setTimeout(dodelay,30000);
}
function dodelay(){
  if(firsttime)
    v.newPlay("http://tinyvid.tv/file/hk9gmeag5hla.ogg");
  else
    v.pause();
  firsttime = 0;
}


More information about the whatwg mailing list