HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2404[Gecko] [Webkit] Make <source type> optional. Move canPlayType from navigator to HTMLMediaElement. Make it return a string instead of an integer. Fix up the candidate URL list generation. Make loadstart/play event sequencing deterministic.2008-11-15 19:28
@@ -17899,24 +17899,24 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
   multiple <span title="media resource">media resources</span> for
   <span title="media element">media elements</span>.</p>
 
   <p>The <dfn title="attr-source-src"><code>src</code></dfn> attribute
   gives the address of the <span>media resource</span>. The value must
   be a <span>valid URL</span>. This attribute must be present.</p>
 
   <p>The <dfn title="attr-source-type"><code>type</code></dfn>
   attribute gives the type of the <span>media resource</span>, to help
   the user agent determine if it can play this <span>media
-  resource</span> before fetching it. Its value must be a MIME
-  type. The <code title="">codecs</code> parameter may be specified
-  and might be necessary to specify exactly how the resource is
-  encoded. <a href="#refsRFC2046">[RFC2046]</a> <a
+  resource</span> before fetching it. If specified, its value must be
+  a MIME type. The <code title="">codecs</code> parameter may be
+  specified and might be necessary to specify exactly how the resource
+  is encoded. <a href="#refsRFC2046">[RFC2046]</a> <a
   href="#refsRFC4281">[RFC4281]</a></p>
 
   <div class="example">
 
    <p>The following list shows some examples of how to use the <code
    title="">codecs=</code> MIME parameter in the <code
    title="attr-source-type">type</code> attribute.</p>
 
    <dl>
 
@@ -18007,25 +18007,20 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
 
   </div>
 
   <p>The <dfn title="attr-source-media"><code>media</code></dfn>
   attribute gives the intended media type of the <span>media
   resource</span>, to help the user agent determine if this
   <span>media resource</span> is useful to the user before fetching
   it. Its value must be a valid <a href="#mq">media query</a>. <a
   href="#refsMQ">[MQ]</a></p>
 
-  <p>Either the <code title="attr-source-type">type</code> attribute,
-  the <code title="attr-source-media">media</code> attribute or both,
-  must be specified, unless this is the last <code>source</code>
-  element child of the parent element.</p>
-
   <p>The <dfn
   title="attr-source-pixelratio"><code>pixelratio</code></dfn>
   attribute allows the author to specify the pixel ratio of anamorphic
   <span title="media resource">media resources</span> that do not
   self-describe their <span title="concept-video-adjusted-ratio">pixel
   ratio</span>. The attribute value, if specified, must be a
   <span>valid floating point number</span> giving the ratio of the
   correct rendered width of each pixel to the actual height of each
   pixel in the image. The default value, if the attribute is omitted
   or cannot be parsed, is 1.0.</p>
@@ -18083,20 +18078,21 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
   const unsigned short <span title="dom-media-NETWORK_IDLE">NETWORK_IDLE</span> = 1;
   const unsigned short <span title="dom-media-NETWORK_LOADING">NETWORK_LOADING</span> = 2;
   const unsigned short <span title="dom-media-NETWORK_LOADED">NETWORK_LOADED</span> = 3;
   readonly attribute unsigned short <span title="dom-media-networkState">networkState</span>;
   readonly attribute float <span title="dom-media-bufferingRate">bufferingRate</span>;
   readonly attribute boolean <span title="dom-media-bufferingThrottled">bufferingThrottled</span>;
   readonly attribute <span>TimeRanges</span> <span title="dom-media-buffered">buffered</span>;
   readonly attribute <span>ByteRanges</span> <span title="dom-media-bufferedBytes">bufferedBytes</span>;
   readonly attribute unsigned long <span title="dom-media-totalBytes">totalBytes</span>;
   void <span title="dom-media-load">load</span>();
+  DOMString <span title="dom-navigator-canPlayType">canPlayType</span>(in DOMString type);
 
   // ready state
   const unsigned short <span title="dom-media-HAVE_NOTHING">HAVE_NOTHING</span> = 0;
   const unsigned short <span title="dom-media-HAVE_METADATA">HAVE_METADATA</span> = 1;
   const unsigned short <span title="dom-media-HAVE_SOME_DATA">HAVE_SOME_DATA</span> = 2;
   const unsigned short <span title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</span> = 3;
   const unsigned short <span title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</span> = 4;
   const unsigned short <span title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</span> = 5;
   readonly attribute unsigned short <span title="dom-media-readyState">readyState</span>;
   readonly attribute boolean <span title="dom-media-seeking">seeking</span>;
@@ -18177,24 +18173,20 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
 
   <p><span title="media element">Media elements</span> use two <span
   title="task queue">task queues</span>, the <dfn>media element event
   task source</dfn> for asynchronous events and callbacks, and the
   <dfn>media element new resource task source</dfn> for handling
   implicit loads. Unless otherwise specified, the <span>task
   source</span> for all the tasks <span title="queue a
   task">queued</span> in this section and its subsections is the
   <span>media element event task source</span>.</p>
 
-  <p>The <code title="dom-navigator-canPlayType">canPlayType()</code>
-  method can be used to probe the user agent to determine what types
-  are supported.</p>
-
 
   <h5>Error codes</h5>
 
   <p>All <span title="media element">media elements</span> have an
   associated error status, which records the last error the element
   encountered since the <code title="dom-media-load">load()</code>
   method was last invoked. The <dfn
   title="dom-media-error"><code>error</code></dfn> attribute, on
   getting, must return the <code>MediaError</code> object created for
   this last error, or null if there has not been an error.</p>
@@ -18334,39 +18326,40 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
    override</var> be that result. Otherwise, let it be
    <i>none</i>.</p></li>
 
    <li>
 
     <p>If all the following conditions are true:</p>
 
     <ul>
 
      <li>The <var title="">candidate</var> element has a <code
-     title="attr-source-src">src</code> attribute</li>
+     title="attr-source-src">src</code> attribute.</li>
 
      <li><span title="resolve a url">Resolving</span> the
      <span>URL</span> given by the <var title="">candidate</var>
      element's <code title="attr-source-src">src</code> attribute does
-     not fail</li>
-
-     <li>The <var title="">candidate</var> element has a <code
-     title="attr-source-type">type</code> attribute and that
-     attribute's value, when parsed as a MIME type (including any
-     codecs described by the <code title="">codec</code> parameter),
-     does not represent a type that the user agent knows it cannot
-     render <a href="#refsRFC2046">[RFC2046]</a> <a
-     href="#refsRFC4281">[RFC4281]</a></li>
-
-     <li>The <var title="">candidate</var> element has a <code
-     title="attr-source-media">media</code> attribute and that
-     attribute's value, when processed according to the rules for <a
-     href="#mq">media queries</a>, matches the current environment <a
+     not fail.</li>
+
+     <li>The <var title="">candidate</var> element either has no <code
+     title="attr-source-type">type</code> attribute, or its <code
+     title="attr-source-type">type</code> attribute's value, when
+     parsed as a MIME type (including any codecs described by the
+     <code title="">codec</code> parameter), does not represent
+     <span>a type that the user agent knows it cannot
+     render</span>.</li>
+
+     <li>The <var title="">candidate</var> element either has no <code
+     title="attr-source-media">media</code> attribute, or its <code
+     title="attr-source-media">media</code> attribute's value, when
+     processed according to the rules for <a href="#mq">media
+     queries</a>, matches the current environment. <a
      href="#refsMQ">[MQ]</a></li>
 
     </ul>
 
     <p>...then append an item to the <var title="">result</var> list
     consisting of the <span>absolute URL</span> resulting from <span
     title="resolve a url">resolving</span> the <span>URL</span> given
     in that <var title="">candidate</var> element's <code
     title="attr-source-src">src</code> attribute as the resource's
     address, and the <var title="">candidate pixel ratio
@@ -18381,20 +18374,96 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
 
    <li><p>If <var title="">candidate</var> is not null, return to the
    step labeled <i>loop</i>.</p></li>
 
    <li><p>Return <var title="">result</var>.</p></li>
 
   </ol>
 
 
 
+  <h5>Media types</h5>
+
+  <p>A <span>media resource</span> can be described in terms of its
+  <em>type</em>, specifically a MIME type, optionally with a <code
+  title="">codecs</code> parameter. <a
+  href="#refsRFC2046">[RFC2046]</a> <a
+  href="#refsRFC4281">[RFC4281]</a>.</p>
+
+  <p>Types are usually somewhat incomplete descriptions; for example
+  "<code title="">video/mpeg</code>" doesn't say anything except what
+  the container type is, and even a type like "<code
+  title="">video/mp4; codecs=&quot;avc1.42E01E,
+  mp4a.40.2&quot;</code>" doesn't include information like the actual
+  bitrate (only the maximum bitrate). Thus, given a type, a user agent
+  can often only know whether it <em>might</em> be able to play
+  media of that type (with varying levels of confidence), or whether
+  it definitely <em>cannot</em> play media of that type.</p>
+
+  <p><dfn>A type that the user agent knows it cannot render</dfn> is
+  one that describes a resource that the user agent definitely does
+  not support, for example because it doesn't recognise the container
+  type, or it doesn't support the listed codecs.</p>
+
+  <p>The <dfn title="dom-navigator-canPlayType"><code>canPlayType(<var
+  title="">type</var>)</code></dfn> method must return the string
+  "<code title="">no</code>" if <var title="">type</var> is <span>a
+  type that the user agent knows it cannot render</span>; it must
+  return "<code title="">probably</code>" if the user agent is
+  confident that the type represents a <span>media resource</span>
+  that it can render if used in with this <code>audio</code> or
+  <code>video</code> element; and it must return "<code
+  title="">maybe</code>" otherwise. Implementors are encouraged to
+  return "<code title="">maybe</code>" unless the type can be
+  confidently established as being supported or not. Generally, a user
+  agent should never return "<code title="">probably</code>" if the
+  type doesn't have a <code title="">codecs</code> parameter.</p>
+
+  <div class="example">
+
+   <p>This script tests to see if the user agent supports a
+   (fictional) new format to dynamically decide whether to use a
+   <code>video</code> element or a plugin:</p>
+
+   <pre>&lt;section id="video">
+ &lt;p>&lt;a href="playing-cats.nfv">Download video&lt;/a>&lt;/p>
+&lt;/section>
+&lt;script>
+ var videoSection = document.getElementById('video');
+ var videoElement = document.createElement('video');
+ var support = videoElement.canPlayType('video/x-new-fictional-format;codecs="kittens,bunnies"');
+ if (support != "probably" &amp;&amp; "New Fictional Video Plug-in" in navigator.plugins) {
+   // not confident of browser support
+   // but we have a plugin
+   // so use plugin instead
+   videoElement = document.createElement("embed");
+ } else if (support == "no") {
+   // no support from browser and no plugin
+   // do nothing
+   videoElement = null;
+ }
+ if (videoElement) {
+   while (videoSection.hasChildNodes())
+     videoSection.removeChild(videoSection.firstChild);
+   videoElement.setAttribute("src", "playing-cats.nfv");
+   videoSection.appendChild(videoElement);
+ }
+&lt;/script></pre>
+
+  </div>
+
+  <p class="note">To express the type of a <span>media resource</span>
+  to allow the user agent to avoid downloading resources it can't
+  render, authors can use the <code>source</code> element's <code
+  title="attr-source-type">type</code> attribute.</p>
+
+
   <h5>Network states</h5>
 
   <p>As <span title="media element">media elements</span> interact
   with the network, their current network activity is represented by
   the <dfn
   title="dom-media-networkState"><code>networkState</code></dfn>
   attribute. On getting, it must return the current network state of
   the element, which must be one of the following values:</p>
 
   <dl>
@@ -18534,38 +18603,38 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
    </li>
 
    <li><p><span>Generate the list of potential media resources</span>
    and let the resulting list be <var
    title="">candidates</var>.</p></li>
 
    <li><p>Set the <code
    title="dom-media-networkState">networkState</code> to <code
    title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
 
+   <li><p>Set the <span>begun flag</span> to true and <span>queue a
+   task</span> to <span>fire a progress event</span> called <code
+   title="event-loadstart">loadstart</code> at the <span>media
+   element</span>.</p></li>
+
    <li>
 
     <p>The method must return, but these steps must continue.</p>
 
     <p class="note">Playback of any previously playing <span>media
     resource</span> for this element stops.</p>
 
    </li>
 
 
    <!-- SYNCHRONOUS / ASYNCHRONOUS BOUNDARY FOR EVENT DISPATCH -->
 
 
-   <li><p>Set the <span>begun flag</span> to true and <span>queue a
-   task</span> to <span>fire a progress event</span> called <code
-   title="event-loadstart">loadstart</code> at the <span>media
-   element</span>.</p></li>
-
    <li>
 
     <p><i>Candidate loop</i>: For each item in <var
     title="">candidates</var>, if any, and in the same order as they
     were added to the list, run the following steps:</p>
 
     <ol>
 
      <li><p>Let the <var title="">current media resource</var> be the
      resource given by the <span>absolute URL</span> for the current
@@ -19494,21 +19563,21 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
    be set to false.</p></li>
 
    <li><p>The <span>media element</span>'s <span>autoplaying
    flag</span> must be set to false.</p></li>
 
    <li><p>The method must then return.</p></li>
 
    <li><p>If the fourth step above changed the value of <code
    title="dom-media-paused">paused</code>, the user agent must
    <span>queue a task</span> to <span>fire a simple event</span>
-   called <code title="event-pause">play</code> at the
+   called <code title="event-play">play</code> at the
    element.</p></li>
 
   </ol>
 
   <hr>
 
   <p>When the <dfn title="dom-media-pause"><code>pause()</code></dfn>
   method is invoked, the user agent must run the following steps:</p>
 
   <ol>
@@ -38522,34 +38591,34 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   readonly attribute DOMString <span title="dom-navigator-appName">appName</span>;
   readonly attribute DOMString <span title="dom-navigator-appVersion">appVersion</span>;
   readonly attribute DOMString <span title="dom-navigator-platform">platform</span>;
   readonly attribute DOMString <span title="dom-navigator-userAgent">userAgent</span>;
 };
 
 [NoInterfaceObject] interface <dfn>NavigatorOnLine</dfn> {
   readonly attribute boolean <span title="dom-navigator-onLine">onLine</span>;
 };
 
-[NoInterfaceObject] interface <dfn>NavigatorBrowsingContextAbilities</dfn> {
+[NoInterfaceObject] interface <dfn>NavigatorAbilities</dfn> {
   // content handler registration
   void <span title="dom-navigator-registerProtocolHandler">registerProtocolHandler</span>(in DOMString protocol, in DOMString url, in DOMString title);
   void <span title="dom-navigator-registerContentHandler">registerContentHandler</span>(in DOMString mimeType, in DOMString url, in DOMString title);
-<!--  XXX cookieEnabled geolocator javaEnabled mozIsLocallyAvailable plugins preference
-  readonly attribute <span>MimeTypeArray</span> <span title="dom-navigator-mimeTypes">mimeTypes</span>;-->
-  // abilities
-  short <span title="dom-navigator-canPlayType">canPlayType</span>(in DOMString type);
-};</pre>
+<!--  XXX cookieEnabled geolocator javaEnabled mozIsLocallyAvailable preference
+  readonly attribute <span>MimeTypeArray</span> <span title="dom-navigator-mimeTypes">mimeTypes</span>;
+  readonly attribute <span>PluginArray</span> <span title="dom-navigator-plugins">plugins</span>;
+  (the latter is used in a <video> element demo now)
+-->};</pre>
 
   <p>Objects implementing the <code>Navigator</code> interface must
   also implement the <span>NavigatorID</span>,
   <span>NavigatorOnLine</span>, and
-  <span>NavigatorBrowsingContextAbilities</span> interfaces. (These
+  <span>NavigatorAbilities</span> interfaces. (These
   interfaces are defined separately so that other specifications can
   re-use parts of the <code>Navigator</code> interface.)</p>
 
    <!-- XXX also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
 
    <!-- XXX also, could expose languages:
    <dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
    <dd><p>Must return either null or a language code representing the language the browser uses in its interface.</p></dd>
    <dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
    <dt><dfn title="dom-navigator-language"><code>language</code></dfn></dt> <!- - Opera, Safari, and Mozilla only - ->
@@ -38939,34 +39008,20 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   sections, will redirect the user to
   "http://kittens.example.org/?show=x-meow%3AS2l0dGVucyBhcmUgdGhlIGN1dGVzdCE%253D".</p>
 
   <p>The <code
   title="dom-navigator-registerContentHandler">registerContentHandler()</code>
   method would work equivalently, but for unknown MIME types instead
   of unknown protocols.</p>
 
 
 
-
-  <h4>Client abilities</h4>
-
-  <p>The <dfn title="dom-navigator-canPlayType"><code>canPlayType(<var
-  title="">type</var>)</code></dfn> method must return 1 if <var
-  title="">type</var> is a MIME type that the user agent is confident
-  represents a <span>media resource</span> that it can render if used
-  in a <code>audio</code> or <code>video</code> element, 0 if it
-  cannot determine whether it could do so, and &#x2212;1 if it is
-  confident that it would not be able to render resources of that
-  type.</p>
-
-
-
   <h3 id="offline">Offline Web applications</h3>
 
   <h4>Introduction</h4>
 
   <p><em>This section is non-normative.</em></p>
 
   <p class="XXX">...</p>
 
 
   <h4 id="appcache">Application caches</h4>

|