Accessibility/HTML5 captions v2: Difference between revisions

fixed typo
(replace all element starts with <)
(fixed typo)
 
(18 intermediate revisions by 2 users not shown)
Line 4: Line 4:


The [https://wiki.mozilla.org/Accessibility/Experiment1_feedback feedback on the first version] has encouraged a full work-over of the specification.
The [https://wiki.mozilla.org/Accessibility/Experiment1_feedback feedback on the first version] has encouraged a full work-over of the specification.
Please leave feedback on this second version at [https://wiki.mozilla.org/Accessibility/Experiment2_feedback https://wiki.mozilla.org/Accessibility/Experiment2_feedback].


A particular change is the introduction of a grouping-level element between the media element and the itext element. This has several advantages: the itext elements inside this element are regarded as alternative tracks for display in one region, only at most one of them can be active at any point in time, a default display style can be associated with them, and event handlers for entering and leaving a new element can be associated. The only disadvantage is that there are now two new elements rather than only one to extend an already large HTML5 specification.
A particular change is the introduction of a grouping-level element between the media element and the itext element. This has several advantages: the itext elements inside this element are regarded as alternative tracks for display in one region, only at most one of them can be active at any point in time, a default display style can be associated with them, and event handlers for entering and leaving a new element can be associated. The only disadvantage is that there are now two new elements rather than only one to extend an already large HTML5 specification.
Line 28: Line 30:


Content attributes:
Content attributes:
     Global attributes (include id, class and style)
     Global attributes (include id, class, title and style)
     category
     category
     active
     active
Line 35: Line 37:


     [Callable=namedItem]
     [Callable=namedItem]
     interface HTMLItextElement : HTMLElement {
     interface HTMLItextListElement : HTMLElement {
               attribute DOMString category;
               attribute DOMString category;
               attribute DOMString active;
               attribute DOMString active;
              attribute DOMString name;


       // event handler  
       // event handler  
Line 64: Line 67:


The "active" attribute describes which itext element is active and can have the values "none", "auto", or the id name of a contained itext element. In case of an error, no itext element will be active. The default value is "auto", which means an itext track is selected based on the browser settings. These include the browser's language setting and its setting related to accessibility - e.g. for blind users no text is displayed, but if a TAD track is available, it will be activated in the selected language.
The "active" attribute describes which itext element is active and can have the values "none", "auto", or the id name of a contained itext element. In case of an error, no itext element will be active. The default value is "auto", which means an itext track is selected based on the browser settings. These include the browser's language setting and its setting related to accessibility - e.g. for blind users no text is displayed, but if a TAD track is available, it will be activated in the selected language.
The "name" attribute is optional. It specifies the name that should be used in a menu that is created when there are several itextlist elements and each itextlist represents a submenu.




Line 109: Line 114:


These functions allow cues to be associated with text elements, e.g. the display of a special offer, or moving to another sentence in a full text transcript of a video.
These functions allow cues to be associated with text elements, e.g. the display of a special offer, or moving to another sentence in a full text transcript of a video.


== The itext element ==
== The itext element ==
Line 149: Line 153:
       readonly attribute langName;
       readonly attribute langName;


      void fetch();
       DOMString currentText(currentTime);
       DOMString currentText(currentTime);
     };     
     };     
Line 161: Line 164:
The src  attribute gives the address of the external itext resource. The value of the attribute must be a valid URL identifying a text resource of the type given by the type attribute, if the attribute is present, or of the type "text/srt", if the attribute is absent. This attribute is required to enable the user agent to pick the correct parser for the file, even if it only receives a "text/plain" resource.
The src  attribute gives the address of the external itext resource. The value of the attribute must be a valid URL identifying a text resource of the type given by the type attribute, if the attribute is present, or of the type "text/srt", if the attribute is absent. This attribute is required to enable the user agent to pick the correct parser for the file, even if it only receives a "text/plain" resource.


The type attribute gives the format of the data, RFC 2046. If the attribute is present, its value must be a valid MIME type, optionally with parameters. The charset parameter must not be specified. (The default, which is used if the attribute is absent, is "text/srt".) [RFC2046]
The type attribute gives the format of the data, RFC 2046. If the attribute is present, its value must be a valid MIME type, optionally with parameters. The type parameter must not be specified. (The default, which is used if the attribute is absent, is "text/srt".) [RFC2046]


NOTE: text/srt will need to be registered as a mime type (as well as a format standardisation)
NOTE: text/srt will need to be registered as a mime type (as well as a format standardisation)
Line 172: Line 175:
2. Itext fetching
2. Itext fetching


An itext resource is not automatically fetched as the element is parsed, since there may be a sizeable number of external resources to retrieve for an individual video or audio element. It is only fetched under the following circumstances:
An itext resource is not automatically fetched as the element is parsed, since there may be a sizeable number of external resources to retrieve for an individual video or audio element. It is only fetched if the parent itextlist element activates it.
 
* if the parent itextlist element activates it or
* if the fetch() function has been called on the itext element.


Fetching an itext resource means following the src URL and retrieving the resource. Fetching the external resource must not delay the load event of the element's document. The user agent will work with the fetched itext resource as soon as it is retrieved.
Fetching an itext resource means following the src URL and retrieving the resource. Fetching the external resource must not delay the audio or video. The user agent will work with the fetched itext resource as soon as it is retrieved.


The "fetched" attribute will signify if the fetching process has finished.
The "fetched" attribute will signify if the fetching process has finished.
Line 184: Line 184:
3. Itext display
3. Itext display


An activated itext resource displays its content on screen.
An activated itext resource displays its content into a specified screen area provided by the browser based on default styling. If the active itext resource changes, the text will change to originate from the new resource as soon as possible to the browser without interrupting any of its other display requirements (e.g. audio/video playback).
 
An itext resource that has been fetched using the fetch() function is not activated until its itextlist parent activates it. In this way, itext resources can be pre-fetched.




Line 220: Line 218:


The currentText(currentTime) function returns the current text segment from the itext resource, i.e. the text that is active at the parent's currentTime attribute value.
The currentText(currentTime) function returns the current text segment from the itext resource, i.e. the text that is active at the parent's currentTime attribute value.


== Examples ==
== Examples ==
Line 244: Line 241:
   &lt;video src="video.ogv" controls>
   &lt;video src="video.ogv" controls>
     &lt;itextlist category="CC" active="none">
     &lt;itextlist category="CC" active="none">
       &lt;itext src="caption_en.dfxp" lang="en" type="application/ttaf+xml"/>
       &lt;itext src="caption_en.xml" lang="en" type="application/ttaf+xml"/>
       &lt;itext src="caption_de.srt"  lang="de" charset="ISO-8859-1" delay="3" stretch="97%"/>
       &lt;itext src="caption_de.srt"  lang="de" charset="ISO-8859-1" delay="3" stretch="97%"/>
       &lt;itext src="caption_fr.smil" lang="fr" type="application/smil+xml" />
       &lt;itext src="caption_fr.smil" lang="fr" type="application/smil+xml" />
Line 285: Line 282:
   &lt;/video>
   &lt;/video>


A JavaScript function is called upon entering or leaving a new chapter. The associated text may or may not be displayed: visibility can be set to hidden for the text area in which the chapter text is displayed.
A JavaScript function is called upon entering or leaving a new chapter.
 
5. Multiple itextlist elements
 
  &lt;video src="video.ogv" aria-label="test video" title="test video" controls>
    &lt;itextlist category="SUB" name="subtitles">
      &lt;itext src="sub_en.srt" lang="en"/>
      &lt;itext src="sub_de.srt" lang="de"/>
      &lt;itext src="sub_fr.srt" lang="fr"/>
      &lt;itext src="sub_jp.srt" lang="jp"/>
    &lt;/itextlist>
 
    &lt;itextlist category="TAD" active="tad_en" name="spoken transcript">
      &lt;itext id="tad_en" src="tad_en.srt" lang="en"/>
      &lt;itext id="tad_de" src="tad_de.srt" lang="de"/>
      &lt;itext id="tad_fr" src="tad_fr.srt" lang="fr"/>
      &lt;itext id="tad_jp" src="tad_jp.srt" lang="jp"/>
    &lt;/itextlist>
  &lt;/video>
 
As the controls attribute in the video element is specified, this creates a menu with subtitles and spoken transcript as the submenu items to select from. Only one track can be activated at any point in time from within a itextlist. Also, an additional element of "none" should be added by the browser to allow to deactivate all itext elements.