This Week in HTML 5 – Episode 13
Welcome back to "This Week in HTML 5," where I'll try to summarize the major activity in the ongoing standards process in the WHATWG and W3C HTML Working Group.
The big news this week is a major revamping of how browsers should process multimedia in the
r2404 makes a number of important changes. First, the
canPlayType() method has moved from the
navigator object to
HTMLMediaElement (i.e. a specific
<video> element), and it now returns a string rather than an integer. [
The canPlayType(type) method must return the string "no" if type is a type that the user agent knows it cannot render; it must return "probably" if the user agent is confident that the type represents a media resource that it can render if used in with this audio or video element; and it must return "maybe" otherwise. Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not. Generally, a user agent should never return "probably" if the type doesn't have a codecs parameter.
codecs parameter? That's the second major change: the
<source type> attribute (which previously could only contain a MIME type like "video/mp4", which is insufficient to determine playability) can now contain a MIME type and a
codecs parameter. As specified in RFC 4281, the
codecs parameter specifies the specific codecs used by the individual streams within the audio/video container. The section on the
type attribute contains several examples of using the
<source type> attribute is now optional. If you aren't sure what kind of video you're serving, you can just throw one or more
<source> elements into a
<video> element and the browser will try each of them in the order specified [r2403] until it finds something it can play. [
load() algorithm discussion] Of course, if you include a
type attribute (and
codecs parameter within it), the browser may use it to determine playability without loading multiple resources, but this is no longer required.
The final change (this week) to multimedia elements is the elimination of the
playcount attributes. They are all replaced by a single attribute,
loop, which takes a boolean. To handle initially seeking to a specific timecode (like the now-eliminated
start attribute), the HTML 5 spec vaguely declares, "For example, a fragment identifier could be used to indicate a start position." This obviously needs further specification.
One multimedia-related issue that did not change in the spec this week is same-origin checking for media elements. Robert O'Callahan asked whether video should be allowed to load from another domain, noting (correctly) that it could lead to information leakage about files posted on private intranets. Chris Double outlines the issues and some proposed solutions. However, contrary to Chris' expectation, HTML 5 will not (yet) mandate cross-site restrictions for audio/video files. This is an ongoing discussion. [WHATWG discussion thread, Theora discussion thread]
In other news, Ian Hickson summarized the discussion around the
<input placeholder> attribute (which I first mentioned in This Week in HTML 5 Episode 8) and committed r2409 that defines the new attribute:
The placeholder attribute represents a short hint (a word or short phrase) intended to aid the user with data entry. A hint could be a sample value or a brief description of the expected format.
For a longer hint or other advisory text, the title attribute is more appropriate.
The placeholder attribute should not be used as an alternative to a label.
User agents should present this hint to the user only when the element's value is the empty string and the control is not focused (e.g. by displaying it inside a blank unfocused control).
Read the section on the placeholder attribute for an example of its proper use.
Other interesting tidbits this week:
- Ian Hickson explains why the
<link rev>attribute was dropped.
- Lots of feedback about the Web Workers draft.
- Lots of feedback about the WebSocket interface.
- r2413 adds a
resolveURL()method to the
- r2406 defines negative
- r2407 defines how often browsers should fire the
timeupdateevent while playing audio or video.
- r2416 simplifies the content model of the
Around the web:
- The W3C published an editor's draft of Lachlan Hunt's Web Developer's Guide to HTML 5.
- Austin Chau posted a demo of HTML 5 cross-document messaging. Further discussion: Using HTML5 postMessage, postMessage API changes, and the unfortunately-named xssinterface library which implements a
postMessage-like API in browsers that do not yet support it.
- Ryan Tomayko posted an excellent summary of things caches do, specifically HTTP caches like Squid and rack-cache.
- Joe Clark posted This is How the Web Gets Regulated, a call to action on video accessibility.
<video>elements that point to Ogg Theora video files and replaces them with plugin-specific markup to play the video through oggplay, vlc-plugin, Java cortado, mplayer, Totem, or Apple Quicktime (if Xiph's Ogg Theora Quicktime component is installed). A demo page demonstrates the technique.
<audio>elements that point to Ogg Vorbis audio files and replace them with a Flash wrapper that could play the audio file, even in browsers that do not support the
<audio>element or the Ogg Vorbis audio codec.
Tune in next week for another exciting episode of "This Week in HTML 5."