[whatwg] <video> element feedback

Simon Pieters zcorpan at gmail.com
Tue Mar 20 08:51:29 PDT 2007


On Tue, 20 Mar 2007 16:18:16 +0100, Shadow2531 <shadow2531 at gmail.com>  
wrote:

>> > However, if JS is needed for the video element to function at all,  
>> then
>> > the video element needs to fall back if JS is turned off.
>>
>> Interesting point.
>
> Yes, since JS is required, if JS is off, the browser should display
> the alternate content.

Disagreed. You can still start the video with the context menu or from the  
separate window mode or full screen, or whatever (non-inline) UI the  
browser provides. Also, as soon as browsers have implemented what is  
currently specced, it is expected that declarative features for a native  
UI will be added, so then it should *not* fall back with JS off. Making it  
fall back for v1 but not for v2 would just cause interoperability problems.

You would have to script the fallback, as everything else with v1. ;-)

>> You can do this with JS, of course (and that's the
>> preferred way; hide the fallback when you have JS).
>
> Are you saying that with JS on, the fallback content will be displayed
> in addition to the video and you have to use JS to hide the fallback
> content like the following?
>
> window.onload = function() {
>     var x = document.getElementsByTagName("video")[0];
>     x.play();
>     x.innerHTML = "";
> };

That wouldn't help, as without JS you wouldn't access the fallback  
content. You could do this:

    <p id="videofallback">fallback</p>
    <script>
     var video = document.createElement("video");
     video.src = "foo.ogg";
     var fallback = document.getElementById("videofallback");
     var parent = fallback.parentNode;
     var pos = fallback.nextSibling;
     video.appendChild(fallback);
     parent.insertBefore(video, pos);
    </script>

BTW, this would be a lot simpler to do if the src="" attribute was made  
optional:

    <video><p>fallback</p></video>
    <script>
     document.getElementsByTagName("video")[0].src = "foo.ogg";
    </script>

I think this should be allowed. Without the src attribute, the video  
element could represent a placeholder where a video might have been  
relevant (e.g. if scripting was enabled).

-- 
Simon Pieters



More information about the whatwg mailing list