W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] <video> resource selection algorithm and NETWORK_NO_SOURCE

From: Simon Pieters <simonp@opera.com>
Date: Thu, 09 Dec 2010 10:42:45 +0100
Message-ID: <op.vnfw9jmbidj3kv@dhcp-190.linkoping.osa>
On Thu, 09 Dec 2010 02:58:12 +0100, Ian Hickson <ian at hixie.ch> wrote:

> On Wed, 1 Sep 2010, Simon Pieters wrote:
>> I think it might be good to run the media element load algorithm when
>> setting or changing src on <source> (that has a media element as its
>> parent), but not type and media (what's the use case for type and
>> media?). However it would fire an 'emptied' event for each <source> that
>> changed, which is kind of undesirable. Maybe the media element load
>> algorithm should only be invoked if src is set or changed on a <source>
>> that has no previous sibling <source> elements?
> What's the use case? Just set .src before you insert the element.

The use case under discussion is changing to another video. So the element  
is already inserted and already has src.

Something like:

<video controls autoplay>
  <source src=video1.webm type=video/webm>
  <source src=video1.mp4 type=video/mp4>
function loadVideo(src) {
   var video = document.getElementsByTagName('video')[0];
   sources = video.getElementsByTagName('source');
   sources[0].src = src + '.webm';
   sources[1].src = src + '.mp4';
<input type="button" value="See video 1" onclick="loadVideo('video1')">
<input type="button" value="See video 2" onclick="loadVideo('video2')">
<input type="button" value="See video 3" onclick="loadVideo('video3')">

Simon Pieters
Opera Software
Received on Thursday, 9 December 2010 01:42:45 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC