Added model section, finished syntax section, started parser section.
authorSilvia Pfeiffer
Wed, 06 Feb 2013 18:02:23 +1100
changeset 55 08f3dc408ee4
parent 54 412701c36230
child 56 8807cb6f4645
Added model section, finished syntax section, started parser section.
608toVTT/region.html
--- a/608toVTT/region.html	Tue Feb 05 22:56:50 2013 +1100
+++ b/608toVTT/region.html	Wed Feb 06 18:02:23 2013 +1100
@@ -117,15 +117,13 @@
       <p>This specification is the result of discussions in the <a href="http://www.w3.org/community/texttracks/">W3C Text Tracks Community Group (CG)</a>. The intention is to provide a backwards compatible extension to the WebVTT specification <a href="#refsWEBVTT">[WEBVTT]</a> such that the lack of support of the "region" feature in video players doesn't stop a WebVTT file with regions from being parsed and displayed on top of the video.
       </p>
 
-      <p>The "region" specification in this document specifies the most fundamental concepts. There are many ways in which this specification can be extended and in fact some ideas have been discussed on the <a href="http://www.w3.org/community/texttracks/wiki/MultiCueBox">W3C Text Tracks CG wiki</a>. We will wait for browser vendors to implement the core features and for developers to provide feedback on their use cases and needs before extending this specification.
+      <p>This document specifies the most fundamental concepts. There are many ways in which this "region" specification can be extended and in fact some ideas have been discussed on the <a href="http://www.w3.org/community/texttracks/wiki/MultiCueBox">W3C Text Tracks CG wiki</a>. We will wait for browser vendors to implement the core features and for developers to provide feedback on their use cases and needs before extending this specification.
       </p>
 
       <section>
         <h3>Example WebVTT file with regions</h3>
 
-        <p>In the following example there are two regions containing rollup captions for two different
-        speakers. Fred's cues scroll up in the left half of the video and the first cue disappears at
-        12.5sec even because it is limited to 3 lines even through it is defined until 20sec:
+        <p>In the following example there are two regions containing rollup captions for two different speakers. Fred's cues scroll up in the left half of the video and the first cue disappears at 12.5sec even because it is limited to 3 lines even through it is defined until 20sec:
         </p>
 
         <pre>WEBVTT
@@ -150,14 +148,77 @@
 00:00:12.500 --> 00:00:32.500 region:fred align:left
 OK, let's go.</pre>
       </section>
-    
-      <p>All terms used in this specification that are not (re-)defined in this specification
-      rely on terms specified in the WebVTT specification <a href="#refsWEBVTT">[WEBVTT]</a>.
+
+      <p>Note that regions are only defined for horizontal cues at this time.</p>
+
+      <p>All terms used in this specification that are not (re-)defined in this specification rely on terms specified in the WebVTT specification <a href="#refsWEBVTT">[WEBVTT]</a>.
       </p>
     </section>
 
     <section>
-      <h2>Region definition syntax</h2>
+      <h2>Extension of the text track model</h2>
+
+      <p>The WebVTT specification references the <a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/#text-track-model">text track model</a> of the HTML specification <a href="#refsHTML">[HTML]</a> to define the core terms of the WebVTT specification.</p>
+
+      <p>This specification introduces the concept of a <a class="internalDFN" href="#text-track-region">text track region</a> and extends the concept of a <a href="http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#text-track-cue" class="externalDFN">text track cue</a>.</p>
+
+      <section>
+        <h3>Text track region</h3>
+        <p>A <dfn id="text-track-region">text track region</dfn> represents a subpart of the video viewport and provides a rendering area for <a class="externalDFN" href="http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#text-track-cue">text track cues</a>.</p>
+
+        <p>Each <a href="#text-track-region" class="internalDFN">text track region</a> consists of:</p>
+
+        <dl>
+
+         <dt><dfn id="text-track-region-identifier">An identifier</dfn></dt>
+         <dd>
+          <p>An arbitrary string.</p>
+         </dd>
+
+         <dt><dfn id="text-track-region-width">A width</dfn></dt>
+         <dd>
+          <p>A number giving the width of the box within which the text of each line of the containing cues is to be rendered, to be interpreted as a percentage of the video width. Defaults to 100%.</p>
+         </dd>
+
+         <dt><dfn id="text-track-region-height">A height</dfn></dt>
+         <dd>
+          <p>A number giving the number of lines of the box within which the text of each line of the containing cues is to be rendered. Defaults to 3.</p>
+         </dd>
+
+         <dt><dfn id="text-track-region-anchor">A region anchor point</dfn></dt>
+         <dd>
+          <p>Two numbers giving the x and y coordinates within the region which is anchored to the video viewport and does not change location even when the region does, e.g. because of font size changes. Defaults to (0%,100%), i.e. the bottom left corner of the region.</p>
+         </dd>
+
+         <dt><dfn id="text-track-region-viewport-anchor">A region viewport anchor point</dfn></dt>
+         <dd>
+          <p>Two numbers giving the x and y coordinates within the video viewport to which the region anchor point is anchored. Defaults to (0%,100%), i.e. the bottom left corner of the viewport.</p>
+         </dd>
+
+         <dt><dfn id="text-track-region-scroll">A scroll flag</dfn></dt>
+         <dd>
+          <p>A flag indicating whether cues within the region are to stay fixed "none" or scroll "up" as new cues are added to the region.</p><!-- in the future we may introduce scroll="down"-->
+         </dd>
+        </dl>
+      </section>
+
+      <section>
+        <h3>Extension of text track cue</h3>
+
+        <p>In addition to the existing attributes, each <a href="http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#text-track-cue" class="externalDFN"><dfn>text track cue</dfn></a> also consists of:</p>
+
+        <dl>
+         <dt><dfn id="text-track-cue-region">A region reference</dfn></dt>
+         <dd>
+          <p>A string that identifies the region that a cue belongs to, if it is not null.</p>
+         </dd>
+        </dl>
+      </section>
+    </section>
+
+
+    <section>
+      <h2>Region syntax</h2>
 
       <p>The <a href="#http://dev.w3.org/html5/webvtt/#parsing">WebVTT parser</a> is flexible when parsing the header of a WebVTT file and allows for characters to be present before the first cue in the file. We take advantage of this extension point of the WebVTT spec to introduce the specification of regions in the header of WebTT files.
       </p>
@@ -258,7 +319,7 @@
          <li>A <a href="#webvtt-region-scroll">WebVTT region scroll setting</a>.</li> <!-- scroll:up -->
         </ul>
 
-        <p class="note"><a href="#webvtt-region-settings">WebVTT region settings</a> give configuration
+        <p class="note"><a href="#webvtt-region-setting">WebVTT region settings</a> give configuration
         options regarding the dimensions, positioning and anchoring of the region. For
         example, it allows a group of cues within a region to be anchored in the center of the
         region and the center of the video viewport. In this example, when the font size grows,
@@ -274,15 +335,20 @@
           "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
           U+003E GREATER-THAN SIGN).</p></li>
         </ol>
+        <p class ="note">The <a href="#webvtt-region-identifier">WebVTT region identifier</a> gives
+        a name to the region so it can be referenced by the cues that belong to the region.</p>
 
         <p>A <dfn id="webvtt-region-width">WebVTT region width setting</dfn> consists of the
         following components, in the order given:</p>
         <ol>
          <li><p>The string "<code title="">width</code>".</p></li>
-         <li><p>A U+003D EQUALS SIGN character ().</p></li>
+         <li><p>A U+003D EQUALS SIGN character (=).</p></li>
          <li><p>One or more <span>ASCII digits</span>.</p></li>
          <li><p>A U+0025 PERCENT SIGN character (%).</p></li>
         </ol>
+        <p class ="note">The <a href="#webvtt-region-width">WebVTT region width setting</a> provides
+        a fixed width as a percentage of the video width for the region into which cues are
+        rendered and based on which alignment is calculated.</p>
 
         <p>A <dfn id="webvtt-region-height">WebVTT region height setting</dfn> consists of the
         following components, in the order given:</p>
@@ -291,6 +357,9 @@
          <li><p>A U+003D EQUALS SIGN character (=).</p></li>
          <li><p>One or more <span>ASCII digits</span>.</p></li>
         </ol>
+        <p class ="note">The <a href="#webvtt-region-height">WebVTT region height setting</a> provides
+        a fixed height as a number of lines for the region into which cues are rendered. As such, it
+        defines the height of the roll-up region if it is a scroll region.</p>
 
         <p>A <dfn id="webvtt-region-anchor">WebVTT region anchor setting</dfn> consists of the
         following components, in the order given:</p>
@@ -303,6 +372,12 @@
          <li><p>One or more <span>ASCII digits</span>.</p></li>
          <li><p>A U+0025 PERCENT SIGN character (%).</p></li>
         </ol>
+        <p class ="note">The <a href="#webvtt-region-anchor">WebVTT region anchor setting</a> provides
+        a tuple of two percentages that specify the point within the region box that is fixed in
+        location. The first percentage measures the x-dimension and the second percentage
+        y-dimension from the top left corner of the region box. If no
+        <a href="#webvtt-region-anchor">WebVTT region anchor setting</a> is given, the anchor
+        defaults to 0%,100% (i.e. the bottom left corner).</p>
 
         <p>A <dfn id="webvtt-region-viewport-anchor">WebVTT region viewport anchor setting</dfn>
         consists of the following components, in the order given:</p>
@@ -315,7 +390,17 @@
          <li><p>One or more <span>ASCII digits</span>.</p></li>
          <li><p>A U+0025 PERCENT SIGN character (%).</p></li>
         </ol>
+        <p class ="note">The <a href="#webvtt-region-viewport-anchor">WebVTT region viewport
+        anchor setting</a> provides a tuple of two percentages that specify the point within
+        the video viewport that the region anchor point is anchored to. The first percentage
+        measures the x-dimension and the second percentage measures the y-dimension from the
+        top left corner of the video viewport box. If no viewport anchor is given, it defaults
+        to 0%, 100% (i.e. the bottom left corner).</p>
 
+        <p class ="note">For browsers, the region maps to an absolute positioned CSS box relative
+        to the video viewport, i.e. there is a relative positioned box that represents the video
+        viewport relative to which the regions are absolutely positioned. Overflow is hidden.</p>
+        
         <p>A <dfn id="webvtt-region-scroll">WebVTT region scroll setting</dfn> consists of the
         following components, in the order given:</p>
         <ol>
@@ -323,10 +408,89 @@
           <li><p>A U+003D EQUALS SIGN character (=).</p></li>
           <li><p>The string "<code>up</code>".</code></p></li>
         </ol>
-                
+        <p class ="note">The <a href="#webvtt-region-scroll">WebVTT region scroll setting</a>
+        specifies whether cues rendered into the region are allowed to move out of their initial
+        rendering place and roll up, i.e. move towards the top of the video viewport. If the
+        scroll setting is omitted, cues do not move from their rendered position.</p> 
+
+        <p class="note">Cues are added to a region one line at a time below existing cue lines.
+        When an existing rendered cue line is removed, and it was above another already rendered
+        cue line, that cue line moves into its space, thus scrolling in the given direction. If
+        there is not enough space for a new cue line to be added to a region, the top-most cue
+        line is pushed off the visible region (thus slowly becoming invisible as it moves into
+        overflow:hidden). This eventually makes space for the new cue line and allows it to be
+        added.</p>
+          
+        <p class="note">When there is no scroll direction, cue lines are added in the empty line
+        closest to the line in the bottom of the region. If no empty line is available, the oldest
+        line is replaced.</p>
+        
+      </section>
+
+      <section>
+        <h3>WebVTT region cue setting syntax</h3>
+
+        <p>We extend the existing set of <a class="externalDFN"
+        href="http://dev.w3.org/html5/webvtt/#webvtt-cue-settings">WebVTT cue settings</a> with a
+        new setting.</p>
+
+        <p>A <dfn id="webvtt-region-cue-setting">WebVTT region cue setting</dfn> consists of the
+        following components, in the order given:</p>
+        <ol>
+          <li><p>The string "<code>region</code>".</p></li>
+          <li><p>A U+003A COLON character (:).</p></li>
+          <li><p>An arbitrary string of one or more characters other than U+0020 SPACE
+          or U+0009 CHARACTER TABULATION character. The string must not contain the substring
+          "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
+          U+003E GREATER-THAN SIGN).</p></li>
+        </ol>
+        <p class ="note">A <a href="#webvtt-region-cue-setting">WebVTT region cue setting</a>
+        configures a cue to become part of a region by referencing the region's identifier unless
+        the cue has a <a href="http://dev.w3.org/html5/webvtt/#webvtt-vertical-text-cue-setting"
+        class="externalDFN">"vertical"</a>, <a class="externalDFN"
+        href="http://dev.w3.org/html5/webvtt/#webvtt-line-position-cue-setting">"line"</a> or
+        <a href="http://dev.w3.org/html5/webvtt/#webvtt-size-cue-setting"
+        class="externalDFN">"size"</a> cue setting. If a cue is part of a region, its cue settings
+        for <a class="externalDFN"
+        href="http://dev.w3.org/html5/webvtt/#webvtt-text-position-cue-setting">"position"</a> and
+        <a href="http://dev.w3.org/html5/webvtt/#webvtt-alignment-cue-setting"
+        class="externalDFN">"align"</a> are applied to the line boxes in the cue relative to the
+        region box.</p>
       </section>
     </section>
 
+    <section>
+      <h2>Extension of the WebVTT parser algorithm</h2>
+
+      <p>The <a
+      href="http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#text-track-model"
+      class="externalDFN">WebVTT parser algorithm</a> is extended to parse the <a class="internalDFN"
+      href="#webvtt-metadata-header">WebVTT region metadata header</a> and the <a class="internalDFN"
+      href="#webvtt-region-cue-setting">WebVTT region cue setting</a>.</p>
+
+      <p>
+
+      <section>
+        <h3>Extension of WebVTT header parsing</h3>
+
+        <p>This is an extension of step 15 of the <a class="externalDFN"
+        href="http://dev.w3.org/html5/webvtt/#webvtt-parser-algorithm">WebVTT parser algorithm</a>.</p>
+        
+        <ol start="15">
+          <li><i>Metadata header loop</i>: If <var>line</var> is not the empty string, run the following substeps:
+            <ol>
+              <li><i>Metadata header creation</i>: Let <var>field</var> be a new <>
+              <li>jump back to the step labeled header</li>
+            </ol>
+          </li>
+        </ol>
+
+      </section>
+
+      <section>
+        <h3>Extension of WebVTT cue creation</h3>
+      </section>
+    </section>
 
     <section class='appendix'>
       <h2>References</h2>
@@ -337,6 +501,11 @@
        <dt id="refsFCC">[FCC]</dt>
        <dd><cite><a href="http://www.fcc.gov/guides/captioning-internet-video-programming">Captioning of Internet Video Programming, 13 June 2012</a></cite>, US FCC (Federal Communications Commission).</dd>
 
+       <dt id="refsHTML">[HTML]</dt>
+       <dd><cite><a href="http://www.w3.org/html/wg/drafts/html/master/">HTML 5.1 Nightly:
+       A vocabulary and associated APIs for HTML and XHTML</a></cite>, Robin Berjon, Travis
+       Leithead, Erika Doyle Navara, Edward O'Connor, Silvia Pfeiffer. W3C.</dd>
+
        <dt id="refsWEBVTT">[WEBVTT]</dt>
        <dd><cite><a href="http://dev.w3.org/html5/webvtt/">WebVTT: Web Video Text Tracks</a></cite>, Ian Hickson. W3C.</dd>