posted by Thom Holwerda on Fri 19th Jun 2009 15:23 UTC
IconWe're on the verge of a serious evolution on the web. Right now, the common way to include video on the web is by use of Flash, a closed-source technology that is a massive resource hog. The answer is the HTML5 video tag, which allows you to embed video into HTML pages without the use of Flash or any other non-HTML technology; combined with open video codecs, this could provide the perfect opportunity to further open up and standardise the web. Sadly, not even Mozilla itself really seems to understand what it is supposed to do with the video tag, and actually advocates the use of JavaScript to implement it. Kroc Camen, OSNews editor, is very involved in making/keeping the web open, and has written an open letter to Mozilla in which he urges them to not use JavaScript for HTML video. Note that Kroc's website may not work properly in Internet Explorer. (Update The letter has been mirrored in the article, Read More for the full text)

The blog post by Mozilla is supposed to provide a method for website owners to use open video, but still allow browsers that do not support it to fall back to using Flash video. While this in and of itself is a good idea, the implementation is bad, as it uses JavaScript. Since the <video> tag is supposed to work like a glorified <img>, this doesn't seem to make an awful lot of sense. "Just as you would never expect JavaScript to be required just to view an image (and bad code be responsible if so), the same should be true of video," Kroc writes in the open letter. <video> Is an element, not a JavaScript object.

The use of JavaScript conjures up a number of problems. Accessibility is one of them, as screen readers may not be able to play nice with JavaScript code; it may also hinder the use of WAI-ARIA. Lesser-known browsers may struggle with JavaScript implementation as well, since web developers may use JS features rarer browsers do not support. On top of that, the use of JavaScript may lead to security problems, for instance via XSS attacks.

A more philosophical - but no less valid - argument deals with the actual purpose of HTML. HTML is not restricted to just browsers, and may be parsed by other applications as well, applications which may not support JavaScript at all (RSS readers, for instance). Robots and spiders could also be hindered by the use of JavaScript.

Merely pointing out an error in ways is easy; it's much harder to come up with a valid alternative. Kroc has done just that, and what makes it easier is that his "Video for everybody" is a far superior implementation than whatever the Mozilla boys and girls came up with. It degrades peacefully across all platforms and browsers, and makes no use of JavaScript to do so.

Simply put, "Video for everybody" uses the <video> tag if your browser supports it, using OGG video. If your browser does not support it, it falls back to Flash. Is Flash not supported either? QuickTime will be used (which allows playback on the iPhone). Don't have QuickTime either? Internet Explorer in Windows Vista and up will switch to Windows Media Player.

But don't despair, if none of the above methods allow you to playback the video, a simple notice will appear, which will allow you to download the video in question and play it back from your hard drive. All this quiet degrading is done with just HTML - no JavaScript required. As a result, even OWB in AmigaOS4 works with Video for Everybody, showing me a nice download link.


What Mozilla should do

Kroc asks the following of Mozilla:

Remove the content of that blog post and replace it with new content that covers two main factors:
  • How to insert HTML5 video using HTML and providing levels of fallback for legacy systems
  • Why providing good fallback options / text is so important to a range of users and devices, and therefore why JavaScript should only be used to enhance a solution rather than be a requirement

Adopt HTML5 video (with fallbacks) across all Mozilla branded blogs, sites and web properties, unilaterally

  • I personally don't have Flash installed, it is - after all - an optional install, and I don't like what it does to my computer. It seems counter to the work you are doing providing HTML5 video in your browser that I cannot see your own announcements.
  • I believe Mozilla need to make a company-wide (and community-wide) commitment to using HTML5 video in all of their ventures - past, present and future.

Personally, I support Kroc's open letter, and he hopes that more of you will do so. If you agree with Kroc that the <video> should be used properly, and that it is important to move towards a web that is more open and more standardised than it is now, you can contact Kroc (Twitter | e-mail) to have your name added to the list of undersigned. In addition, you can spread the word, and propagate Kroc's open letter to Mozilla, Video for Everybody, or this OSNews item across the web.


The Letter (Mirror): An Open Letter to Mozilla Regarding Their Use and Promotion of HTML5 Video

Dear Mozilla,

The content of this letter is based upon this blog post at the hacks.mozilla.org initiative.

HTML5 video is coming, and a million web developers up and down the web will be soon looking for advice and sample code to make use of HTML5 video. Web developers vary massively in skill and understanding of the open principles of web development, promoted by yourselves via the Mozilla Manifesto.

We cannot expect all developers to understand the knock-on effect of code snippets that they are copy-pasting from people’s sites. It is one thing to educate people with a piece of code, it is another to communicate effectively the principles behind a piece of code. Some developers do not care, and never will—that is a fact of life.

In presenting a JavaScript-only method for using HTML5 video, you are promoting to developers a number of major drawbacks, counter-intuitive to the points outlined in the Mozilla Manifesto.

Accessibility
Screen-readers may be presented with a hurdle by a JavaScript solution. Users may also be using browsers that developers are very unlikely testing in, who may inadvertedly break support by using JavaScript features that are either not present, or not compatible with JavaScript implementations in these browsers. Requiring JavaScript may also hinder use of WAI-ARIA.
<video> is an element, not a JavaScript object

In other blog posts you have promoted the <video> element as a glorified <img> element—being fundamentally a part of the document with all the same capabilities CSS-wise. Some incredible examples have been demonstrated that go well beyond what is possible with plugins.

Just as you would never expect JavaScript to be required just to view an image (and bad code be responsible if so), the same should be true of video.

JavaScript still has no solid security model
By requiring JavaScript, you are also requiring people to switch on JavaScript for sites that they may otherwise not trust. Viruses and malware have travelled far by hiding behind videos, and XSS attacks could be done by forcing people to enable JavaScript for a site so they can see a video.
Non-aggregatable, mashable

The use of JavaScript promotes a traditional browser-centric model. As a document format, HTML goes beyond just the traditional ‘web-browser’ and may be parsed in many ways and environments outside of the traditional browser.

RSS aggregators (particularly web-based ones) may not execute JavaScript as a safety measure, thus preventing the user from seeing the content.

Robots and spiders also would not be able to spider HTML5 video content if it is only present with JavaScript. That alone could prevent all kinds of innovation that we cannot yet conceive. What if a TV station could be created using nothing but <video> tags found on the web? Requiring JavaScript to see <video> largely puts a stop to mash-ups wanting to pull video from the web.

A Solution Has Been Presented

A solution for using HTML5 video with fallbacks for Adobe Flash, QuickTime and Windows Media Player that works on a wide range of browsers without the need for JavaScript has been developed, it’s called “Video for Everybody”.

The market is made up of more OSes, browsers and processor architectures than it was five years ago. More people (especially geeks) are browsing with AdBlock / NoScript / FlashBlock than ever before. We can no longer just assume people are going to have Flash and are allowing you to use it.

The same rules apply to video. If my platform / device / browser of choice cannot see your video, or you do not offer me the means to download the video to view offline, then I don’t see whatever it is you’ve got to show me.

It helps web developers promote HTML5 video as an equal citizen alongside Flash and QuickTime. The necessary playback is chosen automatically based on browser / operating system capabilities, all without JavaScript. If the video is not able to play within the browser helpful fallback text is displayed to offer the users a means of downloading the video file, or how to get the video to play in the webpage by installing an HTML5-capable browser, Flash or QuickTime.

This means that it is almost impossible for the user to not be able to view the video—one way or another—and they are not hindered from viewing the content by bad design decisions such as requiring JavaScript to use a native HTML tag.

What You Can Do

I ask you to please do the following:

Remove the content of that blog post and replace it with new content that covers two main factors:
  1. How to insert HTML5 video using HTML and providing levels of fallback for legacy systems

  2. Why providing good fallback options / text is so important to a range of users and devices, and therefore why JavaScript should only be used to enhance a solution rather than be a requirement

Adopt HTML5 video (with fallbacks) across all Mozilla branded blogs, sites and web properties, unilaterally

I personally don’t have Flash installed, it is—after all—an optional install, and I don’t like what it does to my computer. It seems counter to the work you are doing providing HTML5 video in your browser that I cannot see your own announcements.

I believe Mozilla need to make a company-wide (and community-wide) commitment to using HTML5 video in all of their ventures—past, present and future.

e p (27)    65 Comment(s)

Technology White Papers

See More