--- a/media-source/byte-stream-format-registry-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Media Source Extensions Byte Stream Format Registry</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/byte-stream-format-registry.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- //publishDate: "2014-07-17",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- ],
-
- mseDefGroupName: "byte-stream-format-registry",
- mseUnusedGroupNameExcludeList: ["media-source"],
- mseContributors: [
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {
- },
-
- postProcess: [ mediaSourcePostProcessor ]
- };
- </script>
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
-
- <style type="text/css">
- #registry table { border-collapse: collapse; border-style: hidden hidden none hidden; }
- #registry table thead, table tbody { border-bottom: solid; }
- #registry table tbody th:first-child { border-left: solid; }
- #registry table tbody th { text-align: left; }
- #registry table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
- </style>
- </head>
- <body>
-
- <section id="purpose">
- <h2>Purpose</h2>
- <p>This registry is intended to enhance interoperability among implementations and users of
- <a class="externalDFN">SourceBuffer</a> objects described in the
- <a def-id="mse-spec"></a>(MSE) specification. In particular, this registry provides the means (1) to identify
- and avoid MIME-type collisions among byte stream formats, and (2) to disclose information about byte stream formats accepted by MSE
- implementations to promote interoperability.
- </section>
-
- <section id="organization">
- <h2>Organization</h2>
- <p>The registry maintains a mapping between MIME-type/subtype pairs and byte stream format specifications. The byte stream format specifications describe the
- structure and semantics of byte streams accepted by <a class="externalDFN">SourceBuffer</a> objects
- created with the associated MIME-type/subtype pair.</p>
- <p>This registry is not intended to include any information on whether a byte stream format is encumbered by intellectual property claims. Implementors and users
- are advised to seek appropriate legal counsel in this matter if they intend to implement or use a specific byte stream format.</p>
- </section>
-
- <section id="entry-requirements">
- <h2>Registration Entry Requirements</h2>
- <ol>
- <li>Each entry must include a unique MIME-type/subtype pair. If the byte stream format is derived-from an existing file format, then it should use the
- MIME-type/subtype pairs typically used for the file format.</li>
- <li>Each entry must include a <a def-id="generate-timestamps-flag"></a> value that must be used by
- <a class="externalDFN">SourceBuffer</a> when handling the byte stream format.</li>
- <li>Each entry must include a link that references a publically available specification. It is recommended that such a specification be made available
- without cost (other than reasonable shipping and handling if not available by online means).</li>
- <li>Each entry must comply with all requirements outlined in the <a def-id="byte-stream-formats-section"></a>
- of the <a def-id="mse-spec"></a> specification.</li>
- <li>Candidate entries must be announced on <a href="public-html-media@w3.org">public-html-media@w3.org</a>(<a href="public-html-media-request@w3.org">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>) so they can be discussed and evaluated for compliance before being added to the
- registry.</li>
- </ol>
- <p>If a registration fails to satisfy a mandatory requirement specified above, then it may be removed from the registry (without prejudice).
- </section>
-
- <section id="registry">
- <h2>Registry</h2>
- <table>
- <thead>
- <tr>
- <th>MIME type/subtype</th>
- <th>Public Specification(s)</th>
- <th>Generate Timestamps Flag</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- audio/webm<br>
- video/webm
- </td>
- <td><a href="webm-byte-stream-format.html">WebM Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mp4<br>
- video/mp4
- </td>
- <td><a href="isobmff-byte-stream-format.html">ISO BMFF Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mp2t<br>
- video/mp2t
- </td>
- <td><a href="mp2t-byte-stream-format.html">MPEG-2 Transport Streams Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mpeg<br>
- audio/aac
- </td>
- <td><a href="mpeg-audio-byte-stream-format.html">MPEG Audio Byte Stream Format</a></td>
- <td>true</td>
- </tr>
- </tbody>
- </table>
- </section>
- </body>
-</html>
--- a/media-source/byte-stream-format-registry.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/byte-stream-format-registry.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,280 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>Media Source Extensions Byte Stream Format Registry</title>
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
-
- <style type="text/css">
- #registry table { border-collapse: collapse; border-style: hidden hidden none hidden; }
- #registry table thead, table tbody { border-bottom: solid; }
- #registry table tbody th:first-child { border-left: solid; }
- #registry table tbody th { text-align: left; }
- #registry table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
- </style>
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">Media Source Extensions Byte Stream Format Registry</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-04-30T03:32:56.000Z" id="w3c-editor-s-draft-29-april-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-04-29">29 April 2014</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/byte-stream-format-registry.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/byte-stream-format-registry.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR//">http://www.w3.org/TR//</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/byte-stream-format-registry.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/byte-stream-format-registry.html</a></dd>
-
-
-
-
-
-
-
-
- <dt>Editor:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2014
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
-
- <section id="purpose" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_purpose"><span class="secno">1. </span>Purpose</h2>
- <p>This registry is intended to enhance interoperability among implementations and users of
- <code><a href="media-source.html#idl-def-SourceBuffer" class="idlType">SourceBuffer</a></code> objects described in the
- <a href="media-source.html#">Media Source Extensions</a>(MSE) specification. In particular, this registry provides the means (1) to identify
- and avoid MIME-type collisions among byte stream formats, and (2) to disclose information about byte stream formats accepted by MSE
- implementations to promote interoperability.
- </p></section>
-
- <section id="organization" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_organization"><span class="secno">2. </span>Organization</h2>
- <p>The registry maintains a mapping between MIME-type/subtype pairs and byte stream format specifications. The byte stream format specifications describe the
- structure and semantics of byte streams accepted by <code><a href="media-source.html#idl-def-SourceBuffer" class="idlType">SourceBuffer</a></code> objects
- created with the associated MIME-type/subtype pair.</p>
- <p>This registry is not intended to include any information on whether a byte stream format is encumbered by intellectual property claims. Implementors and users
- are advised to seek appropriate legal counsel in this matter if they intend to implement or use a specific byte stream format.</p>
- </section>
-
- <section id="entry-requirements" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_entry-requirements"><span class="secno">3. </span>Registration Entry Requirements</h2>
- <ol>
- <li>Each entry must include a unique MIME-type/subtype pair. If the byte stream format is derived-from an existing file format, then it should use the
- MIME-type/subtype pairs typically used for the file format.</li>
- <li>Each entry must include a <var><a href="media-source.html#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> value that must be used by
- <code><a href="media-source.html#idl-def-SourceBuffer" class="idlType">SourceBuffer</a></code> when handling the byte stream format.</li>
- <li>Each entry must include a link that references a publically available specification. It is recommended that such a specification be made available
- without cost (other than reasonable shipping and handling if not available by online means).</li>
- <li>Each entry must comply with all requirements outlined in the <a href="media-source.html#byte-stream-formats">byte stream formats section</a>
- of the <a href="media-source.html#">Media Source Extensions</a> specification.</li>
- <li>Candidate entries must be announced on <a href="public-html-media@w3.org">public-html-media@w3.org</a>(<a href="public-html-media-request@w3.org">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>) so they can be discussed and evaluated for compliance before being added to the
- registry.</li>
- </ol>
- <p>If a registration fails to satisfy a mandatory requirement specified above, then it may be removed from the registry (without prejudice).
- </p></section>
-
- <section id="registry" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_registry"><span class="secno">4. </span>Registry</h2>
- <table>
- <thead>
- <tr>
- <th>MIME type/subtype</th>
- <th>Public Specification(s)</th>
- <th>Generate Timestamps Flag</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- audio/webm<br>
- video/webm
- </td>
- <td><a href="webm-byte-stream-format.html">WebM Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mp4<br>
- video/mp4
- </td>
- <td><a href="isobmff-byte-stream-format.html">ISO BMFF Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mp2t<br>
- video/mp2t
- </td>
- <td><a href="mp2t-byte-stream-format.html">MPEG-2 Transport Streams Byte Stream Format</a></td>
- <td>false</td>
- </tr>
- <tr>
- <td>
- audio/mpeg<br>
- audio/aac
- </td>
- <td><a href="mpeg-audio-byte-stream-format.html">MPEG Audio Byte Stream Format</a></td>
- <td>true</td>
- </tr>
- </tbody>
- </table>
- </section>
-
-
-<form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/byte-stream-format-registry.html");
+ </script>
+ </head>
+ <body>
+ The Media Source Extensions Byte Stream Format Registry has moved to <a href="https://w3c.github.io/media-source/byte-stream-format-registry.html">https://w3c.github.io/media-source/byte-stream-format-registry.html</a>.
+ </body>
+</html>
--- a/media-source/isobmff-byte-stream-format-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>ISO BMFF Byte Stream Format</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- (function() {
- var isobmffContainerSpecDefinitions = {
- 'iso-14496-12': { fragment: 'http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip', link_text: 'ISO/IEC 14496-12', },
- 'movie-fragment-relative-addressing': { fragment: '#movie-fragment-relative-addressing', link_text: 'movie-fragment relative addressing'}
- };
-
- mediaSourceAddDefinitionInfo("isobmff-byte-stream-format", "", isobmffContainerSpecDefinitions);
- })();
- </script>
-
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/isobmff-byte-stream-format.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- //publishDate: "2014-07-17",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- { name: "Adrian Bateman", url: "", company: "Microsoft Corporation", companyURL: "http://www.microsoft.com/" },
- { name: "Mark Watson", url: "", company: "Netflix Inc.", companyURL: "http://www.netflix.com/" },
- ],
-
- mseDefGroupName: "isobmff-byte-stream-format",
- mseUnusedGroupNameExcludeList: ["media-source"],
- mseContributors: [
- "Steven Robertson",
- "Kevin Streeter",
- "Joe Steele",
- "Michael Thornburgh",
- "John Simmons",
- "Jerry Smith",
- "Cyril Concolato",
- "David Singer",
- "Chris Poole",
- "Jer Noble"
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {},
-
- postProcess: [ mediaSourcePostProcessor ]
-
- };
- </script>
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
- <style>
- .iso-box { font-weight: bold; }
- .iso-var { font-style: italic; }
- </style>
-
- </head>
- <body>
- <section id="abstract">
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on the ISO Base Media
- File Format.
- </section>
-
- <section id="introduction">
- <h2>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support the ISO Base Media File Format
- <a def-id="iso-14496-12"></a> (ISO BMFF).</p> It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a def-id="init-segments"></a>, <a def-id="media-segments"></a>, and <a def-id="random-access-points"></a> required by
- the <a def-id="byte-stream-formats-section"></a> of the Media Source Extensions spec.</p>
- </section>
-
- <section id="mime-parameters">
- <h2>MIME-type parameters</h2>
- <p>This section specifies the parameters that can be used in the MIME-type passed to <a def-id="isTypeSupported"></a> or <a def-id="addSourceBuffer"></a>.</p>
- <p>MIME-types for this specification must conform to the rules outlined for "audio/mp4" and "video/mp4" in <a href="http://tools.ietf.org/html/rfc6381">RFC 6381</a>.
- </p>
- <div class="note">Implementations may only implement a subset of the codecs and profiles mentioned in the RFC.</div>
- </section>
-
- <section id="iso-init-segments">
- <h4>Initialization Segments</h4>
- <p>An ISO BMFF <a def-id="init-segment"></a> is defined in this specification as a single File Type Box (<span class="iso-box">ftyp</span>) followed by a single Movie Header Box (<span class="iso-box">moov</span>).</p>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are met:</p>
- <ol>
- <li>A File Type Box contains a <span class="iso-var">major_brand</span> or <span class="iso-var">compatible_brand</span> that the user agent does not support.</li>
- <li>A box or field in the Movie Header Box is encountered that violates the requirements mandated
- by the <span class="iso-var">major_brand</span> or one of the
- <span class="iso-var">compatible_brands</span> in the File Type Box.</li>
- <li>The tracks in the Movie Header Box contain samples (i.e. the <span class="iso-var">entry_count</span> in the
- <span class="iso-box">stts</span>, <span class="iso-box">stsc</span> or <span class="iso-box">stco</span> boxes are not set to zero).</li>
- <li>A Movie Extends (<span class="iso-box">mvex</span>) box is not contained in the Movie (<span class="iso-box">moov</span>) box to indicate that Movie Fragments are to be expected.</li>
- </ol>
- <p>The user agent must support setting the offset from media composition time to movie presentation time by handling an Edit Box (<span class="iso-box">edts</span>) containing a single Edit List Box
- (<span class="iso-box">elst</span>) that contains a single edit with media rate one. This edit may have a duration of 0 (indicating that it spans all subsequent media) or may have a non-zero duration
- (indicating the total duration of the movie including fragments).</p>
-
- <p>The user agent must support parameter sets (e.g., PPS/SPS) stored in the sample entry (as defined for avc1/avc2), and should support parameter
- sets stored inband in the samples themselves (as defined for avc3/avc4).</p>
- <p class="note">For maximum content interoperability, user agents are strongly advised to support both inband and out-of-band storage of the SPS and PPS.</p>
-
- <p>Valid top-level boxes such as <span class="iso-box">pdin</span>, <span class="iso-box">free</span>, and <span class="iso-box">sidx</span> are
- allowed to appear before the <span class="iso-box">moov</span> box. These boxes must be accepted and ignored by the user agent and are not
- considered part of the <a def-id="init-segment"></a> in this specification.</p>
- </section>
-
- <section id="iso-media-segments">
- <h4>Media Segments</h4>
- <p>An ISO BMFF <a def-id="media-segment"></a> is defined in this specification as one optional
- Segment Type Box (<span class="iso-box">styp</span>) followed by a single Movie Fragment Box
- (<span class="iso-box">moof</span>) followed by one or more Media Data Boxes (<span class="iso-box">mdat</span>).
- If the Segment Type Box is not present, the segment must conform to the brands listed in the
- File Type Box (<span class="iso-box">ftyp</span>) in the <a def-id="init-segment"></a>.</p>
- <p>Valid top-level boxes defined in <a def-id="iso-14496-12"></a> other than <span class="iso-box">ftyp</span>,
- <span class="iso-box">moov</span>, <span class="iso-box">styp</span>, <span class="iso-box">moof</span>, and <span class="iso-box">mdat</span> are allowed to appear between the end of an
- <a def-id="init-segment"></a> or <a def-id="media-segment"></a> and before the beginning of a new <a def-id="media-segment"></a>.
- These boxes must be accepted and ignored by the user agent and are not considered part of the <a def-id="media-segment"></a> in this
- specification.
- </p>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are met:</p>
- <ol>
- <li>A box or field in the Movie Fragment Box is encountered that violates the requirements mandated
- by the <span class="iso-var">major_brand</span> or one of the
- <span class="iso-var">compatible_brands</span> in the Segment Type Box in this
- <a def-id="media-segment"></a> or the File Type Box in the <a def-id="init-segment"></a> if a
- Segment Type Box is not present.</li>
- <li>This <a def-id="media-segment"></a> contains a Segment Type Box that is not compatible with the
- File Type Box in the <a def-id="init-segment"></a>.</li>
- <li>The Movie Fragment Box does not contain at least one Track Fragment Box (<span class="iso-box">traf</span>).</li>
- <li>The Movie Fragment Box does not use <a def-id="movie-fragment-relative-addressing"></a>.</li>
- <li>External data references are being used.</li>
- <li>At least one Track Fragment Box does not contain a Track Fragment Decode Time Box (<span class="iso-box">tfdt</span>)</li>
- <li>The Media Data Boxes do not contain all the samples referenced by the Track Fragment Run Boxes (<span class="iso-box">trun</span>) of the Movie Fragment Box.</li>
- <li>Inband parameter sets are not present in the appropriate samples and parameter sets are not present in the last initialization segment appended.</li>
- </ol>
-
- <p>A Movie Fragment Box uses <dfn id="movie-fragment-relative-addressing">movie-fragment relative addressing</dfn>
- when the first Track Fragment Run(<span class="iso-box">trun</span>) box in each Track Fragment Box
- has the <span class="iso-var">data-offset-present</span> flag set and either of the following
- conditions are met:</p>
- <ul>
- <li>Every Track Fragment Box in a Movie Fragment Box has the <span class="iso-var">default-base-is-moof</span> flag set.
- <p class="note">This implies that the <span class="iso-var">base-data-offset-present</span> flag
- is not set.</p>
- </li>
- <li>The Movie Fragment Box contains a single Track Fragment Box and that box does not have the <span class="iso-var">base-data-offset-present</span> flag set.</li>
- </ul>
- </section>
-
- <section id="iso-random-access-points">
- <h4>Random Access Points</h4>
- <p>A <a def-id="random-access-point"></a> as defined in this specification corresponds to a Stream Access Point of type 1 or 2 as defined in Annex I of <a def-id="iso-14496-12"></a>.</p>
- </section>
-
- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section>
-
- <section id="revision-history">
- <h2>Revision History</h2>
- <table class="old-table">
- <thead>
- <tr>
- <th>Version</th>
- <th>Comment</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>20 June 2014</td>
- <td>
- <ul>
- <li>Bug 26066 - Clarify edit list requirements.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/cad94fce3b90/media-source/isobmff-byte-stream-format.html">03 March 2014</a></td>
- <td>
- <ul>
- <li>Bug 24903 - Add ftyp & styp validation text.</li>
- <li>Bug 24345 - Loosen restrictions and clarify what relative addressing means.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/190b670254ff/media-source/isobmff-byte-stream-format.html">02 December 2013</a></td>
- <td>Initial CR version.</td>
- </tr>
- </tbody>
- </table>
- </body>
-</html>
--- a/media-source/isobmff-byte-stream-format.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/isobmff-byte-stream-format.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,444 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>ISO BMFF Byte Stream Format</title>
-
-
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <style>/* --- ISSUES/NOTES --- */
-div.issue-title, div.note-title {
- padding-right: 1em;
- min-width: 7.5em;
- color: #b9ab2d;
-}
-div.issue-title { color: #e05252; }
-div.note-title { color: #2b2; }
-div.issue-title span, div.note-title span {
- text-transform: uppercase;
-}
-div.note, div.issue {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-.note > p:first-child, .issue > p:first-child { margin-top: 0 }
-.issue, .note {
- padding: .5em;
- border-left-width: .5em;
- border-left-style: solid;
-}
-div.issue, div.note {
- padding: 1em 1.2em 0.5em;
- margin: 1em 0;
- position: relative;
- clear: both;
-}
-span.note, span.issue { padding: .1em .5em .15em; }
-
-.issue {
- border-color: #e05252;
- background: #fbe9e9;
-}
-.note {
- border-color: #52e052;
- background: #e9fbe9;
-}
-
-
-</style><link rel="stylesheet" href="mse.css">
- <style>
- .iso-box { font-weight: bold; }
- .iso-var { font-style: italic; }
- </style>
-
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-
-@media print {
- .removeOnSave {
- display: none;
- }
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">ISO BMFF Byte Stream Format</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-06-21T00:12:30.000Z" id="w3c-editor-s-draft-20-june-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-06-20">20 June 2014</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/isobmff-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/isobmff-byte-stream-format.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR//">http://www.w3.org/TR//</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/isobmff-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/isobmff-byte-stream-format.html</a></dd>
-
-
-
-
-
-
-
-
-
- <dt>Editors:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Adrian Bateman</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.microsoft.com/">Microsoft Corporation</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mark Watson</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.netflix.com/">Netflix Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2014
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
- <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#abstract" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2><p>
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on the ISO Base Media
- File Format.
- </p></section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#sotd" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2>
-
-
-
- <p>
- <em>This section describes the status of this document at the time of its publication.
- Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the
- latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at
- http://www.w3.org/TR/.</em>
- </p>
-
- <p>
- This document was published by the <a href="http://www.w3.org/html/wg/">HTML Working Group</a> as an Editor's Draft.
-
-
- If you wish to make comments regarding this document, please send them to
- <a href="mailto:public-html-media@w3.org">public-html-media@w3.org</a>
- (<a href="mailto:public-html-media-request@w3.org?subject=subscribe">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
-
-
-
-
- All comments are welcome.
-
- </p>
-
-
- <p>
- Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
- Membership. This is a draft document and may be updated, replaced or obsoleted by other
- documents at any time. It is inappropriate to cite this document as other than work in
- progress.
- </p>
-
-
-
- <p>
-
- This document was produced by a group operating under the
- <a id="sotd_patent" about="" rel="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
- Policy</a>.
-
-
-
-
- <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
- disclosures</a>
-
- made in connection with the deliverables of the group; that page also includes
- instructions for disclosing a patent. An individual who has actual knowledge of a patent
- which the individual believes contains
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
- Claim(s)</a> must disclose the information in accordance with
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
- 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
-
-
- </p>
-
-
-
-
-</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#mime-parameters" class="tocxref"><span class="secno">2. </span>MIME-type parameters</a></li><li class="tocline"><a href="#iso-init-segments" class="tocxref"><span class="secno">3. </span>Initialization Segments</a></li><li class="tocline"><a href="#iso-media-segments" class="tocxref"><span class="secno">4. </span>Media Segments</a></li><li class="tocline"><a href="#iso-random-access-points" class="tocxref"><span class="secno">5. </span>Random Access Points</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">6. </span>Acknowledgments</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">7. </span>Revision History</a></li></ul></section>
-
- <section id="introduction" typeof="bibo:Chapter" resource="#introduction" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_introduction"><span class="secno">1. </span>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support the ISO Base Media File Format
- <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a> (ISO BMFF).</p> It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a href="media-source.html#init-segment">initialization segments</a>, <a href="media-source.html#media-segment">media segments</a>, and <a href="media-source.html#random-access-point">random access points</a> required by
- the <a href="media-source.html#byte-stream-formats">byte stream formats section</a> of the Media Source Extensions spec.<p></p>
- </section>
-
- <section id="mime-parameters" typeof="bibo:Chapter" resource="#mime-parameters" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mime-parameters"><span class="secno">2. </span>MIME-type parameters</h2>
- <p>This section specifies the parameters that can be used in the MIME-type passed to <code><a href="media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported()</a></code> or <code><a href="media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.</p>
- <p>MIME-types for this specification must conform to the rules outlined for "audio/mp4" and "video/mp4" in <a href="http://tools.ietf.org/html/rfc6381">RFC 6381</a>.
- </p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_1"><span>Note</span></div><div class="">Implementations may only implement a subset of the codecs and profiles mentioned in the RFC.</div></div>
- </section>
-
- <section id="iso-init-segments" typeof="bibo:Chapter" resource="#iso-init-segments" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_iso-init-segments"><span class="secno">3. </span>Initialization Segments</h2>
- <p>An ISO BMFF <a href="media-source.html#init-segment">initialization segment</a> is defined in this specification as a single File Type Box (<span class="iso-box">ftyp</span>) followed by a single Movie Header Box (<span class="iso-box">moov</span>).</p>
-
- <p>The user agent must run the <a href="media-source.html#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="media-source.html#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are met:</p>
- <ol>
- <li>A File Type Box contains a <span class="iso-var">major_brand</span> or <span class="iso-var">compatible_brand</span> that the user agent does not support.</li>
- <li>A box or field in the Movie Header Box is encountered that violates the requirements mandated
- by the <span class="iso-var">major_brand</span> or one of the
- <span class="iso-var">compatible_brands</span> in the File Type Box.</li>
- <li>The tracks in the Movie Header Box contain samples (i.e. the <span class="iso-var">entry_count</span> in the
- <span class="iso-box">stts</span>, <span class="iso-box">stsc</span> or <span class="iso-box">stco</span> boxes are not set to zero).</li>
- <li>A Movie Extends (<span class="iso-box">mvex</span>) box is not contained in the Movie (<span class="iso-box">moov</span>) box to indicate that Movie Fragments are to be expected.</li>
- </ol>
- <p>The user agent must support setting the offset from media composition time to movie presentation time by handling an Edit Box (<span class="iso-box">edts</span>) containing a single Edit List Box
- (<span class="iso-box">elst</span>) that contains a single edit with media rate one. This edit may have a duration of 0 (indicating that it spans all subsequent media) or may have a non-zero duration
- (indicating the total duration of the movie including fragments).</p>
-
- <p>The user agent must support parameter sets (e.g., PPS/SPS) stored in the sample entry (as defined for avc1/avc2), and should support parameter
- sets stored inband in the samples themselves (as defined for avc3/avc4).</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_2"><span>Note</span></div><p class="">For maximum content interoperability, user agents are strongly advised to support both inband and out-of-band storage of the SPS and PPS.</p></div>
-
- <p>Valid top-level boxes such as <span class="iso-box">pdin</span>, <span class="iso-box">free</span>, and <span class="iso-box">sidx</span> are
- allowed to appear before the <span class="iso-box">moov</span> box. These boxes must be accepted and ignored by the user agent and are not
- considered part of the <a href="media-source.html#init-segment">initialization segment</a> in this specification.</p>
- </section>
-
- <section id="iso-media-segments" typeof="bibo:Chapter" resource="#iso-media-segments" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_iso-media-segments"><span class="secno">4. </span>Media Segments</h2>
- <p>An ISO BMFF <a href="media-source.html#media-segment">media segment</a> is defined in this specification as one optional
- Segment Type Box (<span class="iso-box">styp</span>) followed by a single Movie Fragment Box
- (<span class="iso-box">moof</span>) followed by one or more Media Data Boxes (<span class="iso-box">mdat</span>).
- If the Segment Type Box is not present, the segment must conform to the brands listed in the
- File Type Box (<span class="iso-box">ftyp</span>) in the <a href="media-source.html#init-segment">initialization segment</a>.</p>
- <p>Valid top-level boxes defined in <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a> other than <span class="iso-box">ftyp</span>,
- <span class="iso-box">moov</span>, <span class="iso-box">styp</span>, <span class="iso-box">moof</span>, and <span class="iso-box">mdat</span> are allowed to appear between the end of an
- <a href="media-source.html#init-segment">initialization segment</a> or <a href="media-source.html#media-segment">media segment</a> and before the beginning of a new <a href="media-source.html#media-segment">media segment</a>.
- These boxes must be accepted and ignored by the user agent and are not considered part of the <a href="media-source.html#media-segment">media segment</a> in this
- specification.
- </p>
-
- <p>The user agent must run the <a href="media-source.html#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="media-source.html#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are met:</p>
- <ol>
- <li>A box or field in the Movie Fragment Box is encountered that violates the requirements mandated
- by the <span class="iso-var">major_brand</span> or one of the
- <span class="iso-var">compatible_brands</span> in the Segment Type Box in this
- <a href="media-source.html#media-segment">media segment</a> or the File Type Box in the <a href="media-source.html#init-segment">initialization segment</a> if a
- Segment Type Box is not present.</li>
- <li>This <a href="media-source.html#media-segment">media segment</a> contains a Segment Type Box that is not compatible with the
- File Type Box in the <a href="media-source.html#init-segment">initialization segment</a>.</li>
- <li>The Movie Fragment Box does not contain at least one Track Fragment Box (<span class="iso-box">traf</span>).</li>
- <li>The Movie Fragment Box does not use <a href="#movie-fragment-relative-addressing">movie-fragment relative addressing</a>.</li>
- <li>External data references are being used.</li>
- <li>At least one Track Fragment Box does not contain a Track Fragment Decode Time Box (<span class="iso-box">tfdt</span>)</li>
- <li>The Media Data Boxes do not contain all the samples referenced by the Track Fragment Run Boxes (<span class="iso-box">trun</span>) of the Movie Fragment Box.</li>
- <li>Inband parameter sets are not present in the appropriate samples and parameter sets are not present in the last initialization segment appended.</li>
- </ol>
-
- <p>A Movie Fragment Box uses <dfn id="movie-fragment-relative-addressing">movie-fragment relative addressing</dfn>
- when the first Track Fragment Run(<span class="iso-box">trun</span>) box in each Track Fragment Box
- has the <span class="iso-var">data-offset-present</span> flag set and either of the following
- conditions are met:</p>
- <ul>
- <li>Every Track Fragment Box in a Movie Fragment Box has the <span class="iso-var">default-base-is-moof</span> flag set.
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_3"><span>Note</span></div><p class="">This implies that the <span class="iso-var">base-data-offset-present</span> flag
- is not set.</p></div>
- </li>
- <li>The Movie Fragment Box contains a single Track Fragment Box and that box does not have the <span class="iso-var">base-data-offset-present</span> flag set.</li>
- </ul>
- </section>
-
- <section id="iso-random-access-points" typeof="bibo:Chapter" resource="#iso-random-access-points" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_iso-random-access-points"><span class="secno">5. </span>Random Access Points</h2>
- <p>A <a href="media-source.html#random-access-point">random access point</a> as defined in this specification corresponds to a Stream Access Point of type 1 or 2 as defined in Annex I of <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a>.</p>
- </section>
-
- <section id="acknowledgements" typeof="bibo:Chapter" resource="#acknowledgements" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_acknowledgements"><span class="secno">6. </span>Acknowledgments</h2>
- The editors would like to thank Chris Poole, Cyril Concolato, David Singer, Jer Noble, Jerry Smith, Joe Steele, John Simmons, Kevin Streeter, Michael Thornburgh, and Steven Robertson for their contributions to this specification.
- </section>
-
- <section id="revision-history" typeof="bibo:Chapter" resource="#revision-history" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_revision-history"><span class="secno">7. </span>Revision History</h2>
- <table class="old-table">
- <thead>
- <tr>
- <th>Version</th>
- <th>Comment</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>20 June 2014</td>
- <td>
- <ul>
- <li>Bug 26066 - Clarify edit list requirements.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/cad94fce3b90/media-source/isobmff-byte-stream-format.html">03 March 2014</a></td>
- <td>
- <ul>
- <li>Bug 24903 - Add ftyp & styp validation text.</li>
- <li>Bug 24345 - Loosen restrictions and clarify what relative addressing means.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/190b670254ff/media-source/isobmff-byte-stream-format.html">02 December 2013</a></td>
- <td>Initial CR version.</td>
- </tr>
- </tbody>
- </table>
-
-
-</section><form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/isobmff-byte-stream-format.html");
+ </script>
+ </head>
+ <body>
+ The ISO BMFF Byte Stream Format spec has moved to <a href="https://w3c.github.io/media-source/isobmff-byte-stream-format.html">https://w3c.github.io/media-source/isobmff-byte-stream-format.html</a>.
+ </body>
+</html>
--- a/media-source/media-source-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3201 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Media Source Extensions</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "media-source",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- //publishDate: "2014-07-17",
- previousMaturity: "CR",
- previousPublishDate: "2014-01-09",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "",
- company: "Google Inc.", companyURL: "http://www.google.com/" },
- { name: "Adrian Bateman", url: "",
- company: "Microsoft Corporation", companyURL: "http://www.microsoft.com/" },
- { name: "Mark Watson", url: "",
- company: "Netflix Inc.", companyURL: "http://www.netflix.com/" },
- ],
-
- mseDefGroupName: "media-source",
- mseContributors: [
- "Bob Lund",
- "Alex Giladi",
- "Duncan Rowden",
- "Mark Vickers",
- "Glenn Adams",
- "Frank Galligan",
- "Steven Robertson",
- "Matt Ward",
- "David Dorwin",
- "Kevin Streeter",
- "Joe Steele",
- "Michael Thornburgh",
- "Philip Jägenstedt",
- "John Simmons",
- "Jerry Smith",
- "Pierre Lemieux",
- "Cyril Concolato",
- "Ralph Giles",
- "David Singer",
- "Tatsuya Igarashi",
- "Chris Poole",
- "Jer Noble",
- "Matthew Gregan",
- "Matt Wolenetz"
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {
- MediaSource: function() {},
- SourceBuffer: function() {},
- SourceBufferList: function() {},
- AppendMode: function() {},
- VideoPlaybackQuality: function() {},
- Stream: function() {},
- ArrayBuffer: function() {},
- ArrayBufferView: function() {},
- },
- postProcess: [ mediaSourcePostProcessor ],
-
- localBiblio: {
- "STREAMS-API": {
- title: "Streams API",
- href: "http://www.w3.org/TR/2013/WD-streams-api-20131105/",
- authors: ["Feras Moussa", "Takeshi Yoshino"],
- status: "WD",
- publisher: "W3C",
- },
- "MSE-REGISTRY": {
- title: "Media Source Extensions Byte Stream Format Registry",
- href: "byte-stream-format-registry.html",
- //href: "http://www.w3.org/2013/12/byte-stream-format-registry/",
- authors: ["Aaron Colwell"],
- publisher: "W3C",
- }
- }
- };
- </script>
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
- </head>
- <body>
-
- <section id="sotd">
- <p>The working groups maintains <a href="http://w3.org/brief/Mjcw">a list of all bug reports that the editors have not yet tried to address</a>. This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid.</p>
- <p>Implementors should be aware that this specification is not stable. <strong>Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways.</strong> Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the mailing list mentioned below and take part in the discussions.</p>
-
- <p>The following features are <strong>at risk</strong> and may be removed due to lack of implementation.
- </p>
- <ul>
- <li><a def-id="totalFrameDelay"></a></li>
- </ul>
-
- </section>
-
- <section id="abstract">
- This specification extends HTMLMediaElement to allow
- JavaScript to generate media streams for playback.
- Allowing JavaScript to generate streams facilitates a variety of use
- cases like adaptive streaming and time shifting live streams.
-
- <p>If you wish to make comments or file bugs regarding this document in a manner that is tracked by the W3C, please submit them via
- <a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=HTML%20WG&component=Media%20Source%20Extensions&short_desc=%5BMSE%5D%20">our public bug database</a>.
- </p>
- </section>
-
-
- <section id="introduction">
- <h2>Introduction</h2>
- <p>This specification allows JavaScript to dynamically construct media streams for <audio> and <video>.
- It defines objects that allow JavaScript to pass media segments to an <a def-id="videoref" name="htmlmediaelement">HTMLMediaElement</a> [[!HTML5]].
- A buffering model is also included to describe how the user agent acts when different media segments are
- appended at different times. Byte stream specifications used with these extensions are available in the byte stream format registry [[MSE-REGISTRY]].</p>
- <img src="pipeline_model.png" alt="Media Source Pipeline Model Diagram">
-
- <section id="goals">
- <h3>Goals</h3>
- <p>This specification was designed with the following goals in mind:</p>
- <ul>
- <li>Allow JavaScript to construct media streams independent of how the media is fetched.</li>
- <li>Define a splicing and buffering model that facilitates use cases like adaptive streaming, ad-insertion, time-shifting, and video editing.</li>
- <li>Minimize the need for media parsing in JavaScript.</li>
- <li>Leverage the browser cache as much as possible.</li>
- <li>Provide requirements for byte stream format specifications.</li>
- <li>Not require support for any particular media format or codec.</li>
- </ul>
- <p>This specification defines:</p>
- <ul>
- <li>Normative behavior for user agents to enable interoperability between user agents and web applications when processing media data.</li>
- <li>Normative requirements to enable other specifications to define media formats to be used within this specification.</li>
- </ul>
- </section>
-
- <section id="definitions">
- <h3>Definitions</h3>
-
- <dl>
- <dt id="active-track-buffers">Active Track Buffers</dt>
- <dd><p>The <a def-id="track-buffers"></a> that provide <a def-id="coded-frames"></a> for the <a def-id="audiotrack-enabled"></a>
- <a def-id="audiotracks"></a>, the <a def-id="videotrack-selected"></a> <a def-id="videotracks"></a>, and the
- <a def-id="texttrack-showing"></a> or <a def-id="texttrack-hidden"></a> <a def-id="texttracks"></a>. All these tracks are associated with
- <a>SourceBuffer</a> objects in the <a def-id="activeSourceBuffers"></a> list.</p>
- </dd>
-
- <dt id="append-window">Append Window</dt>
- <dd><p>A <a def-id="presentation-timestamp"></a> range used to filter out <a def-id="coded-frames"></a> while appending. The append window represents a single
- continuous time range with a single start time and end time. Coded frames with <a def-id="presentation-timestamp"></a> within this range are allowed to be appended
- to the <a>SourceBuffer</a> while coded frames outside this range are filtered out. The append window start and end times are controlled by
- the <a def-id="appendWindowStart"></a> and <a def-id="appendWindowEnd"></a> attributes respectively.</p></dd>
-
- <dt id="coded-frame">Coded Frame</dt>
- <dd><p>A unit of media data that has a <a def-id="presentation-timestamp"></a>, a <a def-id="decode-timestamp"></a>, and a <a def-id="coded-frame-duration"></a>.</p></dd>
-
- <dt id="coded-frame-duration">Coded Frame Duration</dt>
- <dd>
- <p>The duration of a <a def-id="coded-frame"></a>. For video and text, the duration indicates how long the video frame or text should be displayed. For audio, the duration represents the sum of all the samples contained within the coded frame. For example, if an audio frame contained 441 samples @44100Hz the frame duration would be 10 milliseconds.</p>
- </dd>
-
- <dt id="coded-frame-end-timestamp">Coded Frame End Timestamp</dt>
- <dd>
- <p>The sum of a <a def-id="coded-frame"></a> <a def-id="presentation-timestamp"></a> and its
- <a def-id="coded-frame-duration"></a>. It represents the <a def-id="presentation-timestamp"></a> that immediately follows the coded frame.</p>
- </dd>
-
- <dt id="coded-frame-group">Coded Frame Group</dt>
- <dd><p>A group of <a def-id="coded-frames"></a> that are adjacent and have monotonically increasing <a def-id="decode-timestamps"></a> without any gaps. Discontinuities detected by the
- <a def-id="coded-frame-processing-algorithm"></a> and <a def-id="abort"></a> calls trigger the start of a new coded frame group.</p>
- </dd>
-
- <dt id="decode-timestamp">Decode Timestamp</dt>
- <dd>
- <p> The decode timestamp indicates the latest time at which the frame needs to be decoded assuming instantaneous decoding and rendering of this and any dependant frames (this is equal to the <a def-id="presentation-timestamp"></a> of the earliest frame, in <a def-id="presentation-order"></a>, that is dependant on this frame). If frames can be decoded out of <a def-id="presentation-order"></a>, then the decode timestamp must be present in or derivable from the byte stream. The user agent must run the <a def-id="eos-decode"></a> if this is not the case. If frames cannot be decoded out of <a def-id="presentation-order"></a> and a decode timestamp is not present in the byte stream, then the decode timestamp is equal to the <a def-id="presentation-timestamp"></a>.</dt>
- </dd>
-
- <dt id="displayed-frame-delay">Displayed Frame Delay</dt>
- <dd>
- <p>The delay between a frame's presentation time and the actual time it was displayed, in a double-precision value in seconds & rounded to the nearest display refresh interval. This
- delay is always greater than or equal to zero since frames must never be displayed before their presentation time. Non-zero delays are a sign of playback jitter
- and possible loss of A/V sync.</p>
- </dd>
-
- <dt id="init-segment">Initialization Segment</dt>
- <dd>
- <p>A sequence of bytes that contain all of the initialization information required to decode a sequence of <a def-id="media-segments"></a>. This includes codec initialization data, <a def-id="track-id"></a> mappings for multiplexed segments, and timestamp offsets (e.g. edit lists).</p>
- <p class="note">The <a def-id="byte-stream-format-specs"></a> in the byte stream format registry [[MSE-REGISTRY]] contain format specific examples.</p>
-
- <dt id="media-segment">Media Segment</dt>
- <dd>
- <p>A sequence of bytes that contain packetized & timestamped media data for a portion of the <a def-id="media-timeline"></a>. Media segments are always associated with the most recently appended <a def-id="init-segment"></a>.</p>
- <p class="note">The <a def-id="byte-stream-format-specs"></a> in the byte stream format registry [[MSE-REGISTRY]] contain format specific examples.</p>
- </dd>
-
- <dt id="mediasource-object-url">MediaSource object URL</dt>
- <dd>
- <p>A MediaSource object URL is a unique <a def-id="blob-uri"></a> [[!FILE-API]] created by <a def-id="createObjectURL"></a>. It is used to attach a <a>MediaSource</a> object to an HTMLMediaElement.</p>
- <p>These URLs are the same as a <a def-id="blob-uri"></a>, except that anything in the definition of that feature that refers to <a def-id="File"></a> and <a def-id="Blob"></a> objects is hereby extended to also apply to <a>MediaSource</a> objects.</p>
- <p>The <a def-id="origin">origin</a> of the MediaSource object URL is the <a def-id="effective-script-origin"></a> of the document that called <a def-id="createObjectURL"></a>.</p>
- <p class="note">For example, the <a def-id="origin"></a> of the MediaSource object URL affects the way that the media element is <a href="http://www.w3.org/TR/html5/embedded-content-0.html#security-with-canvas-elements">consumed by canvas</a>.</p>
- </dd>
-
- <dt id="parent-media-source">Parent Media Source</dt>
- <dd><p>The parent media source of a <a>SourceBuffer</a> object is the <a>MediaSource</a> object that created it.</p></dd>
-
- <dt id="presentation-start-time">Presentation Start Time</dt>
- <dd><p>The presentation start time is the earliest time point in the presentation and specifies the <a def-id="videoref" name="initial-playback-position">initial playback position</a> and <a def-id="videoref" name="earliest-possible-position">earliest possible position</a>. All presentations created using this specification have a presentation start time of 0.</dd>
-
- <dt id="presentation-interval">Presentation Interval</dt>
- <dd>
- <p>The presentation interval of a <a def-id="coded-frame"></a> is the time interval from its <a def-id="presentation-timestamp"></a> to the <a def-id="presentation-timestamp"></a> plus the <a def-id="coded-frames-duration"></a>. For example, if a coded frame has a presentation timestamp of 10 seconds and a <a def-id="coded-frame-duration"></a> of 100 milliseconds, then the presentation interval would be [10-10.1). Note that the start of the range is inclusive, but the end of the range is exclusive.</p>
- </dd>
-
- <dt id="presentation-order">Presentation Order</dt>
- <dd>
- <p>The order that <a def-id="coded-frames"></a> are rendered in the presentation. The presentation order is achieved by ordering <a def-id="coded-frames"></a> in monotonically increasing order by their <a def-id="presentation-timestamps"></a>.</p>
- </dd>
-
- <dt id="presentation-timestamp">Presentation Timestamp</dt>
- <dd>
- <p>A reference to a specific time in the presentation. The presentation timestamp in a <a def-id="coded-frame"></a> indicates when the frame must be rendered.</p>
- </dd>
-
- <dt id="random-access-point">Random Access Point</dt>
- <dd><p>A position in a <a def-id="media-segment"></a> where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.</p></dd>
-
- <dt id="sourcebuffer-byte-stream-format-spec">SourceBuffer byte stream format specification</dt>
- <dd><p>The specific <a def-id="byte-stream-format-spec"></a> that describes the format of the byte stream accepted by a <a>SourceBuffer</a> instance. The
- <a def-id="byte-stream-format-spec"></a>, for a <a>SourceBuffer</a> object, is selected based on the <var>type</var> passed to the
- <a def-id="addSourceBuffer"></a> call that created the object.</p></dd>
-
- <dt id="sourcebuffer-configuration">SourceBuffer configuration</dt>
- <dd><p>A specific set of tracks distributed across one or more <a>SourceBuffer</a>
- objects owned by a single <a>MediaSource</a> instance.</p>
- <p>Implementations must support at least 1 <a>MediaSource</a> object with the following
- configurations:</p>
- <ul>
- <li>A single SourceBuffer with 1 audio track and/or 1 video track.</li>
- <li>Two SourceBuffers with one handling a single audio track and the other handling a single video track.</li>
- </ul>
- <p>MediaSource objects must support each of the configurations above, but they are only
- required to support one configuration at a time. Supporting multiple configurations at once
- or additional configurations is a quality of implementation issue.</p>
- </dd>
-
- <dt id="track-description">Track Description</dt>
- <dd><p>A byte stream format specific structure that provides the <a def-id="track-id"></a>, codec configuration, and other metadata for a single track. Each track description inside a single <a def-id="init-segment"></a> has a unique <a def-id="track-id"></a>. The user agent must run the <a def-id="eos-decode"></a> if the <a def-id="track-id"></a> is not unique within the <a def-id="init-segment"></a> .</p></dd>
-
- <dt id="track-id">Track ID</dt>
- <dd><p>A Track ID is a byte stream format specific identifier that marks sections of the byte stream as being part of a specific track. The Track ID in a <a def-id="track-description"></a> identifies which sections of a <a def-id="media-segment"></a> belong to that track.</p></dd>
-
- </dl>
- </section>
- </section>
-
- <section id="mediasource">
- <h2>MediaSource Object</h2>
- <p>The MediaSource object represents a source of media data for an HTMLMediaElement. It keeps track of the <a def-id="readyState"></a> for this source as well as a list of <a>SourceBuffer</a> objects that can be used to add media data to the presentation. MediaSource objects are created by the web application and then attached to an HTMLMediaElement. The application uses the <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a> to add media data to this source. The HTMLMediaElement fetches this media data from the <a>MediaSource</a> object when it is needed during playback.</p>
-
- <dl title="enum ReadyState" class="idl">
- <dt>closed</dt>
- <dd>
- Indicates the source is not currently attached to a media element.
- </dd>
- <dt>open</dt>
- <dd>
- The source has been opened by a media element and is ready for data to be appended to the <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>.
- </dd>
- <dt>ended</dt>
- <dd>
- The source is still attached to a media element, but <a def-id="endOfStream"></a> has been called.
- </dd>
- </dl>
-
- <dl title="enum EndOfStreamError" class="idl">
- <dt>network</dt>
- <dd>
- <p>Terminates playback and signals that a network error has occured.</p>
- <p class="note">JavaScript applications should use this status code to terminate playback with a network error. For example, if a network error occurs while fetching media data.</p>
- </dd>
- <dt>decode</dt>
- <dd>
- <p>Terminates playback and signals that a decoding error has occured.</p>
- <p class="note">JavaScript applications should use this status code to terminate playback with a decode error. For example, if a parsing error occurs while processing out-of-band media data.</p>
- </dd>
- </dl>
-
- <dl title="[Constructor] interface MediaSource : EventTarget" class='idl'>
- <dt>readonly attribute SourceBufferList sourceBuffers</dt>
- <dd>
- Contains the list of <a>SourceBuffer</a> objects associated with this <a>MediaSource</a>. When <a def-id="readyState"></a> equals <a def-id="closed"></a> this list will be empty. Once <a def-id="readyState"></a> transitions to <a def-id="open"></a> SourceBuffer objects can be added to this list by using <a def-id="addSourceBuffer"></a>.
- </dd>
-
- <dt>readonly attribute SourceBufferList activeSourceBuffers</dt>
- <dd>
- <p>Contains the subset of <a def-id="sourceBuffers"></a> that are providing the
- <a def-id="videoref" name="dom-videotrack-selected">selected video track</a>, the
- <a def-id="videoref" name="dom-audiotrack-enabled">enabled audio track(s)</a>, and the
- <a def-id="videoref" name="dom-texttrack-showing">"showing"</a> or <a def-id="videoref" name="dom-texttrack-hidden">"hidden"</a> text track(s).
- </p>
- <p><a>SourceBuffer</a> objects in this list must appear in the same order as they appear in
- the <a def-id="sourceBuffers"></a> attribute. (e.g., If only sourceBuffers[0] and
- sourceBuffers[3] are in <a def-id="activeSourceBuffers"></a>, then activeSourceBuffers[0] must
- equal sourceBuffers[0] and activeSourceBuffers[1] must equal sourceBuffers[3].)
- </p>
- <p class="note">The <a href="#active-source-buffer-changes">Changes to selected/enabled track state</a> section describes how this attribute gets
- updated.</p>
- </dd>
-
- <dt>readonly attribute ReadyState readyState</dt>
- <dd>
- <p>Indicates the current state of the <a>MediaSource</a> object. When the <a>MediaSource</a> is created <a def-id="readyState"></a> must be set to <a def-id="closed"></a>.
- </dd>
-
- <dt>attribute unrestricted double duration</dt>
- <dd>
- <p>Allows the web application to set the presentation duration. The duration is initially set to NaN when the <a>MediaSource</a> object is created.</p>
- <p>On getting, run the following steps:</p>
- <ol>
- <li>If the <a def-id="readyState"></a> attribute is <a def-id="closed"></a> then return NaN and abort these steps.</li>
- <li>Return the current value of the attribute.</li>
- </ol>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If the value being set is negative or NaN then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="readyState"></a> attribute is not <a def-id="open"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true on any <a>SourceBuffer</a> in <a def-id="sourceBuffers"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the value being assigned to this attribute.
- <p class="note"><a def-id="appendBuffer"></a>, <a def-id="appendStream"></a> and <a def-id="endOfStream"></a> can update the duration under certain circumstances.</p>
- </li>
- </ol>
- </dd>
-
- <dt>SourceBuffer addSourceBuffer(DOMString type)</dt>
- <dd>
- <p>Adds a new <a>SourceBuffer</a> to <a def-id="sourceBuffers"></a>.</p>
- <ol class="method-algorithm">
- <li>If <var>type</var> is an empty string then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
- <li>If <var>type</var> contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified for the other <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>, then throw a <a def-id="not-supported-err"></a> exception and abort these steps.</li>
- <li>If the user agent can't handle any more SourceBuffer objects or if creating a SourceBuffer
- based on <var>type</var> would result in an unsupported <a def-id="sourcebuffer-configuration"></a>,
- then throw a <a def-id="quota-exceeded-err"></a> exception and abort these steps.
- <p class="note">For example, a user agent may throw a <a def-id="quota-exceeded-err"></a> exception if the media element has reached the
- <a def-id="have-metadata"></a> readyState. This can occur if the user agent's media engine does not support adding more tracks during
- playback.
- </p>
- </li>
- <li>If the <a def-id="readyState"></a> attribute is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>Create a new <a>SourceBuffer</a> object and associated resources.</li>
- <li>Set the <a def-id="generate-timestamps-flag"></a> on the new object to the value in the
- "Generate Timestamps Flag" column of the byte stream format registry [[MSE-REGISTRY]] entry
- that is associated with <var>type</var>.
- <li>
- <dl class="switch">
- <dt>If the <a def-id="generate-timestamps-flag"></a> equals true:</dt>
- <dd>
- Set the <a def-id="mode"></a> attribute on the new object to
- <a def-id="AppendMode-sequence"></a>.
- </dd>
- <dt>Otherwise:</dt>
- <dd>
- Set the <a def-id="mode"></a> attribute on the new object to
- <a def-id="AppendMode-segments"></a>.
- </dd>
- </li>
- <li>Add the new object to <a def-id="sourceBuffers"></a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="addsourcebuffer"></a> at <a def-id="sourceBuffers"></a>.</li>
- <li>Return the new object.</li>
- </ol>
- </dd>
-
- <dt>void removeSourceBuffer(SourceBuffer sourceBuffer)</dt>
- <dd>
- <p>Removes a <a>SourceBuffer</a> from <a def-id="sourceBuffers"></a>.</p>
-
- <ol class="method-algorithm">
- <li>If <var>sourceBuffer</var> specifies an object that is not in <a def-id="sourceBuffers"></a> then throw a <a def-id="not-found-err"></a> exception and abort these steps.</li>
- <li>If the <var>sourceBuffer</var>.<a def-id="updating"></a> attribute equals true, then run the following steps:
- <ol>
- <li>Abort the <a def-id="buffer-append"></a> and <a def-id="stream-append-loop"></a> algorithms if they are running.</li>
- <li>Set the <var>sourceBuffer</var>.<a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateabort"></a> at <var>sourceBuffer</var>.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at <var>sourceBuffer</var>.</li>
- </ol>
- </li>
-
- <li>Let <var>SourceBuffer audioTracks list</var> equal the <a def-id="audio-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-audioTracks"></a>.</li>
- <li>If the <var>SourceBuffer audioTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement audioTracks list</var> equal the <a def-id="audio-track-list"></a> object returned by the <a def-id="audiotracks"></a> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed enabled audio track flag</var> equal false.</li>
- <li>For each <a def-id="audio-track"></a> object in the <var>SourceBuffer audioTracks list</var>, run the following steps:
- <ol>
- <li>Set the <a def-id="audiotrack-sourceBuffer"></a> attribute on the <a def-id="audio-track"></a> object to null.</li>
- <li>If the <a def-id="audiotrack-enabled"></a> attribute on the <a def-id="audio-track"></a> object is true, then
- set the <var>removed enabled audio track flag</var> to true.</li>
- <li>Remove the <a def-id="audio-track"></a> object from the <var>HTMLMediaElement audioTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>HTMLMediaElement audioTracks list</var>.</li>
- <li>Remove the <a def-id="audio-track"></a> object from the <var>SourceBuffer audioTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>SourceBuffer audioTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed enabled audio track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
- <var>HTMLMediaElement audioTracks list</var>.</li>
- </ol>
- </li>
-
- <li>Let <var>SourceBuffer videoTracks list</var> equal the <a def-id="video-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-videoTracks"></a>.</li>
- <li>If the <var>SourceBuffer videoTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement videoTracks list</var> equal the <a def-id="video-track-list"></a> object returned by the <a def-id="videotracks"></a> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed selected video track flag</var> equal false.</li>
- <li>For each <a def-id="video-track"></a> object in the <var>SourceBuffer videoTracks list</var>, run the following steps:
- <ol>
- <li>Set the <a def-id="videotrack-sourceBuffer"></a> attribute on the <a def-id="video-track"></a> object to null.</li>
- <li>If the <a def-id="videotrack-selected"></a> attribute on the <a def-id="video-track"></a> object is true, then
- set the <var>removed selected video track flag</var> to true.</li>
- <li>Remove the <a def-id="video-track"></a> object from the <var>HTMLMediaElement videoTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>HTMLMediaElement videoTracks list</var>.</li>
- <li>Remove the <a def-id="video-track"></a> object from the <var>SourceBuffer videoTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>SourceBuffer videoTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed selected video track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
- <var>HTMLMediaElement videoTracks list</var>.</li>
- </ol>
- </li>
-
-
- <li>Let <var>SourceBuffer textTracks list</var> equal the <a def-id="text-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-textTracks"></a>.</li>
- <li>If the <var>SourceBuffer textTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement textTracks list</var> equal the <a def-id="text-track-list"></a> object returned by the <a def-id="texttracks"></a> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed enabled text track flag</var> equal false.</li>
- <li>For each <a def-id="text-track"></a> object in the <var>SourceBuffer textTracks list</var>, run the following steps:
- <ol>
- <li>Set the <a def-id="texttrack-sourceBuffer"></a> attribute on the <a def-id="text-track"></a> object to null.</li>
- <li>If the <a def-id="texttrack-mode"></a> attribute on the <a def-id="text-track"></a> object is set to <a def-id="texttrack-showing"></a> or
- <a def-id="texttrack-hidden"></a> , then set the <var>removed enabled text track flag</var> to true.</li>
- <li>Remove the <a def-id="text-track"></a> object from the <var>HTMLMediaElement textTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>HTMLMediaElement textTracks list</var>.</li>
- <li>Remove the <a def-id="text-track"></a> object from the <var>SourceBuffer textTracks list</var>.</li>
- <li><a def-id="Queue-and-fire-removetrack"></a> at the <var>SourceBuffer textTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed enabled text track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
- <var>HTMLMediaElement textTracks list</var>.</li>
- </ol>
- </li>
-
- <li>If <var>sourceBuffer</var> is in <a def-id="activeSourceBuffers"></a>, then remove <var>sourceBuffer</var> from <a def-id="activeSourceBuffers"></a> and
- <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at the <a>SourceBufferList</a> returned by <a def-id="activeSourceBuffers"></a>.</li>
- <li>Remove <var>sourceBuffer</var> from <a def-id="sourceBuffers"></a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at
- the <a>SourceBufferList</a> returned by <a def-id="sourceBuffers"></a>.</li>
- <li>Destroy all resources for <var>sourceBuffer</var>.</li>
- </ol>
- </dd>
-
- <dt>void endOfStream(optional EndOfStreamError error)</dt>
- <dd>
- <p>Signals the end of the stream.</p>
-
- <ol class="method-algorithm">
- <li>If the <a def-id="readyState"></a> attribute is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true on any <a>SourceBuffer</a> in <a def-id="sourceBuffers"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>Run the <a def-id="end-of-stream-algorithm"></a> with the <var>error</var> parameter set to <var>error</var>.</li>
- </ol>
- </dd>
-
- <dt>static boolean isTypeSupported(DOMString type)</dt>
- <dd>
- <p>Check to see whether the <a>MediaSource</a> is capable of creating <a>SourceBuffer</a> objects for the specified MIME type.</p>
-
- <ol class="method-algorithm">
- <li>If <var>type</var> is an empty string, then return false.</li>
- <li>If <var>type</var> does not contain a valid MIME type string, then return false.</li>
- <li>If <var>type</var> contains a media type or media subtype that the MediaSource does not support, then return false.</li>
- <li>If <var>type</var> contains a codec that the MediaSource does not support, then return false.</li>
- <li>If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.</li>
- <li>Return true.</li>
- </ol>
- <p class="note">
- If true is returned from this method, it only indicates that the <a>MediaSource</a> implementation is capable of creating <a>SourceBuffer</a> objects for the specified MIME type. An <a def-id="addSourceBuffer"></a> call may still fail if sufficient resources are not available to support the addition of a new <a>SourceBuffer</a>.
- </p>
- <p class="note">
- This method returning true implies that HTMLMediaElement.canPlayType() will return "maybe" or "probably" since it does not make sense for a <a>MediaSource</a> to support a type the HTMLMediaElement knows it cannot play.
- </p>
- </dd>
- </dl>
-
- <section id="mediasource-events">
- <h3>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a def-id="eventdfn">sourceopen</a></td>
- <td><code>Event</code></td>
- <td><a def-id="readyState"></a> transitions from <a def-id="closed"></a> to <a def-id="open"></a> or from <a def-id="ended"></a> to <a def-id="open"></a>.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">sourceended</a></td>
- <td><code>Event</code></td>
- <td><a def-id="readyState"></a> transitions from <a def-id="open"></a> to <a def-id="ended"></a>.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">sourceclose</a></td>
- <td><code>Event</code></td>
- <td><a def-id="readyState"></a> transitions from <a def-id="open"></a> to <a def-id="closed"></a> or <a def-id="ended"></a> to <a def-id="closed"></a>.</td>
- </tr>
- </tbody>
- </table>
- </section>
-
- <section id="mediasource-algorithms">
- <h3>Algorithms</h3>
-
- <section id="mediasource-attach">
- <h4>Attaching to a media element</h4>
- <p> A <a>MediaSource</a> object can be attached to a media element by assigning a <a def-id="MediaSource-object-URL"></a> to the media element <a def-id="media-src"></a> attribute or the src attribute of a <source> inside a media element. A <a def-id="MediaSource-object-URL"></a> is created by passing a MediaSource object to <a def-id="createObjectURL"></a>.</p>
- <p>If the <a def-id="resource-fetch-algorithm"></a> absolute URL matches the MediaSource object URL, run the following steps right before the <a def-id="perform-potentially-cors-enabled-fetch"></a>
- step in the <a def-id="resource-fetch-algorithm"></a>.</p>
-
- <dl class="switch">
- <dt>If <a def-id="readyState"></a> is NOT set to <a def-id="closed"></a></dt>
- <dd>Run the <a def-id="media-data-cannot-be-fetched"></a> steps of the <a def-id="resource-fetch-algorithm"></a>.</dd>
- <dt>Otherwise</dt>
- <dd>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute to <a def-id="open"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a>MediaSource</a>.</li>
- <li>Continue the <a def-id="resource-fetch-algorithm"></a> by running the <a def-id="perform-potentially-cors-enabled-fetch"></a> step. Text in the <a def-id="resource-fetch-algorithm"></a>
- that refers to "the download" or "bytes received" refer to data passed in via <a def-id="appendBuffer"></a> and <a def-id="appendStream"></a>. References to
- HTTP in the <a def-id="resource-fetch-algorithm"></a> do not apply because the HTMLMediaElement does not fetch media data via HTTP when a <a>MediaSource</a> is attached.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="mediasource-detach">
- <h4>Detaching from a media element</h4>
- <p>The following steps are run in any case where the media element is going to transition to <a def-id="videoref" name="dom-media-network_empty">NETWORK_EMPTY</a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="videoref" name="event-mediacontroller-emptied">emptied</a> at the media element. These steps must be run right before the transition.</p>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute to <a def-id="closed"></a>.</li>
- <li>Set the <a def-id="duration"></a> attribute to NaN.</li>
- <li>Remove all the <a>SourceBuffer</a> objects from <a def-id="activeSourceBuffers"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>.</li>
- <li>Remove all the <a>SourceBuffer</a> objects from <a def-id="sourceBuffers"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="sourceBuffers"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceclose"></a> at the <a>MediaSource</a>.</li>
- </ol>
- </section>
-
- <section id="mediasource-seeking">
- <h4>Seeking</h4>
- <p>Run the following steps as part of the "<i>Wait until the user agent has established whether or not the media data for the new playback position is available, and, if it is, until it has decoded enough data to play back that position"</i> step of the <a def-id="hme-seek-algorithm"></a>:</p>
- <ol>
- <li>The media element looks for <a def-id="media-segments"></a> containing the <var>new playback position</var> in each <a>SourceBuffer</a> object in <a def-id="activeSourceBuffers"></a>.
- <dl class="switch">
- <dt>If one or more of the objects in <a def-id="activeSourceBuffers"></a> is missing <a def-id="media-segments"></a> for the <var>new playback position</var>
- </dt>
- <dd>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-metadata"></a>.</li>
- <li>The media element waits until an <a def-id="appendBuffer"></a> or an <a def-id="appendStream"></a> call causes the <a def-id="coded-frame-processing-algorithm"></a> to set
- the <a def-id="ready-state"></a> attribute to a value greater than <a def-id="have-metadata"></a>.
- <p class="note">The web application can use <a def-id="buffered"></a> to determine what the media element needs to resume playback.</p>
- </li>
- </ol>
- </dd>
- <dt>Otherwise</dt>
- <dd>Continue</dd>
- </dl>
- </li>
- <li>The media element resets all decoders and initializes each one with data from the appropriate <a def-id="init-segment"></a>.</li>
- <li>The media element feeds <a def-id="coded-frames"></a> from the <a def-id="active-track-buffers"></a> into the decoders starting with the
- closest <a def-id="random-access-point"></a> before the <var>new playback position</var>.</li>
- <li>Resume the <a def-id="hme-seek-algorithm"></a> at the "<i>Await a stable state</i>" step.</li>
- </ol>
- </section>
-
- <section id="buffer-monitoring">
- <h4>SourceBuffer Monitoring</h4>
- <p>The following steps are periodically run during playback to make sure that all of the <a>SourceBuffer</a> objects in <a def-id="activeSourceBuffers"></a> have <a def-id="enough-data"></a>. Appending new segments and changes to <a def-id="activeSourceBuffers"></a> also cause these steps to run because they affect the conditions that trigger state transitions.</p>
-
- <p>Having <dfn id="enough-data">enough data to ensure uninterrupted playback</dfn> is an implementation specific condition where the user agent
- determines that it currently has enough data to play the presentation without stalling for a meaningful period of time. This condition is
- constantly evaluated to determine when to transition the media element into and out of the <a def-id="have-enough-data"></a> ready state.
- These transitions indicate when the user agent believes it has enough data buffered or it needs more data respectively.</p>
-
- <p class="note">An implementation may choose to use bytes buffered, time buffered, the append rate, or any other metric it sees fit to
- determine when it has enough data. The metrics used may change during playback so web applications should only rely on the value of
- <a def-id="ready-state"></a> to determine whether more data is needed or not.</p>
-
- <p class="note">When the media element needs more data, the user agent should transition it from <a def-id="have-enough-data"></a> to
- <a def-id="have-future-data"></a> early enough for a web application to be able to respond without causing an interruption in playback.
- For example, transitioning when the current playback position is 500ms before the end of the buffered data gives the application roughly
- 500ms to append more data before playback stalls.</p>
-
- <dl class="switch">
- <dt>If <a def-id="hme-buffered"></a> does not contain a <a def-id="timerange"></a> for the current playback position:</dt>
- <dd>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-metadata"></a>.</li>
- <li>If this is the first transition to <a def-id="have-metadata"></a>, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="loadedmetadata"></a> at the media element.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <a def-id="hme-buffered"></a> contains a <a def-id="timerange"></a> that includes the current playback position and <a def-id="enough-data"></a>:</dt>
- <dd>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-enough-data"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="canplaythrough"></a> at the media element.</li>
- <li>Playback may resume at this point if it was previously suspended by a transition to <a def-id="have-current-data"></a>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <a def-id="hme-buffered"></a> contains a <a def-id="timerange"></a> that includes the current playback position and some time beyond the current playback position, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-future-data"></a>.</li>
- <li>If the previous value of <a def-id="ready-state"></a> was less than <a def-id="have-future-data"></a>, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="canplay"></a> at the media element.</li>
- <li>Playback may resume at this point if it was previously suspended by a transition to <a def-id="have-current-data"></a>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <a def-id="hme-buffered"></a> contains a <a def-id="timerange"></a> that ends at the current playback position and does not have a range covering the time immediately after the current position:</dt>
- <dd>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-current-data"></a>.</li>
- <li>If this is the first transition to <a def-id="have-current-data"></a>, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="loadeddata"></a> at the media element.</li>
- <li>Playback is suspended at this point since the media element doesn't have enough data to advance the <a def-id="media-timeline"></a>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="active-source-buffer-changes">
- <h4>Changes to selected/enabled track state</h4>
- <p>During playback <a def-id="activeSourceBuffers"></a> needs to be updated if the <a def-id="videoref" name="dom-videotrack-selected">selected video track</a>, the <a def-id="videoref" name="dom-audiotrack-enabled">enabled audio track(s)</a>, or a text track <a def-id="videoref" name="dom-texttrack-mode">mode</a> changes. When one or more of these changes occur the following steps need to be followed.</p>
- <dl class="switch">
- <dt>If the selected video track changes, then run the following steps:</dt>
- <dd>
- <ol>
- <li>If the <a>SourceBuffer</a> associated with the previously selected video track is not associated with any other enabled tracks, run the following steps:
- <ol>
- <li>Remove the <a>SourceBuffer</a> from <a def-id="activeSourceBuffers"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </li>
- <li>If the <a>SourceBuffer</a> associated with the newly selected video track is not already in <a def-id="activeSourceBuffers"></a>, run the following steps:
- <ol>
- <li>Add the <a>SourceBuffer</a> to <a def-id="activeSourceBuffers"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="addsourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </li>
- </ol>
- </dd>
- <dt>If an audio track becomes disabled and the <a>SourceBuffer</a> associated with this track is not associated with any other enabled or selected track, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Remove the <a>SourceBuffer</a> associated with the audio track from <a def-id="activeSourceBuffers"></a>
- </li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </dd>
- <dt>If an audio track becomes enabled and the <a>SourceBuffer</a> associated with this track is not already in <a def-id="activeSourceBuffers"></a>, then run the following steps:
- </dt>
- <dd>
- <ol>
- <li>Add the <a>SourceBuffer</a> associated with the audio track to <a def-id="activeSourceBuffers"></a>
- </li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="addsourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </dd>
- <dt>If a text track <a def-id="videoref" name="dom-texttrack-mode">mode</a> becomes <a def-id="videoref" name="dom-texttrack-disabled">"disabled"</a> and the <a>SourceBuffer</a> associated with this track is not associated with any other enabled or selected track, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Remove the <a>SourceBuffer</a> associated with the text track from <a def-id="activeSourceBuffers"></a>
- </li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </dd>
- <dt>If a text track <a def-id="videoref" name="dom-texttrack-mode">mode</a> becomes <a def-id="videoref" name="dom-texttrack-showing">"showing"</a> or <a def-id="videoref" name="dom-texttrack-hidden">"hidden"</a> and the <a>SourceBuffer</a> associated with this track is not already in <a def-id="activeSourceBuffers"></a>, then run the following steps:
- </dt>
- <dd>
- <ol>
- <li>Add the <a>SourceBuffer</a> associated with the text track to <a def-id="activeSourceBuffers"></a>
- </li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="addsourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>
- </li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="duration-change-algorithm">
- <h4>Duration change</h4>
- <p>Follow these steps when <a def-id="duration"></a> needs to change to a <var>new duration</var>.</p>
- <ol>
- <li>If the current value of <a def-id="duration"></a> is equal to <var>new duration</var>, then return.</li>
- <li>Set <var>old duration</var> to the current value of <a def-id="duration"></a>.
- <li>Update <a def-id="duration"></a> to <var>new duration</var>.</li>
- <li>If the <var>new duration</var> is less than <var>old duration</var>, then run the
- <a def-id="range-removal"></a> algorithm with <var>new duration</var> and
- <var>old duration</var> as the start and end of the removal range.</li>
- <p class="note">This preserves audio frames and text cues that start before and end after the <a def-id="duration"></a>.</p></li>
- <li>If a user agent is unable to partially render audio frames or text cues that start before and end after the <a def-id="duration"></a>, then run the following steps:
- <ol>
- <li>Update <var>new duration</var> to the highest end time reported by the <a def-id="buffered"></a> attribute across all <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>.</li>
- <li>Update <a def-id="duration"></a> to <var>new duration</var>.</li>
- </ol>
- </li>
- <li>Update the <a def-id="hme-duration"></a> to <var>new duration</var> and run the <a def-id="hme-duration-change-algorithm"></a>.</li>
- </ol>
- </section>
-
- <section id="end-of-stream-algorithm">
- <h4>End of stream algorithm</h4>
- <p>This algorithm gets called when the application signals the end of stream via an <a def-id="endOfStream"></a> call or an algorithm needs to
- signal a decode error. This algorithm takes an <var>error</var> parameter that indicates whether an error will be signalled.</p>
- <ol>
- <li>Change the <a def-id="readyState"></a> attribute value to <a def-id="ended"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceended"></a> at the <a>MediaSource</a>.</li>
- <li><dl class="switch">
- <dt>If <var>error</var> is not set</dt>
- <dd>
- <ol>
- <li>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the highest end time reported by the <a def-id="buffered"></a> attribute across all <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>.<br>
- <p class="note">This allows the duration to properly reflect the end of the appended media segments. For example, if the duration was explicitly set to 10 seconds and only media segments for 0 to 5 seconds were appended before endOfStream() was called, then the duration will get updated to 5 seconds.</p>
- </li>
- <li>Notify the media element that it now has all of the media data.</li>
- </ol>
- </dd>
- <dt>If <var>error</var> is set to <a def-id="network"></a>
- </dt>
- <dd>
- <dl class="switch">
- <dt>If the <a def-id="ready-state"></a> attribute equals <a def-id="have-nothing"></a>
- </dt>
- <dd>Run the <a def-id="media-data-cannot-be-fetched"></a> steps of the <a def-id="resource-fetch-algorithm"></a>.</dd>
- <dt>If the <a def-id="ready-state"></a> attribute is greater than <a def-id="have-nothing"></a>
- </dt>
- <dd>Run the "<i>If the connection is interrupted after some media data has been received, causing the user agent to give up trying to fetch the resource</i>" steps of the <a def-id="resource-fetch-algorithm"></a>.</dd>
- </dl>
- </dd>
- <dt>If <var>error</var> is set to <a def-id="decode"></a>
- </dt>
- <dd>
- <ol>
- <li>If <a def-id="updating"></a> equals true, then run the <a def-id="append-error-algorithm"></a>.</li>
- <li>
- <dl class="switch">
- <dt>If the <a def-id="ready-state"></a> attribute equals <a def-id="have-nothing"></a>
- </dt>
- <dd>Run the "<i>If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all</i>" steps of the <a def-id="resource-fetch-algorithm"></a>.</dd>
- <dt>If the <a def-id="ready-state"></a> attribute is greater than <a def-id="have-nothing"></a>
- </dt>
- <dd>Run the <a def-id="media-data-is-corrupted"></a> steps of the <a def-id="resource-fetch-algorithm"></a>.</dd>
- </dl>
- </li>
- </ol>
- </dd>
- </dl>
- </li>
- </ol>
- </section>
- </section>
- </section>
-
- <section id="sourcebuffer">
- <h2>SourceBuffer Object</h2>
-
-
- <dl title="enum AppendMode" class="idl">
- <dt>segments</dt>
- <dd>
- <p>The timestamps in the media segment determine where the <a def-id="coded-frames"></a> are placed in the presentation. Media segments can be appended in any order.</p>
- </dd>
- <dt>sequence</dt>
- <dd>
- <p>Media segments will be treated as adjacent in time independent of the timestamps in the media segment. Coded frames in a new media segment will be placed immediately after the coded
- frames in the previous media segment. The <a def-id="timestampOffset"></a> attribute will be updated if a new offset is needed to make the new media segments adjacent to the previous media segment.
- Setting the <a def-id="timestampOffset"></a> attribute in <a def-id="AppendMode-sequence"></a> mode allows a media segment to be placed at a specific position in the timeline without any knowledge
- of the timestamps in the media segment.
- </p>
- </dd>
- </dl>
-
- <dl title="interface SourceBuffer : EventTarget" class="idl">
- <dt>attribute AppendMode mode</dt>
- <dd>
- <p>Controls how a sequence of <a def-id="media-segments"></a> are handled. This attribute is initially set by <a def-id="addSourceBuffer"></a> after the object is created.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>Let <var>new mode</var> equal the new value being assigned to this attribute.</li>
- <li>If <a def-id="generate-timestamps-flag"></a> equals true and <var>new mode</var> equals
- <a def-id="AppendMode-segments"></a>, then throw an <a def-id="invalid-access-err"></a>
- exception and abort these steps.</li>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an <a def-id="invalid-state-err"></a> exception and
- abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>
- <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> to <a def-id="open"></a></li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a def-id="parent-media-source"></a>.</li>
- </ol>
- </li>
- <li>If the <a def-id="append-state"></a> equals <a def-id="parsing-media-segment"></a>, then throw an <a def-id="invalid-state-err"></a> and abort these steps.</li>
- <li>If the <var>new mode</var> equals <a def-id="AppendMode-sequence"></a>, then set the <a def-id="group-start-timestamp"></a> to the <a def-id="group-end-timestamp"></a>.</li>
- <li>Update the attribute to <var>new mode</var>.</li>
- </ol>
- </dd>
-
- <dt>readonly attribute boolean updating</dt>
- <dd>
- <p>Indicates whether the asynchronous continuation of an <a def-id="appendBuffer"></a>, <a def-id="appendStream"></a>, or <a def-id="remove"></a>
- operation is still being processed. This attribute is initially set to false when the object is created.</p>
- </dd>
-
- <dt>readonly attribute TimeRanges buffered</dt>
- <dd>
- <p>Indicates what <a def-id="timeranges"></a> are buffered in the <a>SourceBuffer</a>.</p>
- <p>When the attribute is read the following steps must occur:</p>
- <ol>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>Let <var>highest end time</var> be the largest <a def-id="track-buffer-ranges"></a> end time across all the <a def-id="track-buffers"></a> managed by this <a>SourceBuffer</a> object.</li>
- <li>Let <var>intersection ranges</var> equal a <a def-id="timerange"></a> object containing a single range from 0 to <var>highest end time</var>.</li>
- <li>For each <a def-id="track-buffer"></a> managed by this <a>SourceBuffer</a>, run the following steps:
- <ol>
- <li>Let <var>track ranges</var> equal the <a def-id="track-buffer-ranges"></a> for the current <a def-id="track-buffer"></a>.</li>
- <li>If <a def-id="readyState"></a> is <a def-id="ended"></a>, then set the end time on the last range in <var>track ranges</var> to <var>highest end time</var>.</li>
- <li>Let <var>new intersection ranges</var> equal the intersection between the <var>intersection ranges</var> and the <var>track ranges</var>.</li>
- <li>Replace the ranges in <var>intersection ranges</var> with the <var>new intersection ranges</var>.</li>
- </ol>
- </li>
- <li>Return the <var>intersection ranges</var>.</li>
- </ol>
- </dd>
-
- <dt>attribute double timestampOffset</dt>
- <dd>
- <p>Controls the offset applied to timestamps inside subsequent <a def-id="media-segments"></a> that are appended to this <a>SourceBuffer</a>. The <a def-id="timestampOffset"></a> is initially set to 0 which indicates that no offset is being applied.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>Let <var>new timestamp offset</var> equal the new value being assigned to this attribute.</li>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>
- <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> to <a def-id="open"></a></li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a def-id="parent-media-source"></a>.</li>
- </ol>
- </li>
- <li>If the <a def-id="append-state"></a> equals <a def-id="parsing-media-segment"></a>, then throw an <a def-id="invalid-state-err"></a> and abort these steps.</li>
- <li>If the <a def-id="mode"></a> attribute equals <a def-id="AppendMode-sequence"></a>, then set the <a def-id="group-start-timestamp"></a> to <var>new timestamp offset</var>.</li>
- <li>Update the attribute to <var>new timestamp offset</var>.</li>
- </ol>
- </dd>
-
- <dt>readonly attribute AudioTrackList audioTracks</dt>
- <dd>
- The list of <a def-id="audio-track"></a> objects created by this object.
- </dd>
-
- <dt>readonly attribute VideoTrackList videoTracks</dt>
- <dd>
- The list of <a def-id="video-track"></a> objects created by this object.
- </dd>
-
- <dt>readonly attribute TextTrackList textTracks</dt>
- <dd>
- The list of <a def-id="text-track"></a> objects created by this object.
- </dd>
-
- <dt>attribute double appendWindowStart</dt>
- <dd>
- <p>The <a def-id="presentation-timestamp"></a> for the start of the <a def-id="append-window"></a>. This attribute is initially set to the <a def-id="presentation-start-time"></a>.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an
- <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the new value is less than 0 or greater than or equal to <a def-id="appendWindowEnd"></a> then throw an <a def-id="invalid-access-err"></a> exception
- and abort these steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd>
-
- <dt>attribute unrestricted double appendWindowEnd</dt>
- <dd>
- <p>The <a def-id="presentation-timestamp"></a> for the end of the <a def-id="append-window"></a>. This attribute is initially set to positive Infinity.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an
- <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the new value equals NaN, then throw an <a def-id="invalid-access-err"></a> and abort these steps.</li>
- <li>If the new value is less than or equal to <a def-id="appendWindowStart"></a> then throw an <a def-id="invalid-access-err"></a> exception and abort these
- steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd>
-
- <dt>void appendBuffer(ArrayBuffer data)</dt>
- <dd>
- <p>Appends the segment data in an <a>ArrayBuffer</a>[[!TYPED-ARRAYS]] to the source buffer.</p>
- <p>The steps for this method are the same as the ArrayBufferView version of <a def-id="appendBuffer"></a>.</p>
- </dd>
-
- <dt>void appendBuffer(ArrayBufferView data)</dt>
- <dd>
- <p>Appends the segment data in an <a>ArrayBufferView</a>[[!TYPED-ARRAYS]] to the source buffer.</p>
-
- <ol class="method-algorithm">
- <li>Run the <a def-id="prepare-append"></a> algorithm.</li>
- <li>Add <var>data</var> to the end of the <a def-id="input-buffer"></a>.</li>
- <li>Set the <a def-id="updating"></a> attribute to true.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
- <li>Asynchronously run the <a def-id="buffer-append"></a> algorithm.</li>
- </ol>
- </dd>
-
- <dt>void appendStream(Stream stream, [EnforceRange] optional unsigned long long maxSize)</dt>
- <dd>
- <p>Appends segment data to the source buffer from a <a class="externalDFN">Stream</a>[[!STREAMS-API]].</p>
-
- <ol class="method-algorithm">
- <li>Run the <a def-id="prepare-append"></a> algorithm.</li>
- <li>Set the <a def-id="updating"></a> attribute to true.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
- <li>Asynchronously run the <a def-id="stream-append-loop"></a> algorithm with <var>stream</var> and <var>maxSize</var>.</li>
- </ol>
- </dd>
-
- <dt>void abort()</dt>
- <dd>
- <p>Aborts the current segment and resets the segment parser.</p>
-
- <ol class="method-algorithm">
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then run the following steps:
- <ol>
- <li>Abort the <a def-id="buffer-append"></a> and <a def-id="stream-append-loop"></a> algorithms if they are running.</li>
- <li>Set the <a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateabort"></a> at this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
- </ol>
- </li>
- <li>Run the <a def-id="reset-parser-state-algorithm"></a>.</li>
- <li>Set <a def-id="appendWindowStart"></a> to the <a def-id="presentation-start-time"></a>.</li>
- <li>Set <a def-id="appendWindowEnd"></a> to positive Infinity.</li>
- </ol>
- </dd>
-
- <dt>void remove(double start, unrestricted double end)</dt>
- <dd>
- <p>Removes media for a specific time range.</p>
-
- <ol class="method-algorithm">
- <li>If <a def-id="duration"></a> equals NaN, then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
- <li>If <var>start</var> is negative or greater than <a def-id="duration"></a>, then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
- <li>If <var>end</var> is less than or equal to <var>start</var> or <var>end</var> equals NaN, then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>
- <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run
- the following steps:</p>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> to <a def-id="open"></a></li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a def-id="parent-media-source"></a> .</li>
- </ol>
- </li>
- <li>Run the <a def-id="range-removal"></a> algorithm with <var>start</var> and <var>end</var> as the start and end of the removal range.</li>
- </ol>
-
- </dd>
- <dt>attribute TrackDefaultList trackDefaults</dt>
- <dd>
- <p>Specifies the default values to use if kind, label, and/or language information is not available in the
- <a def-id="init-segment"></a> when the <a def-id="init-segment-received-algorithm"></a> needs
- to create track objects. This attribute is initially set to an empty <a>TrackDefaultList</a> object.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an
- <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd>
- </dl>
-
- <section id="track-buffers">
- <h3>Track Buffers</h3>
- <p>A <dfn id="track-buffer">track buffer</dfn> stores the <a def-id="track-descriptions"></a> and <a def-id="coded-frames"></a> for an individual
- track. The track buffer is updated as <a def-id="init-segments"></a> and <a def-id="media-segments"></a> are appended to the
- <a>SourceBuffer</a>.</p>
-
- <p>Each <a def-id="track-buffer"></a> has a <dfn id="last-decode-timestamp">last decode timestamp</dfn> variable that stores
- the decode timestamp of the last <a def-id="coded-frame"></a> appended in the current <a def-id="coded-frame-group"></a>. The variable is initially
- unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
-
- <p>Each <a def-id="track-buffer"></a> has a <dfn id="last-frame-duration">last frame duration</dfn> variable that stores
- the <a def-id="coded-frame-duration"></a> of the last <a def-id="coded-frame"></a> appended in the current <a def-id="coded-frame-group"></a>. The variable is initially
- unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
-
- <p>Each <a def-id="track-buffer"></a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
- the highest <a def-id="presentation-timestamp"></a> encountered in a <a def-id="coded-frame"></a> appended in the current <a def-id="coded-frame-group"></a>.
- The variable is initially unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
-
- <p>Each <a def-id="track-buffer"></a> has a <dfn id="need-RAP-flag">need random access point flag</dfn> variable that keeps track of whether
- the track buffer is waiting for a <a def-id="random-access-point"></a> <a def-id="coded-frame"></a>. The variable is initially set to true to
- indicate that <a def-id="random-access-point"></a> <a def-id="coded-frame"></a> is needed before anything can be added to the
- <a def-id="track-buffer"></a>.</p>
-
- <p>Each <a def-id="track-buffer"></a> has a <dfn id="track-buffer-ranges">track buffer ranges</dfn> variable that represents the presentation time ranges occupied by the <a def-id="coded-frames"></a>
- currently stored in the track buffer. For specification purposes, this information is treated as if it were stored in a <a def-id="normalized-timeranges-object"></a>.</p>
- </section>
-
- <section id="sourcebuffer-events">
- <h3>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a def-id="eventdfn">updatestart</a></td>
- <td><code>Event</code></td>
- <td><a def-id="updating"></a> transitions from false to true.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">update</a></td>
- <td><code>Event</code></td>
- <td>The append or remove has successfully completed. <a def-id="updating"></a> transitions from true to false.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">updateend</a></td>
- <td><code>Event</code></td>
- <td>The append or remove has ended.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">error</a></td>
- <td><code>Event</code></td>
- <td>An error occurred during the append. <a def-id="updating"></a> transitions from true to false.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">abort</a></td>
- <td><code>Event</code></td>
- <td>The append or remove was aborted by an <a def-id="abort"></a> call. <a def-id="updating"></a> transitions from true to false.</td>
- </tr>
- </tbody>
- </table>
- </section>
-
- <section id="sourcebuffer-algorithms">
- <h3>Algorithms</h3>
-
- <section id="sourcebuffer-segment-parser-loop">
- <h4>Segment Parser Loop</h4>
- <p>All SourceBuffer objects have an internal <dfn id="sourcebuffer-append-state">append state</dfn> variable that keeps track of the high-level segment parsing state. It is initially set to <a def-id="waiting-for-segment"></a> and can transition to the following states as data is appended.</p>
- <table class="old-table">
- <thead>
- <tr>
- <th>Append state name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><dfn id="sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</dfn></td>
- <td>Waiting for the start of an <a def-id="init-segment"></a> or <a def-id="media-segment"></a> to be appended.</td>
- </tr>
- <tr>
- <td><dfn id="sourcebuffer-parsing-init-segment">PARSING_INIT_SEGMENT</dfn></td>
- <td>Currently parsing an <a def-id="init-segment"></a>.</td>
- </tr>
- <tr>
- <td><dfn id="sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</dfn></td>
- <td>Currently parsing a <a def-id="media-segment"></a>.</td>
- </tr>
- </tbody>
- </table>
-
- <p>The <dfn id="sourcebuffer-input-buffer">input buffer</dfn> is a byte buffer that is used to hold unparsed bytes across <a def-id="appendBuffer"></a> and <a def-id="appendStream"></a> calls. The buffer is empty when the SourceBuffer object is created.</p>
-
- <p>The <dfn id="sourcebuffer-buffer-full-flag">buffer full flag</dfn> keeps track of whether <a def-id="appendBuffer"></a> or
- <a def-id="appendStream"></a> is allowed to accept more bytes. It is set to false when the SourceBuffer object is created and gets updated
- as data is appended and removed.</p>
-
- <p>The <dfn id="sourcebuffer-group-start-timestamp">group start timestamp</dfn> variable keeps track of the starting timestamp for a new
- <a def-id="coded-frame-group"></a> in the <a def-id="AppendMode-sequence"></a> mode.
- It is unset when the SourceBuffer object is created and gets updated when the <a def-id="mode"></a> attribute equals <a def-id="AppendMode-sequence"></a> and the
- <a def-id="timestampOffset"></a> attribute is set, or the <a def-id="coded-frame-processing-algorithm"></a> runs.
- </p>
-
- <p>The <dfn id="sourcebuffer-group-end-timestamp">group end timestamp</dfn> variable stores the
- highest <a def-id="coded-frame-end-timestamp"></a> across all <a def-id="coded-frames"></a> in
- the current <a def-id="coded-frame-group"></a>. It is set to 0 when the SourceBuffer object is created and gets updated
- by the <a def-id="coded-frame-processing-algorithm"></a>.
- </p>
- <p class="note">The <a def-id="group-end-timestamp"></a> stores the highest <a def-id="coded-frame-end-timestamp"></a> across all <a def-id="track-buffers"></a> in a <a>SourceBuffer</a>. Therefore, care should be taken in setting the <a def-id="mode"></a> attribute when appending multiplexed segments in which the timestamps are not aligned across tracks.
- </p>
-
- <p>The <dfn id="sourcebuffer-generate-timestamps-flag">generate timestamps flag</dfn> is a
- boolean variable that keeps track of whether timestamps need to be generated for the
- <a def-id="coded-frames"></a> passed to the <a def-id="coded-frame-processing-algorithm"></a>.
- This flag is set by <a def-id="addSourceBuffer"></a> when the SourceBuffer object is created.
- </p>
- <p>When the segment parser loop algorithm is invoked, run the following steps:</p>
-
- <ol>
- <li><i>Loop Top:</i> If the <a def-id="input-buffer"></a> is empty, then jump to the <i>need more data</i> step below.</li>
- <li>If the <a def-id="input-buffer"></a> contains bytes that violate the <a def-id="sourcebuffer-byte-stream-format-spec"></a>, then run the
- <a def-id="eos-decode"></a> and abort this algorithm.</li>
- <li>Remove any bytes that the <a def-id="byte-stream-format-specs"></a> say must be ignored from the start of the <a def-id="input-buffer"></a>.</li>
- <li>
- <p>If the <a def-id="append-state"></a> equals <a def-id="waiting-for-segment"></a>, then run the following steps:</p>
- <ol>
- <li>If the beginning of the <a def-id="input-buffer"></a> indicates the start of an <a def-id="init-segment"></a>, set the <a def-id="append-state"></a> to <a def-id="parsing-init-segment"></a>.</li>
- <li>If the beginning of the <a def-id="input-buffer"></a> indicates the start of a <a def-id="media-segment"></a>, set <a def-id="append-state"></a> to <a def-id="parsing-media-segment"></a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="append-state"></a> equals <a def-id="parsing-init-segment"></a>, then run the following steps:</p>
- <ol>
- <li>If the <a def-id="input-buffer"></a> does not contain a complete <a def-id="init-segment"></a> yet, then jump to the <i>need more data</i> step below.</li>
- <li>Run the <a def-id="init-segment-received-algorithm"></a>.</li>
- <li>Remove the <a def-id="init-segment"></a> bytes from the beginning of the <a def-id="input-buffer"></a>.</li>
- <li>Set <a def-id="append-state"></a> to <a def-id="waiting-for-segment"></a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="append-state"></a> equals <a def-id="parsing-media-segment"></a>, then run the following steps:</p>
- <ol>
- <li>If the <a def-id="first-init-segment-received-flag"></a> is false, then run the <a def-id="eos-decode"></a> and abort this algorithm.</li>
- <li>If the <a def-id="input-buffer"></a> does not contain a complete <a def-id="media-segment"></a> header yet, then jump to the <i>need more data</i> step below.</li>
- <li>If the <a def-id="input-buffer"></a> contains one or more complete <a def-id="coded-frames"></a>, then run the
- <a def-id="coded-frame-processing-algorithm"></a>.
- <p class="note">
- The frequency at which the coded frame processing algorithm is run is implementation-specific. The coded frame processing algorithm may
- be called when the input buffer contains the complete media segment or it may be called multiple times as complete coded frames are
- added to the input buffer.
- </p>
- </li>
- <li>If this <a>SourceBuffer</a> is full and cannot accept more media data, then set the <a def-id="buffer-full-flag"></a> to true.</li>
- <li>If the <a def-id="input-buffer"></a> does not contain a complete <a def-id="media-segment"></a>, then jump to the <i>need more data</i> step below.</p>
- <li>Remove the <a def-id="media-segment"></a> bytes from the beginning of the <a def-id="input-buffer"></a>.</li>
- <li>Set <a def-id="append-state"></a> to <a def-id="waiting-for-segment"></a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li><i>Need more data:</i> Return control to the calling algorithm.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-reset-parser-state">
- <h4>Reset Parser State</h4>
- <p>When the parser state needs to be reset, run the following steps:</p>
- <ol>
- <li>If the <a def-id="append-state"></a> equals <a def-id="parsing-media-segment"></a> and the <a def-id="input-buffer"></a> contains some
- complete <a def-id="coded-frames"></a>, then run the <a def-id="coded-frame-processing-algorithm"></a> until all of these complete
- <a def-id="coded-frames"></a> have been processed.</li>
- <li>Unset the <a def-id="last-decode-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Unset the <a def-id="last-frame-duration"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Unset the <a def-id="highest-presentation-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Set the <a def-id="need-RAP-flag"></a> on all <a def-id="track-buffers"></a> to true.</li>
- <li>Remove all bytes from the <a def-id="input-buffer"></a>.</li>
- <li>Set <a def-id="append-state"></a> to <a def-id="waiting-for-segment"></a>.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-append-error">
- <h4>Append Error Algorithm</h4>
- <p>When an error occurs during an append, run the following steps:</p>
- <ol>
- <li>Run the <a def-id="reset-parser-state-algorithm"></a>.</li>
- <li>Set the <a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateerror"></a> at this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-prepare-append">
- <h4>Prepare Append Algorithm</h4>
- <p>When an append operation begins, the follow steps are run to validate and prepare the <a>SourceBuffer</a>.</p>
- <ol>
- <li>If the <a>SourceBuffer</a> has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
- <li>
- <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> to <a def-id="open"></a>
- </li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a def-id="parent-media-source"></a> .</li>
- </ol>
- </li>
- <li>Run the <a def-id="coded-frame-eviction-algorithm"></a>.</li>
- <li>
- <p>If the <a def-id="buffer-full-flag"></a> equals true, then throw a <a def-id="quota-exceeded-err"></a> exception and abort these step.</p>
- <p class="note">This is the signal that the implementation was unable to evict enough data to accomodate the append or the append is too big. The web
- application should use <a def-id="remove"></a> to explicitly free up space and/or reduce the size of the append.</p>
- </li>
- </ol>
- </section>
-
- <section id="sourcebuffer-buffer-append">
- <h4>Buffer Append Algorithm</h4>
- <p>When <a def-id="appendBuffer"></a> is called, the following steps are run to process the appended data.</p>
- <ol>
- <li>Run the <a def-id="segment-parser-loop"></a> algorithm.</li>
- <li>If the <a def-id="segment-parser-loop"></a> algorithm in the previous step was aborted, then abort this algorithm.</li>
- <li>Set the <a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="update"></a> at this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-stream-append-loop">
- <h4>Stream Append Loop</h4>
- <p>When a <a class="externalDFN">Stream</a>[[!STREAMS-API]] is passed to <a def-id="appendStream"></a>, the following steps are run to transfer data from the
- <a class="externalDFN">Stream</a> to the <a>SourceBuffer</a>. This algorithm is initialized with the <var>stream</var> and <var>maxSize</var> parameters
- from the <a def-id="appendStream"></a> call.
- </p>
- <ol>
- <li>If <var>maxSize</var> is set, then let <var>bytesLeft</var> equal <var>maxSize</var>.</li>
- <li><i>Loop Top: </i>If <var>maxSize</var> is set and <var>bytesLeft</var> equals 0, then jump to the <i>loop done</i> step below.</li>
- <li>If <var>stream</var> has been closed, then jump to the <i>loop done</i> step below.</li>
- <li>Read data from <var>stream</var> into <var>data</var>:
- <dl class="switch">
- <dt>If <var>maxSize</var> is set:</dt>
- <dd>
- <ol>
- <li>Read up to <var>bytesLeft</var> bytes from <var>stream</var> into <var>data</var>.</li>
- <li>Subtract the number of bytes in <var>data</var> from <var>bytesLeft</var>.</li>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Read all available bytes in <var>stream</var> into <var>data</var>.</dd>
- </dl>
- </li>
- <li>If an error occured while reading from <var>stream</var>, then run the <a def-id="append-error-algorithm"></a> and abort this algorithm.</li>
- <li>Run the <a def-id="coded-frame-eviction-algorithm"></a>.</li>
- <li>
- <p>If the <a def-id="buffer-full-flag"></a> equals true, then run the <a def-id="append-error-algorithm"></a> and abort this algorithm.</p>
- <p class="note">The web application should use <a def-id="remove"></a> to free up space in the <a>SourceBuffer</a>.</p>
- </li>
- <li>Add <var>data</var> to the end of the <a def-id="input-buffer"></a>.</li>
- <li>Run the <a def-id="segment-parser-loop"></a> algorithm.</li>
- <li>If the <a def-id="segment-parser-loop"></a> algorithm in the previous step was aborted, then abort this algorithm.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- <li><i>Loop Done: </i>Set the <a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="update"></a> at this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-range-removal">
- <h4>Range Removal</h4>
- <p>Follow these steps when a caller needs to initiate a JavaScript visible range removal
- operation that blocks other SourceBuffer updates:</p>
- <ol>
- <li>Let <var>start</var> equal the starting <a def-id="presentation-timestamp"></a> for the removal range.</li>
- <li>Let <var>end</var> equal the end <a def-id="presentation-timestamp"></a> for the removal range.</li>
- <li>Set the <a def-id="updating"></a> attribute to true.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
- <li>Return control to the caller and run the rest of the steps asynchronously.</li>
- <li>Run the <a def-id="coded-frame-removal-algorithm"></a> with <var>start</var> and <var>end</var> as the start and end of the removal range.</li>
- <li>Set the <a def-id="updating"></a> attribute to false.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="update"></a> at this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
- </ol>
- </section>
- <section id="sourcebuffer-init-segment-received">
- <h4>Initialization Segment Received</h4>
- <p>The following steps are run when the <a def-id="segment-parser-loop"></a> successfully parses a complete <a def-id="init-segment"></a>:</p>
- <p>Each SourceBuffer object has an internal <dfn id="first-init-segment-received-flag">first initialization segment received flag</dfn> that tracks whether the first <a def-id="init-segment"></a> has been appended and received by this algorithm. This flag is set to false when the SourceBuffer is created and updated by the algorithm below.</p>
- <ol>
- <li>Update the <a def-id="duration"></a> attribute if it currently equals NaN:
- <dl class="switch">
- <dt>If the initialization segment contains a duration:</dt>
- <dd>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the duration in the initialization segment.</dd>
- <dt>Otherwise:</dt>
- <dd>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to positive Infinity.</dd>
- </dl>
- </li>
- <li>If the <a def-id="init-segment"></a> has no audio, video, or text tracks, then run the <a def-id="eos-decode"></a> and abort these steps.</li>
- <li>If the <a def-id="first-init-segment-received-flag"></a> is true, then run the following steps:
- <ol>
- <li>Verify the following properties. If any of the checks fail then run the <a def-id="eos-decode"></a> and abort these steps.
- <ul>
- <li>The number of audio, video, and text tracks match what was in the first <a def-id="init-segment"></a>.</li>
- <li>The codecs for each track, match what was specified in the first <a def-id="init-segment"></a>.</li>
- <li>If more than one track for a single type are present (ie 2 audio tracks), then the <a def-id="track-ids"></a> match the ones in the
- first <a def-id="init-segment"></a>.</li>
- </ul>
- </li>
- <li>Add the appropriate <a def-id="track-descriptions"></a> from this <a def-id="init-segment"></a> to each of the
- <a def-id="track-buffers"></a>.</li>
- <li>Set the <a def-id="need-RAP-flag"></a> on all track buffers to true.</li>
- </ol>
- </li>
- <li>Let <var>active track flag</var> equal false.</li>
- <li>
- <p>If the <a def-id="first-init-segment-received-flag"></a> is false, then run the following steps:</p>
- <ol>
- <li>If the <a def-id="init-segment"></a> contains tracks with codecs the user agent does not support, then run the <a def-id="eos-decode"></a>
- and abort these steps.
- <p class="note">User agents may consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not
- specified in the <var>type</var> parameter passed to <a def-id="addSourceBuffer"></a>. <br>
- For example, MediaSource.isTypeSupported('video/webm;codecs="vp8,vorbis"') may return true, but if
- <a def-id="addSourceBuffer"></a> was called with 'video/webm;codecs="vp8"' and a Vorbis track appears in the
- <a def-id="init-segment"></a>, then the user agent may use this step to trigger a decode error.
- </p>
- </li>
- <li>
- <p>For each audio track in the <a def-id="init-segment"></a>, run following steps:</p>
- <ol>
- <li>Let <var>audio byte stream track ID</var> be the
- <a def-id="track-id"></a> for the current track being processed.</li>
- <li>Let <var>audio language</var> be a BCP 47 language tag for the language
- specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>audio language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a def-id="default-track-language-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-audio"></a> and assign the value returned by the
- algorithm to <var>audio language</var>.</li>
- <li>Let <var>audio label</var> be a label specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>audio label</var> equals an empty string, then run the
- <a def-id="default-track-label-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-audio"></a> and assign the value returned by the
- algorithm to <var>audio label</var>.</li>
- <li>Let <var>audio kinds</var> be an array of kind strings specified in the
- <a def-id="init-segment"></a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>audio kinds</var> equals an empty array, then run the
- <a def-id="default-track-kinds-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-audio"></a> and assign the value returned by the
- algorithm to <var>audio kinds</var>.</li>
- <li>For each value in <var>audio kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current audio kind</var> equal the value from <var>audio kinds</var>
- for this iteration of the loop.</li>
- <li>Let <var>new audio track</var> be a new <a def-id="audio-track"></a> object.</li>
- <li>Generate a unique ID and assign it to the <a def-id="audiotrack-id"></a> property on <var>new audio track</var>.</li>
- <li>Assign <var>audio language</var> to the <a def-id="audiotrack-language"></a>
- property on <var>new audio track</var>.</li>
- <li>Assign <var>audio label</var> to the <a def-id="audiotrack-label"></a>
- property on <var>new audio track</var>.</li>
- <li>Assign <var>current audio kind</var> to the <a def-id="audiotrack-kind"></a>
- property on <var>new audio track</var>.</li>
- <li>
- <p>
- If <a def-id="audiotracks"></a>.<a def-id="audiotracklist-length"></a> equals 0, then run
- the following steps:
- </p>
- <ol>
- <li>Set the <a def-id="audiotrack-enabled"></a> property on <var>new audio track</var> to true.</li>
- <li>Set <var>active track flag</var> to true.</li>
- </ol>
- </li>
- <li>Add <var>new audio track</var> to the <a def-id="sourcebuffer-audioTracks"></a> attribute on this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at the <a def-id="audio-track-list"></a> object referenced by the
- <a def-id="sourcebuffer-audioTracks"></a> attribute on this <a>SourceBuffer</a> object.</li>
- <li>Add <var>new audio track</var> to the <a def-id="audiotracks"></a> attribute on the HTMLMediaElement.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at the <a def-id="audio-track-list"></a> object referenced by the <a def-id="audiotracks"></a>
- attribute on the HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a def-id="track-buffer"></a> to store <a def-id="coded-frames"></a> for this track.</li>
- <li>Add the <a def-id="track-description"></a> for this track to the <a def-id="track-buffer"></a>.</li>
- </ol>
- </li>
- <li>
- <p>For each video track in the <a def-id="init-segment"></a>, run following steps:</p>
- <ol>
- <li>Let <var>video byte stream track ID</var> be the
- <a def-id="track-id"></a> for the current track being processed.</li>
- <li>Let <var>video language</var> be a BCP 47 language tag for the language
- specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>video language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a def-id="default-track-language-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-video"></a> and assign the value returned by the
- algorithm to <var>video language</var>.</li>
- <li>Let <var>video label</var> be a label specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>video label</var> equals an empty string, then run the
- <a def-id="default-track-label-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-video"></a> and assign the value returned by the
- algorithm to <var>video label</var>.</li>
- <li>Let <var>video kinds</var> be an array of kind strings specified in the
- <a def-id="init-segment"></a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>video kinds</var> equals an empty array, then run the
- <a def-id="default-track-kinds-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-video"></a> and assign the value returned by the
- algorithm to <var>video kinds</var>.</li>
- <li>For each value in <var>video kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current video kind</var> equal the value from <var>video kinds</var>
- for this iteration of the loop.</li>
- <li>Let <var>new video track</var> be a new <a def-id="video-track"></a> object.</li>
- <li>Generate a unique ID and assign it to the <a def-id="videotrack-id"></a> property on <var>new video track</var>.</li>
- <li>Assign <var>video language</var> to the <a def-id="videotrack-language"></a>
- property on <var>new video track</var>.</li>
- <li>Assign <var>video label</var> to the <a def-id="videotrack-label"></a>
- property on <var>new video track</var>.</li>
- <li>Assign <var>current video kind</var> to the <a def-id="videotrack-kind"></a>
- property on <var>new video track</var>.</li>
- <li>
- <p>
- If <a def-id="videotracks"></a>.<a def-id="videotracklist-length"></a> equals 0, then run
- the following steps:
- </p>
- <ol>
- <li>Set the <a def-id="videotrack-selected"></a> property on <var>new video track</var> to true.</li>
- <li>Set <var>active track flag</var> to true.</li>
- </ol>
- </li>
- <li>Add <var>new video track</var> to the <a def-id="sourcebuffer-videoTracks"></a> attribute on this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at the <a def-id="video-track-list"></a> object referenced by the <a def-id="sourcebuffer-videoTracks"></a> attribute
- on this <a>SourceBuffer</a> object.</li>
- <li>Add <var>new video track</var> to the <a def-id="videotracks"></a> attribute on the HTMLMediaElement.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at the <a def-id="video-track-list"></a> object referenced by the <a def-id="videotracks"></a> attribute on the
- HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a def-id="track-buffer"></a> to store <a def-id="coded-frames"></a> for this track.</li>
- <li>Add the <a def-id="track-description"></a> for this track to the <a def-id="track-buffer"></a>.</li>
- </ol>
- </li>
- <li>
- <p>For each text track in the <a def-id="init-segment"></a>, run following steps:</p>
- <ol>
- <li>Let <var>text byte stream track ID</var> be the
- <a def-id="track-id"></a> for the current track being processed.</li>
- <li>Let <var>text language</var> be a BCP 47 language tag for the language
- specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>text language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a def-id="default-track-language-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-text"></a> and assign the value returned by the
- algorithm to <var>text language</var>.</li>
- <li>Let <var>text label</var> be a label specified in the <a def-id="init-segment"></a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>text label</var> equals an empty string, then run the
- <a def-id="default-track-label-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-text"></a> and assign the value returned by the
- algorithm to <var>text label</var>.</li>
- <li>Let <var>text kinds</var> be an array of kind strings specified in the
- <a def-id="init-segment"></a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>text kinds</var> equals an empty array, then run the
- <a def-id="default-track-kinds-algorithm"></a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <a def-id="TrackDefaultType-text"></a> and assign the value returned by the
- algorithm to <var>text kinds</var>.</li>
- <li>For each value in <var>text kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current text kind</var> equal the value from <var>text kinds</var>
- for this iteration of the loop.</li>
- <li>
- Let <var>new text track</var> be a new <a def-id="text-track"></a> object.</li>
- <li>Generate a unique ID and assign it to the <a def-id="texttrack-id"></a> property on <var>new text track</var>.</li>
- <li>Assign <var>text language</var> to the <a def-id="texttrack-language"></a>
- property on <var>new text track</var>.</li>
- <li>Assign <var>text label</var> to the <a def-id="texttrack-label"></a>
- property on <var>new text track</var>.</li>
- <li>Assign <var>current text kind</var> to the <a def-id="texttrack-kind"></a>
- property on <var>new text track</var>.</li>
- <li>Populate the remaining properties on <var>new text track</var> with the
- appropriate information from the <a def-id="init-segment"></a>.
- <li>
- If the <a def-id="texttrack-mode"></a> property on <var>new text track</var> equals <a def-id="texttrack-showing"></a> or
- <a def-id="texttrack-hidden"></a>, then set <var>active track flag</var> to true.
- </li>
- <li>Add <var>new text track</var> to the <a def-id="sourcebuffer-textTracks"></a> attribute on this <a>SourceBuffer</a> object.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at <a def-id="sourcebuffer-textTracks"></a> attribute
- on this <a>SourceBuffer</a> object.</li>
- <li>Add <var>new text track</var> to the <a def-id="texttracks"></a> attribute on the HTMLMediaElement.</li>
- <li><a def-id="Queue-and-fire-addtrack"></a> at the <a def-id="text-track-list"></a> object referenced by the <a def-id="texttracks"></a> attribute on the
- HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a def-id="track-buffer"></a> to store <a def-id="coded-frames"></a> for this track.</li>
- <li>Add the <a def-id="track-description"></a> for this track to the <a def-id="track-buffer"></a>.</li>
- </ol>
- </li>
- <li>If <var>active track flag</var> equals true, then run the following steps:
- <ol>
- <li>Add this <a>SourceBuffer</a> to <a def-id="activeSourceBuffers"></a>.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="addsourcebuffer"></a> at <a def-id="activeSourceBuffers"></a></li>
- </ol>
- </li>
- <li>Set <a def-id="first-init-segment-received-flag"></a> to true.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="ready-state"></a> attribute is <a def-id="have-nothing"></a>, then run the following steps:</p>
- <ol>
- <li>
- If one or more objects in <a def-id="sourceBuffers"></a> have <a def-id="first-init-segment-received-flag"></a> set to false, then abort
- these steps.</li>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-metadata"></a>.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="loadedmetadata"></a> at the media element.</li>
- </ol>
- </li>
- <li>
- If the <var>active track flag</var> equals true and the <a def-id="ready-state"></a> attribute is greater than
- <a def-id="have-current-data"></a>, then set the <a def-id="ready-state"></a> attribute to <a def-id="have-metadata"></a>.
- </li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-language">
- <h4>Default track language</h4>
- <p>The following steps are run when the <a def-id="init-segment-received-algorithm"></a> needs
- to determine what the default language for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a def-id="init-segment-received-algorithm"></a>.</p>
- <ol>
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <a def-id="TrackDefault-language"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- an empty string, then return the value of the
- <a def-id="TrackDefault-language"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an empty string to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-label">
- <h4>Default track label</h4>
- <p>The following steps are run when the <a def-id="init-segment-received-algorithm"></a> needs
- to determine what the default label for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a def-id="init-segment-received-algorithm"></a>.</p>
- <ol>
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <a def-id="TrackDefault-label"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- an empty string, then return the value of the
- <a def-id="TrackDefault-label"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an empty string to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-kinds">
- <h4>Default track kinds</h4>
- <p>The following steps are run when the <a def-id="init-segment-received-algorithm"></a> needs
- to determine what the default kinds for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a def-id="init-segment-received-algorithm"></a>.</p>
- <ol>
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <a def-id="TrackDefault-kinds"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <a def-id="trackDefaults"></a> contains a <a>TrackDefault</a> object with a
- <a def-id="TrackDefault-type"></a> attribute equal to <var>type</var> and a
- <a def-id="TrackDefault-byteStreamTrackID"></a> attribute equal to
- an empty string, then return the value of the
- <a def-id="TrackDefault-kinds"></a> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an array with a single empty string element in it to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-processing">
- <h4>Coded Frame Processing</h4>
- <p>When complete <a def-id="coded-frames"></a> have been parsed by the <a def-id="segment-parser-loop"></a> then the following steps are run:</p>
- <ol>
- <li>
- <p>For each <a def-id="coded-frame"></a> in the <a def-id="media-segment"></a> run the following steps:</p>
- <ol>
- <li><i>Loop Top: </i><dl class="switch">
- <dt>If <a def-id="generate-timestamps-flag"></a> equals true:</dt>
- <dd>
- <ol>
- <li>Let <var>presentation timestamp</var> equal 0.</li>
- <li>Let <var>decode timestamp</var> equal 0.</li>
- </ol>
- </dd>
- <dt>Otherwise:</dt>
- <dd>
- <ol>
- <li>Let <var>presentation timestamp</var> be a double precision floating point representation of the coded frame's <a def-id="presentation-timestamp"></a> in seconds.
- <p class="note">Special processing may be needed to determine the presentation and decode timestamps for timed text frames since this information may not be explicitly
- present in the underlying format or may be dependent on the order of the frames. Some metadata text tracks, like MPEG2-TS PSI data, may only have implied timestamps.
- Format specific rules for these situations should be in the <a def-id="byte-stream-format-specs"></a> or in separate extension specifications.</p>
- </li>
- <li>Let <var>decode timestamp</var> be a double precision floating point representation of the coded frame's decode timestamp in seconds.
- <p class="note">Implementations don't have to internally store timestamps in a double precision floating point representation. This
- representation is used here because it is the represention for timestamps in the HTML spec. The intention here is to make the
- behavior clear without adding unnecessary complexity to the algorithm to deal with the fact that adding a timestampOffset may
- cause a timestamp rollover in the underlying timestamp representation used by the byte stream format. Implementations can use any
- internal timestamp representation they wish, but the addition of timestampOffset should behave in a similar manner to what would happen
- if a double precision floating point representation was used.
- </p>
- </li>
- </ol>
- </dd>
- </dl>
- </li>
- <li>Let <var>frame duration</var> be a double precision floating point representation of the <a def-id="coded-frames-duration"></a> in seconds.</li>
- <li>If <a def-id="mode"></a> equals <a def-id="AppendMode-sequence"></a> and <a def-id="group-start-timestamp"></a> is set, then run the following steps:
- <ol>
- <li>Set <a def-id="timestampOffset"></a> equal to <a def-id="group-start-timestamp"></a> - <var>presentation timestamp</var>.</li>
- <li>Set <a def-id="group-end-timestamp"></a> equal to <a def-id="group-start-timestamp"></a>.</li>
- <li>Set the <a def-id="need-RAP-flag"></a> on all <a def-id="track-buffers"></a> to true.</li>
- <li>Unset <a def-id="group-start-timestamp"></a>.</li>
- </ol>
- </li>
- <li>
- <p>If <a def-id="timestampOffset"></a> is not 0, then run the following steps:</p>
- <ol>
- <li>Add <a def-id="timestampOffset"></a> to the <var>presentation timestamp</var>.</li>
- <li>Add <a def-id="timestampOffset"></a> to the <var>decode timestamp</var>.</li>
- </ol>
- </li>
- <li>Let <var>track buffer</var> equal the <a def-id="track-buffer"></a> that the coded frame will be added to.</li>
- <li>
- <dl class="switch">
- <dt>If <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> is set and <var>decode timestamp</var> is less than
- <a def-id="last-decode-timestamp"></a>:</dt>
- <dd>OR</dd>
- <dt>If <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> is set and the difference between <var>decode timestamp</var> and <a def-id="last-decode-timestamp"></a>
- is greater than 2 times <a def-id="last-frame-duration"></a>:</dt>
- <dd>
- <ol>
- <li>
- <dl class="switch">
- <dt>If <a def-id="mode"></a> equals <a def-id="AppendMode-segments"></a>:</dt>
- <dd>Set <a def-id="group-end-timestamp"></a> to <var>presentation timestamp</var>.</dd>
- <dt>If <a def-id="mode"></a> equals <a def-id="AppendMode-sequence"></a>:</dt>
- <dd>Set <a def-id="group-start-timestamp"></a> equal to the <a def-id="group-end-timestamp"></a>.</dd>
- </dl>
- </li>
- <li>Unset the <a def-id="last-decode-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Unset the <a def-id="last-frame-duration"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Unset the <a def-id="highest-presentation-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
- <li>Set the <a def-id="need-RAP-flag"></a> on all <a def-id="track-buffers"></a> to true.</li>
- <li>Jump to the <i>Loop Top</i> step above to restart processing of the current <a def-id="coded-frame"></a>.</li>
- </ol>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Continue.</dd>
- </dl>
- </li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>If <var>presentation timestamp</var> is less than <a def-id="appendWindowStart"></a>, then set the <a def-id="need-RAP-flag"></a> to true, drop the
- coded frame, and jump to the top of the loop to start processing the next coded frame.
- <p class="note">Some implementations may choose to collect some of these coded frames that are outside the <a def-id="append-window"></a> and use them
- to generate a splice at the first coded frame that has a <a def-id="presentation-timestamp"></a> greater than or equal to <a def-id="appendWindowStart"></a> even if
- that frame is not a <a def-id="random-access-point"></a>. Supporting this requires multiple decoders or faster than real-time decoding so for now
- this behavior will not be a normative requirement.
- </p>
- </li>
- <li>If <var>frame end timestamp</var> is greater than <a def-id="appendWindowEnd"></a>, then set the <a def-id="need-RAP-flag"></a> to true, drop the
- coded frame, and jump to the top of the loop to start processing the next coded frame.
- <li>If the <var>decode timestamp</var> is less than the <a def-id="presentation-start-time"></a>,
- then run the <a def-id="eos-decode"></a>, and abort these steps.</li>
- <li>If the <a def-id="need-RAP-flag"></a> on <var>track buffer</var> equals true, then run the following steps:
- <ol>
- <li>If the coded frame is not a <a def-id="random-access-point"></a>, then drop the coded frame and jump to the top of the loop to start
- processing the next coded frame.</li>
- <li>Set the <a def-id="need-RAP-flag"></a> on <var>track buffer</var> to false.</li>
- </ol>
- </li>
- <li>Let <var>spliced audio frame</var> be an unset variable for holding audio splice information</li>
- <li>Let <var>spliced timed text frame</var> be an unset variable for holding timed text splice information</li>
- <li>If <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> is unset and <var>presentation timestamp</var> falls within the <a def-id="presentation-interval"></a> of a <a def-id="coded-frame"></a> in <var>track buffer</var>,then run the following steps:
- <ol>
- <li>Let <var>overlapped frame</var> be the <a def-id="coded-frame"></a> in <var>track buffer</var> that matches the condition above.</li>
- <li>
- <dl class="switch">
- <dt>If <var>track buffer</var> contains audio <a def-id="coded-frames"></a>:</dt>
- <dd>Run the <a def-id="audio-splice-frame-algorithm"></a> and if a splice frame is returned, assign it to <var>spliced audio frame</var>.</dd>
- <dt>If <var>track buffer</var> contains video <a def-id="coded-frames"></a>:</dt>
- <dd>
- <ol>
- <li>Let <var>overlapped frame presentation timestamp</var> equal the <a def-id="presentation-timestamp"></a> of <var>overlapped frame</var>.</li>
- <li>Let <var>remove window timestamp</var> equal <var>overlapped frame presentation timestamp</var> plus 1 microsecond.</li>
- <li>If the <var>presentation timestamp</var> is less than the <var>remove window timestamp</var>, then remove <var>overlapped frame</var> and any
- <a def-id="coded-frames"></a> that depend on it from <var>track buffer</var>.
- <p class="note">
- This is to compensate for minor errors in frame timestamp computations that can appear when converting back and forth between double precision
- floating point numbers and rationals. This tolerance allows a frame to replace an existing one as long as it is within 1 microsecond of the existing
- frame's start time. Frames that come slightly before an existing frame are handled by the removal step below.
- </p>
- </li>
- </ol>
- </dd>
- <dt>If <var>track buffer</var> contains timed text <a def-id="coded-frames"></a>:</dt>
- <dd>Run the <a def-id="text-splice-frame-algorithm"></a> and if a splice frame is returned, assign it to <var>spliced timed text frame</var>.</dd>
- </dl>
- </li>
- </ol>
- </li>
- <li>Remove existing coded frames in <var>track buffer</var>:
- <dl class="switch">
- <dt>If <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var> is not set:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> from <var>track buffer</var> that have a <a def-id="presentation-timestamp"></a> greater than or equal to
- <var>presentation timestamp</var> and less than <var>frame end timestamp</var>.</dd>
- <dt>If <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var> is set and less than or equal to <var>presentation timestamp</var>:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> from <var>track buffer</var> that have a <a def-id="presentation-timestamp"></a> greater than
- or equal to <a def-id="highest-presentation-timestamp"></a> and less than <var>frame end timestamp</var></dd>
- </dl>
- </li>
- <li>Remove decoding dependencies of the coded frames removed in the previous step:
- <dl class="switch">
- <dt>If detailed information about decoding dependencies is available:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
- the previous step.
- <p class="note">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
- should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.
- </p>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> between the coded frames removed in the previous step and the next
- <a def-id="random-access-point"></a> after those removed frames.
- <p class="note">Removing all <a def-id="coded-frames"></a> until the next <a def-id="random-access-point"></a> is a conservative
- estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
- depended on the frames that were removed.
- </p>
- </dd>
- </li>
- <li>
- <dl class="switch">
- <dt>If <var>spliced audio frame</var> is set:</dt>
- <dd>Add <var>spliced audio frame</var> to the <var>track buffer</var>.</dd>
- <dt>If <var>spliced timed text frame</var> is set:</dt>
- <dd>Add <var>spliced timed text frame</var> to the <var>track buffer</var>.</dd>
- <dt>Otherwise:</dt>
- <dd>Add the <a def-id="coded-frame"></a> with the <var>presentation timestamp</var>, <var>decode timestamp</var>, and <var>frame duration</var> to the
- <var>track buffer</var>.</dd>
- </dl>
- <li>Set <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> to <var>decode timestamp</var>.</li>
- <li>Set <a def-id="last-frame-duration"></a> for <var>track buffer</var> to <var>frame duration</var>.</li>
- <li>If <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var> is unset or <var>frame end timestamp</var> is greater
- than <a def-id="highest-presentation-timestamp"></a>, then set <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var>
- to <var>frame end timestamp</var>.
- <p class="note">The greater than check is needed because bidirectional prediction between coded frames can cause
- <var>presentation timestamp</var> to not be monotonically increasing eventhough the decode timestamps are monotonically increasing.</p>
- </li>
- <li>If <var>frame end timestamp</var> is greater than <a def-id="group-end-timestamp"></a>,
- then set <a def-id="group-end-timestamp"></a> equal to <var>frame end timestamp</var>.</li>
- <li>If <a def-id="generate-timestamps-flag"></a> equals true, then set
- <a def-id="timestampOffset"></a> equal to <var>frame end timestamp</var>.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="ready-state"></a> attribute is <a def-id="have-metadata"></a> and the new <a def-id="coded-frames"></a> cause <a def-id="hme-buffered"></a> to have a <a def-id="timerange"></a> for the current playback position, then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-current-data"></a>.</li>
- <li>If this is the first transition to <a def-id="have-current-data"></a>, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="loadeddata"></a> at the media element.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="ready-state"></a> attribute is <a def-id="have-current-data"></a> and the new <a def-id="coded-frames"></a> cause <a def-id="hme-buffered"></a> to have a <a def-id="timerange"></a> that includes the current playback position and some time beyond the current playback position, then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-future-data"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="canplay"></a> at the media element.</li>
- </ol>
- </li>
- <li>
- <p>If the <a def-id="ready-state"></a> attribute is <a def-id="have-future-data"></a> and the new <a def-id="coded-frames"></a> cause <a def-id="hme-buffered"></a> to have a <a def-id="timerange"></a> that includes the current playback position and <a def-id="enough-data"></a>, then run the following steps:</p>
- <ol>
- <li>Set the <a def-id="ready-state"></a> attribute to <a def-id="have-enough-data"></a>.</li>
- <li>
- <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="canplaythrough"></a> at the media element.</li>
- </ol>
- </li>
- <li>If the <a def-id="media-segment"></a> contains data beyond the current <a def-id="duration"></a>, then run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the maximum of the current duration and the <a def-id="group-end-timestamp"></a>.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-removal">
- <h4>Coded Frame Removal Algorithm</h4>
- <p>Follow these steps when <a def-id="coded-frames"></a> for a specific time range need to be removed from the SourceBuffer:</p>
- <ol>
- <li>Let <var>start</var> be the starting <a def-id="presentation-timestamp"></a> for the removal range.</li>
- <li>Let <var>end</var> be the end <a def-id="presentation-timestamp"></a> for the removal range. </li>
- <li><p>For each <a def-id="track-buffer"></a> in this source buffer, run the following steps:</p>
- <ol>
- <li>Let <var>remove end timestamp</var> be the current value of <a def-id="duration"></a></li>
- <li>
- <p>If this <a def-id="track-buffer"></a> has a <a def-id="random-access-point"></a> timestamp that is greater than or equal to
- <var>end</var>, then update <var>remove end timestamp</var> to that random access point timestamp.</p>
- <p class="note">Random access point timestamps can be different across tracks because the dependencies between <a def-id="coded-frames"></a> within a
- track are usually different than the dependencies in another track.</p>
- </li>
- <li>Remove all media data, from this <a def-id="track-buffer"></a>, that contain starting timestamps greater than or equal to
- <var>start</var> and less than the <var>remove end timestamp</var>.</li>
- <li>Remove decoding dependencies of the coded frames removed in the previous step:
- <dl class="switch">
- <dt>If detailed information about decoding dependencies is available:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> from this <a def-id="track-buffer"></a> that have decoding dependencies on the coded frames removed in
- the previous step.
- <p class="note">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
- should be removed from this <a def-id="track-buffer"></a>.
- </p>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Remove all <a def-id="coded-frames"></a> between the coded frames removed in the previous step and the next
- <a def-id="random-access-point"></a> after those removed frames.
- <p class="note">Removing all <a def-id="coded-frames"></a> until the next <a def-id="random-access-point"></a> is a conservative
- estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
- depended on the frames that were removed.
- </p>
- </dd>
- </li>
- <li>
- <p>If this object is in <a def-id="activeSourceBuffers"></a>, the <a def-id="current-playback-position"></a> is greater than or equal to
- <var>start</var> and less than the <var>remove end timestamp</var>, and <a def-id="ready-state"></a> is greater than
- <a def-id="have-metadata"></a>, then set the <a def-id="ready-state"></a> attribute to <a def-id="have-metadata"></a> and stall playback.</p>
- <p class="note">This transition occurs because media data for the current position has been removed. Playback cannot progress until media for the
- <a def-id="current-playback-position"></a> is appended or the <a href="#active-source-buffer-changes">selected/enabled tracks change</a>.</p>
- </li>
- </ol>
- </li>
- <li>If <a def-id="buffer-full-flag"></a> equals true and this object is ready to accept more bytes, then set
- the <a def-id="buffer-full-flag"></a> to false.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-eviction">
- <h4>Coded Frame Eviction Algorithm</h4>
- <p>This algorithm is run to free up space in this source buffer when new data is appended.</p>
- <ol>
- <li>Let <var>new data</var> equal the data that is about to be appended to this SourceBuffer.</li>
- <li>If the <a def-id="buffer-full-flag"></a> equals false, then abort these steps.</li>
- <li>Let <var>removal ranges</var> equal a list of presentation time ranges that can be evicted from the presentation to make room for the
- <var>new data</var>.
- <p class="note">Implementations may use different methods for selecting <var>removal ranges</var> so web applications should not depend on a
- specific behavior. The web application can use the <a def-id="buffered"></a> attribute to observe whether portions of the buffered data have been evicted.
- </p>
- </li>
- <li>For each range in <var>removal ranges</var>, run the <a def-id="coded-frame-removal-algorithm"></a> with <var>start</var> and <var>end</var> equal to
- the removal range start and end timestamp respectively.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-audio-splice-frame-algorithm">
- <h4>Audio Splice Frame Algorithm</h4>
- <p>Follow these steps when the <a def-id="coded-frame-processing-algorithm"></a> needs to generate a splice frame for two overlapping audio
- <a def-id="coded-frames"></a>:</p>
- <ol>
- <li>Let <var>track buffer</var> be the <a def-id="track-buffer"></a> that will contain the splice.</li>
- <li>Let <var>new coded frame</var> be the new <a def-id="coded-frame"></a>, that is being added to <var>track buffer</var>, which triggered the need for a splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a def-id="presentation-timestamp"></a> for <var>new coded frame</var></li>
- <li>Let <var>decode timestamp</var> be the decode timestamp for <var>new coded frame</var>.</li>
- <li>Let <var>frame duration</var> be the <a def-id="coded-frame-duration"></a> of <var>new coded frame</var>.</li>
- <li>Let <var>overlapped frame</var> be the <a def-id="coded-frame"></a> in <var>track buffer</var> with a <a def-id="presentation-interval"></a> that contains <var>presentation timestamp</var>.
- </li>
- <li>Update <var>presentation timestamp</var> and <var>decode timestamp</var> to the nearest audio sample timestamp based on sample rate of the
- audio in <var>overlapped frame</var>. If a timestamp is equidistant from both audio sample timestamps, then use the higher timestamp. (eg.
- floor(x * sample_rate + 0.5) / sample_rate).
- <div class="note">
- <p>For example, given the following values:</p>
- <ul>
- <li>The <a def-id="presentation-timestamp"></a> of <var>overlapped frame</var> equals 10.</li>
- <li>The sample rate of <var>overlapped frame</var> equals 8000 Hz</li>
- <li><var>presentation timestamp</var> equals 10.01255</li>
- <li><var>decode timestamp</var> equals 10.01255</li>
- </ul>
- <p><var>presentation timestamp</var> and <var>decode timestamp</var> are updated to 10.0125 since 10.01255 is closer to
- 10 + 100/8000 (10.0125) than 10 + 101/8000 (10.012625)</p>
- </div>
- </li>
- <li>If the user agent does not support crossfading then run the following steps:
- <ol>
- <li>Remove <var>overlapped frame</var> from <var>track buffer</var>.</li>
- <li>Add a silence frame to <var>track buffer</var> with the following properties:
- <ul>
- <li>The <a def-id="presentation-timestamp"></a> set to the <var>overlapped frame</var> <a def-id="presentation-timestamp"></a>.</li>
- <li>The <a def-id="decode-timestamp"></a> set to the <var>overlapped frame</var> <a def-id="decode-timestamp"></a>.</li>
- <li>The <a def-id="coded-frame-duration"></a> set to difference between <var>presentation timestamp</var> and the <var>overlapped frame</var> <a def-id="presentation-timestamp"></a>.</li>
- </ul>
- <p class="note">
- Some implementations may apply fades to/from silence to coded frames on either side of the inserted silence to make the transition less
- jarring.
- </p>
- </li>
- <li>Return to caller without providing a splice frame.
- <p class="note">
- This is intended to allow <var>new coded frame</var> to be added to the <var>track buffer</var> as if
- <var>overlapped frame</var> had not been in the <var>track buffer</var> to begin with.
- </p>
- </li>
- </ol>
- </li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>Let <var>splice end timestamp</var> equal the sum of <var>presentation timestamp</var> and the splice duration of 5 milliseconds.</li>
- <li>Let <var>fade out coded frames</var> equal <var>overlapped frame</var> as well as any additional frames in <var>track buffer</var> that
- have a <a def-id="presentation-timestamp"></a> greater than <var>presentation timestamp</var> and less than <var>splice end timestamp</var>.</li>
- <li>Remove all the frames included in <var>fade out coded frames</var> from <var>track buffer</var>.
- <li>Return a splice frame with the following properties:
- <ul>
- <li>The <a def-id="presentation-timestamp"></a> set to the <var>overlapped frame</var> <a def-id="presentation-timestamp"></a>.</li>
- <li>The <a def-id="decode-timestamp"></a> set to the <var>overlapped frame</var> <a def-id="decode-timestamp"></a>.</li>
- <li>The <a def-id="coded-frame-duration"></a> set to difference between <var>frame end timestamp</var> and the <var>overlapped frame</var> <a def-id="presentation-timestamp"></a>.</li>
- <li>The fade out coded frames equals <var>fade-out coded frames</var>.</li>
- <li>The fade in coded frame equal <var>new coded frame</var>.
- <p class="note">If the <var>new coded frame</var> is less than 5 milliseconds in duration, then coded frames that are appended after the
- <var>new coded frame</var> will be needed to properly render the splice.</p>
- </li>
- <li>The splice timestamp equals <var>presentation timestamp</var>.</li>
- </ul>
- <p class="note">See the <a def-id="audio-splice-rendering-algorithm"></a> for details on how this splice frame is rendered.</p>
- </li>
- </ol>
- </section>
- <section id="sourcebuffer-audio-splice-rendering-algorithm">
- <h4>Audio Splice Rendering Algorithm</h4>
- <p>The following steps are run when a spliced frame, generated by the <a def-id="audio-splice-frame-algorithm"></a>, needs to be rendered by the
- media element:</p>
- <ol>
- <li>Let <var>fade out coded frames</var> be the <a def-id="coded-frames"></a> that are faded out during the splice.</li>
- <li>Let <var>fade in coded frames</var> be the <a def-id="coded-frames"></a> that are faded in during the splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a def-id="presentation-timestamp"></a> of the first coded frame in <var>fade out coded frames</var>.</li>
- <li>Let <var>end timestamp</var> be the sum of the <a def-id="presentation-timestamp"></a> and the <a def-id="coded-frame-duration"></a> of the last frame in <var>fade in coded frames</var>.</li>
- <li>Let <var>splice timestamp</var> be the <a def-id="presentation-timestamp"></a> where the splice starts. This corresponds with the <a def-id="presentation-timestamp"></a> of the first frame in
- <var>fade in coded frames</var>.</li>
- <li>Let <var>splice end timestamp</var> equal <var>splice timestamp</var> plus five milliseconds.</li>
- <li>Let <var>fade out samples</var> be the samples generated by decoding <var>fade out coded frames</var>.</li>
- <li>Trim <var>fade out samples</var> so that it only contains samples between <var>presentation timestamp</var> and <var>splice end timestamp</var>.</li>
- <li>Let <var>fade in samples</var> be the samples generated by decoding <var>fade in coded frames</var>.</li>
- <li>If <var>fade out samples</var> and <var>fade in samples</var> do not have a common sample rate and channel layout, then convert
- <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
- <li>Let <var>output samples</var> be a buffer to hold the output samples.</li>
- <li>Apply a linear gain fade out with a starting gain of 1 and an ending gain of 0 to the samples between
- <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
- <li>Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between <var>splice timestamp</var> and
- <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
- <li>Copy samples between <var>presentation timestamp</var> to <var>splice timestamp</var> from <var>fade out samples</var> into <var>output samples</var>.</li>
- <li>For each sample between <var>splice timestamp</var> and <var>splice end timestamp</var>, compute the sum of a sample from <var>fade out samples</var> and the
- corresponding sample in <var>fade in samples</var> and store the result in <var>output samples</var>.</li>
- <li>Copy samples between <var>splice end timestamp</var> to <var>end timestamp</var> from <var>fade in samples</var> into <var>output samples</var>.</li>
- <li>Render <var>output samples</var>.</li>
- </ol>
- <div class="note">
- <p>Here is a graphical representation of this algorithm.</p>
- <img src="audio_splice.png" alt="Audio splice diagram">
- </div>
- </section>
- <section id="sourcebuffer-text-splice-frame-algorithm">
- <h4>Text Splice Frame Algorithm</h4>
- <p>Follow these steps when the <a def-id="coded-frame-processing-algorithm"></a> needs to generate a splice frame for two overlapping timed text
- <a def-id="coded-frames"></a>:</p>
- <ol>
- <li>Let <var>track buffer</var> be the <a def-id="track-buffer"></a> that will contain the splice.</li>
- <li>Let <var>new coded frame</var> be the new <a def-id="coded-frame"></a>, that is being added to <var>track buffer</var>, which triggered the need for a splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a def-id="presentation-timestamp"></a> for <var>new coded frame</var></li>
- <li>Let <var>decode timestamp</var> be the decode timestamp for <var>new coded frame</var>.</li>
- <li>Let <var>frame duration</var> be the <a def-id="coded-frame-duration"></a> of <var>new coded frame</var>.</li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>Let <var>first overlapped frame</var> be the <a def-id="coded-frame"></a> in <var>track buffer</var> with a <a def-id="presentation-interval"></a> that contains <var>presentation timestamp</var>.
- </li>
- <li>Let <var>overlapped presentation timestamp</var> be the <a def-id="presentation-timestamp"></a> of the <var>first overlapped frame</var>.</li>
- <li>Let <var>overlapped frames</var> equal <var>first overlapped frame</var> as well as any additional frames in <var>track buffer</var> that
- have a <a def-id="presentation-timestamp"></a> greater than <var>presentation timestamp</var> and less than <var>frame end timestamp</var>.</li>
- <li>Remove all the frames included in <var>overlapped frames</var> from <var>track buffer</var>.
- <li>Update the <a def-id="coded-frame-duration"></a> of the <var>first overlapped frame</var> to <var>presentation timestamp</var> - <var>overlapped presentation timestamp</var>.</li>
- <li>Add <var>first overlapped frame</var> to the <var>track buffer</var>.
- <li>Return to caller without providing a splice frame.
- <p class="note">This is intended to allow <var>new coded frame</var> to be added to the <var>track buffer</var> as if
- it hadn't overlapped any frames in <var>track buffer</var> to begin with.</p>
- </li>
- </ol>
- </section>
- </section>
- </section>
-
- <section id="sourcebufferlist">
- <h2>SourceBufferList Object</h2>
- <p>SourceBufferList is a simple container object for <a>SourceBuffer</a> objects. It provides read-only array access and fires events when the list is modified.</p>
-
- <dl title="interface SourceBufferList : EventTarget" class="idl">
- <dt>readonly attribute unsigned long length</dt>
- <dd>
- <p>Indicates the number of <a>SourceBuffer</a> objects in the list.</p>
- </dd>
- <dt>getter SourceBuffer (unsigned long index)</dt>
- <dd>
- <p>Allows the SourceBuffer objects in the list to be accessed with an array operator (i.e. []).</p>
-
- <ol class="method-algorithm">
- <li>If <var>index</var> is greater than or equal to the <a def-id="length"></a> attribute then return undefined and abort these steps.</li>
- <li>Return the <var>index</var>'th <a>SourceBuffer</a> object in the list.</li>
- </ol>
- </dd>
- </dl>
-
- <section id="sourcebufferlist-events">
- <h3>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a def-id="eventdfn">addsourcebuffer</a></td>
- <td><code>Event</code></td>
- <td>When a <a>SourceBuffer</a> is added to the list.</td>
- </tr>
- <tr>
- <td><a def-id="eventdfn">removesourcebuffer</a></td>
- <td><code>Event</code></td>
- <td>When a <a>SourceBuffer</a> is removed from the list.</td>
- </tr>
- </tbody>
- </table>
- </section>
- </section>
-
- <section id="videoplaybackquality">
- <h2>VideoPlaybackQuality Object</h2>
- <dl title="interface VideoPlaybackQuality" class="idl">
- <dt>readonly attribute DOMHighResTimeStamp creationTime</dt>
- <dd>
- <p>The timestamp returned by <a def-id="performance-now"></a> when this object was created.</p>
- </dd>
-
- <dt>readonly attribute unsigned long totalVideoFrames</dt>
- <dd>
- <p>The total number of frames that would have been displayed if no frames are dropped.</p>
- </dd>
-
- <dt>readonly attribute unsigned long droppedVideoFrames</dt>
- <dd>
- <p>The total number of frames dropped predecode or dropped because the frame missed
- its display deadline.</p>
- </dd>
-
- <dt>readonly attribute unsigned long corruptedVideoFrames</dt>
- <dd>
- <p>The total number of corrupted frames that have been detected.</p>
- </dd>
-
- <dt>readonly attribute double totalFrameDelay</dt>
- <dd>
- <p>The sum of all <a def-id="displayed-frame-delays"></a> for all displayed frames. (i.e., Frames included in the <a def-id="totalVideoFrames"></a> count, but not in the <a def-id="droppedVideoFrames"></a>
- count.</p>
- </dd>
- </dl>
- </section>
-
- <section id="trackdefault">
- <h2>TrackDefault Object</h2>
- <p>The TrackDefault object is used to provide kind, label, and language information for tracks that do not
- contain this information in the <a def-id="init-segments"></a>. This information is only consulted
- when the <a def-id="init-segment-received-algorithm"></a> creates track objects.</p>
-
- <dl title="enum TrackDefaultType" class="idl">
- <dt>audio</dt>
- <dd>
- Indicates that the information in the <a>TrackDefault</a> object should only be used when
- creating <a>AudioTrack</a> objects.
- </dd>
- <dt>video</dt>
- <dd>
- Indicates that the information in the <a>TrackDefault</a> object should only be used when
- creating <a>VideoTrack</a> objects.
- </dd>
- <dt>text</dt>
- <dd>
- Indicates that the information in the <a>TrackDefault</a> object should only be used when
- creating <a>TextTrack</a> objects.
- </dd>
- </dl>
-
- <dl title="interface TrackDefault" class="idl">
- <dt class="extended-attribute">
- Constructor(TrackDefaultType type, DOMString language, DOMString label, sequence<DOMString> kinds, optional DOMString byteStreamTrackID = "")
- </dt>
- <dd>
- <ol class="method-algorithm">
- <li>If <var>language</var> is not an empty string and <var>language</var> is not a BCP 47
- language tag, then throw an <a def-id="invalid-access-err"></a> and abort these steps.</li>
- <li>
- <dl class="switch">
- <dt>If <var>type</var> equals <a def-id="TrackDefaultType-audio"></a>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed as applying to
- audio in the <a def-id="av-kind-categories-table"></a>, then throw an
- <a def-id="invalid-access-err"></a> and abort these steps.
- </dd>
- <dt>If <var>type</var> equals <a def-id="TrackDefaultType-video"></a>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed as applying to
- video in the <a def-id="av-kind-categories-table"></a>, then throw an
- <a def-id="invalid-access-err"></a> and abort these steps.
- </dd>
-
- <dt>If <var>type</var> equals <a def-id="TrackDefaultType-text"></a>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed in the
- <a def-id="text-track-kind-list"></a>, then throw an <a def-id="invalid-access-err"></a>
- and abort these steps.
- </dd>
- </dl>
- </li>
- <li>Set the <a def-id="TrackDefault-type"></a> attribute on this new object to <var>type</var>.</li>
- <li>Set the <a def-id="TrackDefault-language"></a> attribute on this new object to <var>language</var>.</li>
- <li>Set the <a def-id="TrackDefault-label"></a> attribute on this new object to <var>label</var>.</li>
- <li>Set the <a def-id="TrackDefault-kinds"></a> attribute to on this new object <var>kinds</var>.</li>
- <li>Set the <a def-id="TrackDefault-byteStreamTrackID"></a> attribute on this new object to <var>byteStreamTrackID</var>.</li>
- </ol>
- </dd>
- <dt>readonly attribute TrackDefaultType type</dt>
- <dd>
- <p>The type of track that can be constructed using the information in this object.</p>
- </dd>
- <dt>readonly attribute DOMString byteStreamTrackID</dt>
- <dd>
- <p>The decimal string representation of the <a def-id="track-id"></a> that identifies the specific
- track that this object should apply to. An empty string indicates that this object can be
- used for any track of the appropriate type. (i.e. any <a>AudioTrack</a> if
- <a def-id="TrackDefault-type"></a> equals <a def-id="TrackDefaultType-audio"></a>).</p>
- </dd>
- <dt>readonly attribute DOMString language</dt>
- <dd>
- <p>The default language to use when an <a def-id="init-segment"></a> does not contain language
- information for a new track. See <a def-id="init-segment-received-algorithm"></a> for details.</p>
- </dd>
- <dt>readonly attribute DOMString label</dt>
- <dd>
- <p>The default label to use when an <a def-id="init-segment"></a> does not contain label
- information for a new track. See <a def-id="init-segment-received-algorithm"></a> for details.</p>
- </dd>
- <dt>readonly attribute DOMString[] kinds</dt>
- <dd>
- <p>The default kinds used when an <a def-id="init-segment"></a> does not contain kind
- information for a new track. See <a def-id="init-segment-received-algorithm"></a> for details.</p>
- </dd>
- </dl>
- </section>
-
- <section id="trackdefaultlist">
- <h2>TrackDefaultList Object</h2>
- <p>TrackDefaultList is a simple container object for <a>TrackDefault</a> objects. It provides read-only array access.</p>
-
- <dl title="interface TrackDefaultList" class="idl">
- <dt class="extended-attribute">
- Constructor(sequence<TrackDefault> trackDefaults)
- </dt>
- <dd>
- <ol class="method-algorithm">
- <li>If <var>trackDefaults</var> contains two or more <a>TrackDefault</a> objects with
- the same <a def-id="TrackDefault-type"></a> and the same
- <a def-id="TrackDefault-byteStreamTrackID"></a>, then throw an
- <a def-id="invalid-access-err"></a> and abort these steps.
- <p class="note">This also applies when <a def-id="TrackDefault-byteStreamTrackID"></a> contains
- an empty string and ensures that there is only one "byteStreamTrackID independent" default
- for each <a>TrackDefaultType</a> value.</p></li>
- <li>Store a copy of <var>trackDefaults</var> in this new object so the values can be returned
- by the accessor methods.</li>
- </ol>
- </dd>
- <dt>readonly attribute unsigned long length</dt>
- <dd>
- <p>Indicates the number of <a>TrackDefault</a> objects in the list.</p>
- </dd>
- <dt>getter TrackDefault (unsigned long index)</dt>
- <dd>
- <p>Allows the TrackDefault objects in the list to be accessed with an array operator (i.e. []).</p>
-
- <ol class="method-algorithm">
- <li>If <var>index</var> is greater than or equal to the <a def-id="length"></a> attribute then return undefined and abort these steps.</li>
- <li>Return the <var>index</var>'th <a>TrackDefault</a> object in the list.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="url">
- <h2>URL Object Extensions</h2>
- <p>This section specifies extensions to the <a def-id="URL"></a>[[!FILE-API]] object definition.</p>
-
- <dl title="partial interface URL" class="idl">
- <dt>static DOMString createObjectURL(MediaSource mediaSource)</dt>
- <dd>
- <p>Creates URLs for <a>MediaSource</a> objects.</p>
-
- <ol class="method-algorithm">
- <li>Return a unique <a def-id="MediaSource-object-URL"></a> that can be used to dereference the <var>mediaSource</var> argument, and run the rest of the algorithm asynchronously.</li>
- <li><a def-id="provide-a-stable-state"></a></li>
- <li>Revoke the <a def-id="MediaSource-object-URL"></a> by calling <a def-id="file-revokeObjectURL"></a> on it.</li>
- </ol>
- <p class="note">This algorithm is intended to mirror the behavior of the <a def-id="file-createObjectURL"></a>[[!FILE-API]] method with autoRevoke set to true.</p>
- </dd>
- </dl>
- </section>
-
- <section id="htmlmediaelement-extensions">
- <h2>HTMLMediaElement Extensions</h2>
- <p>This section specifies what existing attributes on the <a def-id="htmlmediaelement"></a> must return when a <a>MediaSource</a> is attached to the element.</p>
-
- <p>The <a def-id="videoref" name="dom-media-seekable">HTMLMediaElement.seekable</a> attribute returns a new static <a def-id="normalized-timeranges-object"></a> created based on the following steps:</p>
- <dl class="switch">
- <dt>If <a def-id="duration"></a> equals NaN:</dt>
- <dd>Return an empty <a def-id="timeranges"></a> object.</dd>
- <dt>If <a def-id="duration"></a> equals positive Infinity:</dt>
- <dd>
- <ol>
- <li>If the <a def-id="hme-buffered"></a> attribute returns an empty <a def-id="timeranges"></a>
- object, then return an empty <a def-id="timeranges"></a> object and abort these steps.</li>
- <li>Return a single range with a start time of 0 and an end time equal to the highest end time reported by the <a def-id="hme-buffered"></a> attribute.
- </ol></dd>
- <dt>Otherwise:</dt>
- <dd>Return a single range with a start time of 0 and an end time equal to <a def-id="duration"></a>.</dd>
- </dl>
-
- <p id="dom-htmlmediaelement.buffered">The <a def-id="hme-buffered"></a> attribute returns a new static <a def-id="normalized-timeranges-object"></a> created based on the following steps:</p>
- <ol>
- <li>If <a def-id="activeSourceBuffers"></a>.length equals 0 then return an empty <a def-id="timeranges"></a> object and abort these steps.</li>
- <li>Let <var>active ranges</var> be the ranges returned by <a def-id="buffered"></a> for each <a>SourceBuffer</a> object in <a def-id="activeSourceBuffers"></a>.</li>
- <li>Let <var>highest end time</var> be the largest range end time in the <var>active ranges</var>.</li>
- <li>Let <var>intersection ranges</var> equal a <a def-id="timerange"></a> object containing a single range from 0 to <var>highest end time</var>.</li>
- <li>For each <a>SourceBuffer</a> object in <a def-id="activeSourceBuffers"></a> run the following steps:
- <ol>
- <li>Let <var>source ranges</var> equal the ranges returned by the <a def-id="buffered"></a> attribute on the current <a>SourceBuffer</a>.</li>
- <li>If <a def-id="readyState"></a> is <a def-id="ended"></a>, then set the end time on the last range in <var>source ranges</var> to
- <var>highest end time</var>.</li>
- <li>Let <var>new intersection ranges</var> equal the intersection between the <var>intersection ranges</var> and the <var>source ranges</var>.</li>
- <li>Replace the ranges in <var>intersection ranges</var> with the <var>new intersection ranges</var>.</li>
- </ol>
- </li>
- <li>Return the <var>intersection ranges</var>.</li>
- </ol>
- </section>
-
- <section id="htmlvideoelement-extensions">
- <h2>HTMLVideoElement Extensions</h2>
- <p>This section specifies new attributes and internal state that are being added to the <a def-id="htmlvideoelement"></a>.</p>
-
- <p>Each <a def-id="htmlvideoelement"></a> will maintain a <dfn id="total-video-frame-count">total video frame count</dfn> variable that keeps
- track of the total number of frames that have been displayed and dropped. This variable is initialized to 0 when the
- element is created and whenever the <a def-id="media-element-load-algorithm"></a> is invoked. It is incremented when a video frame is displayed
- or when the <a def-id="dropped-video-frame-count"></a> is incremented.</p>
-
- <p>Each <a def-id="htmlvideoelement"></a> will maintain a <dfn id="dropped-video-frame-count">dropped video frame count</dfn> variable that keeps
- track of the total number of frames that have been dropped. This variable is initialized to 0 when the
- element is created and whenever the <a def-id="media-element-load-algorithm"></a> is invoked. It is incremented when a video frame is dropped
- predecode or when a frame is decoded but dropped because it missed a display deadline.</p>
-
- <p>Each <a def-id="htmlvideoelement"></a> will maintain a <dfn id="corrupted-video-frame-count">corrupted video frame count</dfn> variable that keeps
- track of the total number of corrupted frames detected. This variable is initialized to 0 when the element is created and whenever the
- <a def-id="media-element-load-algorithm"></a> is invoked. It is incremented when a corrupted video frame is detected by the decoder. It is up to
- the implementation to determine whether to display or drop a corrupted frame. Whichever choice is made, the <a def-id="total-video-frame-count"></a>
- and <a def-id="dropped-video-frame-count"></a> must be updated appropriately.
- </p>
-
- <p>Each <a def-id="htmlvideoelement"></a> will maintain a <dfn id="displayed-frame-delay-sum">displayed frame delay sum</dfn> variable that keeps
- track of the sum of all <a def-id="displayed-frame-delays"></a>. This variable is initialized to 0 when the element is created and whenever the
- <a def-id="media-element-load-algorithm"></a> is invoked. When a frame is displayed, its <a def-id="displayed-frame-delay"></a> is computed and added
- to this variable.
- </p>
-
- <dl title="partial interface HTMLVideoElement" class="idl">
- <dt>VideoPlaybackQuality getVideoPlaybackQuality()</dt>
- <dd>
- <p>Provides the current the playback quality metrics.</p>
- <ol class="method-algorithm">
- <li>Let <var>playbackQuality</var> be a new instance of <a>VideoPlaybackQuality</a>.</li>
- <li>Set <var>playbackQuality</var>.<a def-id="creationTime"></a> to the value returned by a call to <a def-id="performance-now"></a>.</li>
- <li>Set <var>playbackQuality</var>.<a def-id="totalVideoFrames"></a> to the current value of the <a def-id="total-video-frame-count"></a>.</li>
- <li>Set <var>playbackQuality</var>.<a def-id="droppedVideoFrames"></a> to the current value of the <a def-id="dropped-video-frame-count"></a>.</li>
- <li>Set <var>playbackQuality</var>.<a def-id="corruptedVideoFrames"></a> to the current value of the <a def-id="corrupted-video-frame-count"></a>.</li>
- <li>Set <var>playbackQuality</var>.<a def-id="totalFrameDelay"></a> to the current value of the <a def-id="displayed-frame-delay-sum"></a>.</li>
- <li>Return <var>playbackQuality</var>.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="audio-track-extensions">
- <h2>AudioTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <a def-id="audio-track"></a> definition.</p>
-
- <dl title="partial interface AudioTrack" class="idl">
- <dt>readonly attribute SourceBuffer? sourceBuffer</dt>
- <dd>
- <p>Returns the <a>SourceBuffer</a> that created this track. Returns null if this track was not created by a <a>SourceBuffer</a> or the <a>SourceBuffer</a> has been removed from the <a def-id="sourceBuffers"></a> attribute of its <a def-id="parent-media-source"></a>.</p>
- </dd>
- </dl>
- </section>
-
- <section id="video-track-extensions">
- <h2>VideoTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <a def-id="video-track"></a> definition.</p>
-
- <dl title="partial interface VideoTrack" class="idl">
- <dt>readonly attribute SourceBuffer? sourceBuffer</dt>
- <dd>
- <p>Returns the <a>SourceBuffer</a> that created this track. Returns null if this track was not created by a <a>SourceBuffer</a> or the <a>SourceBuffer</a> has been removed from the <a def-id="sourceBuffers"></a> attribute of its <a def-id="parent-media-source"></a>.</p>
- </dd>
- </dl>
- </section>
-
- <section id="text-track-extensions">
- <h2>TextTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <a def-id="text-track"></a> definition.</p>
-
- <dl title="partial interface TextTrack" class="idl">
- <dt>readonly attribute SourceBuffer? sourceBuffer</dt>
- <dd>
- <p>Returns the <a>SourceBuffer</a> that created this track. Returns null if this track was not created by a <a>SourceBuffer</a> or the <a>SourceBuffer</a> has been removed from the <a def-id="sourceBuffers"></a> attribute of its <a def-id="parent-media-source"></a>.</p>
- </dd>
- </dl>
- </section>
-
- <section id="byte-stream-formats">
- <h2>Byte Stream Formats</h2>
- <p>The bytes provided through <a def-id="appendBuffer"></a> and <a def-id="appendStream"></a> for a <a>SourceBuffer</a> form a logical byte stream. The format and
- semantics of these byte streams are defined in <dfn id="byte-stream-format-specs">byte stream format specifications</dfn>.
- The byte stream format registry [[MSE-REGISTRY]] provides mappings between a MIME type that may be passed to <a def-id="addSourceBuffer"></a> or
- <a def-id="isTypeSupported"></a> and the byte stream format expected by a <a>SourceBuffer</a> created with that MIME type. Implementations are encouraged to register
- mappings for byte stream formats they support to facilitate interoperability. The byte stream format registry [[MSE-REGISTRY]] is the authoritative source for these
- mappings. If an implementation claims to support a MIME type listed in the registry, its <a>SourceBuffer</a> implementation must conform to the
- <a def-id="byte-stream-format-spec"></a> listed in the registry entry.</p>
- <p class="note">The byte stream format specifications in the registry are not intended to define new storage formats. They simply outline the subset of
- existing storage format structures that implementations of this specification will accept.</p>
- <p class="note">Byte stream format parsing and validation is implemented in the <a def-id="segment-parser-loop"></a> algorithm.</p>
-
- <p>This section provides general requirements for all byte stream format specifications:</p>
- <ul>
- <li>A byte stream format specification must define <a def-id="init-segments"></a> and <a def-id="media-segments"></a>.</li>
- <li>It must be possible to identify segment boundaries and segment type (initialization or media) by examining the byte stream alone.</li>
- <li>The user agent must run the <a def-id="eos-decode"></a> when any of the following conditions are met:
- <ol>
- <li>
- <p>The number and type of tracks are not consistent.</p>
- <p class="note">For example, if the first <a def-id="init-segment"></a> has 2 audio tracks and 1 video track, then all <a def-id="init-segments"></a> that follow it in the byte stream must describe 2 audio tracks and 1 video track.</p>
- </li>
- <li><a def-id="track-ids"></a> are not the same across <a def-id="init-segments"></a>, for segments describing multiple tracks of a single type. (e.g. 2 audio tracks).</li>
- <li>
- <p>Codecs changes across <a def-id="init-segments"></a>.</p>
- <p class="note">For example, a byte stream that starts with an <a def-id="init-segment"></a> that specifies a single AAC track and later contains an <a def-id="init-segment"></a> that specifies a single AMR-WB track is not allowed. Support for multiple codecs is handled with multiple <a>SourceBuffer</a> objects.</p>
- </li>
- </ol>
- </li>
- <li>The user agent must support the following:
- <ol>
- <li><a def-id="track-ids"></a> changing across <a def-id="init-segments"></a> if the segments describes only one track of each type.</li>
- <li>
- <p>Video frame size changes. The user agent must support seamless playback.</p>
- <p class="note">This will cause the <video> display region to change size if the web application does not use CSS or HTML attributes (width/height) to constrain the element size.</p>
- </li>
- <li>
- <p>Audio channel count changes. The user agent may support this seamlessly and could trigger downmixing.</p>
- <p class="note">This is a quality of implementation issue because changing the channel count may require reinitializing the audio device, resamplers, and channel mixers which tends to be audible.</p>
- </li>
- </ol>
- </li>
- <li>The following rules apply to all <a def-id="media-segments"></a> within a byte stream. A user agent must:
- <ol>
- <li>Map all timestamps to the same <a def-id="media-timeline"></a>.</li>
- <li>Support seamless playback of <a def-id="media-segments"></a> having a timestamp gap smaller than the audio frame size. User agent must not reflect these gaps in the <a def-id="buffered"></a> attribute.
- <p class="note">This is intended to simplify switching between audio streams where the frame boundaries don't always line up across encodings (e.g. Vorbis).</p>
- </li>
- </ol>
- </li>
- <li>The user agent must run the <a def-id="eos-decode"></a> when any combination of an <a def-id="init-segment"></a> and any contiguous sequence of <a def-id="media-segments"></a> satisfies the
- following conditions:
- <ol>
- <li>The number and type (audio, video, text, etc.) of all tracks in the <a def-id="media-segments"></a> are not identified.</li>
- <li>The decoding capabilities needed to decode each track (i.e. codec and codec parameters) are not provided.</li>
- <li>Encryption parameters necessary to decrypt the content (except the encryption key itself) are not provided for all encrypted tracks.</li>
- <li>All information necessary to decode and render the earliest <a def-id="random-access-point"></a> in the sequence of <a def-id="media-segments"></a> and all subsequence samples in the sequence
- (in presentation time) are not provided. This includes in particular,
- <ul>
- <li>Information that determines the <a def-id="intrinsic-width-and-height"></a> of the video (specifically, this requires either the picture or pixel aspect ratio, together with the encoded
- resolution).</li>
- <li>Information necessary to convert the video decoder output to a format suitable for display</li>
- </ul>
- </li>
- <li>Information necessary to compute the global <a def-id="presentation-timestamp"></a> of every sample in the sequence of <a def-id="media-segments"></a> is not provided.</li>
- </ol>
- <p>For example, if I1 is associated with M1, M2, M3 then the above must hold for all the combinations I1+M1, I1+M2, I1+M1+M2, I1+M2+M3, etc.</p>
- </li>
- </ul>
- <p>Byte stream specifications must at a minimum define constraints which ensure that the above requirements hold. Additional constraints may be defined, for example to simplify implementation.</p>
-
- </section>
-
- <section id="examples">
- <h2>Examples</h2>
- <p>Example use of the Media Source Extensions</p>
- <div class="block">
- <div class="blockContent">
- <pre class="code">
-<script>
- function onSourceOpen(videoTag, e) {
- var mediaSource = e.target;
-
- if (mediaSource.sourceBuffers.length > 0)
- return;
-
- var sourceBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
-
- videoTag.addEventListener('seeking', onSeeking.bind(videoTag, mediaSource));
- videoTag.addEventListener('progress', onProgress.bind(videoTag, mediaSource));
-
- var initSegment = GetInitializationSegment();
-
- if (initSegment == null) {
- // Error fetching the initialization segment. Signal end of stream with an error.
- mediaSource.endOfStream("network");
- return;
- }
-
- // Append the initialization segment.
- var firstAppendHandler = function(e) {
- var sourceBuffer = e.target;
- sourceBuffer.removeEventListener('updateend', firstAppendHandler);
-
- // Append some initial media data.
- appendNextMediaSegment(mediaSource);
- };
- sourceBuffer.addEventListener('updateend', firstAppendHandler);
- sourceBuffer.appendBuffer(initSegment);
- }
-
- function appendNextMediaSegment(mediaSource) {
- if (mediaSource.readyState == "closed")
- return;
-
- // If we have run out of stream data, then signal end of stream.
- if (!HaveMoreMediaSegments()) {
- mediaSource.endOfStream();
- return;
- }
-
- // Make sure the previous append is not still pending.
- if (mediaSource.sourceBuffers[0].updating)
- return;
-
- var mediaSegment = GetNextMediaSegment();
-
- if (!mediaSegment) {
- // Error fetching the next media segment.
- mediaSource.endOfStream("network");
- return;
- }
-
- // NOTE: If mediaSource.readyState == “ended”, this appendBuffer() call will
- // cause mediaSource.readyState to transition to "open". The web application
- // should be prepared to handle multiple “sourceopen” events.
- mediaSource.sourceBuffers[0].appendBuffer(mediaSegment);
- }
-
- function onSeeking(mediaSource, e) {
- var video = e.target;
-
- if (mediaSource.readyState == "open") {
- // Abort current segment append.
- mediaSource.sourceBuffers[0].abort();
- }
-
- // Notify the media segment loading code to start fetching data at the
- // new playback position.
- SeekToMediaSegmentAt(video.currentTime);
-
- // Append a media segment from the new playback position.
- appendNextMediaSegment(mediaSource);
- }
-
- function onProgress(mediaSource, e) {
- appendNextMediaSegment(mediaSource);
- }
-</script>
-
-<video id="v" autoplay> </video>
-
-<script>
- var video = document.getElementById('v');
- var mediaSource = new MediaSource();
- mediaSource.addEventListener('sourceopen', onSourceOpen.bind(this, video));
- video.src = window.URL.createObjectURL(mediaSource);
-</script>
- </pre>
- </div>
- </div>
- </section>
-
- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section>
-
- <section id="revision-history">
- <h2>Revision History</h2>
- <table class="old-table">
- <thead>
- <tr>
- <th>Version</th>
- <th>Comment</th>
- </tr>
- </thead>
- <tbody>
- <tbody>
- <tr>
- <td>11 November 2014</td>
- <td>
- <ul>
- <li>Bug 27296 - Clarify .seekable when duration is Infinity and .buffered is empty.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/af052af0dd5f/media-source/media-source.html">04 November 2014</a></td>
- <td>
- <ul>
- <li>Bug 27241 - Fixed step 1 of the TrackDefault constructor so it doesn't always throw an exception.</li>
- <li>Bug 27240 - Make TrackDefaultList contructor throw an exception on any duplicate (type, byteStreamTrackID) pair.</li>
- <li>Bug 27174 - Added SourceBuffer configuration definition to clarify addSourceBuffer() behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/567b8e0764f8/media-source/media-source.html">06 October 2014</a></td>
- <td>
- <ul>
- <li>Bug 26924 - Run default language algorithm if 'und' BCP 47 value is present in the init segment.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/567b8e0764f8/media-source/media-source.html">29 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26932 - Fix TrackDefault constructor kinds parameter type.</li>
- <li>Update to ReSpec 3.2.20.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/df74aa427173/media-source/media-source.html">10 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26777 - Rename 'first initialization segment flag' to 'first initialization segment received flag'.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9066cfb5ad1d/media-source/media-source.html">09 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26721 - Add label attribute to TrackDefault object.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/856c321c7a6b/media-source/media-source.html">12 August 2014</a></td>
- <td>
- <ul>
- <li>Bug 26436 - Use HTMLMediaElement.buffered for HTMLMediaElement.readyState transitions instead of individual SourceBuffer.buffered attributes.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/c63fe313d13a/media-source/media-source.html">24 July 2014</a></td>
- <td>
- <ul>
- <li>Bug 26345 - Make activeSourceBuffers order match sourceBuffers order.</li>
- <li>Bug 26316 - Changed duration change algorithm to avoid open transition on endOfStream().</li>
- <li>Bug 26314 - Fixed coded frame removal algorithm to remove dependencies that may lie outside the removal range.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9b4db0f089bf/media-source/media-source.html">20 June 2014</a></td>
- <td>
- <ul>
- <li>Bug 26032 - Set need random access point flag on all track buffers when a new init
- segment is received.</li>
- <li>Bug 25845 - Clarify SourceBuffer.buffered getter behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/a38529a7910d/media-source/media-source.html">13 June 2014</a></td>
- <td>
- <ul>
- <li>Bug 25995 - Fix conditions in "remove existing coded frames" step.</li>
- <li>Bug 25999 - Change appendWindowStart assignments to reference presentation start time.</li>
- <li>Bug 26000 - Make it explicit that SourceBuffer.remove() throws an exception if duration equals NaN.</li>
- <li>Bug 25846 - Update end of stream algorithm to invoke the append error algorithm on decode errors.</li>
- <li>Bug 25850 - Specify SourceBuffer.trackDefaults initial value and setter/getter behavior.</li>
- <li>Bug 25998 - Move presentation & decode timestamp checks after append window filtering steps.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/01c9e30d71b0/media-source/media-source.html">21 May 2014</a></td>
- <td>
- <ul>
- <li>Bug 24370 - Add TrackDefault object and remove kind/language overloads.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3e8dfccbfded/media-source/media-source.html">20 May 2014</a></td>
- <td>
- <ul>
- <li>Bug 25518 - Make remove() end parameter an unrestricted double.</li>
- <li>Bug 25580 - Add informative reference to byte stream format registry.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/29f17705b5c2/media-source/media-source.html">29 April 2014</a></td>
- <td>
- <ul>
- <li>Bug 25347 - Remove unnecessary null & invalid enum value checks.</li>
- <li>Bug 25505 - Introduce "generate timestamps flag" to handle MPEG audio timestamp
- generation.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d471a4412040/media-source/media-source.html">01 April 2014</a></td>
- <td>
- <ul>
- <li>Bug 25157 - Fix typo in coded frame duration example.</li>
- <li>Bug 24854 - Moved negative timestamp checking to allow "sequence" mode to handle
- appending coded frames in reverse order</li>
- <li>Bug 24820 - Renamed highest presentation end timestamp to group end timestamp and
- fixed a few related issues.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/cad94fce3b90/media-source/media-source.html">03 March 2014</a></td>
- <td>
- <ul>
- <li>Bug 24347 - Fix HAVE_FUTURE_DATA transition condition in SourceBuffer monitoring algorithm.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d8ad50e85da3/media-source/media-source.html">10 December 2013</a></td>
- <td>
- <ul>
- <li>Bug 23169 - Restore totalFrameDelay units to seconds.</li>
- <li>Bug 23989 - Update blob URL origin text to remove stale File API reference.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/7c96c97306ce/media-source/media-source.html">02 December 2013</a></td>
- <td>
- <ul>
- <li>Bug 23818 - Make external spec references normative.</li>
- <li>Bug 23441 - Update byte stream format registry text.</li>
- <li>Bug 23169 - Update totalFrameDelay text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/306bb395f94e/media-source/media-source.html">14 November 2013</a></td>
- <td>
- <ul>
- <li>Bug 23663 - Clarify seeking behavior in Section 2.4.3.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/47e74f565722/media-source/media-source.html">04 November 2013</a></td>
- <td>
- <ul>
- <li>Bug 23441 - Established MSE byte stream format registry and extracted byte stream format text into separate documents.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/15e7e8f7eecd/media-source/media-source.html">29 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23553 - Fixed segment parser loop so it doesn't appear to prematurely remove the media segment header.</li>
- <li>Bug 23557 - Update SPS/PPS note to not explicitly recommend specific avc versions.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/bed8606bd0a7/media-source/media-source.html">28 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23549 - Add definitions for decode timestamp, presentation timestamp, an presentation order.</li>
- <li>Bug 23552 - Clarify 'this' in section 3.5.1</li>
- <li>Bug 23554 - Introduced presentation interval and coded frame duration terms to clarify text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3fda61eb902f/media-source/media-source.html">15 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23525 - Fix mvex box error behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/56e209741937/media-source/media-source.html">04 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23442 - Fix example to work when seeking in the 'ended' state.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9035359fe231/media-source/media-source.html">26 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22136 - Added text for Inband SPS/PPS support.</li>
- <li>Bug 22776 - Clarified that implementations are only required to support one SourceBuffer configuration at a time.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/2b2d8865de83/media-source/media-source.html">18 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22117 - Reword byte stream specs in terms of UA behavior.</li>
- <li>Bug 22148 - Replace VideoPlaybackQuality.playbackJitter with VideoPlaybackQuality.totalFrameDelay.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b98190a4472c/media-source/media-source.html">02 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22401 - Fix typo</li>
- <li>Bug 22134 - Clarify byte stream format enforcement.</li>
- <li>Bug 22431 - Convert videoPlaybackQuality attribute to getVideoPlaybackQuality() method.</li>
- <li>Bug 22109 - Renamed 'coded frame sequence' to 'coded frame group' to avoid confusion around multiple 'sequence' concepts.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/63675668846c/media-source/media-source.html">05 June 2013</a></td>
- <td>
- <ul>
- <li>Bug 22139 - Added a note clarifying that byte stream specs aren't defining new storage formats.</li>
- <li>Bug 22148 - Added playbackJitter metric.</li>
- <li>Bug 22134 - Added minimal number of SourceBuffers requirements.</li>
- <li>Bug 22115 - Make algorithm abort text consistent.</li>
- <li>Bug 22113 - Address typos.</li>
- <li>Bug 22065 - Fix infinite loop in coded frame processing algorithm.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/1ac9c2205a7b/media-source/media-source.html">01 June 2013</a></td>
- <td>
- <ul>
- <li>Bug 21431 - Updated coded frame processing algorithm for text splicing.</li>
- <li>Bug 22035 - Update addtrack and removetrack event firing text to match HTML5 language.</li>
- <li>Bug 22111 - Remove useless playback sentence from end of stream algorithm.</li>
- <li>Bug 22052 - Add corrupted frame metric.</li>
- <li>Bug 22062 - Added links for filing bugs.</li>
- <li>Bug 22125 - Add "ended" to "open" transition to remove().</li>
- <li>Bug 22143 - Move HTMLMediaElement.playbackQuality to HTMLVideoElement.videoPlaybackQuality.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/71968956733e/media-source/media-source.html">13 May 2013</a></td>
- <td>
- <ul>
- <li>Bug 21954 - Add [EnforceRange] to appendStream's maxSize parameter.</li>
- <li>Bug 21953 - Add NaN handling to appendWindowEnd setter algorithm.</li>
- <li>Alphabetize definitions section.</li>
- <li>Changed endOfStream('decode') references to make it clear that JavaScript can't intercept these calls.</li>
- <li>Fix links for all types in the IDL that are defined in external specifications.</li>
- </ul>
- </td>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9ff5e42736b6/media-source/media-source.html">06 May 2013</a></td>
- <td>
- <ul>
- <li>Bug 20901 - Remove AbortMode and add AppendMode.</li>
- <li>Bug 21911 - Change MediaPlaybackQuality.creationTime to DOMHighResTimeStamp.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b60bf8077d9c/media-source/media-source.html">02 May 2013</a></td>
- <td>
- <ul>
- <li>Reworked ambiguous text in a variety of places.</li>
- <li>Added Acknowledgements section.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ffb76048861e/media-source/media-source.html">30 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21822 - Fix 'fire ... event ... at the X attribute' text.</li>
- <li>Bug 21819 & 21328 - Remove 'compressed' from coded frame definition.</li>
- </ul>
- </td>
- </tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/237133bfdd57/media-source/media-source.html">24 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21796 - Removed issue box from 'Append Error' algorithm.</li>
- <li>Bug 21703 - Changed appendWindowEnd to 'unrestricted double'.</li>
- <li>Bug 20760 - Adding MediaPlaybackQuality object.</li>
- <li>Bug 21536 - Specify the origin of media data appended.</li>
- </ul>
- </td>
- </tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/f7f2b7226543/media-source/media-source.html">08 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21327 - Crossfade clarifications.</li>
- <li>Bug 21334 - Clarified seeking behavoir.</li>
- <li>Bug 21326 - Add a note stating some implementations may choose to add fades to/from silence.</li>
- <li>Bug 21375 - Clarified decode dependency removal.</li>
- <li>Bug 21376 - Replace 100ms limit with 2x last frame duration limit.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/rev/1e6898152c5b">26 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21301 - Change timeline references to "media timeline" links.</li>
- <li>Bug 19676 - Clarified "fade out coded frames" definition.</li>
- <li>Bug 21276 - Convert a few append error scenarios to endOfStream('decode') errors.</li>
- <li>Bug 21376 - Changed 'time' to 'decode time' to append sequence definition.</li>
- <li>Bug 21374 - Clarify the abort() behavior.</li>
- <li>Bug 21373 - Clarified incremental parsing text in segment parser loop.</li>
- <li>Bug 21364 - Remove redundant condition from remove overlapped frame step.</li>
- <li>Bug 21327 - Clarify what to do with a splice that starts with an audio frame with a duration less than 5ms.</li>
- <li>Update to ReSpec 3.1.48</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/f0fb58d45f96/media-source/media-source.html">12 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21112 - Add appendWindowStart & appendWindowEnd attributes.</li>
- <li>Bug 19676 - Clarify overlapped frame definitions and splice logic.</li>
- <li>Bug 21172 - Added coded frame removal and eviction algorithms.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/dcd406812201/media-source/media-source.html">05 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21170 - Remove 'stream aborted' step from stream append loop algorithm.</li>
- <li>Bug 21171 - Added informative note about when addSourceBuffer() might throw an QUOTA_EXCEEDED_ERR exception.</li>
- <li>Bug 20901 - Add support for 'continuation' and 'timestampOffset' abort modes.</li>
- <li>Bug 21159 - Rename appendArrayBuffer to appendBuffer() and add ArrayBufferView overload.</li>
- <li>Bug 21198 - Remove redundant 'closed' readyState checks.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/668a1c82fb88/media-source/media-source.html">25 February 2013</a></td>
- <td>
- <ul>
- <li>Remove Source Buffer Model section since all the behavior is covered by the algorithms now.</li>
- <li>Bug 20899 - Remove media segments must start with a random access point requirement.</li>
- <li>Bug 21065 - Update example code to use updating attribute instead of old appending attribute.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d5956e93b991/media-source/media-source.html">19 February 2013</a></td>
- <td>
- <ul>
- <li>Bug 19676, 20327 - Provide more detail for audio & video splicing.</li>
- <li>Bug 20900 - Remove complete access unit constraint.</li>
- <li>Bug 20948 - Setting timestampOffset in 'ended' triggers a transition to 'open'</li>
- <li>Bug 20952 - Added update event.</li>
- <li>Bug 20953 - Move end of append event firing out of segment parser loop.</li>
- <li>Bug 21034 - Add steps to fire addtrack and removetrack events.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
- <td>
- <ul>
- <li>Bug 19676 - Added a note clarifying that the internal timestamp representation doesn't have to be a double.</li>
- <li>Added steps to the coded frame processing algorithm to remove old frames when new ones overlap them.</li>
- <li>Fix isTypeSupported() return type.</li>
- <li>Bug 18933 - Clarify what top-level boxes to ignore for ISO-BMFF.</li>
- <li>Bug 18400 - Add a check to avoid creating huge hidden gaps when out-of-order appends occur w/o calling abort().</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b35722b0cd8f/media-source/media-source.html">31 January 2013</a></td>
- <td>
- <ul>
- <li>Make remove() asynchronous.</li>
- <li>Added steps to various algorithms to throw an INVALID_STATE_ERR exception when async appends or remove() are pending.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/aae26333e7d1/media-source/media-source.html">30 January 2013</a></td>
- <td>
- <ul>
- <li>Remove early abort step on 0-byte appends so the same events fire as a normal append with bytes.</li>
- <li>Added definition for 'enough data to ensure uninterrupted playback'.</li>
- <li>Updated buffered ranges algorithm to properly compute the ranges for Philip's example.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/fd2a58eec443/media-source/media-source.html">15 January 2013</a></td>
- <td>Replace setTrackInfo() and getSourceBuffer() with AudioTrack, VideoTrack, and TextTrack extensions.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/52a85235137b/media-source/media-source.html">04 January 2013</a></td>
- <td>
- <ul>
- <li>Renamed append() to appendArrayBuffer() and made appending asynchronous.</li>
- <li>Added SourceBuffer.appendStream().</li>
- <li>Added SourceBuffer.setTrackInfo() methods.</li>
- <li>Added issue boxes to relevant sections for outstanding bugs.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/53ea7c19edd2/media-source/media-source.html">14 December 2012</a></td>
- <td>
- Pubrules, Link Checker, and Markup Validation fixes.
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e1c91093dfdc/media-source/media-source.html">13 December 2012</a></td>
- <td>
- <ul>
- <li>Added MPEG-2 Transport Stream section.</li>
- <li>Added text to require abort() for out-of-order appends.</li>
- <li>Renamed "track buffer" to "decoder buffer".</li>
- <li>Redefined "track buffer" to mean the per-track buffers that hold the SourceBuffer media data.</li>
- <li>Editorial fixes.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ee6e8ae9337c/media-source/media-source.html">08 December 2012</a></td>
- <td>
- <ul>
- <li>Added MediaSource.getSourceBuffer() methods.</li>
- <li>Section 2 cleanup.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/43be42e69533/media-source/media-source.html">06 December 2012</a></td>
- <td>
- <ul>
- <li>append() now throws a QUOTA_EXCEEDED_ERR when the SourceBuffer is full.</li>
- <li>Added unique ID generation text to Initialization Segment Received algorithm.</li>
- <li>Remove 2.x subsections that are already covered by algorithm text.</li>
- <li>Rework byte stream format text so it doesn't imply that the MediaSource implementation must support all formats supported by the
- HTMLMediaElement.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/0c638da9a67a/media-source/media-source.html">28 November 2012</a></td>
- <td>
- <ul>
- <li>Added transition to HAVE_METADATA when current playback position is removed.</li>
- <li>Added remove() calls to duration change algorithm.</li>
- <li>Added MediaSource.isTypeSupported() method.</li>
- <li>Remove initialization segments are optional text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3e4d27b3a98f/media-source/media-source.html">09 November 2012</a></td>
- <td>Converted document to ReSpec.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e029f71aafca/media-source/media-source.html">18 October 2012</a></td>
- <td>Refactored SourceBuffer.append() & added SourceBuffer.remove().</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/6d127e69c9f8/media-source/media-source.html">8 October 2012</a></td>
- <td>
- <ul>
- <li>Defined what HTMLMediaElement.seekable and HTMLMediaElement.buffered should return.</li>
- <li>Updated seeking algorithm to run inside Step 10 of the HTMLMediaElement seeking algorithm.</li>
- <li>Removed transition from "ended" to "open" in the seeking algorithm.</li>
- <li>Clarified all the event targets.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/media-source.html">1 October 2012</a></td>
- <td>Fixed various addsourcebuffer & removesourcebuffer bugs and allow append() in ended state.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/349559debcc3/media-source/media-source.html">13 September 2012</a></td>
- <td>Updated endOfStream() behavior to change based on the value of HTMLMediaElement.readyState.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ca093bbbbefb/media-source/media-source.html">24 August 2012</a></td>
- <td>
- <ul>
- <li>Added early abort on to duration change algorithm.</li>
- <li>Added createObjectURL() IDL & algorithm.</li>
- <li>Added Track ID & Track description definitions.</li>
- <li>Rewrote start overlap for audio frames text.</li>
- <li>Removed rendering silence requirement from section 2.5.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/340786fcae83/media-source/media-source.html">22 August 2012</a></td>
- <td>
- <ul>
- <li>Clarified WebM byte stream requirements.</li>
- <li>Clarified SourceBuffer.buffered return value.</li>
- <li>Clarified addsourcebuffer & removesourcebuffer event targets.</li>
- <li>Clarified when media source attaches to the HTMLMediaElement.</li>
- <li>Introduced duration change algorithm and update relevant algorithms to use it.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/032f7b8681d1/media-source/media-source.html">17 August 2012</a></td>
- <td>Minor editorial fixes.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/29687c019735/media-source/media-source.html">09 August 2012</a></td>
- <td>Change presentation start time to always be 0 instead of using format specific rules about the first media segment appended.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/087ea42f59c8/media-source/media-source.html">30 July 2012</a></td>
- <td>Added SourceBuffer.timestampOffset and MediaSource.duration.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ab36e8e882c6/media-source/media-source.html">17 July 2012</a></td>
- <td>Replaced SourceBufferList.remove() with MediaSource.removeSourceBuffer().</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b499a199e427/media-source/media-source.html">02 July 2012</a></td>
- <td>Converted to the object-oriented API</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9bbfe09653e4/media-source/media-source.html">26 June 2012</a></td>
- <td>Converted to Editor's draft.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e433598d22a7/media-source/media-source.html">0.5</a></td>
- <td>Minor updates before proposing to W3C HTML-WG.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.4/draft-spec/mediasource-draft-spec.html">0.4</a></td>
- <td>Major revision. Adding source IDs, defining buffer model, and clarifying byte stream formats.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.3/draft-spec/mediasource-draft-spec.html">0.3</a></td>
- <td>Minor text updates.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.2/draft-spec/mediasource-draft-spec.html">0.2</a></td>
- <td>Updates to reflect initial WebKit implementation.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.1/draft-spec/mediasource-draft-spec.html">0.1</a></td>
- <td>Initial Proposal</td>
- </tr>
- </tbody>
- </table>
- </section>
- </body>
-</html>
--- a/media-source/media-source.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/media-source.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,3532 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>Media Source Extensions</title>
-
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <style>/* --- ISSUES/NOTES --- */
-div.issue-title, div.note-title {
- padding-right: 1em;
- min-width: 7.5em;
- color: #b9ab2d;
-}
-div.issue-title { color: #e05252; }
-div.note-title { color: #2b2; }
-div.issue-title span, div.note-title span {
- text-transform: uppercase;
-}
-div.note, div.issue {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-.note > p:first-child, .issue > p:first-child { margin-top: 0 }
-.issue, .note {
- padding: .5em;
- border-left-width: .5em;
- border-left-style: solid;
-}
-div.issue, div.note {
- padding: 1em 1.2em 0.5em;
- margin: 1em 0;
- position: relative;
- clear: both;
-}
-span.note, span.issue { padding: .1em .5em .15em; }
-
-.issue {
- border-color: #e05252;
- background: #fbe9e9;
-}
-.note {
- border-color: #52e052;
- background: #e9fbe9;
-}
-
-
-</style><style>/* --- WEB IDL --- */
-pre.idl {
- border-top: 1px solid #90b8de;
- border-bottom: 1px solid #90b8de;
- padding: 1em;
- line-height: 120%;
-}
-
-pre.idl::before {
- content: "WebIDL";
- display: block;
- width: 150px;
- background: #90b8de;
- color: #fff;
- font-family: initial;
- padding: 3px;
- font-weight: bold;
- margin: -1em 0 1em -1em;
-}
-
-.idlType {
- color: #ff4500;
- font-weight: bold;
- text-decoration: none;
-}
-
-/*.idlModule*/
-/*.idlModuleID*/
-/*.idlInterface*/
-.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
- font-weight: bold;
- color: #005a9c;
-}
-a.idlEnumItem {
- color: #000;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-.idlSuperclass {
- font-style: italic;
- color: #005a9c;
-}
-
-/*.idlAttribute*/
-.idlAttrType, .idlFieldType, .idlMemberType {
- color: #005a9c;
-}
-.idlAttrName, .idlFieldName, .idlMemberName {
- color: #ff4500;
-}
-.idlAttrName a, .idlFieldName a, .idlMemberName a {
- color: #ff4500;
- border-bottom: 1px dotted #ff4500;
- text-decoration: none;
-}
-
-/*.idlMethod*/
-.idlMethType, .idlCallbackType {
- color: #005a9c;
-}
-.idlMethName {
- color: #ff4500;
-}
-.idlMethName a {
- color: #ff4500;
- border-bottom: 1px dotted #ff4500;
- text-decoration: none;
-}
-
-/*.idlCtor*/
-.idlCtorName {
- color: #ff4500;
-}
-.idlCtorName a {
- color: #ff4500;
- border-bottom: 1px dotted #ff4500;
- text-decoration: none;
-}
-
-/*.idlParam*/
-.idlParamType {
- color: #005a9c;
-}
-.idlParamName, .idlDefaultValue {
- font-style: italic;
-}
-
-.extAttr {
- color: #666;
-}
-
-/*.idlSectionComment*/
-.idlSectionComment {
- color: gray;
-}
-
-/*.idlConst*/
-.idlConstType {
- color: #005a9c;
-}
-.idlConstName {
- color: #ff4500;
-}
-.idlConstName a {
- color: #ff4500;
- border-bottom: 1px dotted #ff4500;
- text-decoration: none;
-}
-
-/*.idlException*/
-.idlExceptionID {
- font-weight: bold;
- color: #c00;
-}
-
-.idlTypedefID, .idlTypedefType {
- color: #005a9c;
-}
-
-.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
- color: #c00;
- font-weight: normal;
-}
-
-.excName a {
- font-family: monospace;
-}
-
-.idlRaises a.idlType, .excName a.idlType {
- border-bottom: 1px dotted #c00;
-}
-
-.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
- width: 45px;
- text-align: center;
-}
-.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
-.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
-
-.idlImplements a {
- font-weight: bold;
-}
-
-dl.attributes, dl.methods, dl.constants, dl.constructors, dl.fields, dl.dictionary-members {
- margin-left: 2em;
-}
-
-.attributes dt, .methods dt, .constants dt, .constructors dt, .fields dt, .dictionary-members dt {
- font-weight: normal;
-}
-
-.attributes dt code, .methods dt code, .constants dt code, .constructors dt code, .fields dt code, .dictionary-members dt code {
- font-weight: bold;
- color: #000;
- font-family: monospace;
-}
-
-.attributes dt code, .fields dt code, .dictionary-members dt code {
- background: #ffffd2;
-}
-
-.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
- color: #005a9c;
- background: transparent;
- font-family: inherit;
- font-weight: normal;
- font-style: italic;
-}
-
-.methods dt code {
- background: #d9e6f8;
-}
-
-.constants dt code {
- background: #ddffd2;
-}
-
-.constructors dt code {
- background: #cfc;
-}
-
-.attributes dd, .methods dd, .constants dd, .constructors dd, .fields dd, .dictionary-members dd {
- margin-bottom: 1em;
-}
-
-table.parameters, table.exceptions {
- border-spacing: 0;
- border-collapse: collapse;
- margin: 0.5em 0;
- width: 100%;
-}
-table.parameters { border-bottom: 1px solid #90b8de; }
-table.exceptions { border-bottom: 1px solid #deb890; }
-
-.parameters th, .exceptions th {
- color: #fff;
- padding: 3px 5px;
- text-align: left;
- font-family: initial;
- font-weight: normal;
- text-shadow: #666 1px 1px 0;
-}
-.parameters th { background: #90b8de; }
-.exceptions th { background: #deb890; }
-
-.parameters td, .exceptions td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
- vertical-align: top;
-}
-
-.parameters tr:first-child td, .exceptions tr:first-child td {
- border-top: none;
-}
-
-.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
- width: 100px;
-}
-
-.parameters td.prmType {
- width: 120px;
-}
-
-table.exceptions table {
- border-spacing: 0;
- border-collapse: collapse;
- width: 100%;
-}
-</style><link rel="stylesheet" href="mse.css">
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #C83500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-
-@media print {
- .removeOnSave {
- display: none;
- }
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">Media Source Extensions</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-11-11T16:52:00.000Z" id="w3c-editor-s-draft-11-november-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-11-11">11 November 2014</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR/media-source/">http://www.w3.org/TR/media-source/</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html</a></dd>
-
-
-
-
-
-
-
-
-
- <dt>Editors:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Adrian Bateman</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.microsoft.com/">Microsoft Corporation</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mark Watson</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.netflix.com/">Netflix Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2014
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
-
-
-
- <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#abstract" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2>
- This specification extends HTMLMediaElement to allow
- JavaScript to generate media streams for playback.
- Allowing JavaScript to generate streams facilitates a variety of use
- cases like adaptive streaming and time shifting live streams.
-
- <p>If you wish to make comments or file bugs regarding this document in a manner that is tracked by the <abbr title="World Wide Web Consortium">W3C</abbr>, please submit them via
- <a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=HTML%20WG&component=Media%20Source%20Extensions&short_desc=%5BMSE%5D%20">our public bug database</a>.
- </p>
- </section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#sotd" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2>
-
-
-
- <p>
- <em>This section describes the status of this document at the time of its publication.
- Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the
- latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at
- http://www.w3.org/TR/.</em>
- </p>
-
- <p>The working groups maintains <a href="http://w3.org/brief/Mjcw">a list of all bug reports that the editors have not yet tried to address</a>. This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid.</p>
- <p>Implementors should be aware that this specification is not stable. <strong>Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways.</strong> Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the mailing list mentioned below and take part in the discussions.</p>
-
- <p>The following features are <strong>at risk</strong> and may be removed due to lack of implementation.
- </p>
- <ul>
- <li><code><a href="#widl-VideoPlaybackQuality-totalFrameDelay">totalFrameDelay</a></code></li>
- </ul>
-
-
- <p>
- This document was published by the <a href="http://www.w3.org/html/wg/">HTML Working Group</a> as an Editor's Draft.
-
-
- If you wish to make comments regarding this document, please send them to
- <a href="mailto:public-html-media@w3.org">public-html-media@w3.org</a>
- (<a href="mailto:public-html-media-request@w3.org?subject=subscribe">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
-
-
-
-
- All comments are welcome.
-
- </p>
-
-
- <p>
- Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
- Membership. This is a draft document and may be updated, replaced or obsoleted by other
- documents at any time. It is inappropriate to cite this document as other than work in
- progress.
- </p>
-
-
-
- <p>
-
- This document was produced by a group operating under the
- <a id="sotd_patent" about="" rel="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
- Policy</a>.
-
-
-
-
- <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
- disclosures</a>
-
- made in connection with the deliverables of the group; that page also includes
- instructions for disclosing a patent. An individual who has actual knowledge of a patent
- which the individual believes contains
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
- Claim(s)</a> must disclose the information in accordance with
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
- 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
-
-
- </p>
-
- <p>This document is governed by the <a id="w3c_process_revision" href="http://www.w3.org/2014/Process-20140801/">1 August 2014 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>.
- </p>
-
-
-
-
-
-</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">2. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">2.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">2.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">2.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">2.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">2.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">2.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">2.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">2.4.6 </span>Duration change</a></li><li class="tocline"><a href="#end-of-stream-algorithm" class="tocxref"><span class="secno">2.4.7 </span>End of stream algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">3. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">3.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">3.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">3.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">3.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">3.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">3.5.3 </span>Append Error Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-prepare-append" class="tocxref"><span class="secno">3.5.4 </span>Prepare Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-buffer-append" class="tocxref"><span class="secno">3.5.5 </span>Buffer Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">3.5.6 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-range-removal" class="tocxref"><span class="secno">3.5.7 </span>Range Removal</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">3.5.8 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-default-track-language" class="tocxref"><span class="secno">3.5.9 </span>Default track language</a></li><li class="tocline"><a href="#sourcebuffer-default-track-label" class="tocxref"><span class="secno">3.5.10 </span>Default track label</a></li><li class="tocline"><a href="#sourcebuffer-default-track-kinds" class="tocxref"><span class="secno">3.5.11 </span>Default track kinds</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">3.5.12 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-removal" class="tocxref"><span class="secno">3.5.13 </span>Coded Frame Removal Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-eviction" class="tocxref"><span class="secno">3.5.14 </span>Coded Frame Eviction Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.15 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">3.5.16 </span>Audio Splice Rendering Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-text-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.17 </span>Text Splice Frame Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">4. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">4.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#videoplaybackquality" class="tocxref"><span class="secno">5. </span>VideoPlaybackQuality Object</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#trackdefault" class="tocxref"><span class="secno">6. </span>TrackDefault Object</a><ul class="toc"><li class="tocline"><a href="#constructors" class="tocxref"><span class="secno">6.1 </span>Constructors</a></li><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">6.2 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#trackdefaultlist" class="tocxref"><span class="secno">7. </span>TrackDefaultList Object</a><ul class="toc"><li class="tocline"><a href="#constructors-1" class="tocxref"><span class="secno">7.1 </span>Constructors</a></li><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">7.2 </span>Attributes</a></li><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">7.3 </span>Methods</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">8. </span>URL Object Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-4" class="tocxref"><span class="secno">8.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-extensions" class="tocxref"><span class="secno">9. </span>HTMLMediaElement Extensions</a></li><li class="tocline"><a href="#htmlvideoelement-extensions" class="tocxref"><span class="secno">10. </span>HTMLVideoElement Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-5" class="tocxref"><span class="secno">10.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">11. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-6" class="tocxref"><span class="secno">11.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">12. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-7" class="tocxref"><span class="secno">12.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">13. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-8" class="tocxref"><span class="secno">13.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">14. </span>Byte Stream Formats</a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">15. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">16. </span>Acknowledgments</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">17. </span>Revision History</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></section>
-
-
- <section id="introduction" typeof="bibo:Chapter" resource="#introduction" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_introduction"><span class="secno">1. </span>Introduction</h2>
- <p>This specification allows JavaScript to dynamically construct media streams for <audio> and <video>.
- It defines objects that allow JavaScript to pass media segments to an <a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement">HTMLMediaElement</a> [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
- A buffering model is also included to describe how the user agent acts when different media segments are
- appended at different times. Byte stream specifications used with these extensions are available in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>].</p>
- <img src="pipeline_model.png" alt="Media Source Pipeline Model Diagram">
-
- <section id="goals" typeof="bibo:Chapter" resource="#goals" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_goals"><span class="secno">1.1 </span>Goals</h3>
- <p>This specification was designed with the following goals in mind:</p>
- <ul>
- <li>Allow JavaScript to construct media streams independent of how the media is fetched.</li>
- <li>Define a splicing and buffering model that facilitates use cases like adaptive streaming, ad-insertion, time-shifting, and video editing.</li>
- <li>Minimize the need for media parsing in JavaScript.</li>
- <li>Leverage the browser cache as much as possible.</li>
- <li>Provide requirements for byte stream format specifications.</li>
- <li>Not require support for any particular media format or codec.</li>
- </ul>
- <p>This specification defines:</p>
- <ul>
- <li>Normative behavior for user agents to enable interoperability between user agents and web applications when processing media data.</li>
- <li>Normative requirements to enable other specifications to define media formats to be used within this specification.</li>
- </ul>
- </section>
-
- <section id="definitions" typeof="bibo:Chapter" resource="#definitions" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_definitions"><span class="secno">1.2 </span>Definitions</h3>
-
- <dl>
- <dt id="active-track-buffers">Active Track Buffers</dt>
- <dd><p>The <a href="#track-buffer">track buffers</a> that provide <a href="#coded-frame">coded frames</a> for the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled</a></code>
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>, the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected</a></code> <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code>, and the
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a></code> <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code>. All these tracks are associated with
- <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in the <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> list.</p>
- </dd>
-
- <dt id="append-window">Append Window</dt>
- <dd><p>A <a href="#presentation-timestamp">presentation timestamp</a> range used to filter out <a href="#coded-frame">coded frames</a> while appending. The append window represents a single
- continuous time range with a single start time and end time. Coded frames with <a href="#presentation-timestamp">presentation timestamp</a> within this range are allowed to be appended
- to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> while coded frames outside this range are filtered out. The append window start and end times are controlled by
- the <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> and <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> attributes respectively.</p></dd>
-
- <dt id="coded-frame">Coded Frame</dt>
- <dd><p>A unit of media data that has a <a href="#presentation-timestamp">presentation timestamp</a>, a <a href="#decode-timestamp">decode timestamp</a>, and a <a href="#coded-frame-duration">coded frame duration</a>.</p></dd>
-
- <dt id="coded-frame-duration">Coded Frame Duration</dt>
- <dd>
- <p>The duration of a <a href="#coded-frame">coded frame</a>. For video and text, the duration indicates how long the video frame or text should be displayed. For audio, the duration represents the sum of all the samples contained within the coded frame. For example, if an audio frame contained 441 samples @44100Hz the frame duration would be 10 milliseconds.</p>
- </dd>
-
- <dt id="coded-frame-end-timestamp">Coded Frame End Timestamp</dt>
- <dd>
- <p>The sum of a <a href="#coded-frame">coded frame</a> <a href="#presentation-timestamp">presentation timestamp</a> and its
- <a href="#coded-frame-duration">coded frame duration</a>. It represents the <a href="#presentation-timestamp">presentation timestamp</a> that immediately follows the coded frame.</p>
- </dd>
-
- <dt id="coded-frame-group">Coded Frame Group</dt>
- <dd><p>A group of <a href="#coded-frame">coded frames</a> that are adjacent and have monotonically increasing <a href="#decode-timestamp">decode timestamps</a> without any gaps. Discontinuities detected by the
- <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> and <code><a href="#widl-SourceBuffer-abort-void">abort()</a></code> calls trigger the start of a new coded frame group.</p>
- </dd>
-
- <dt id="decode-timestamp">Decode Timestamp</dt>
- <dd>
- <p> The decode timestamp indicates the latest time at which the frame needs to be decoded assuming instantaneous decoding and rendering of this and any dependant frames (this is equal to the <a href="#presentation-timestamp">presentation timestamp</a> of the earliest frame, in <a href="#presentation-order">presentation order</a>, that is dependant on this frame). If frames can be decoded out of <a href="#presentation-order">presentation order</a>, then the decode timestamp must be present in or derivable from the byte stream. The user agent must run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> if this is not the case. If frames cannot be decoded out of <a href="#presentation-order">presentation order</a> and a decode timestamp is not present in the byte stream, then the decode timestamp is equal to the <a href="#presentation-timestamp">presentation timestamp</a>.
- </p></dd>
-
- <dt id="displayed-frame-delay">Displayed Frame Delay</dt>
- <dd>
- <p>The delay between a frame's presentation time and the actual time it was displayed, in a double-precision value in seconds & rounded to the nearest display refresh interval. This
- delay is always greater than or equal to zero since frames must never be displayed before their presentation time. Non-zero delays are a sign of playback jitter
- and possible loss of A/V sync.</p>
- </dd>
-
- <dt id="init-segment">Initialization Segment</dt>
- <dd>
- <p>A sequence of bytes that contain all of the initialization information required to decode a sequence of <a href="#media-segment">media segments</a>. This includes codec initialization data, <a href="#track-id">Track ID</a> mappings for multiplexed segments, and timestamp offsets (e.g. edit lists).</p>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_1"><span>Note</span></div><p class="">The <a href="#byte-stream-format-specs">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] contain format specific examples.</p></div>
-
- </dd><dt id="media-segment">Media Segment</dt>
- <dd>
- <p>A sequence of bytes that contain packetized & timestamped media data for a portion of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-timeline">media timeline</a>. Media segments are always associated with the most recently appended <a href="#init-segment">initialization segment</a>.</p>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_2"><span>Note</span></div><p class="">The <a href="#byte-stream-format-specs">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] contain format specific examples.</p></div>
- </dd>
-
- <dt id="mediasource-object-url">MediaSource object URL</dt>
- <dd>
- <p>A MediaSource object URL is a unique <a href="http://www.w3.org/TR/FileAPI/#url">Blob URI</a> [<cite><a class="bibref" href="#bib-FILE-API">FILE-API</a></cite>] created by <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>. It is used to attach a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object to an HTMLMediaElement.</p>
- <p>These URLs are the same as a <a href="http://www.w3.org/TR/FileAPI/#url">Blob URI</a>, except that anything in the definition of that feature that refers to <a href="http://www.w3.org/TR/FileAPI/#dfn-file">File</a> and <a href="http://www.w3.org/TR/FileAPI/#dfn-Blob">Blob</a> objects is hereby extended to also apply to <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> objects.</p>
- <p>The <a href="http://www.w3.org/TR/html5/browsers.html#origin-0">origin</a> of the MediaSource object URL is the <a href="http://www.w3.org/TR/html5/browsers.html#effective-script-origin">effective script origin</a> of the document that called <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>.</p>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_3"><span>Note</span></div><p class="">For example, the <a href="http://www.w3.org/TR/html5/browsers.html#origin-0">origin</a> of the MediaSource object URL affects the way that the media element is <a href="http://www.w3.org/TR/html5/embedded-content-0.html#security-with-canvas-elements">consumed by canvas</a>.</p></div>
- </dd>
-
- <dt id="parent-media-source">Parent Media Source</dt>
- <dd><p>The parent media source of a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object is the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object that created it.</p></dd>
-
- <dt id="presentation-start-time">Presentation Start Time</dt>
- <dd><p>The presentation start time is the earliest time point in the presentation and specifies the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#initial-playback-position">initial playback position</a> and <a href="http://www.w3.org/TR/html5/embedded-content-0.html#earliest-possible-position">earliest possible position</a>. All presentations created using this specification have a presentation start time of 0.</p></dd>
-
- <dt id="presentation-interval">Presentation Interval</dt>
- <dd>
- <p>The presentation interval of a <a href="#coded-frame">coded frame</a> is the time interval from its <a href="#presentation-timestamp">presentation timestamp</a> to the <a href="#presentation-timestamp">presentation timestamp</a> plus the <a href="#coded-frame-duration">coded frame's duration</a>. For example, if a coded frame has a presentation timestamp of 10 seconds and a <a href="#coded-frame-duration">coded frame duration</a> of 100 milliseconds, then the presentation interval would be [10-10.1). Note that the start of the range is inclusive, but the end of the range is exclusive.</p>
- </dd>
-
- <dt id="presentation-order">Presentation Order</dt>
- <dd>
- <p>The order that <a href="#coded-frame">coded frames</a> are rendered in the presentation. The presentation order is achieved by ordering <a href="#coded-frame">coded frames</a> in monotonically increasing order by their <a href="#presentation-timestamp">presentation timestamps</a>.</p>
- </dd>
-
- <dt id="presentation-timestamp">Presentation Timestamp</dt>
- <dd>
- <p>A reference to a specific time in the presentation. The presentation timestamp in a <a href="#coded-frame">coded frame</a> indicates when the frame must be rendered.</p>
- </dd>
-
- <dt id="random-access-point">Random Access Point</dt>
- <dd><p>A position in a <a href="#media-segment">media segment</a> where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.</p></dd>
-
- <dt id="sourcebuffer-byte-stream-format-spec">SourceBuffer byte stream format specification</dt>
- <dd><p>The specific <a href="#byte-stream-format-specs">byte stream format specification</a> that describes the format of the byte stream accepted by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> instance. The
- <a href="#byte-stream-format-specs">byte stream format specification</a>, for a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object, is selected based on the <var>type</var> passed to the
- <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> call that created the object.</p></dd>
-
- <dt id="sourcebuffer-configuration">SourceBuffer configuration</dt>
- <dd><p>A specific set of tracks distributed across one or more <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>
- objects owned by a single <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> instance.</p>
- <p>Implementations must support at least 1 <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object with the following
- configurations:</p>
- <ul>
- <li>A single SourceBuffer with 1 audio track and/or 1 video track.</li>
- <li>Two SourceBuffers with one handling a single audio track and the other handling a single video track.</li>
- </ul>
- <p>MediaSource objects must support each of the configurations above, but they are only
- required to support one configuration at a time. Supporting multiple configurations at once
- or additional configurations is a quality of implementation issue.</p>
- </dd>
-
- <dt id="track-description">Track Description</dt>
- <dd><p>A byte stream format specific structure that provides the <a href="#track-id">Track ID</a>, codec configuration, and other metadata for a single track. Each track description inside a single <a href="#init-segment">initialization segment</a> has a unique <a href="#track-id">Track ID</a>. The user agent must run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> if the <a href="#track-id">Track ID</a> is not unique within the <a href="#init-segment">initialization segment</a> .</p></dd>
-
- <dt id="track-id">Track ID</dt>
- <dd><p>A Track ID is a byte stream format specific identifier that marks sections of the byte stream as being part of a specific track. The Track ID in a <a href="#track-description">track description</a> identifies which sections of a <a href="#media-segment">media segment</a> belong to that track.</p></dd>
-
- </dl>
- </section>
- </section>
-
- <section id="mediasource" typeof="bibo:Chapter" resource="#mediasource" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mediasource"><span class="secno">2. </span>MediaSource Object</h2>
- <p>The MediaSource object represents a source of media data for an HTMLMediaElement. It keeps track of the <code><a href="#widl-MediaSource-readyState">readyState</a></code> for this source as well as a list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects that can be used to add media data to the presentation. MediaSource objects are created by the web application and then attached to an HTMLMediaElement. The application uses the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> to add media data to this source. The HTMLMediaElement fetches this media data from the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object when it is needed during playback.</p>
-
- <pre class="idl"><span class="idlEnum" id="idl-def-ReadyState">enum <span class="idlEnumID">ReadyState</span> {
- "<a href="#idl-def-ReadyState.closed" class="idlEnumItem">closed</a>",
- "<a href="#idl-def-ReadyState.open" class="idlEnumItem">open</a>",
- "<a href="#idl-def-ReadyState.ended" class="idlEnumItem">ended</a>"
-};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-ReadyState.closed">closed</code></td><td>
- Indicates the source is not currently attached to a media element.
- </td></tr><tr><td><code id="idl-def-ReadyState.open">open</code></td><td>
- The source has been opened by a media element and is ready for data to be appended to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.
- </td></tr><tr><td><code id="idl-def-ReadyState.ended">ended</code></td><td>
- The source is still attached to a media element, but <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> has been called.
- </td></tr></tbody></table>
-
- <pre class="idl"><span class="idlEnum" id="idl-def-EndOfStreamError">enum <span class="idlEnumID">EndOfStreamError</span> {
- "<a href="#idl-def-EndOfStreamError.network" class="idlEnumItem">network</a>",
- "<a href="#idl-def-EndOfStreamError.decode" class="idlEnumItem">decode</a>"
-};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-EndOfStreamError.network">network</code></td><td>
- <p>Terminates playback and signals that a network error has occured.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_4"><span>Note</span></div><p class="">JavaScript applications should use this status code to terminate playback with a network error. For example, if a network error occurs while fetching media data.</p></div>
- </td></tr><tr><td><code id="idl-def-EndOfStreamError.decode">decode</code></td><td>
- <p>Terminates playback and signals that a decoding error has occured.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_5"><span>Note</span></div><p class="">JavaScript applications should use this status code to terminate playback with a decode error. For example, if a parsing error occurs while processing out-of-band media data.</p></div>
- </td></tr></tbody></table>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-MediaSource">[<span class="extAttr">Constructor</span>]
-interface <span class="idlInterfaceID">MediaSource</span> : <span class="idlSuperclass">EventTarget</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-ReadyState" class="idlType"><code>ReadyState</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-readyState">readyState</a></span>;</span>
-<span class="idlAttribute"> attribute <span class="idlAttrType">unrestricted double</span> <span class="idlAttrName"><a href="#widl-MediaSource-duration">duration</a></span>;</span>
-<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span> <span class="idlMethName"><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType">DOMString</span> <span class="idlParamName">type</span></span>);</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer">removeSourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span> <span class="idlParamName">sourceBuffer</span></span>);</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream</a></span> (<span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></span> <span class="idlParamName">error</span></span>);</span>
-<span class="idlMethod"> static <span class="idlMethType">boolean</span> <span class="idlMethName"><a href="#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported</a></span> (<span class="idlParam"><span class="idlParamType">DOMString</span> <span class="idlParamName">type</span></span>);</span>
-};</span></pre><section id="attributes"><h3 aria-level="2" role="heading" id="h3_attributes"><span class="secno">2.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-MediaSource-activeSourceBuffers"><code>activeSourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly </dt><dd>
- <p>Contains the subset of <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> that are providing the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected video track</a>, the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled audio track(s)</a>, and the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a> or <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a> text track(s).
- </p>
- <p><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in this list must appear in the same order as they appear in
- the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute. (e.g., If only sourceBuffers[0] and
- sourceBuffers[3] are in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then activeSourceBuffers[0] must
- equal sourceBuffers[0] and activeSourceBuffers[1] must equal sourceBuffers[3].)
- </p>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_6"><span>Note</span></div><p class="">The <a href="#active-source-buffer-changes">Changes to selected/enabled track state</a> section describes how this attribute gets
- updated.</p></div>
- </dd><dt id="widl-MediaSource-duration"><code>duration</code> of type <span class="idlAttrType">unrestricted double</span>, </dt><dd>
- <p>Allows the web application to set the presentation duration. The duration is initially set to NaN when the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object is created.</p>
- <p>On getting, run the following steps:</p>
- <ol>
- <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> then return NaN and abort these steps.</li>
- <li>Return the current value of the attribute.</li>
- </ol>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If the value being set is negative or NaN then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not <code><a href="#idl-def-ReadyState.open">"open"</a></code> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the value being assigned to this attribute.
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_7"><span>Note</span></div><p class=""><code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code>, <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> and <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> can update the duration under certain circumstances.</p></div>
- </li>
- </ol>
- </dd><dt id="widl-MediaSource-readyState"><code>readyState</code> of type <span class="idlAttrType"><a href="#idl-def-ReadyState" class="idlType"><code>ReadyState</code></a></span>, readonly </dt><dd>
- <p>Indicates the current state of the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object. When the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is created <code><a href="#widl-MediaSource-readyState">readyState</a></code> must be set to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code>.
- </p></dd><dt id="widl-MediaSource-sourceBuffers"><code>sourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly </dt><dd>
- Contains the list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects associated with this <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>. When <code><a href="#widl-MediaSource-readyState">readyState</a></code> equals <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> this list will be empty. Once <code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions to <code><a href="#idl-def-ReadyState.open">"open"</a></code> SourceBuffer objects can be added to this list by using <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.
- </dd></dl></section><section id="methods"><h3 aria-level="2" role="heading" id="h3_methods"><span class="secno">2.2 </span>Methods</h3><dl class="methods"><dt id="widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type"><code>addSourceBuffer</code></dt><dd>
- <p>Adds a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> to <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</p>
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">type</td><td class="prmType"><code>DOMString</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>type</var> is an empty string then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
- <li>If <var>type</var> contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified for the other <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-not_supported_err">NOT_SUPPORTED_ERR</a></code> exception and abort these steps.</li>
- <li>If the user agent can't handle any more SourceBuffer objects or if creating a SourceBuffer
- based on <var>type</var> would result in an unsupported <a href="#sourcebuffer-configuration">SourceBuffer configuration</a>,
- then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-quota_exceeded_err">QUOTA_EXCEEDED_ERR</a></code> exception and abort these steps.
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_8"><span>Note</span></div><p class="">For example, a user agent may throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-quota_exceeded_err">QUOTA_EXCEEDED_ERR</a></code> exception if the media element has reached the
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code> readyState. This can occur if the user agent's media engine does not support adding more tracks during
- playback.
- </p></div>
- </li>
- <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not in the <code><a href="#idl-def-ReadyState.open">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>Create a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object and associated resources.</li>
- <li>Set the <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> on the new object to the value in the
- "Generate Timestamps Flag" column of the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] entry
- that is associated with <var>type</var>.
- </li><li>
- <dl class="switch">
- <dt>If the <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> equals true:</dt>
- <dd>
- Set the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute on the new object to
- <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code>.
- </dd>
- <dt>Otherwise:</dt>
- <dd>
- Set the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute on the new object to
- <code><a href="#idl-def-AppendMode.segments">"segments"</a></code>.
- </dd>
- </dl></li>
- <li>Add the new object to <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
- <li>Return the new object.</li>
- </ol></dd><dt id="widl-MediaSource-endOfStream-void-EndOfStreamError-error"><code>endOfStream</code></dt><dd>
- <p>Signals the end of the stream.</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">error</td><td class="prmType"><code><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptTrue"><span role="img" aria-label="True">✔</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not in the <code><a href="#idl-def-ReadyState.open">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>Run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <var>error</var>.</li>
- </ol></dd><dt id="widl-MediaSource-isTypeSupported-boolean-DOMString-type"><code>isTypeSupported</code>, static</dt><dd>
- <p>Check to see whether the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is capable of creating <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects for the specified MIME type.</p>
-
-
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_9"><span>Note</span></div><p class="">
- If true is returned from this method, it only indicates that the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> implementation is capable of creating <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects for the specified MIME type. An <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> call may still fail if sufficient resources are not available to support the addition of a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.
- </p></div>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_10"><span>Note</span></div><p class="">
- This method returning true implies that HTMLMediaElement.canPlayType() will return "maybe" or "probably" since it does not make sense for a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> to support a type the HTMLMediaElement knows it cannot play.
- </p></div>
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">type</td><td class="prmType"><code>DOMString</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>boolean</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>type</var> is an empty string, then return false.</li>
- <li>If <var>type</var> does not contain a valid MIME type string, then return false.</li>
- <li>If <var>type</var> contains a media type or media subtype that the MediaSource does not support, then return false.</li>
- <li>If <var>type</var> contains a codec that the MediaSource does not support, then return false.</li>
- <li>If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.</li>
- <li>Return true.</li>
- </ol></dd><dt id="widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer"><code>removeSourceBuffer</code></dt><dd>
- <p>Removes a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> from <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">sourceBuffer</td><td class="prmType"><code><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>sourceBuffer</var> specifies an object that is not in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-not_found_err">NOT_FOUND_ERR</a></code> exception and abort these steps.</li>
- <li>If the <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then run the following steps:
- <ol>
- <li>Abort the <a href="#sourcebuffer-buffer-append">buffer append</a> and <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithms if they are running.</li>
- <li>Set the <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-abort">abort</a></code> at <var>sourceBuffer</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at <var>sourceBuffer</var>.</li>
- </ol>
- </li>
-
- <li>Let <var>SourceBuffer audioTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code>.</li>
- <li>If the <var>SourceBuffer audioTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement audioTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed enabled audio track flag</var> equal false.</li>
- <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object in the <var>SourceBuffer audioTracks list</var>, run the following steps:
- <ol>
- <li>Set the <code><a href="#widl-AudioTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object to null.</li>
- <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object is true, then
- set the <var>removed enabled audio track flag</var> to true.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object from the <var>HTMLMediaElement audioTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>HTMLMediaElement audioTracks list</var>.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object from the <var>SourceBuffer audioTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>SourceBuffer audioTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed enabled audio track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
- <var>HTMLMediaElement audioTracks list</var>.</li>
- </ol>
- </li>
-
- <li>Let <var>SourceBuffer videoTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code>.</li>
- <li>If the <var>SourceBuffer videoTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement videoTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed selected video track flag</var> equal false.</li>
- <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object in the <var>SourceBuffer videoTracks list</var>, run the following steps:
- <ol>
- <li>Set the <code><a href="#widl-VideoTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object to null.</li>
- <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object is true, then
- set the <var>removed selected video track flag</var> to true.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object from the <var>HTMLMediaElement videoTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>HTMLMediaElement videoTracks list</var>.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object from the <var>SourceBuffer videoTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>SourceBuffer videoTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed selected video track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
- <var>HTMLMediaElement videoTracks list</var>.</li>
- </ol>
- </li>
-
-
- <li>Let <var>SourceBuffer textTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code>.</li>
- <li>If the <var>SourceBuffer textTracks list</var> is not empty, then run the following steps:
- <ol>
- <li>Let <var>HTMLMediaElement textTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li>Let the <var>removed enabled text track flag</var> equal false.</li>
- <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object in the <var>SourceBuffer textTracks list</var>, run the following steps:
- <ol>
- <li>Set the <code><a href="#widl-TextTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object to null.</li>
- <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object is set to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a></code> or
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a></code> , then set the <var>removed enabled text track flag</var> to true.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object from the <var>HTMLMediaElement textTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>HTMLMediaElement textTracks list</var>.</li>
- <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object from the <var>SourceBuffer textTracks list</var>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <var>SourceBuffer textTracks list</var>.</li>
- </ol>
- </li>
- <li>If the <var>removed enabled text track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
- <var>HTMLMediaElement textTracks list</var>.</li>
- </ol>
- </li>
-
- <li>If <var>sourceBuffer</var> is in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> and
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at the <a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a> returned by <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>Remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at
- the <a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a> returned by <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
- <li>Destroy all resources for <var>sourceBuffer</var>.</li>
- </ol></dd></dl></section>
-
- <section id="mediasource-events" typeof="bibo:Chapter" resource="#mediasource-events" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_mediasource-events"><span class="secno">2.3 </span>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><dfn id="dom-evt-sourceopen"><code>sourceopen</code></dfn></td>
- <td><code>Event</code></td>
- <td><code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions from <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> to <code><a href="#idl-def-ReadyState.open">"open"</a></code> or from <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> to <code><a href="#idl-def-ReadyState.open">"open"</a></code>.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-sourceended"><code>sourceended</code></dfn></td>
- <td><code>Event</code></td>
- <td><code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions from <code><a href="#idl-def-ReadyState.open">"open"</a></code> to <code><a href="#idl-def-ReadyState.ended">"ended"</a></code>.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-sourceclose"><code>sourceclose</code></dfn></td>
- <td><code>Event</code></td>
- <td><code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions from <code><a href="#idl-def-ReadyState.open">"open"</a></code> to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> or <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code>.</td>
- </tr>
- </tbody>
- </table>
- </section>
-
- <section id="mediasource-algorithms" typeof="bibo:Chapter" resource="#mediasource-algorithms" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_mediasource-algorithms"><span class="secno">2.4 </span>Algorithms</h3>
-
- <section id="mediasource-attach" typeof="bibo:Chapter" resource="#mediasource-attach" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_mediasource-attach"><span class="secno">2.4.1 </span>Attaching to a media element</h4>
- <p> A <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object can be attached to a media element by assigning a <a href="#mediasource-object-url">MediaSource object URL</a> to the media element <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#attr-media-src">src</a></code> attribute or the src attribute of a <source> inside a media element. A <a href="#mediasource-object-url">MediaSource object URL</a> is created by passing a MediaSource object to <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>.</p>
- <p>If the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> absolute URL matches the MediaSource object URL, run the following steps right before the <span>"<i>Perform a potentially CORS-enabled fetch</i>"</span>
- step in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</p>
-
- <dl class="switch">
- <dt>If <code><a href="#widl-MediaSource-readyState">readyState</a></code> is NOT set to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code></dt>
- <dd>Run the <span>"<i>If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource</i>"</span> steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
- <dt>Otherwise</dt>
- <dd>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute to <code><a href="#idl-def-ReadyState.open">"open"</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>.</li>
- <li>Continue the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> by running the <span>"<i>Perform a potentially CORS-enabled fetch</i>"</span> step. Text in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>
- that refers to "the download" or "bytes received" refer to data passed in via <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>. References to
- HTTP in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> do not apply because the HTMLMediaElement does not fetch media data via HTTP when a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is attached.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="mediasource-detach" typeof="bibo:Chapter" resource="#mediasource-detach" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_mediasource-detach"><span class="secno">2.4.2 </span>Detaching from a media element</h4>
- <p>The following steps are run in any case where the media element is going to transition to <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-network_empty">NETWORK_EMPTY</a> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-mediacontroller-emptied">emptied</a> at the media element. These steps must be run right before the transition.</p>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code>.</li>
- <li>Set the <code><a href="#widl-MediaSource-duration">duration</a></code> attribute to NaN.</li>
- <li>Remove all the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>Remove all the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects from <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceclose">sourceclose</a></code> at the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>.</li>
- </ol>
- </section>
-
- <section id="mediasource-seeking" typeof="bibo:Chapter" resource="#mediasource-seeking" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_mediasource-seeking"><span class="secno">2.4.3 </span>Seeking</h4>
- <p>Run the following steps as part of the "<i>Wait until the user agent has established whether or not the media data for the new playback position is available, and, if it is, until it has decoded enough data to play back that position"</i> step of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seek">seek algorithm</a>:</p>
- <ol>
- <li>The media element looks for <a href="#media-segment">media segments</a> containing the <var>new playback position</var> in each <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.
- <dl class="switch">
- <dt>If one or more of the objects in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> is missing <a href="#media-segment">media segments</a> for the <var>new playback position</var>
- </dt>
- <dd>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>.</li>
- <li>The media element waits until an <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> or an <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> call causes the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> to set
- the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to a value greater than <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_11"><span>Note</span></div><p class="">The web application can use <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> to determine what the media element needs to resume playback.</p></div>
- </li>
- </ol>
- </dd>
- <dt>Otherwise</dt>
- <dd>Continue</dd>
- </dl>
- </li>
- <li>The media element resets all decoders and initializes each one with data from the appropriate <a href="#init-segment">initialization segment</a>.</li>
- <li>The media element feeds <a href="#coded-frame">coded frames</a> from the <a href="#active-track-buffers">active track buffers</a> into the decoders starting with the
- closest <a href="#random-access-point">random access point</a> before the <var>new playback position</var>.</li>
- <li>Resume the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seek">seek algorithm</a> at the "<i>Await a stable state</i>" step.</li>
- </ol>
- </section>
-
- <section id="buffer-monitoring" typeof="bibo:Chapter" resource="#buffer-monitoring" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_buffer-monitoring"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</h4>
- <p>The following steps are periodically run during playback to make sure that all of the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> have <a href="#enough-data">enough data to ensure uninterrupted playback</a>. Appending new segments and changes to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> also cause these steps to run because they affect the conditions that trigger state transitions.</p>
-
- <p>Having <dfn id="enough-data">enough data to ensure uninterrupted playback</dfn> is an implementation specific condition where the user agent
- determines that it currently has enough data to play the presentation without stalling for a meaningful period of time. This condition is
- constantly evaluated to determine when to transition the media element into and out of the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_enough_data">HAVE_ENOUGH_DATA</a></code> ready state.
- These transitions indicate when the user agent believes it has enough data buffered or it needs more data respectively.</p>
-
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_12"><span>Note</span></div><p class="">An implementation may choose to use bytes buffered, time buffered, the append rate, or any other metric it sees fit to
- determine when it has enough data. The metrics used may change during playback so web applications should only rely on the value of
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> to determine whether more data is needed or not.</p></div>
-
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_13"><span>Note</span></div><p class="">When the media element needs more data, the user agent should transition it from <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_enough_data">HAVE_ENOUGH_DATA</a></code> to
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code> early enough for a web application to be able to respond without causing an interruption in playback.
- For example, transitioning when the current playback position is 500ms before the end of the buffered data gives the application roughly
- 500ms to append more data before playback stalls.</p></div>
-
- <dl class="switch">
- <dt>If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> does not contain a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> for the current playback position:</dt>
- <dd>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>.</li>
- <li>If this is the first transition to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-loadedmetadata">loadedmetadata</a></code> at the media element.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> contains a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> that includes the current playback position and <a href="#enough-data">enough data to ensure uninterrupted playback</a>:</dt>
- <dd>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_enough_data">HAVE_ENOUGH_DATA</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-canplaythrough">canplaythrough</a></code> at the media element.</li>
- <li>Playback may resume at this point if it was previously suspended by a transition to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> contains a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> that includes the current playback position and some time beyond the current playback position, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code>.</li>
- <li>If the previous value of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> was less than <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code>, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-canplay">canplay</a></code> at the media element.</li>
- <li>Playback may resume at this point if it was previously suspended by a transition to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- <dt>If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> contains a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> that ends at the current playback position and does not have a range covering the time immediately after the current position:</dt>
- <dd>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>.</li>
- <li>If this is the first transition to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-loadeddata">loadeddata</a></code> at the media element.</li>
- <li>Playback is suspended at this point since the media element doesn't have enough data to advance the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-timeline">media timeline</a>.</li>
- <li>Abort these steps.</li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="active-source-buffer-changes" typeof="bibo:Chapter" resource="#active-source-buffer-changes" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_active-source-buffer-changes"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</h4>
- <p>During playback <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> needs to be updated if the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected video track</a>, the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled audio track(s)</a>, or a text track <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a> changes. When one or more of these changes occur the following steps need to be followed.</p>
- <dl class="switch">
- <dt>If the selected video track changes, then run the following steps:</dt>
- <dd>
- <ol>
- <li>If the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the previously selected video track is not associated with any other enabled tracks, run the following steps:
- <ol>
- <li>Remove the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </li>
- <li>If the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the newly selected video track is not already in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, run the following steps:
- <ol>
- <li>Add the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </li>
- </ol>
- </dd>
- <dt>If an audio track becomes disabled and the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with this track is not associated with any other enabled or selected track, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Remove the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the audio track from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </dd>
- <dt>If an audio track becomes enabled and the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with this track is not already in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then run the following steps:
- </dt>
- <dd>
- <ol>
- <li>Add the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the audio track to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </dd>
- <dt>If a text track <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a> becomes <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-disabled">"disabled"</a> and the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with this track is not associated with any other enabled or selected track, then run the following steps:</dt>
- <dd>
- <ol>
- <li>Remove the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the text track from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </dd>
- <dt>If a text track <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a> becomes <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a> or <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a> and the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with this track is not already in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then run the following steps:
- </dt>
- <dd>
- <ol>
- <li>Add the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> associated with the text track to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>
- </li>
- </ol>
- </dd>
- </dl>
- </section>
-
- <section id="duration-change-algorithm" typeof="bibo:Chapter" resource="#duration-change-algorithm" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_duration-change-algorithm"><span class="secno">2.4.6 </span>Duration change</h4>
- <p>Follow these steps when <code><a href="#widl-MediaSource-duration">duration</a></code> needs to change to a <var>new duration</var>.</p>
- <ol>
- <li>If the current value of <code><a href="#widl-MediaSource-duration">duration</a></code> is equal to <var>new duration</var>, then return.</li>
- <li>Set <var>old duration</var> to the current value of <code><a href="#widl-MediaSource-duration">duration</a></code>.
- </li><li>Update <code><a href="#widl-MediaSource-duration">duration</a></code> to <var>new duration</var>.</li>
- <li>If the <var>new duration</var> is less than <var>old duration</var>, then run the
- <a href="#sourcebuffer-range-removal">range removal</a> algorithm with <var>new duration</var> and
- <var>old duration</var> as the start and end of the removal range.</li>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_14"><span>Note</span></div><p class="">This preserves audio frames and text cues that start before and end after the <code><a href="#widl-MediaSource-duration">duration</a></code>.</p></div>
- <li>If a user agent is unable to partially render audio frames or text cues that start before and end after the <code><a href="#widl-MediaSource-duration">duration</a></code>, then run the following steps:
- <ol>
- <li>Update <var>new duration</var> to the highest end time reported by the <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> attribute across all <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
- <li>Update <code><a href="#widl-MediaSource-duration">duration</a></code> to <var>new duration</var>.</li>
- </ol>
- </li>
- <li>Update the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-controller-duration">media controller duration</a></code> to <var>new duration</var> and run the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#durationChange">HTMLMediaElement duration change algorithm</a>.</li>
- </ol>
- </section>
-
- <section id="end-of-stream-algorithm" typeof="bibo:Chapter" resource="#end-of-stream-algorithm" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_end-of-stream-algorithm"><span class="secno">2.4.7 </span>End of stream algorithm</h4>
- <p>This algorithm gets called when the application signals the end of stream via an <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> call or an algorithm needs to
- signal a decode error. This algorithm takes an <var>error</var> parameter that indicates whether an error will be signalled.</p>
- <ol>
- <li>Change the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute value to <code><a href="#idl-def-ReadyState.ended">"ended"</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceended">sourceended</a></code> at the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>.</li>
- <li><dl class="switch">
- <dt>If <var>error</var> is not set</dt>
- <dd>
- <ol>
- <li>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the highest end time reported by the <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> attribute across all <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.<br>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_15"><span>Note</span></div><p class="">This allows the duration to properly reflect the end of the appended media segments. For example, if the duration was explicitly set to 10 seconds and only media segments for 0 to 5 seconds were appended before endOfStream() was called, then the duration will get updated to 5 seconds.</p></div>
- </li>
- <li>Notify the media element that it now has all of the media data.</li>
- </ol>
- </dd>
- <dt>If <var>error</var> is set to <code><a href="#idl-def-EndOfStreamError.network">"network"</a></code>
- </dt>
- <dd>
- <dl class="switch">
- <dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute equals <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
- </dt>
- <dd>Run the <span>"<i>If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource</i>"</span> steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
- <dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is greater than <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
- </dt>
- <dd>Run the "<i>If the connection is interrupted after some media data has been received, causing the user agent to give up trying to fetch the resource</i>" steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
- </dl>
- </dd>
- <dt>If <var>error</var> is set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code>
- </dt>
- <dd>
- <ol>
- <li>If <code><a href="#widl-SourceBuffer-updating">updating</a></code> equals true, then run the <a href="#sourcebuffer-append-error">append error algorithm</a>.</li>
- <li>
- <dl class="switch">
- <dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute equals <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
- </dt>
- <dd>Run the "<i>If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all</i>" steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
- <dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is greater than <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
- </dt>
- <dd>Run the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#fatal-decode-error">media data is corrupted</a> steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
- </dl>
- </li>
- </ol>
- </dd>
- </dl>
- </li>
- </ol>
- </section>
- </section>
- </section>
-
- <section id="sourcebuffer" typeof="bibo:Chapter" resource="#sourcebuffer" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_sourcebuffer"><span class="secno">3. </span>SourceBuffer Object</h2>
-
-
- <pre class="idl"><span class="idlEnum" id="idl-def-AppendMode">enum <span class="idlEnumID">AppendMode</span> {
- "<a href="#idl-def-AppendMode.segments" class="idlEnumItem">segments</a>",
- "<a href="#idl-def-AppendMode.sequence" class="idlEnumItem">sequence</a>"
-};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-AppendMode.segments">segments</code></td><td>
- <p>The timestamps in the media segment determine where the <a href="#coded-frame">coded frames</a> are placed in the presentation. Media segments can be appended in any order.</p>
- </td></tr><tr><td><code id="idl-def-AppendMode.sequence">sequence</code></td><td>
- <p>Media segments will be treated as adjacent in time independent of the timestamps in the media segment. Coded frames in a new media segment will be placed immediately after the coded
- frames in the previous media segment. The <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> attribute will be updated if a new offset is needed to make the new media segments adjacent to the previous media segment.
- Setting the <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> attribute in <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code> mode allows a media segment to be placed at a specific position in the timeline without any knowledge
- of the timestamps in the media segment.
- </p>
- </td></tr></tbody></table>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-SourceBuffer">interface <span class="idlInterfaceID">SourceBuffer</span> : <span class="idlSuperclass">EventTarget</span> {
-<span class="idlAttribute"> attribute <span class="idlAttrType"><a href="#idl-def-AppendMode" class="idlType"><code>AppendMode</code></a></span> <span class="idlAttrName"><a href="#widl-SourceBuffer-mode">mode</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">boolean</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-updating">updating</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">TimeRanges</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-buffered">buffered</a></span>;</span>
-<span class="idlAttribute"> attribute <span class="idlAttrType">double</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">AudioTrackList</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">VideoTrackList</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">TextTrackList</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-textTracks">textTracks</a></span>;</span>
-<span class="idlAttribute"> attribute <span class="idlAttrType">double</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></span>;</span>
-<span class="idlAttribute"> attribute <span class="idlAttrType">unrestricted double</span> <span class="idlAttrName"><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></span>;</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data">appendBuffer</a></span> (<span class="idlParam"><span class="idlParamType">ArrayBuffer</span> <span class="idlParamName">data</span></span>);</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer</a></span> (<span class="idlParam"><span class="idlParamType">ArrayBufferView</span> <span class="idlParamName">data</span></span>);</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream</a></span> (<span class="idlParam"><span class="idlParamType">Stream</span> <span class="idlParamName">stream</span></span>, <span class="idlParam">[<span class="extAttr">EnforceRange</span>] optional <span class="idlParamType">unsigned long long</span> <span class="idlParamName">maxSize</span></span>);</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-SourceBuffer-abort-void">abort</a></span> ();</span>
-<span class="idlMethod"> <span class="idlMethType">void</span> <span class="idlMethName"><a href="#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end">remove</a></span> (<span class="idlParam"><span class="idlParamType">double</span> <span class="idlParamName">start</span></span>, <span class="idlParam"><span class="idlParamType">unrestricted double</span> <span class="idlParamName">end</span></span>);</span>
-<span class="idlAttribute"> attribute <span class="idlAttrType"><a href="#idl-def-TrackDefaultList" class="idlType"><code>TrackDefaultList</code></a></span> <span class="idlAttrName"><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></span>;</span>
-};</span></pre><section id="attributes-1"><h3 aria-level="2" role="heading" id="h3_attributes-1"><span class="secno">3.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBuffer-appendWindowEnd"><code>appendWindowEnd</code> of type <span class="idlAttrType">unrestricted double</span>, </dt><dd>
- <p>The <a href="#presentation-timestamp">presentation timestamp</a> for the end of the <a href="#append-window">append window</a>. This attribute is initially set to positive Infinity.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the new value equals NaN, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> and abort these steps.</li>
- <li>If the new value is less than or equal to <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these
- steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-appendWindowStart"><code>appendWindowStart</code> of type <span class="idlAttrType">double</span>, </dt><dd>
- <p>The <a href="#presentation-timestamp">presentation timestamp</a> for the start of the <a href="#append-window">append window</a>. This attribute is initially set to the <a href="#presentation-start-time">presentation start time</a>.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the new value is less than 0 or greater than or equal to <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception
- and abort these steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-audioTracks"><code>audioTracks</code> of type <span class="idlAttrType">AudioTrackList</span>, readonly </dt><dd>
- The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> objects created by this object.
- </dd><dt id="widl-SourceBuffer-buffered"><code>buffered</code> of type <span class="idlAttrType">TimeRanges</span>, readonly </dt><dd>
- <p>Indicates what <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> are buffered in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
- <p>When the attribute is read the following steps must occur:</p>
- <ol>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>Let <var>highest end time</var> be the largest <a href="#track-buffer-ranges">track buffer ranges</a> end time across all the <a href="#track-buffer">track buffers</a> managed by this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Let <var>intersection ranges</var> equal a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> object containing a single range from 0 to <var>highest end time</var>.</li>
- <li>For each <a href="#track-buffer">track buffer</a> managed by this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>, run the following steps:
- <ol>
- <li>Let <var>track ranges</var> equal the <a href="#track-buffer-ranges">track buffer ranges</a> for the current <a href="#track-buffer">track buffer</a>.</li>
- <li>If <code><a href="#widl-MediaSource-readyState">readyState</a></code> is <code><a href="#idl-def-ReadyState.ended">"ended"</a></code>, then set the end time on the last range in <var>track ranges</var> to <var>highest end time</var>.</li>
- <li>Let <var>new intersection ranges</var> equal the intersection between the <var>intersection ranges</var> and the <var>track ranges</var>.</li>
- <li>Replace the ranges in <var>intersection ranges</var> with the <var>new intersection ranges</var>.</li>
- </ol>
- </li>
- <li>Return the <var>intersection ranges</var>.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-mode"><code>mode</code> of type <span class="idlAttrType"><a href="#idl-def-AppendMode" class="idlType"><code>AppendMode</code></a></span>, </dt><dd>
- <p>Controls how a sequence of <a href="#media-segment">media segments</a> are handled. This attribute is initially set by <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> after the object is created.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>Let <var>new mode</var> equal the new value being assigned to this attribute.</li>
- <li>If <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> equals true and <var>new mode</var> equals
- <code><a href="#idl-def-AppendMode.segments">"segments"</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code>
- exception and abort these steps.</li>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and
- abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>
- <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> state then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> to <code><a href="#idl-def-ReadyState.open">"open"</a></code></li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#parent-media-source">parent media source</a>.</li>
- </ol>
- </li>
- <li>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> and abort these steps.</li>
- <li>If the <var>new mode</var> equals <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code>, then set the <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var> to the <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var>.</li>
- <li>Update the attribute to <var>new mode</var>.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-textTracks"><code>textTracks</code> of type <span class="idlAttrType">TextTrackList</span>, readonly </dt><dd>
- The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> objects created by this object.
- </dd><dt id="widl-SourceBuffer-timestampOffset"><code>timestampOffset</code> of type <span class="idlAttrType">double</span>, </dt><dd>
- <p>Controls the offset applied to timestamps inside subsequent <a href="#media-segment">media segments</a> that are appended to this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. The <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> is initially set to 0 which indicates that no offset is being applied.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>Let <var>new timestamp offset</var> equal the new value being assigned to this attribute.</li>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>
- <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> state then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> to <code><a href="#idl-def-ReadyState.open">"open"</a></code></li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#parent-media-source">parent media source</a>.</li>
- </ol>
- </li>
- <li>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute equals <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code>, then set the <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var> to <var>new timestamp offset</var>.</li>
- <li>Update the attribute to <var>new timestamp offset</var>.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-trackDefaults"><code>trackDefaults</code> of type <span class="idlAttrType"><a href="#idl-def-TrackDefaultList" class="idlType"><code>TrackDefaultList</code></a></span>, </dt><dd>
- <p>Specifies the default values to use if kind, label, and/or language information is not available in the
- <a href="#init-segment">initialization segment</a> when the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> needs
- to create track objects. This attribute is initially set to an empty <a href="#idl-def-TrackDefaultList" class="idlType"><code>TrackDefaultList</code></a> object.</p>
- <p>On getting, Return the initial value or the last value that was successfully set.</p>
- <p>On setting, run the following steps:</p>
- <ol>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>Update the attribute to the new value.</li>
- </ol>
- </dd><dt id="widl-SourceBuffer-updating"><code>updating</code> of type <span class="idlAttrType">boolean</span>, readonly </dt><dd>
- <p>Indicates whether the asynchronous continuation of an <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code>, <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>, or <code><a href="#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end">remove()</a></code>
- operation is still being processed. This attribute is initially set to false when the object is created.</p>
- </dd><dt id="widl-SourceBuffer-videoTracks"><code>videoTracks</code> of type <span class="idlAttrType">VideoTrackList</span>, readonly </dt><dd>
- The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> objects created by this object.
- </dd></dl></section><section id="methods-1"><h3 aria-level="2" role="heading" id="h3_methods-1"><span class="secno">3.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBuffer-abort-void"><code>abort</code></dt><dd>
- <p>Aborts the current segment and resets the segment parser.</p>
-
-
- <div><em>No parameters.</em></div><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is not in the <code><a href="#idl-def-ReadyState.open">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then run the following steps:
- <ol>
- <li>Abort the <a href="#sourcebuffer-buffer-append">buffer append</a> and <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithms if they are running.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-abort">abort</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- </ol>
- </li>
- <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
- <li>Set <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> to the <a href="#presentation-start-time">presentation start time</a>.</li>
- <li>Set <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> to positive Infinity.</li>
- </ol></dd><dt id="widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data"><code>appendBuffer</code></dt><dd>
- <p>Appends the segment data in an ArrayBuffer[<cite><a class="bibref" href="#bib-TYPED-ARRAYS">TYPED-ARRAYS</a></cite>] to the source buffer.</p>
- <p>The steps for this method are the same as the ArrayBufferView version of <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code>.</p>
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">data</td><td class="prmType"><code>ArrayBuffer</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div></dd><dt id="widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data"><code>appendBuffer</code></dt><dd>
- <p>Appends the segment data in an ArrayBufferView[<cite><a class="bibref" href="#bib-TYPED-ARRAYS">TYPED-ARRAYS</a></cite>] to the source buffer.</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">data</td><td class="prmType"><code>ArrayBufferView</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>Run the <a href="#sourcebuffer-prepare-append">prepare append</a> algorithm.</li>
- <li>Add <var>data</var> to the end of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Asynchronously run the <a href="#sourcebuffer-buffer-append">buffer append</a> algorithm.</li>
- </ol></dd><dt id="widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize"><code>appendStream</code></dt><dd>
- <p>Appends segment data to the source buffer from a <code><a href="http://www.w3.org/TR/2013/WD-streams-api-20131105/#idl-def-Stream" class="idlType">Stream</a></code>[<cite><a class="bibref" href="#bib-STREAMS-API">STREAMS-API</a></cite>].</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">stream</td><td class="prmType"><code>Stream</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">maxSize</td><td class="prmType"><code>unsigned long long</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptTrue"><span role="img" aria-label="True">✔</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>Run the <a href="#sourcebuffer-prepare-append">prepare append</a> algorithm.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Asynchronously run the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm with <var>stream</var> and <var>maxSize</var>.</li>
- </ol></dd><dt id="widl-SourceBuffer-remove-void-double-start-unrestricted-double-end"><code>remove</code></dt><dd>
- <p>Removes media for a specific time range.</p>
-
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">start</td><td class="prmType"><code>double</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">end</td><td class="prmType"><code>unrestricted double</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>void</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <code><a href="#widl-MediaSource-duration">duration</a></code> equals NaN, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
- <li>If <var>start</var> is negative or greater than <code><a href="#widl-MediaSource-duration">duration</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
- <li>If <var>end</var> is less than or equal to <var>start</var> or <var>end</var> equals NaN, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
- <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>
- <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> state then run
- the following steps:</p>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> to <code><a href="#idl-def-ReadyState.open">"open"</a></code></li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#parent-media-source">parent media source</a> .</li>
- </ol>
- </li>
- <li>Run the <a href="#sourcebuffer-range-removal">range removal</a> algorithm with <var>start</var> and <var>end</var> as the start and end of the removal range.</li>
- </ol></dd></dl></section>
-
- <section id="track-buffers" typeof="bibo:Chapter" resource="#track-buffers" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_track-buffers"><span class="secno">3.3 </span>Track Buffers</h3>
- <p>A <dfn id="track-buffer">track buffer</dfn> stores the <a href="#track-description">track descriptions</a> and <a href="#coded-frame">coded frames</a> for an individual
- track. The track buffer is updated as <a href="#init-segment">initialization segments</a> and <a href="#media-segment">media segments</a> are appended to the
- <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
-
- <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="last-decode-timestamp">last decode timestamp</dfn> variable that stores
- the decode timestamp of the last <a href="#coded-frame">coded frame</a> appended in the current <a href="#coded-frame-group">coded frame group</a>. The variable is initially
- unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
-
- <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="last-frame-duration">last frame duration</dfn> variable that stores
- the <a href="#coded-frame-duration">coded frame duration</a> of the last <a href="#coded-frame">coded frame</a> appended in the current <a href="#coded-frame-group">coded frame group</a>. The variable is initially
- unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
-
- <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
- the highest <a href="#presentation-timestamp">presentation timestamp</a> encountered in a <a href="#coded-frame">coded frame</a> appended in the current <a href="#coded-frame-group">coded frame group</a>.
- The variable is initially unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
-
- <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="need-RAP-flag">need random access point flag</dfn> variable that keeps track of whether
- the track buffer is waiting for a <a href="#random-access-point">random access point</a> <a href="#coded-frame">coded frame</a>. The variable is initially set to true to
- indicate that <a href="#random-access-point">random access point</a> <a href="#coded-frame">coded frame</a> is needed before anything can be added to the
- <a href="#track-buffer">track buffer</a>.</p>
-
- <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="track-buffer-ranges">track buffer ranges</dfn> variable that represents the presentation time ranges occupied by the <a href="#coded-frame">coded frames</a>
- currently stored in the track buffer. For specification purposes, this information is treated as if it were stored in a <a href="http://www.w3.org/TR/html5/embedded-content-0.html#normalized-timeranges-object">normalized TimeRanges object</a>.</p>
- </section>
-
- <section id="sourcebuffer-events" typeof="bibo:Chapter" resource="#sourcebuffer-events" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_sourcebuffer-events"><span class="secno">3.4 </span>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><dfn id="dom-evt-updatestart"><code>updatestart</code></dfn></td>
- <td><code>Event</code></td>
- <td><code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from false to true.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-update"><code>update</code></dfn></td>
- <td><code>Event</code></td>
- <td>The append or remove has successfully completed. <code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from true to false.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-updateend"><code>updateend</code></dfn></td>
- <td><code>Event</code></td>
- <td>The append or remove has ended.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-error"><code>error</code></dfn></td>
- <td><code>Event</code></td>
- <td>An error occurred during the append. <code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from true to false.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-abort"><code>abort</code></dfn></td>
- <td><code>Event</code></td>
- <td>The append or remove was aborted by an <code><a href="#widl-SourceBuffer-abort-void">abort()</a></code> call. <code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from true to false.</td>
- </tr>
- </tbody>
- </table>
- </section>
-
- <section id="sourcebuffer-algorithms" typeof="bibo:Chapter" resource="#sourcebuffer-algorithms" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_sourcebuffer-algorithms"><span class="secno">3.5 </span>Algorithms</h3>
-
- <section id="sourcebuffer-segment-parser-loop" typeof="bibo:Chapter" resource="#sourcebuffer-segment-parser-loop" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-segment-parser-loop"><span class="secno">3.5.1 </span>Segment Parser Loop</h4>
- <p>All SourceBuffer objects have an internal <dfn id="sourcebuffer-append-state">append state</dfn> variable that keeps track of the high-level segment parsing state. It is initially set to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a> and can transition to the following states as data is appended.</p>
- <table class="old-table">
- <thead>
- <tr>
- <th>Append state name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><dfn id="sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</dfn></td>
- <td>Waiting for the start of an <a href="#init-segment">initialization segment</a> or <a href="#media-segment">media segment</a> to be appended.</td>
- </tr>
- <tr>
- <td><dfn id="sourcebuffer-parsing-init-segment">PARSING_INIT_SEGMENT</dfn></td>
- <td>Currently parsing an <a href="#init-segment">initialization segment</a>.</td>
- </tr>
- <tr>
- <td><dfn id="sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</dfn></td>
- <td>Currently parsing a <a href="#media-segment">media segment</a>.</td>
- </tr>
- </tbody>
- </table>
-
- <p>The <dfn id="sourcebuffer-input-buffer">input buffer</dfn> is a byte buffer that is used to hold unparsed bytes across <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> calls. The buffer is empty when the SourceBuffer object is created.</p>
-
- <p>The <dfn id="sourcebuffer-buffer-full-flag">buffer full flag</dfn> keeps track of whether <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> or
- <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> is allowed to accept more bytes. It is set to false when the SourceBuffer object is created and gets updated
- as data is appended and removed.</p>
-
- <p>The <dfn id="sourcebuffer-group-start-timestamp">group start timestamp</dfn> variable keeps track of the starting timestamp for a new
- <a href="#coded-frame-group">coded frame group</a> in the <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code> mode.
- It is unset when the SourceBuffer object is created and gets updated when the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute equals <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code> and the
- <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> attribute is set, or the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> runs.
- </p>
-
- <p>The <dfn id="sourcebuffer-group-end-timestamp">group end timestamp</dfn> variable stores the
- highest <a href="#coded-frame-end-timestamp">coded frame end timestamp</a> across all <a href="#coded-frame">coded frames</a> in
- the current <a href="#coded-frame-group">coded frame group</a>. It is set to 0 when the SourceBuffer object is created and gets updated
- by the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a>.
- </p>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_16"><span>Note</span></div><p class="">The <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var> stores the highest <a href="#coded-frame-end-timestamp">coded frame end timestamp</a> across all <a href="#track-buffer">track buffers</a> in a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. Therefore, care should be taken in setting the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute when appending multiplexed segments in which the timestamps are not aligned across tracks.
- </p></div>
-
- <p>The <dfn id="sourcebuffer-generate-timestamps-flag">generate timestamps flag</dfn> is a
- boolean variable that keeps track of whether timestamps need to be generated for the
- <a href="#coded-frame">coded frames</a> passed to the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a>.
- This flag is set by <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> when the SourceBuffer object is created.
- </p>
- <p>When the segment parser loop algorithm is invoked, run the following steps:</p>
-
- <ol>
- <li><i>Loop Top:</i> If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> is empty, then jump to the <i>need more data</i> step below.</li>
- <li>If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> contains bytes that violate the <a href="#sourcebuffer-byte-stream-format-spec">SourceBuffer byte stream format specification</a>, then run the
- <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> and abort this algorithm.</li>
- <li>Remove any bytes that the <a href="#byte-stream-format-specs">byte stream format specifications</a> say must be ignored from the start of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>
- <p>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a>, then run the following steps:</p>
- <ol>
- <li>If the beginning of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> indicates the start of an <a href="#init-segment">initialization segment</a>, set the <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-parsing-init-segment">PARSING_INIT_SEGMENT</a>.</li>
- <li>If the beginning of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> indicates the start of a <a href="#media-segment">media segment</a>, set <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li>
- <p>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-init-segment">PARSING_INIT_SEGMENT</a>, then run the following steps:</p>
- <ol>
- <li>If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> does not contain a complete <a href="#init-segment">initialization segment</a> yet, then jump to the <i>need more data</i> step below.</li>
- <li>Run the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a>.</li>
- <li>Remove the <a href="#init-segment">initialization segment</a> bytes from the beginning of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>Set <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li>
- <p>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a>, then run the following steps:</p>
- <ol>
- <li>If the <var><a href="#first-init-segment-received-flag">first initialization segment received flag</a></var> is false, then run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> and abort this algorithm.</li>
- <li>If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> does not contain a complete <a href="#media-segment">media segment</a> header yet, then jump to the <i>need more data</i> step below.</li>
- <li>If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> contains one or more complete <a href="#coded-frame">coded frames</a>, then run the
- <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_17"><span>Note</span></div><p class="">
- The frequency at which the coded frame processing algorithm is run is implementation-specific. The coded frame processing algorithm may
- be called when the input buffer contains the complete media segment or it may be called multiple times as complete coded frames are
- added to the input buffer.
- </p></div>
- </li>
- <li>If this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is full and cannot accept more media data, then set the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> to true.</li>
- <li>If the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> does not contain a complete <a href="#media-segment">media segment</a>, then jump to the <i>need more data</i> step below.<p></p>
- </li><li>Remove the <a href="#media-segment">media segment</a> bytes from the beginning of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>Set <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a>.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- </ol>
- </li>
- <li><i>Need more data:</i> Return control to the calling algorithm.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-reset-parser-state" typeof="bibo:Chapter" resource="#sourcebuffer-reset-parser-state" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-reset-parser-state"><span class="secno">3.5.2 </span>Reset Parser State</h4>
- <p>When the parser state needs to be reset, run the following steps:</p>
- <ol>
- <li>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a> and the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> contains some
- complete <a href="#coded-frame">coded frames</a>, then run the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> until all of these complete
- <a href="#coded-frame">coded frames</a> have been processed.</li>
- <li>Unset the <var><a href="#last-decode-timestamp">last decode timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Unset the <var><a href="#last-frame-duration">last frame duration</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Unset the <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on all <a href="#track-buffer">track buffers</a> to true.</li>
- <li>Remove all bytes from the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>Set <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a>.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-append-error" typeof="bibo:Chapter" resource="#sourcebuffer-append-error" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-append-error"><span class="secno">3.5.3 </span>Append Error Algorithm</h4>
- <p>When an error occurs during an append, run the following steps:</p>
- <ol>
- <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-error">error</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-prepare-append" typeof="bibo:Chapter" resource="#sourcebuffer-prepare-append" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-prepare-append"><span class="secno">3.5.4 </span>Prepare Append Algorithm</h4>
- <p>When an append operation begins, the follow steps are run to validate and prepare the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
- <ol>
- <li>If the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
- <li>
- <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState.ended">"ended"</a></code> state then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> to <code><a href="#idl-def-ReadyState.open">"open"</a></code>
- </li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#parent-media-source">parent media source</a> .</li>
- </ol>
- </li>
- <li>Run the <a href="#sourcebuffer-coded-frame-eviction">coded frame eviction algorithm</a>.</li>
- <li>
- <p>If the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals true, then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-quota_exceeded_err">QUOTA_EXCEEDED_ERR</a></code> exception and abort these step.</p>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_18"><span>Note</span></div><p class="">This is the signal that the implementation was unable to evict enough data to accomodate the append or the append is too big. The web
- application should use <code><a href="#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end">remove()</a></code> to explicitly free up space and/or reduce the size of the append.</p></div>
- </li>
- </ol>
- </section>
-
- <section id="sourcebuffer-buffer-append" typeof="bibo:Chapter" resource="#sourcebuffer-buffer-append" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-buffer-append"><span class="secno">3.5.5 </span>Buffer Append Algorithm</h4>
- <p>When <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> is called, the following steps are run to process the appended data.</p>
- <ol>
- <li>Run the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm.</li>
- <li>If the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm in the previous step was aborted, then abort this algorithm.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-update">update</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-stream-append-loop" typeof="bibo:Chapter" resource="#sourcebuffer-stream-append-loop" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-stream-append-loop"><span class="secno">3.5.6 </span>Stream Append Loop</h4>
- <p>When a <code><a href="http://www.w3.org/TR/2013/WD-streams-api-20131105/#idl-def-Stream" class="idlType">Stream</a></code>[<cite><a class="bibref" href="#bib-STREAMS-API">STREAMS-API</a></cite>] is passed to <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>, the following steps are run to transfer data from the
- <code><a href="http://www.w3.org/TR/2013/WD-streams-api-20131105/#idl-def-Stream" class="idlType">Stream</a></code> to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. This algorithm is initialized with the <var>stream</var> and <var>maxSize</var> parameters
- from the <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> call.
- </p>
- <ol>
- <li>If <var>maxSize</var> is set, then let <var>bytesLeft</var> equal <var>maxSize</var>.</li>
- <li><i>Loop Top: </i>If <var>maxSize</var> is set and <var>bytesLeft</var> equals 0, then jump to the <i>loop done</i> step below.</li>
- <li>If <var>stream</var> has been closed, then jump to the <i>loop done</i> step below.</li>
- <li>Read data from <var>stream</var> into <var>data</var>:
- <dl class="switch">
- <dt>If <var>maxSize</var> is set:</dt>
- <dd>
- <ol>
- <li>Read up to <var>bytesLeft</var> bytes from <var>stream</var> into <var>data</var>.</li>
- <li>Subtract the number of bytes in <var>data</var> from <var>bytesLeft</var>.</li>
- </ol></dd>
- <dt>Otherwise:</dt>
- <dd>Read all available bytes in <var>stream</var> into <var>data</var>.</dd>
- </dl>
- </li>
- <li>If an error occured while reading from <var>stream</var>, then run the <a href="#sourcebuffer-append-error">append error algorithm</a> and abort this algorithm.</li>
- <li>Run the <a href="#sourcebuffer-coded-frame-eviction">coded frame eviction algorithm</a>.</li>
- <li>
- <p>If the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals true, then run the <a href="#sourcebuffer-append-error">append error algorithm</a> and abort this algorithm.</p>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_19"><span>Note</span></div><p class="">The web application should use <code><a href="#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end">remove()</a></code> to free up space in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p></div>
- </li>
- <li>Add <var>data</var> to the end of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
- <li>Run the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm.</li>
- <li>If the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm in the previous step was aborted, then abort this algorithm.</li>
- <li>Jump to the <i>loop top</i> step above.</li>
- <li><i>Loop Done: </i>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-update">update</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-range-removal" typeof="bibo:Chapter" resource="#sourcebuffer-range-removal" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-range-removal"><span class="secno">3.5.7 </span>Range Removal</h4>
- <p>Follow these steps when a caller needs to initiate a JavaScript visible range removal
- operation that blocks other SourceBuffer updates:</p>
- <ol>
- <li>Let <var>start</var> equal the starting <a href="#presentation-timestamp">presentation timestamp</a> for the removal range.</li>
- <li>Let <var>end</var> equal the end <a href="#presentation-timestamp">presentation timestamp</a> for the removal range.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Return control to the caller and run the rest of the steps asynchronously.</li>
- <li>Run the <a href="#sourcebuffer-coded-frame-removal">coded frame removal algorithm</a> with <var>start</var> and <var>end</var> as the start and end of the removal range.</li>
- <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-update">update</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- </ol>
- </section>
- <section id="sourcebuffer-init-segment-received" typeof="bibo:Chapter" resource="#sourcebuffer-init-segment-received" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-init-segment-received"><span class="secno">3.5.8 </span>Initialization Segment Received</h4>
- <p>The following steps are run when the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> successfully parses a complete <a href="#init-segment">initialization segment</a>:</p>
- <p>Each SourceBuffer object has an internal <dfn id="first-init-segment-received-flag">first initialization segment received flag</dfn> that tracks whether the first <a href="#init-segment">initialization segment</a> has been appended and received by this algorithm. This flag is set to false when the SourceBuffer is created and updated by the algorithm below.</p>
- <ol>
- <li>Update the <code><a href="#widl-MediaSource-duration">duration</a></code> attribute if it currently equals NaN:
- <dl class="switch">
- <dt>If the initialization segment contains a duration:</dt>
- <dd>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the duration in the initialization segment.</dd>
- <dt>Otherwise:</dt>
- <dd>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to positive Infinity.</dd>
- </dl>
- </li>
- <li>If the <a href="#init-segment">initialization segment</a> has no audio, video, or text tracks, then run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> and abort these steps.</li>
- <li>If the <var><a href="#first-init-segment-received-flag">first initialization segment received flag</a></var> is true, then run the following steps:
- <ol>
- <li>Verify the following properties. If any of the checks fail then run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> and abort these steps.
- <ul>
- <li>The number of audio, video, and text tracks match what was in the first <a href="#init-segment">initialization segment</a>.</li>
- <li>The codecs for each track, match what was specified in the first <a href="#init-segment">initialization segment</a>.</li>
- <li>If more than one track for a single type are present (ie 2 audio tracks), then the <a href="#track-id">Track IDs</a> match the ones in the
- first <a href="#init-segment">initialization segment</a>.</li>
- </ul>
- </li>
- <li>Add the appropriate <a href="#track-description">track descriptions</a> from this <a href="#init-segment">initialization segment</a> to each of the
- <a href="#track-buffer">track buffers</a>.</li>
- <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on all track buffers to true.</li>
- </ol>
- </li>
- <li>Let <var>active track flag</var> equal false.</li>
- <li>
- <p>If the <var><a href="#first-init-segment-received-flag">first initialization segment received flag</a></var> is false, then run the following steps:</p>
- <ol>
- <li>If the <a href="#init-segment">initialization segment</a> contains tracks with codecs the user agent does not support, then run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code>
- and abort these steps.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_20"><span>Note</span></div><p class="">User agents may consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not
- specified in the <var>type</var> parameter passed to <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>. <br>
- For example, MediaSource.isTypeSupported('video/webm;codecs="vp8,vorbis"') may return true, but if
- <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> was called with 'video/webm;codecs="vp8"' and a Vorbis track appears in the
- <a href="#init-segment">initialization segment</a>, then the user agent may use this step to trigger a decode error.
- </p></div>
- </li>
- <li>
- <p>For each audio track in the <a href="#init-segment">initialization segment</a>, run following steps:</p>
- <ol>
- <li>Let <var>audio byte stream track ID</var> be the
- <a href="#track-id">Track ID</a> for the current track being processed.</li>
- <li>Let <var>audio language</var> be a BCP 47 language tag for the language
- specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>audio language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a href="#sourcebuffer-default-track-language">default track language algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.audio">"audio"</a></code> and assign the value returned by the
- algorithm to <var>audio language</var>.</li>
- <li>Let <var>audio label</var> be a label specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>audio label</var> equals an empty string, then run the
- <a href="#sourcebuffer-default-track-label">default track label algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.audio">"audio"</a></code> and assign the value returned by the
- algorithm to <var>audio label</var>.</li>
- <li>Let <var>audio kinds</var> be an array of kind strings specified in the
- <a href="#init-segment">initialization segment</a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>audio kinds</var> equals an empty array, then run the
- <a href="#sourcebuffer-default-track-kinds">default track kinds algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>audio byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.audio">"audio"</a></code> and assign the value returned by the
- algorithm to <var>audio kinds</var>.</li>
- <li>For each value in <var>audio kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current audio kind</var> equal the value from <var>audio kinds</var>
- for this iteration of the loop.</li>
- <li>Let <var>new audio track</var> be a new <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object.</li>
- <li>Generate a unique ID and assign it to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-id">id</a></code> property on <var>new audio track</var>.</li>
- <li>Assign <var>audio language</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-language">language</a></code>
- property on <var>new audio track</var>.</li>
- <li>Assign <var>audio label</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-label">label</a></code>
- property on <var>new audio track</var>.</li>
- <li>Assign <var>current audio kind</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-kind">kind</a></code>
- property on <var>new audio track</var>.</li>
- <li>
- <p>
- If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>.<code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotracklist-length">length</a></code> equals 0, then run
- the following steps:
- </p>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled</a></code> property on <var>new audio track</var> to true.</li>
- <li>Set <var>active track flag</var> to true.</li>
- </ol>
- </li>
- <li>Add <var>new audio track</var> to the <code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code> attribute on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object referenced by the
- <code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code> attribute on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Add <var>new audio track</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>
- attribute on the HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a href="#track-buffer">track buffer</a> to store <a href="#coded-frame">coded frames</a> for this track.</li>
- <li>Add the <a href="#track-description">track description</a> for this track to the <a href="#track-buffer">track buffer</a>.</li>
- </ol>
- </li>
- <li>
- <p>For each video track in the <a href="#init-segment">initialization segment</a>, run following steps:</p>
- <ol>
- <li>Let <var>video byte stream track ID</var> be the
- <a href="#track-id">Track ID</a> for the current track being processed.</li>
- <li>Let <var>video language</var> be a BCP 47 language tag for the language
- specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>video language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a href="#sourcebuffer-default-track-language">default track language algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.video">"video"</a></code> and assign the value returned by the
- algorithm to <var>video language</var>.</li>
- <li>Let <var>video label</var> be a label specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>video label</var> equals an empty string, then run the
- <a href="#sourcebuffer-default-track-label">default track label algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.video">"video"</a></code> and assign the value returned by the
- algorithm to <var>video label</var>.</li>
- <li>Let <var>video kinds</var> be an array of kind strings specified in the
- <a href="#init-segment">initialization segment</a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>video kinds</var> equals an empty array, then run the
- <a href="#sourcebuffer-default-track-kinds">default track kinds algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>video byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.video">"video"</a></code> and assign the value returned by the
- algorithm to <var>video kinds</var>.</li>
- <li>For each value in <var>video kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current video kind</var> equal the value from <var>video kinds</var>
- for this iteration of the loop.</li>
- <li>Let <var>new video track</var> be a new <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object.</li>
- <li>Generate a unique ID and assign it to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-id">id</a></code> property on <var>new video track</var>.</li>
- <li>Assign <var>video language</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-language">language</a></code>
- property on <var>new video track</var>.</li>
- <li>Assign <var>video label</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-label">label</a></code>
- property on <var>new video track</var>.</li>
- <li>Assign <var>current video kind</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-kind">kind</a></code>
- property on <var>new video track</var>.</li>
- <li>
- <p>
- If <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code>.<code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotracklist-length">length</a></code> equals 0, then run
- the following steps:
- </p>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected</a></code> property on <var>new video track</var> to true.</li>
- <li>Set <var>active track flag</var> to true.</li>
- </ol>
- </li>
- <li>Add <var>new video track</var> to the <code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code> attribute on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object referenced by the <code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code> attribute
- on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Add <var>new video track</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code> attribute on the
- HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a href="#track-buffer">track buffer</a> to store <a href="#coded-frame">coded frames</a> for this track.</li>
- <li>Add the <a href="#track-description">track description</a> for this track to the <a href="#track-buffer">track buffer</a>.</li>
- </ol>
- </li>
- <li>
- <p>For each text track in the <a href="#init-segment">initialization segment</a>, run following steps:</p>
- <ol>
- <li>Let <var>text byte stream track ID</var> be the
- <a href="#track-id">Track ID</a> for the current track being processed.</li>
- <li>Let <var>text language</var> be a BCP 47 language tag for the language
- specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- language info is present.</li>
- <li>If <var>text language</var> equals an empty string or the 'und' BCP 47 value, then run the
- <a href="#sourcebuffer-default-track-language">default track language algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.text">"text"</a></code> and assign the value returned by the
- algorithm to <var>text language</var>.</li>
- <li>Let <var>text label</var> be a label specified in the <a href="#init-segment">initialization segment</a> for this track or an empty string if no
- label info is present.</li>
- <li>If <var>text label</var> equals an empty string, then run the
- <a href="#sourcebuffer-default-track-label">default track label algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.text">"text"</a></code> and assign the value returned by the
- algorithm to <var>text label</var>.</li>
- <li>Let <var>text kinds</var> be an array of kind strings specified in the
- <a href="#init-segment">initialization segment</a> for this track or an empty array if no kind information
- is provided.</li>
- <li>If <var>text kinds</var> equals an empty array, then run the
- <a href="#sourcebuffer-default-track-kinds">default track kinds algorithm</a> with <var>byteStreamTrackID</var>
- set to <var>text byte stream track ID</var> and <var>type</var> set to
- <code><a href="#idl-def-TrackDefaultType.text">"text"</a></code> and assign the value returned by the
- algorithm to <var>text kinds</var>.</li>
- <li>For each value in <var>text kinds</var>, run the following steps:
- <ol>
- <li>Let <var>current text kind</var> equal the value from <var>text kinds</var>
- for this iteration of the loop.</li>
- <li>
- Let <var>new text track</var> be a new <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object.</li>
- <li>Generate a unique ID and assign it to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-id">id</a></code> property on <var>new text track</var>.</li>
- <li>Assign <var>text language</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-language">language</a></code>
- property on <var>new text track</var>.</li>
- <li>Assign <var>text label</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-label">label</a></code>
- property on <var>new text track</var>.</li>
- <li>Assign <var>current text kind</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-kind">kind</a></code>
- property on <var>new text track</var>.</li>
- <li>Populate the remaining properties on <var>new text track</var> with the
- appropriate information from the <a href="#init-segment">initialization segment</a>.
- </li><li>
- If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a></code> property on <var>new text track</var> equals <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a></code> or
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a></code>, then set <var>active track flag</var> to true.
- </li>
- <li>Add <var>new text track</var> to the <code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code> attribute on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at <code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code> attribute
- on this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
- <li>Add <var>new text track</var> to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute on the HTMLMediaElement.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to fire a <a href="http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">trusted event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onaddtrack">addtrack</a></code>, that does not bubble and is not cancelable, and that uses the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#trackevent">TrackEvent</a></code> interface, at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute on the
- HTMLMediaElement.</li>
- </ol>
- </li>
- <li>Create a new <a href="#track-buffer">track buffer</a> to store <a href="#coded-frame">coded frames</a> for this track.</li>
- <li>Add the <a href="#track-description">track description</a> for this track to the <a href="#track-buffer">track buffer</a>.</li>
- </ol>
- </li>
- <li>If <var>active track flag</var> equals true, then run the following steps:
- <ol>
- <li>Add this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code></li>
- </ol>
- </li>
- <li>Set <var><a href="#first-init-segment-received-flag">first initialization segment received flag</a></var> to true.</li>
- </ol>
- </li>
- <li>
- <p>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>, then run the following steps:</p>
- <ol>
- <li>
- If one or more objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> have <var><a href="#first-init-segment-received-flag">first initialization segment received flag</a></var> set to false, then abort
- these steps.</li>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-loadedmetadata">loadedmetadata</a></code> at the media element.</li>
- </ol>
- </li>
- <li>
- If the <var>active track flag</var> equals true and the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is greater than
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>, then set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>.
- </li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-language" typeof="bibo:Chapter" resource="#sourcebuffer-default-track-language" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-default-track-language"><span class="secno">3.5.9 </span>Default track language</h4>
- <p>The following steps are run when the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> needs
- to determine what the default language for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a>.</p>
- <ol>
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <code><a href="#widl-TrackDefault-language">language</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- an empty string, then return the value of the
- <code><a href="#widl-TrackDefault-language">language</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an empty string to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-label" typeof="bibo:Chapter" resource="#sourcebuffer-default-track-label" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-default-track-label"><span class="secno">3.5.10 </span>Default track label</h4>
- <p>The following steps are run when the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> needs
- to determine what the default label for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a>.</p>
- <ol>
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <code><a href="#widl-TrackDefault-label">label</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- an empty string, then return the value of the
- <code><a href="#widl-TrackDefault-label">label</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an empty string to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-default-track-kinds" typeof="bibo:Chapter" resource="#sourcebuffer-default-track-kinds" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-default-track-kinds"><span class="secno">3.5.11 </span>Default track kinds</h4>
- <p>The following steps are run when the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> needs
- to determine what the default kinds for a new track should be. This algorithm is initialized
- with <var>byteStreamTrackID</var> and <var>type</var> parameters when invoked by the
- <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a>.</p>
- <ol>
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- <var>byteStreamTrackID</var>, then return the value of the
- <code><a href="#widl-TrackDefault-kinds">kinds</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>If <code><a href="#widl-SourceBuffer-trackDefaults">trackDefaults</a></code> contains a <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object with a
- <code><a href="#widl-TrackDefault-type">type</a></code> attribute equal to <var>type</var> and a
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute equal to
- an empty string, then return the value of the
- <code><a href="#widl-TrackDefault-kinds">kinds</a></code> attribute on this matching object and abort these
- steps.</li>
-
- <li>Return an array with a single empty string element in it to the caller.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-processing" typeof="bibo:Chapter" resource="#sourcebuffer-coded-frame-processing" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-coded-frame-processing"><span class="secno">3.5.12 </span>Coded Frame Processing</h4>
- <p>When complete <a href="#coded-frame">coded frames</a> have been parsed by the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> then the following steps are run:</p>
- <ol>
- <li>
- <p>For each <a href="#coded-frame">coded frame</a> in the <a href="#media-segment">media segment</a> run the following steps:</p>
- <ol>
- <li><i>Loop Top: </i><dl class="switch">
- <dt>If <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> equals true:</dt>
- <dd>
- <ol>
- <li>Let <var>presentation timestamp</var> equal 0.</li>
- <li>Let <var>decode timestamp</var> equal 0.</li>
- </ol>
- </dd>
- <dt>Otherwise:</dt>
- <dd>
- <ol>
- <li>Let <var>presentation timestamp</var> be a double precision floating point representation of the coded frame's <a href="#presentation-timestamp">presentation timestamp</a> in seconds.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_21"><span>Note</span></div><p class="">Special processing may be needed to determine the presentation and decode timestamps for timed text frames since this information may not be explicitly
- present in the underlying format or may be dependent on the order of the frames. Some metadata text tracks, like MPEG2-TS PSI data, may only have implied timestamps.
- Format specific rules for these situations should be in the <a href="#byte-stream-format-specs">byte stream format specifications</a> or in separate extension specifications.</p></div>
- </li>
- <li>Let <var>decode timestamp</var> be a double precision floating point representation of the coded frame's decode timestamp in seconds.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_22"><span>Note</span></div><p class="">Implementations don't have to internally store timestamps in a double precision floating point representation. This
- representation is used here because it is the represention for timestamps in the HTML spec. The intention here is to make the
- behavior clear without adding unnecessary complexity to the algorithm to deal with the fact that adding a timestampOffset may
- cause a timestamp rollover in the underlying timestamp representation used by the byte stream format. Implementations can use any
- internal timestamp representation they wish, but the addition of timestampOffset should behave in a similar manner to what would happen
- if a double precision floating point representation was used.
- </p></div>
- </li>
- </ol>
- </dd>
- </dl>
- </li>
- <li>Let <var>frame duration</var> be a double precision floating point representation of the <a href="#coded-frame-duration">coded frame's duration</a> in seconds.</li>
- <li>If <code><a href="#widl-SourceBuffer-mode">mode</a></code> equals <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code> and <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var> is set, then run the following steps:
- <ol>
- <li>Set <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> equal to <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var> - <var>presentation timestamp</var>.</li>
- <li>Set <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var> equal to <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var>.</li>
- <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on all <a href="#track-buffer">track buffers</a> to true.</li>
- <li>Unset <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var>.</li>
- </ol>
- </li>
- <li>
- <p>If <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> is not 0, then run the following steps:</p>
- <ol>
- <li>Add <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> to the <var>presentation timestamp</var>.</li>
- <li>Add <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> to the <var>decode timestamp</var>.</li>
- </ol>
- </li>
- <li>Let <var>track buffer</var> equal the <a href="#track-buffer">track buffer</a> that the coded frame will be added to.</li>
- <li>
- <dl class="switch">
- <dt>If <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> is set and <var>decode timestamp</var> is less than
- <var><a href="#last-decode-timestamp">last decode timestamp</a></var>:</dt>
- <dd>OR</dd>
- <dt>If <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> is set and the difference between <var>decode timestamp</var> and <var><a href="#last-decode-timestamp">last decode timestamp</a></var>
- is greater than 2 times <var><a href="#last-frame-duration">last frame duration</a></var>:</dt>
- <dd>
- <ol>
- <li>
- <dl class="switch">
- <dt>If <code><a href="#widl-SourceBuffer-mode">mode</a></code> equals <code><a href="#idl-def-AppendMode.segments">"segments"</a></code>:</dt>
- <dd>Set <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var> to <var>presentation timestamp</var>.</dd>
- <dt>If <code><a href="#widl-SourceBuffer-mode">mode</a></code> equals <code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code>:</dt>
- <dd>Set <var><a href="#sourcebuffer-group-start-timestamp">group start timestamp</a></var> equal to the <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var>.</dd>
- </dl>
- </li>
- <li>Unset the <var><a href="#last-decode-timestamp">last decode timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Unset the <var><a href="#last-frame-duration">last frame duration</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Unset the <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
- <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on all <a href="#track-buffer">track buffers</a> to true.</li>
- <li>Jump to the <i>Loop Top</i> step above to restart processing of the current <a href="#coded-frame">coded frame</a>.</li>
- </ol>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Continue.</dd>
- </dl>
- </li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>If <var>presentation timestamp</var> is less than <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code>, then set the <var><a href="#need-RAP-flag">need random access point flag</a></var> to true, drop the
- coded frame, and jump to the top of the loop to start processing the next coded frame.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_23"><span>Note</span></div><p class="">Some implementations may choose to collect some of these coded frames that are outside the <a href="#append-window">append window</a> and use them
- to generate a splice at the first coded frame that has a <a href="#presentation-timestamp">presentation timestamp</a> greater than or equal to <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> even if
- that frame is not a <a href="#random-access-point">random access point</a>. Supporting this requires multiple decoders or faster than real-time decoding so for now
- this behavior will not be a normative requirement.
- </p></div>
- </li>
- <li>If <var>frame end timestamp</var> is greater than <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code>, then set the <var><a href="#need-RAP-flag">need random access point flag</a></var> to true, drop the
- coded frame, and jump to the top of the loop to start processing the next coded frame.
- </li><li>If the <var>decode timestamp</var> is less than the <a href="#presentation-start-time">presentation start time</a>,
- then run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code>, and abort these steps.</li>
- <li>If the <var><a href="#need-RAP-flag">need random access point flag</a></var> on <var>track buffer</var> equals true, then run the following steps:
- <ol>
- <li>If the coded frame is not a <a href="#random-access-point">random access point</a>, then drop the coded frame and jump to the top of the loop to start
- processing the next coded frame.</li>
- <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on <var>track buffer</var> to false.</li>
- </ol>
- </li>
- <li>Let <var>spliced audio frame</var> be an unset variable for holding audio splice information</li>
- <li>Let <var>spliced timed text frame</var> be an unset variable for holding timed text splice information</li>
- <li>If <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> is unset and <var>presentation timestamp</var> falls within the <a href="#presentation-interval">presentation interval</a> of a <a href="#coded-frame">coded frame</a> in <var>track buffer</var>,then run the following steps:
- <ol>
- <li>Let <var>overlapped frame</var> be the <a href="#coded-frame">coded frame</a> in <var>track buffer</var> that matches the condition above.</li>
- <li>
- <dl class="switch">
- <dt>If <var>track buffer</var> contains audio <a href="#coded-frame">coded frames</a>:</dt>
- <dd>Run the <a href="#sourcebuffer-audio-splice-frame-algorithm">audio splice frame algorithm</a> and if a splice frame is returned, assign it to <var>spliced audio frame</var>.</dd>
- <dt>If <var>track buffer</var> contains video <a href="#coded-frame">coded frames</a>:</dt>
- <dd>
- <ol>
- <li>Let <var>overlapped frame presentation timestamp</var> equal the <a href="#presentation-timestamp">presentation timestamp</a> of <var>overlapped frame</var>.</li>
- <li>Let <var>remove window timestamp</var> equal <var>overlapped frame presentation timestamp</var> plus 1 microsecond.</li>
- <li>If the <var>presentation timestamp</var> is less than the <var>remove window timestamp</var>, then remove <var>overlapped frame</var> and any
- <a href="#coded-frame">coded frames</a> that depend on it from <var>track buffer</var>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_24"><span>Note</span></div><p class="">
- This is to compensate for minor errors in frame timestamp computations that can appear when converting back and forth between double precision
- floating point numbers and rationals. This tolerance allows a frame to replace an existing one as long as it is within 1 microsecond of the existing
- frame's start time. Frames that come slightly before an existing frame are handled by the removal step below.
- </p></div>
- </li>
- </ol>
- </dd>
- <dt>If <var>track buffer</var> contains timed text <a href="#coded-frame">coded frames</a>:</dt>
- <dd>Run the <a href="#sourcebuffer-text-splice-frame-algorithm">text splice frame algorithm</a> and if a splice frame is returned, assign it to <var>spliced timed text frame</var>.</dd>
- </dl>
- </li>
- </ol>
- </li>
- <li>Remove existing coded frames in <var>track buffer</var>:
- <dl class="switch">
- <dt>If <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var> is not set:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> from <var>track buffer</var> that have a <a href="#presentation-timestamp">presentation timestamp</a> greater than or equal to
- <var>presentation timestamp</var> and less than <var>frame end timestamp</var>.</dd>
- <dt>If <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var> is set and less than or equal to <var>presentation timestamp</var>:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> from <var>track buffer</var> that have a <a href="#presentation-timestamp">presentation timestamp</a> greater than
- or equal to <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> and less than <var>frame end timestamp</var></dd>
- </dl>
- </li>
- <li>Remove decoding dependencies of the coded frames removed in the previous step:
- <dl class="switch">
- <dt>If detailed information about decoding dependencies is available:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
- the previous step.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_25"><span>Note</span></div><p class="">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
- should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.
- </p></div>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> between the coded frames removed in the previous step and the next
- <a href="#random-access-point">random access point</a> after those removed frames.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_26"><span>Note</span></div><p class="">Removing all <a href="#coded-frame">coded frames</a> until the next <a href="#random-access-point">random access point</a> is a conservative
- estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
- depended on the frames that were removed.
- </p></div>
- </dd>
- </dl></li>
- <li>
- <dl class="switch">
- <dt>If <var>spliced audio frame</var> is set:</dt>
- <dd>Add <var>spliced audio frame</var> to the <var>track buffer</var>.</dd>
- <dt>If <var>spliced timed text frame</var> is set:</dt>
- <dd>Add <var>spliced timed text frame</var> to the <var>track buffer</var>.</dd>
- <dt>Otherwise:</dt>
- <dd>Add the <a href="#coded-frame">coded frame</a> with the <var>presentation timestamp</var>, <var>decode timestamp</var>, and <var>frame duration</var> to the
- <var>track buffer</var>.</dd>
- </dl>
- </li><li>Set <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> to <var>decode timestamp</var>.</li>
- <li>Set <var><a href="#last-frame-duration">last frame duration</a></var> for <var>track buffer</var> to <var>frame duration</var>.</li>
- <li>If <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var> is unset or <var>frame end timestamp</var> is greater
- than <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var>, then set <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var>
- to <var>frame end timestamp</var>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_27"><span>Note</span></div><p class="">The greater than check is needed because bidirectional prediction between coded frames can cause
- <var>presentation timestamp</var> to not be monotonically increasing eventhough the decode timestamps are monotonically increasing.</p></div>
- </li>
- <li>If <var>frame end timestamp</var> is greater than <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var>,
- then set <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var> equal to <var>frame end timestamp</var>.</li>
- <li>If <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> equals true, then set
- <code><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> equal to <var>frame end timestamp</var>.</li>
- </ol>
- </li>
- <li>
- <p>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code> and the new <a href="#coded-frame">coded frames</a> cause <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> to have a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> for the current playback position, then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>.</li>
- <li>If this is the first transition to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code>, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-loadeddata">loadeddata</a></code> at the media element.</li>
- </ol>
- </li>
- <li>
- <p>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_current_data">HAVE_CURRENT_DATA</a></code> and the new <a href="#coded-frame">coded frames</a> cause <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> to have a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> that includes the current playback position and some time beyond the current playback position, then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-canplay">canplay</a></code> at the media element.</li>
- </ol>
- </li>
- <li>
- <p>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code> and the new <a href="#coded-frame">coded frames</a> cause <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> to have a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> that includes the current playback position and <a href="#enough-data">enough data to ensure uninterrupted playback</a>, then run the following steps:</p>
- <ol>
- <li>Set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_enough_data">HAVE_ENOUGH_DATA</a></code>.</li>
- <li>
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-canplaythrough">canplaythrough</a></code> at the media element.</li>
- </ol>
- </li>
- <li>If the <a href="#media-segment">media segment</a> contains data beyond the current <code><a href="#widl-MediaSource-duration">duration</a></code>, then run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the maximum of the current duration and the <var><a href="#sourcebuffer-group-end-timestamp">group end timestamp</a></var>.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-removal" typeof="bibo:Chapter" resource="#sourcebuffer-coded-frame-removal" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-coded-frame-removal"><span class="secno">3.5.13 </span>Coded Frame Removal Algorithm</h4>
- <p>Follow these steps when <a href="#coded-frame">coded frames</a> for a specific time range need to be removed from the SourceBuffer:</p>
- <ol>
- <li>Let <var>start</var> be the starting <a href="#presentation-timestamp">presentation timestamp</a> for the removal range.</li>
- <li>Let <var>end</var> be the end <a href="#presentation-timestamp">presentation timestamp</a> for the removal range. </li>
- <li><p>For each <a href="#track-buffer">track buffer</a> in this source buffer, run the following steps:</p>
- <ol>
- <li>Let <var>remove end timestamp</var> be the current value of <code><a href="#widl-MediaSource-duration">duration</a></code></li>
- <li>
- <p>If this <a href="#track-buffer">track buffer</a> has a <a href="#random-access-point">random access point</a> timestamp that is greater than or equal to
- <var>end</var>, then update <var>remove end timestamp</var> to that random access point timestamp.</p>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_28"><span>Note</span></div><p class="">Random access point timestamps can be different across tracks because the dependencies between <a href="#coded-frame">coded frames</a> within a
- track are usually different than the dependencies in another track.</p></div>
- </li>
- <li>Remove all media data, from this <a href="#track-buffer">track buffer</a>, that contain starting timestamps greater than or equal to
- <var>start</var> and less than the <var>remove end timestamp</var>.</li>
- <li>Remove decoding dependencies of the coded frames removed in the previous step:
- <dl class="switch">
- <dt>If detailed information about decoding dependencies is available:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> from this <a href="#track-buffer">track buffer</a> that have decoding dependencies on the coded frames removed in
- the previous step.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_29"><span>Note</span></div><p class="">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
- should be removed from this <a href="#track-buffer">track buffer</a>.
- </p></div>
- </dd>
- <dt>Otherwise:</dt>
- <dd>Remove all <a href="#coded-frame">coded frames</a> between the coded frames removed in the previous step and the next
- <a href="#random-access-point">random access point</a> after those removed frames.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_30"><span>Note</span></div><p class="">Removing all <a href="#coded-frame">coded frames</a> until the next <a href="#random-access-point">random access point</a> is a conservative
- estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
- depended on the frames that were removed.
- </p></div>
- </dd>
- </dl></li>
- <li>
- <p>If this object is in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#current-playback-position">current playback position</a> is greater than or equal to
- <var>start</var> and less than the <var>remove end timestamp</var>, and <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> is greater than
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code>, then set the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_metadata">HAVE_METADATA</a></code> and stall playback.</p>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_31"><span>Note</span></div><p class="">This transition occurs because media data for the current position has been removed. Playback cannot progress until media for the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#current-playback-position">current playback position</a> is appended or the <a href="#active-source-buffer-changes">selected/enabled tracks change</a>.</p></div>
- </li>
- </ol>
- </li>
- <li>If <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals true and this object is ready to accept more bytes, then set
- the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> to false.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-coded-frame-eviction" typeof="bibo:Chapter" resource="#sourcebuffer-coded-frame-eviction" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-coded-frame-eviction"><span class="secno">3.5.14 </span>Coded Frame Eviction Algorithm</h4>
- <p>This algorithm is run to free up space in this source buffer when new data is appended.</p>
- <ol>
- <li>Let <var>new data</var> equal the data that is about to be appended to this SourceBuffer.</li>
- <li>If the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals false, then abort these steps.</li>
- <li>Let <var>removal ranges</var> equal a list of presentation time ranges that can be evicted from the presentation to make room for the
- <var>new data</var>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_32"><span>Note</span></div><p class="">Implementations may use different methods for selecting <var>removal ranges</var> so web applications should not depend on a
- specific behavior. The web application can use the <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> attribute to observe whether portions of the buffered data have been evicted.
- </p></div>
- </li>
- <li>For each range in <var>removal ranges</var>, run the <a href="#sourcebuffer-coded-frame-removal">coded frame removal algorithm</a> with <var>start</var> and <var>end</var> equal to
- the removal range start and end timestamp respectively.</li>
- </ol>
- </section>
-
- <section id="sourcebuffer-audio-splice-frame-algorithm" typeof="bibo:Chapter" resource="#sourcebuffer-audio-splice-frame-algorithm" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-audio-splice-frame-algorithm"><span class="secno">3.5.15 </span>Audio Splice Frame Algorithm</h4>
- <p>Follow these steps when the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> needs to generate a splice frame for two overlapping audio
- <a href="#coded-frame">coded frames</a>:</p>
- <ol>
- <li>Let <var>track buffer</var> be the <a href="#track-buffer">track buffer</a> that will contain the splice.</li>
- <li>Let <var>new coded frame</var> be the new <a href="#coded-frame">coded frame</a>, that is being added to <var>track buffer</var>, which triggered the need for a splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a href="#presentation-timestamp">presentation timestamp</a> for <var>new coded frame</var></li>
- <li>Let <var>decode timestamp</var> be the decode timestamp for <var>new coded frame</var>.</li>
- <li>Let <var>frame duration</var> be the <a href="#coded-frame-duration">coded frame duration</a> of <var>new coded frame</var>.</li>
- <li>Let <var>overlapped frame</var> be the <a href="#coded-frame">coded frame</a> in <var>track buffer</var> with a <a href="#presentation-interval">presentation interval</a> that contains <var>presentation timestamp</var>.
- </li>
- <li>Update <var>presentation timestamp</var> and <var>decode timestamp</var> to the nearest audio sample timestamp based on sample rate of the
- audio in <var>overlapped frame</var>. If a timestamp is equidistant from both audio sample timestamps, then use the higher timestamp. (eg.
- floor(x * sample_rate + 0.5) / sample_rate).
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_33"><span>Note</span></div><div class="">
- <p>For example, given the following values:</p>
- <ul>
- <li>The <a href="#presentation-timestamp">presentation timestamp</a> of <var>overlapped frame</var> equals 10.</li>
- <li>The sample rate of <var>overlapped frame</var> equals 8000 Hz</li>
- <li><var>presentation timestamp</var> equals 10.01255</li>
- <li><var>decode timestamp</var> equals 10.01255</li>
- </ul>
- <p><var>presentation timestamp</var> and <var>decode timestamp</var> are updated to 10.0125 since 10.01255 is closer to
- 10 + 100/8000 (10.0125) than 10 + 101/8000 (10.012625)</p>
- </div></div>
- </li>
- <li>If the user agent does not support crossfading then run the following steps:
- <ol>
- <li>Remove <var>overlapped frame</var> from <var>track buffer</var>.</li>
- <li>Add a silence frame to <var>track buffer</var> with the following properties:
- <ul>
- <li>The <a href="#presentation-timestamp">presentation timestamp</a> set to the <var>overlapped frame</var> <a href="#presentation-timestamp">presentation timestamp</a>.</li>
- <li>The <a href="#decode-timestamp">decode timestamp</a> set to the <var>overlapped frame</var> <a href="#decode-timestamp">decode timestamp</a>.</li>
- <li>The <a href="#coded-frame-duration">coded frame duration</a> set to difference between <var>presentation timestamp</var> and the <var>overlapped frame</var> <a href="#presentation-timestamp">presentation timestamp</a>.</li>
- </ul>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_34"><span>Note</span></div><p class="">
- Some implementations may apply fades to/from silence to coded frames on either side of the inserted silence to make the transition less
- jarring.
- </p></div>
- </li>
- <li>Return to caller without providing a splice frame.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_35"><span>Note</span></div><p class="">
- This is intended to allow <var>new coded frame</var> to be added to the <var>track buffer</var> as if
- <var>overlapped frame</var> had not been in the <var>track buffer</var> to begin with.
- </p></div>
- </li>
- </ol>
- </li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>Let <var>splice end timestamp</var> equal the sum of <var>presentation timestamp</var> and the splice duration of 5 milliseconds.</li>
- <li>Let <var>fade out coded frames</var> equal <var>overlapped frame</var> as well as any additional frames in <var>track buffer</var> that
- have a <a href="#presentation-timestamp">presentation timestamp</a> greater than <var>presentation timestamp</var> and less than <var>splice end timestamp</var>.</li>
- <li>Remove all the frames included in <var>fade out coded frames</var> from <var>track buffer</var>.
- </li><li>Return a splice frame with the following properties:
- <ul>
- <li>The <a href="#presentation-timestamp">presentation timestamp</a> set to the <var>overlapped frame</var> <a href="#presentation-timestamp">presentation timestamp</a>.</li>
- <li>The <a href="#decode-timestamp">decode timestamp</a> set to the <var>overlapped frame</var> <a href="#decode-timestamp">decode timestamp</a>.</li>
- <li>The <a href="#coded-frame-duration">coded frame duration</a> set to difference between <var>frame end timestamp</var> and the <var>overlapped frame</var> <a href="#presentation-timestamp">presentation timestamp</a>.</li>
- <li>The fade out coded frames equals <var>fade-out coded frames</var>.</li>
- <li>The fade in coded frame equal <var>new coded frame</var>.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_36"><span>Note</span></div><p class="">If the <var>new coded frame</var> is less than 5 milliseconds in duration, then coded frames that are appended after the
- <var>new coded frame</var> will be needed to properly render the splice.</p></div>
- </li>
- <li>The splice timestamp equals <var>presentation timestamp</var>.</li>
- </ul>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_37"><span>Note</span></div><p class="">See the <a href="#sourcebuffer-audio-splice-rendering-algorithm">audio splice rendering algorithm</a> for details on how this splice frame is rendered.</p></div>
- </li>
- </ol>
- </section>
- <section id="sourcebuffer-audio-splice-rendering-algorithm" typeof="bibo:Chapter" resource="#sourcebuffer-audio-splice-rendering-algorithm" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-audio-splice-rendering-algorithm"><span class="secno">3.5.16 </span>Audio Splice Rendering Algorithm</h4>
- <p>The following steps are run when a spliced frame, generated by the <a href="#sourcebuffer-audio-splice-frame-algorithm">audio splice frame algorithm</a>, needs to be rendered by the
- media element:</p>
- <ol>
- <li>Let <var>fade out coded frames</var> be the <a href="#coded-frame">coded frames</a> that are faded out during the splice.</li>
- <li>Let <var>fade in coded frames</var> be the <a href="#coded-frame">coded frames</a> that are faded in during the splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a href="#presentation-timestamp">presentation timestamp</a> of the first coded frame in <var>fade out coded frames</var>.</li>
- <li>Let <var>end timestamp</var> be the sum of the <a href="#presentation-timestamp">presentation timestamp</a> and the <a href="#coded-frame-duration">coded frame duration</a> of the last frame in <var>fade in coded frames</var>.</li>
- <li>Let <var>splice timestamp</var> be the <a href="#presentation-timestamp">presentation timestamp</a> where the splice starts. This corresponds with the <a href="#presentation-timestamp">presentation timestamp</a> of the first frame in
- <var>fade in coded frames</var>.</li>
- <li>Let <var>splice end timestamp</var> equal <var>splice timestamp</var> plus five milliseconds.</li>
- <li>Let <var>fade out samples</var> be the samples generated by decoding <var>fade out coded frames</var>.</li>
- <li>Trim <var>fade out samples</var> so that it only contains samples between <var>presentation timestamp</var> and <var>splice end timestamp</var>.</li>
- <li>Let <var>fade in samples</var> be the samples generated by decoding <var>fade in coded frames</var>.</li>
- <li>If <var>fade out samples</var> and <var>fade in samples</var> do not have a common sample rate and channel layout, then convert
- <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
- <li>Let <var>output samples</var> be a buffer to hold the output samples.</li>
- <li>Apply a linear gain fade out with a starting gain of 1 and an ending gain of 0 to the samples between
- <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
- <li>Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between <var>splice timestamp</var> and
- <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
- <li>Copy samples between <var>presentation timestamp</var> to <var>splice timestamp</var> from <var>fade out samples</var> into <var>output samples</var>.</li>
- <li>For each sample between <var>splice timestamp</var> and <var>splice end timestamp</var>, compute the sum of a sample from <var>fade out samples</var> and the
- corresponding sample in <var>fade in samples</var> and store the result in <var>output samples</var>.</li>
- <li>Copy samples between <var>splice end timestamp</var> to <var>end timestamp</var> from <var>fade in samples</var> into <var>output samples</var>.</li>
- <li>Render <var>output samples</var>.</li>
- </ol>
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_38"><span>Note</span></div><div class="">
- <p>Here is a graphical representation of this algorithm.</p>
- <img src="audio_splice.png" alt="Audio splice diagram">
- </div></div>
- </section>
- <section id="sourcebuffer-text-splice-frame-algorithm" typeof="bibo:Chapter" resource="#sourcebuffer-text-splice-frame-algorithm" rel="bibo:Chapter">
- <h4 aria-level="3" role="heading" id="h4_sourcebuffer-text-splice-frame-algorithm"><span class="secno">3.5.17 </span>Text Splice Frame Algorithm</h4>
- <p>Follow these steps when the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> needs to generate a splice frame for two overlapping timed text
- <a href="#coded-frame">coded frames</a>:</p>
- <ol>
- <li>Let <var>track buffer</var> be the <a href="#track-buffer">track buffer</a> that will contain the splice.</li>
- <li>Let <var>new coded frame</var> be the new <a href="#coded-frame">coded frame</a>, that is being added to <var>track buffer</var>, which triggered the need for a splice.</li>
- <li>Let <var>presentation timestamp</var> be the <a href="#presentation-timestamp">presentation timestamp</a> for <var>new coded frame</var></li>
- <li>Let <var>decode timestamp</var> be the decode timestamp for <var>new coded frame</var>.</li>
- <li>Let <var>frame duration</var> be the <a href="#coded-frame-duration">coded frame duration</a> of <var>new coded frame</var>.</li>
- <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
- <li>Let <var>first overlapped frame</var> be the <a href="#coded-frame">coded frame</a> in <var>track buffer</var> with a <a href="#presentation-interval">presentation interval</a> that contains <var>presentation timestamp</var>.
- </li>
- <li>Let <var>overlapped presentation timestamp</var> be the <a href="#presentation-timestamp">presentation timestamp</a> of the <var>first overlapped frame</var>.</li>
- <li>Let <var>overlapped frames</var> equal <var>first overlapped frame</var> as well as any additional frames in <var>track buffer</var> that
- have a <a href="#presentation-timestamp">presentation timestamp</a> greater than <var>presentation timestamp</var> and less than <var>frame end timestamp</var>.</li>
- <li>Remove all the frames included in <var>overlapped frames</var> from <var>track buffer</var>.
- </li><li>Update the <a href="#coded-frame-duration">coded frame duration</a> of the <var>first overlapped frame</var> to <var>presentation timestamp</var> - <var>overlapped presentation timestamp</var>.</li>
- <li>Add <var>first overlapped frame</var> to the <var>track buffer</var>.
- </li><li>Return to caller without providing a splice frame.
- <div class="note"><div class="note-title" aria-level="4" role="heading" id="h_note_39"><span>Note</span></div><p class="">This is intended to allow <var>new coded frame</var> to be added to the <var>track buffer</var> as if
- it hadn't overlapped any frames in <var>track buffer</var> to begin with.</p></div>
- </li>
- </ol>
- </section>
- </section>
- </section>
-
- <section id="sourcebufferlist" typeof="bibo:Chapter" resource="#sourcebufferlist" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_sourcebufferlist"><span class="secno">4. </span>SourceBufferList Object</h2>
- <p>SourceBufferList is a simple container object for <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects. It provides read-only array access and fires events when the list is modified.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-SourceBufferList">interface <span class="idlInterfaceID">SourceBufferList</span> : <span class="idlSuperclass">EventTarget</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">unsigned long</span> <span class="idlAttrName"><a href="#widl-SourceBufferList-length">length</a></span>;</span>
-<span class="idlMethod"> <span class="idlMethType">getter</span> <span class="idlMethName"><a href="#widl-SourceBufferList-SourceBuffer-getter-unsigned-long-index">SourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType">unsigned long</span> <span class="idlParamName">index</span></span>);</span>
-};</span></pre><section id="attributes-2"><h3 aria-level="2" role="heading" id="h3_attributes-2"><span class="secno">4.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBufferList-length"><code>length</code> of type <span class="idlAttrType">unsigned long</span>, readonly </dt><dd>
- <p>Indicates the number of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in the list.</p>
- </dd></dl></section><section id="methods-2"><h3 aria-level="2" role="heading" id="h3_methods-2"><span class="secno">4.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBufferList-SourceBuffer-getter-unsigned-long-index"><code>SourceBuffer</code></dt><dd>
- <p>Allows the SourceBuffer objects in the list to be accessed with an array operator (i.e. []).</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">index</td><td class="prmType"><code>unsigned long</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>getter</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>index</var> is greater than or equal to the <code><a href="#widl-SourceBufferList-length">length</a></code> attribute then return undefined and abort these steps.</li>
- <li>Return the <var>index</var>'th <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object in the list.</li>
- </ol></dd></dl></section>
-
- <section id="sourcebufferlist-events" typeof="bibo:Chapter" resource="#sourcebufferlist-events" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_sourcebufferlist-events"><span class="secno">4.3 </span>Event Summary</h3>
- <table class="old-table">
- <thead>
- <tr>
- <th>Event name</th>
- <th>Interface</th>
- <th>Dispatched when...</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><dfn id="dom-evt-addsourcebuffer"><code>addsourcebuffer</code></dfn></td>
- <td><code>Event</code></td>
- <td>When a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is added to the list.</td>
- </tr>
- <tr>
- <td><dfn id="dom-evt-removesourcebuffer"><code>removesourcebuffer</code></dfn></td>
- <td><code>Event</code></td>
- <td>When a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is removed from the list.</td>
- </tr>
- </tbody>
- </table>
- </section>
- </section>
-
- <section id="videoplaybackquality" typeof="bibo:Chapter" resource="#videoplaybackquality" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_videoplaybackquality"><span class="secno">5. </span>VideoPlaybackQuality Object</h2>
- <pre class="idl"><span class="idlInterface" id="idl-def-VideoPlaybackQuality">interface <span class="idlInterfaceID">VideoPlaybackQuality</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">DOMHighResTimeStamp</span> <span class="idlAttrName"><a href="#widl-VideoPlaybackQuality-creationTime">creationTime</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">unsigned long</span> <span class="idlAttrName"><a href="#widl-VideoPlaybackQuality-totalVideoFrames">totalVideoFrames</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">unsigned long</span> <span class="idlAttrName"><a href="#widl-VideoPlaybackQuality-droppedVideoFrames">droppedVideoFrames</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">unsigned long</span> <span class="idlAttrName"><a href="#widl-VideoPlaybackQuality-corruptedVideoFrames">corruptedVideoFrames</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">double</span> <span class="idlAttrName"><a href="#widl-VideoPlaybackQuality-totalFrameDelay">totalFrameDelay</a></span>;</span>
-};</span></pre><section id="attributes-3"><h3 aria-level="2" role="heading" id="h3_attributes-3"><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-VideoPlaybackQuality-corruptedVideoFrames"><code>corruptedVideoFrames</code> of type <span class="idlAttrType">unsigned long</span>, readonly </dt><dd>
- <p>The total number of corrupted frames that have been detected.</p>
- </dd><dt id="widl-VideoPlaybackQuality-creationTime"><code>creationTime</code> of type <span class="idlAttrType">DOMHighResTimeStamp</span>, readonly </dt><dd>
- <p>The timestamp returned by <a href="http://www.w3.org/TR/hr-time/#dom-performance-now">Performance.now()</a> when this object was created.</p>
- </dd><dt id="widl-VideoPlaybackQuality-droppedVideoFrames"><code>droppedVideoFrames</code> of type <span class="idlAttrType">unsigned long</span>, readonly </dt><dd>
- <p>The total number of frames dropped predecode or dropped because the frame missed
- its display deadline.</p>
- </dd><dt id="widl-VideoPlaybackQuality-totalFrameDelay"><code>totalFrameDelay</code> of type <span class="idlAttrType">double</span>, readonly </dt><dd>
- <p>The sum of all <a href="#displayed-frame-delay">displayed frame delays</a> for all displayed frames. (i.e., Frames included in the <code><a href="#widl-VideoPlaybackQuality-totalVideoFrames">totalVideoFrames</a></code> count, but not in the <code><a href="#widl-VideoPlaybackQuality-droppedVideoFrames">droppedVideoFrames</a></code>
- count.</p>
- </dd><dt id="widl-VideoPlaybackQuality-totalVideoFrames"><code>totalVideoFrames</code> of type <span class="idlAttrType">unsigned long</span>, readonly </dt><dd>
- <p>The total number of frames that would have been displayed if no frames are dropped.</p>
- </dd></dl></section>
- </section>
-
- <section id="trackdefault" typeof="bibo:Chapter" resource="#trackdefault" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_trackdefault"><span class="secno">6. </span>TrackDefault Object</h2>
- <p>The TrackDefault object is used to provide kind, label, and language information for tracks that do not
- contain this information in the <a href="#init-segment">initialization segments</a>. This information is only consulted
- when the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> creates track objects.</p>
-
- <pre class="idl"><span class="idlEnum" id="idl-def-TrackDefaultType">enum <span class="idlEnumID">TrackDefaultType</span> {
- "<a href="#idl-def-TrackDefaultType.audio" class="idlEnumItem">audio</a>",
- "<a href="#idl-def-TrackDefaultType.video" class="idlEnumItem">video</a>",
- "<a href="#idl-def-TrackDefaultType.text" class="idlEnumItem">text</a>"
-};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-TrackDefaultType.audio">audio</code></td><td>
- Indicates that the information in the <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object should only be used when
- creating <a href="#idl-def-AudioTrack" class="idlType"><code>AudioTrack</code></a> objects.
- </td></tr><tr><td><code id="idl-def-TrackDefaultType.video">video</code></td><td>
- Indicates that the information in the <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object should only be used when
- creating <a href="#idl-def-VideoTrack" class="idlType"><code>VideoTrack</code></a> objects.
- </td></tr><tr><td><code id="idl-def-TrackDefaultType.text">text</code></td><td>
- Indicates that the information in the <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object should only be used when
- creating <a href="#idl-def-TextTrack" class="idlType"><code>TextTrack</code></a> objects.
- </td></tr></tbody></table>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-TrackDefault">[<span class="idlCtor"> <span class="idlCtorKeyword"></span><span class="idlCtorName"><a href="#widl-ctor-TrackDefault--TrackDefaultType-type-DOMString-language-DOMString-label-sequence-DOMString--kinds-DOMString-byteStreamTrackID">Constructor</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-TrackDefaultType" class="idlType"><code>TrackDefaultType</code></a></span> <span class="idlParamName">type</span></span>, <span class="idlParam"><span class="idlParamType">DOMString</span> <span class="idlParamName">language</span></span>, <span class="idlParam"><span class="idlParamType">DOMString</span> <span class="idlParamName">label</span></span>, <span class="idlParam"><span class="idlParamType">sequence<DOMString></span> <span class="idlParamName">kinds</span></span>, <span class="idlParam">optional <span class="idlParamType">DOMString</span> <span class="idlParamName">byteStreamTrackID</span> = <span class="idlDefaultValue">""</span></span>)</span>]
-interface <span class="idlInterfaceID">TrackDefault</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-TrackDefaultType" class="idlType"><code>TrackDefaultType</code></a></span> <span class="idlAttrName"><a href="#widl-TrackDefault-type">type</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">DOMString</span> <span class="idlAttrName"><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">DOMString</span> <span class="idlAttrName"><a href="#widl-TrackDefault-language">language</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">DOMString</span> <span class="idlAttrName"><a href="#widl-TrackDefault-label">label</a></span>;</span>
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">DOMString[]</span> <span class="idlAttrName"><a href="#widl-TrackDefault-kinds">kinds</a></span>;</span>
-};</span></pre><section id="constructors"><h3 aria-level="2" role="heading" id="h3_constructors"><span class="secno">6.1 </span>Constructors</h3><dl class="constructors"><dt id="widl-ctor-TrackDefault--TrackDefaultType-type-DOMString-language-DOMString-label-sequence-DOMString--kinds-DOMString-byteStreamTrackID"><code>TrackDefault</code></dt><dd>
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">type</td><td class="prmType"><code><a href="#idl-def-TrackDefaultType" class="idlType"><code>TrackDefaultType</code></a></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">language</td><td class="prmType"><code>DOMString</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">label</td><td class="prmType"><code>DOMString</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">kinds</td><td class="prmType"><code>sequence<DOMString></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr><tr><td class="prmName">byteStreamTrackID</td><td class="prmType"><code>DOMString = ""</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptTrue"><span role="img" aria-label="True">✔</span></td><td class="prmDesc"></td></tr></tbody></table><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>language</var> is not an empty string and <var>language</var> is not a BCP 47
- language tag, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> and abort these steps.</li>
- <li>
- <dl class="switch">
- <dt>If <var>type</var> equals <code><a href="#idl-def-TrackDefaultType.audio">"audio"</a></code>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed as applying to
- audio in the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-TrackList-getKind-categories">kind categories table</a></code>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> and abort these steps.
- </dd>
- <dt>If <var>type</var> equals <code><a href="#idl-def-TrackDefaultType.video">"video"</a></code>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed as applying to
- video in the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-TrackList-getKind-categories">kind categories table</a></code>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> and abort these steps.
- </dd>
-
- <dt>If <var>type</var> equals <code><a href="#idl-def-TrackDefaultType.text">"text"</a></code>:</dt>
- <dd>
- If any string in <var>kinds</var> contains a value that is not listed in the
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#text-track-kind">text track kind list</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code>
- and abort these steps.
- </dd>
- </dl>
- </li>
- <li>Set the <code><a href="#widl-TrackDefault-type">type</a></code> attribute on this new object to <var>type</var>.</li>
- <li>Set the <code><a href="#widl-TrackDefault-language">language</a></code> attribute on this new object to <var>language</var>.</li>
- <li>Set the <code><a href="#widl-TrackDefault-label">label</a></code> attribute on this new object to <var>label</var>.</li>
- <li>Set the <code><a href="#widl-TrackDefault-kinds">kinds</a></code> attribute to on this new object <var>kinds</var>.</li>
- <li>Set the <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> attribute on this new object to <var>byteStreamTrackID</var>.</li>
- </ol></dd></dl></section><section id="attributes-4"><h3 aria-level="2" role="heading" id="h3_attributes-4"><span class="secno">6.2 </span>Attributes</h3><dl class="attributes"><dt id="widl-TrackDefault-byteStreamTrackID"><code>byteStreamTrackID</code> of type <span class="idlAttrType">DOMString</span>, readonly </dt><dd>
- <p>The decimal string representation of the <a href="#track-id">Track ID</a> that identifies the specific
- track that this object should apply to. An empty string indicates that this object can be
- used for any track of the appropriate type. (i.e. any <a href="#idl-def-AudioTrack" class="idlType"><code>AudioTrack</code></a> if
- <code><a href="#widl-TrackDefault-type">type</a></code> equals <code><a href="#idl-def-TrackDefaultType.audio">"audio"</a></code>).</p>
- </dd><dt id="widl-TrackDefault-kinds"><code>kinds</code> of type array of <span class="idlAttrType">DOMString</span>, readonly </dt><dd>
- <p>The default kinds used when an <a href="#init-segment">initialization segment</a> does not contain kind
- information for a new track. See <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> for details.</p>
- </dd><dt id="widl-TrackDefault-label"><code>label</code> of type <span class="idlAttrType">DOMString</span>, readonly </dt><dd>
- <p>The default label to use when an <a href="#init-segment">initialization segment</a> does not contain label
- information for a new track. See <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> for details.</p>
- </dd><dt id="widl-TrackDefault-language"><code>language</code> of type <span class="idlAttrType">DOMString</span>, readonly </dt><dd>
- <p>The default language to use when an <a href="#init-segment">initialization segment</a> does not contain language
- information for a new track. See <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a> for details.</p>
- </dd><dt id="widl-TrackDefault-type"><code>type</code> of type <span class="idlAttrType"><a href="#idl-def-TrackDefaultType" class="idlType"><code>TrackDefaultType</code></a></span>, readonly </dt><dd>
- <p>The type of track that can be constructed using the information in this object.</p>
- </dd></dl></section>
- </section>
-
- <section id="trackdefaultlist" typeof="bibo:Chapter" resource="#trackdefaultlist" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_trackdefaultlist"><span class="secno">7. </span>TrackDefaultList Object</h2>
- <p>TrackDefaultList is a simple container object for <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> objects. It provides read-only array access.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-TrackDefaultList">[<span class="idlCtor"> <span class="idlCtorKeyword"></span><span class="idlCtorName"><a href="#widl-ctor-TrackDefaultList--sequence-TrackDefault--trackDefaults">Constructor</a></span> (<span class="idlParam"><span class="idlParamType">sequence<<a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a>></span> <span class="idlParamName">trackDefaults</span></span>)</span>]
-interface <span class="idlInterfaceID">TrackDefaultList</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType">unsigned long</span> <span class="idlAttrName"><a href="#widl-TrackDefaultList-length">length</a></span>;</span>
-<span class="idlMethod"> <span class="idlMethType">getter</span> <span class="idlMethName"><a href="#widl-TrackDefaultList-TrackDefault-getter-unsigned-long-index">TrackDefault</a></span> (<span class="idlParam"><span class="idlParamType">unsigned long</span> <span class="idlParamName">index</span></span>);</span>
-};</span></pre><section id="constructors-1"><h3 aria-level="2" role="heading" id="h3_constructors-1"><span class="secno">7.1 </span>Constructors</h3><dl class="constructors"><dt id="widl-ctor-TrackDefaultList--sequence-TrackDefault--trackDefaults"><code>TrackDefaultList</code></dt><dd>
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">trackDefaults</td><td class="prmType"><code>sequence<<a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a>></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>trackDefaults</var> contains two or more <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> objects with
- the same <code><a href="#widl-TrackDefault-type">type</a></code> and the same
- <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code>, then throw an
- <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> and abort these steps.
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_40"><span>Note</span></div><p class="">This also applies when <code><a href="#widl-TrackDefault-byteStreamTrackID">byteStreamTrackID</a></code> contains
- an empty string and ensures that there is only one "byteStreamTrackID independent" default
- for each <a href="#idl-def-TrackDefaultType" class="idlType"><code>TrackDefaultType</code></a> value.</p></div></li>
- <li>Store a copy of <var>trackDefaults</var> in this new object so the values can be returned
- by the accessor methods.</li>
- </ol></dd></dl></section><section id="attributes-5"><h3 aria-level="2" role="heading" id="h3_attributes-5"><span class="secno">7.2 </span>Attributes</h3><dl class="attributes"><dt id="widl-TrackDefaultList-length"><code>length</code> of type <span class="idlAttrType">unsigned long</span>, readonly </dt><dd>
- <p>Indicates the number of <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> objects in the list.</p>
- </dd></dl></section><section id="methods-3"><h3 aria-level="2" role="heading" id="h3_methods-3"><span class="secno">7.3 </span>Methods</h3><dl class="methods"><dt id="widl-TrackDefaultList-TrackDefault-getter-unsigned-long-index"><code>TrackDefault</code></dt><dd>
- <p>Allows the TrackDefault objects in the list to be accessed with an array operator (i.e. []).</p>
-
-
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">index</td><td class="prmType"><code>unsigned long</code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>getter</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>If <var>index</var> is greater than or equal to the <code><a href="#widl-SourceBufferList-length">length</a></code> attribute then return undefined and abort these steps.</li>
- <li>Return the <var>index</var>'th <a href="#idl-def-TrackDefault" class="idlType"><code>TrackDefault</code></a> object in the list.</li>
- </ol></dd></dl></section>
- </section>
-
- <section id="url" typeof="bibo:Chapter" resource="#url" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_url"><span class="secno">8. </span>URL Object Extensions</h2>
- <p>This section specifies extensions to the <a href="http://www.w3.org/TR/FileAPI/#URL-object">URL</a>[<cite><a class="bibref" href="#bib-FILE-API">FILE-API</a></cite>] object definition.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-URL">partial interface <span class="idlInterfaceID">URL</span> {
-<span class="idlMethod"> static <span class="idlMethType">DOMString</span> <span class="idlMethName"><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a></span> <span class="idlParamName">mediaSource</span></span>);</span>
-};</span></pre><section id="methods-4"><h3 aria-level="2" role="heading" id="h3_methods-4"><span class="secno">8.1 </span>Methods</h3><dl class="methods"><dt id="widl-URL-createObjectURL-DOMString-MediaSource-mediaSource"><code>createObjectURL</code>, static</dt><dd>
- <p>Creates URLs for <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> objects.</p>
-
-
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_41"><span>Note</span></div><p class="">This algorithm is intended to mirror the behavior of the <a href="http://www.w3.org/TR/FileAPI/#dfn-createObjectURL">createObjectURL()</a>[<cite><a class="bibref" href="#bib-FILE-API">FILE-API</a></cite>] method with autoRevoke set to true.</p></div>
- <table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">mediaSource</td><td class="prmType"><code><a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code>DOMString</code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>Return a unique <a href="#mediasource-object-url">MediaSource object URL</a> that can be used to dereference the <var>mediaSource</var> argument, and run the rest of the algorithm asynchronously.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#provide-a-stable-state">provide a stable state</a></li>
- <li>Revoke the <a href="#mediasource-object-url">MediaSource object URL</a> by calling <a href="http://www.w3.org/TR/FileAPI/#dfn-revokeObjectURL">revokeObjectURL()</a> on it.</li>
- </ol></dd></dl></section>
- </section>
-
- <section id="htmlmediaelement-extensions" typeof="bibo:Chapter" resource="#htmlmediaelement-extensions" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_htmlmediaelement-extensions"><span class="secno">9. </span>HTMLMediaElement Extensions</h2>
- <p>This section specifies what existing attributes on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement">HTMLMediaElement</a></code> must return when a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is attached to the element.</p>
-
- <p>The <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable">HTMLMediaElement.seekable</a> attribute returns a new static <a href="http://www.w3.org/TR/html5/embedded-content-0.html#normalized-timeranges-object">normalized TimeRanges object</a> created based on the following steps:</p>
- <dl class="switch">
- <dt>If <code><a href="#widl-MediaSource-duration">duration</a></code> equals NaN:</dt>
- <dd>Return an empty <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> object.</dd>
- <dt>If <code><a href="#widl-MediaSource-duration">duration</a></code> equals positive Infinity:</dt>
- <dd>
- <ol>
- <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> attribute returns an empty <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code>
- object, then return an empty <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> object and abort these steps.</li>
- <li>Return a single range with a start time of 0 and an end time equal to the highest end time reported by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> attribute.
- </li></ol></dd>
- <dt>Otherwise:</dt>
- <dd>Return a single range with a start time of 0 and an end time equal to <code><a href="#widl-MediaSource-duration">duration</a></code>.</dd>
- </dl>
-
- <p id="dom-htmlmediaelement.buffered">The <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered">HTMLMediaElement.buffered</a></code> attribute returns a new static <a href="http://www.w3.org/TR/html5/embedded-content-0.html#normalized-timeranges-object">normalized TimeRanges object</a> created based on the following steps:</p>
- <ol>
- <li>If <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.length equals 0 then return an empty <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> object and abort these steps.</li>
- <li>Let <var>active ranges</var> be the ranges returned by <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> for each <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>Let <var>highest end time</var> be the largest range end time in the <var>active ranges</var>.</li>
- <li>Let <var>intersection ranges</var> equal a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRange</a></code> object containing a single range from 0 to <var>highest end time</var>.</li>
- <li>For each <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> run the following steps:
- <ol>
- <li>Let <var>source ranges</var> equal the ranges returned by the <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> attribute on the current <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</li>
- <li>If <code><a href="#widl-MediaSource-readyState">readyState</a></code> is <code><a href="#idl-def-ReadyState.ended">"ended"</a></code>, then set the end time on the last range in <var>source ranges</var> to
- <var>highest end time</var>.</li>
- <li>Let <var>new intersection ranges</var> equal the intersection between the <var>intersection ranges</var> and the <var>source ranges</var>.</li>
- <li>Replace the ranges in <var>intersection ranges</var> with the <var>new intersection ranges</var>.</li>
- </ol>
- </li>
- <li>Return the <var>intersection ranges</var>.</li>
- </ol>
- </section>
-
- <section id="htmlvideoelement-extensions" typeof="bibo:Chapter" resource="#htmlvideoelement-extensions" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_htmlvideoelement-extensions"><span class="secno">10. </span>HTMLVideoElement Extensions</h2>
- <p>This section specifies new attributes and internal state that are being added to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlvideoelement">HTMLVideoElement</a></code>.</p>
-
- <p>Each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlvideoelement">HTMLVideoElement</a></code> will maintain a <dfn id="total-video-frame-count">total video frame count</dfn> variable that keeps
- track of the total number of frames that have been displayed and dropped. This variable is initialized to 0 when the
- element is created and whenever the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-element-load-algorithm">media element load algorithm</a> is invoked. It is incremented when a video frame is displayed
- or when the <var><a href="#dropped-video-frame-count">dropped video frame count</a></var> is incremented.</p>
-
- <p>Each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlvideoelement">HTMLVideoElement</a></code> will maintain a <dfn id="dropped-video-frame-count">dropped video frame count</dfn> variable that keeps
- track of the total number of frames that have been dropped. This variable is initialized to 0 when the
- element is created and whenever the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-element-load-algorithm">media element load algorithm</a> is invoked. It is incremented when a video frame is dropped
- predecode or when a frame is decoded but dropped because it missed a display deadline.</p>
-
- <p>Each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlvideoelement">HTMLVideoElement</a></code> will maintain a <dfn id="corrupted-video-frame-count">corrupted video frame count</dfn> variable that keeps
- track of the total number of corrupted frames detected. This variable is initialized to 0 when the element is created and whenever the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-element-load-algorithm">media element load algorithm</a> is invoked. It is incremented when a corrupted video frame is detected by the decoder. It is up to
- the implementation to determine whether to display or drop a corrupted frame. Whichever choice is made, the <var><a href="#total-video-frame-count">total video frame count</a></var>
- and <var><a href="#dropped-video-frame-count">dropped video frame count</a></var> must be updated appropriately.
- </p>
-
- <p>Each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlvideoelement">HTMLVideoElement</a></code> will maintain a <dfn id="displayed-frame-delay-sum">displayed frame delay sum</dfn> variable that keeps
- track of the sum of all <a href="#displayed-frame-delay">displayed frame delays</a>. This variable is initialized to 0 when the element is created and whenever the
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-element-load-algorithm">media element load algorithm</a> is invoked. When a frame is displayed, its <a href="#displayed-frame-delay">displayed frame delay</a> is computed and added
- to this variable.
- </p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-HTMLVideoElement">partial interface <span class="idlInterfaceID">HTMLVideoElement</span> {
-<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-VideoPlaybackQuality" class="idlType"><code>VideoPlaybackQuality</code></a></span> <span class="idlMethName"><a href="#widl-HTMLVideoElement-getVideoPlaybackQuality-VideoPlaybackQuality">getVideoPlaybackQuality</a></span> ();</span>
-};</span></pre><section id="methods-5"><h3 aria-level="2" role="heading" id="h3_methods-5"><span class="secno">10.1 </span>Methods</h3><dl class="methods"><dt id="widl-HTMLVideoElement-getVideoPlaybackQuality-VideoPlaybackQuality"><code>getVideoPlaybackQuality</code></dt><dd>
- <p>Provides the current the playback quality metrics.</p>
-
- <div><em>No parameters.</em></div><div><em>Return type: </em><code><a href="#idl-def-VideoPlaybackQuality" class="idlType"><code>VideoPlaybackQuality</code></a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
- <li>Let <var>playbackQuality</var> be a new instance of <a href="#idl-def-VideoPlaybackQuality" class="idlType"><code>VideoPlaybackQuality</code></a>.</li>
- <li>Set <var>playbackQuality</var>.<code><a href="#widl-VideoPlaybackQuality-creationTime">creationTime</a></code> to the value returned by a call to <a href="http://www.w3.org/TR/hr-time/#dom-performance-now">Performance.now()</a>.</li>
- <li>Set <var>playbackQuality</var>.<code><a href="#widl-VideoPlaybackQuality-totalVideoFrames">totalVideoFrames</a></code> to the current value of the <var><a href="#total-video-frame-count">total video frame count</a></var>.</li>
- <li>Set <var>playbackQuality</var>.<code><a href="#widl-VideoPlaybackQuality-droppedVideoFrames">droppedVideoFrames</a></code> to the current value of the <var><a href="#dropped-video-frame-count">dropped video frame count</a></var>.</li>
- <li>Set <var>playbackQuality</var>.<code><a href="#widl-VideoPlaybackQuality-corruptedVideoFrames">corruptedVideoFrames</a></code> to the current value of the <var><a href="#corrupted-video-frame-count">corrupted video frame count</a></var>.</li>
- <li>Set <var>playbackQuality</var>.<code><a href="#widl-VideoPlaybackQuality-totalFrameDelay">totalFrameDelay</a></code> to the current value of the <var><a href="#displayed-frame-delay-sum">displayed frame delay sum</a></var>.</li>
- <li>Return <var>playbackQuality</var>.</li>
- </ol></dd></dl></section>
- </section>
-
- <section id="audio-track-extensions" typeof="bibo:Chapter" resource="#audio-track-extensions" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_audio-track-extensions"><span class="secno">11. </span>AudioTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> definition.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-AudioTrack">partial interface <span class="idlInterfaceID">AudioTrack</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-AudioTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-6"><h3 aria-level="2" role="heading" id="h3_attributes-6"><span class="secno">11.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-AudioTrack-sourceBuffer"><code>sourceBuffer</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span>, readonly , nullable</dt><dd>
- <p>Returns the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> that created this track. Returns null if this track was not created by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> or the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of its <a href="#parent-media-source">parent media source</a>.</p>
- </dd></dl></section>
- </section>
-
- <section id="video-track-extensions" typeof="bibo:Chapter" resource="#video-track-extensions" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_video-track-extensions"><span class="secno">12. </span>VideoTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> definition.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-VideoTrack">partial interface <span class="idlInterfaceID">VideoTrack</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-VideoTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-7"><h3 aria-level="2" role="heading" id="h3_attributes-7"><span class="secno">12.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-VideoTrack-sourceBuffer"><code>sourceBuffer</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span>, readonly , nullable</dt><dd>
- <p>Returns the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> that created this track. Returns null if this track was not created by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> or the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of its <a href="#parent-media-source">parent media source</a>.</p>
- </dd></dl></section>
- </section>
-
- <section id="text-track-extensions" typeof="bibo:Chapter" resource="#text-track-extensions" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_text-track-extensions"><span class="secno">13. </span>TextTrack Extensions</h2>
- <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> definition.</p>
-
- <pre class="idl"><span class="idlInterface" id="idl-def-TextTrack">partial interface <span class="idlInterfaceID">TextTrack</span> {
-<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-TextTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-8"><h3 aria-level="2" role="heading" id="h3_attributes-8"><span class="secno">13.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-TextTrack-sourceBuffer"><code>sourceBuffer</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span>, readonly , nullable</dt><dd>
- <p>Returns the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> that created this track. Returns null if this track was not created by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> or the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of its <a href="#parent-media-source">parent media source</a>.</p>
- </dd></dl></section>
- </section>
-
- <section id="byte-stream-formats" typeof="bibo:Chapter" resource="#byte-stream-formats" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_byte-stream-formats"><span class="secno">14. </span>Byte Stream Formats</h2>
- <p>The bytes provided through <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> for a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> form a logical byte stream. The format and
- semantics of these byte streams are defined in <dfn id="byte-stream-format-specs">byte stream format specifications</dfn>.
- The byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] provides mappings between a MIME type that may be passed to <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> or
- <code><a href="#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported()</a></code> and the byte stream format expected by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> created with that MIME type. Implementations are encouraged to register
- mappings for byte stream formats they support to facilitate interoperability. The byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] is the authoritative source for these
- mappings. If an implementation claims to support a MIME type listed in the registry, its <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> implementation must conform to the
- <a href="#byte-stream-format-specs">byte stream format specification</a> listed in the registry entry.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_42"><span>Note</span></div><p class="">The byte stream format specifications in the registry are not intended to define new storage formats. They simply outline the subset of
- existing storage format structures that implementations of this specification will accept.</p></div>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_43"><span>Note</span></div><p class="">Byte stream format parsing and validation is implemented in the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm.</p></div>
-
- <p>This section provides general requirements for all byte stream format specifications:</p>
- <ul>
- <li>A byte stream format specification must define <a href="#init-segment">initialization segments</a> and <a href="#media-segment">media segments</a>.</li>
- <li>It must be possible to identify segment boundaries and segment type (initialization or media) by examining the byte stream alone.</li>
- <li>The user agent must run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> when any of the following conditions are met:
- <ol>
- <li>
- <p>The number and type of tracks are not consistent.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_44"><span>Note</span></div><p class="">For example, if the first <a href="#init-segment">initialization segment</a> has 2 audio tracks and 1 video track, then all <a href="#init-segment">initialization segments</a> that follow it in the byte stream must describe 2 audio tracks and 1 video track.</p></div>
- </li>
- <li><a href="#track-id">Track IDs</a> are not the same across <a href="#init-segment">initialization segments</a>, for segments describing multiple tracks of a single type. (e.g. 2 audio tracks).</li>
- <li>
- <p>Codecs changes across <a href="#init-segment">initialization segments</a>.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_45"><span>Note</span></div><p class="">For example, a byte stream that starts with an <a href="#init-segment">initialization segment</a> that specifies a single AAC track and later contains an <a href="#init-segment">initialization segment</a> that specifies a single AMR-WB track is not allowed. Support for multiple codecs is handled with multiple <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects.</p></div>
- </li>
- </ol>
- </li>
- <li>The user agent must support the following:
- <ol>
- <li><a href="#track-id">Track IDs</a> changing across <a href="#init-segment">initialization segments</a> if the segments describes only one track of each type.</li>
- <li>
- <p>Video frame size changes. The user agent must support seamless playback.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_46"><span>Note</span></div><p class="">This will cause the <video> display region to change size if the web application does not use CSS or HTML attributes (width/height) to constrain the element size.</p></div>
- </li>
- <li>
- <p>Audio channel count changes. The user agent may support this seamlessly and could trigger downmixing.</p>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_47"><span>Note</span></div><p class="">This is a quality of implementation issue because changing the channel count may require reinitializing the audio device, resamplers, and channel mixers which tends to be audible.</p></div>
- </li>
- </ol>
- </li>
- <li>The following rules apply to all <a href="#media-segment">media segments</a> within a byte stream. A user agent must:
- <ol>
- <li>Map all timestamps to the same <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-timeline">media timeline</a>.</li>
- <li>Support seamless playback of <a href="#media-segment">media segments</a> having a timestamp gap smaller than the audio frame size. User agent must not reflect these gaps in the <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> attribute.
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_48"><span>Note</span></div><p class="">This is intended to simplify switching between audio streams where the frame boundaries don't always line up across encodings (e.g. Vorbis).</p></div>
- </li>
- </ol>
- </li>
- <li>The user agent must run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="#idl-def-EndOfStreamError.decode">"decode"</a></code> when any combination of an <a href="#init-segment">initialization segment</a> and any contiguous sequence of <a href="#media-segment">media segments</a> satisfies the
- following conditions:
- <ol>
- <li>The number and type (audio, video, text, etc.) of all tracks in the <a href="#media-segment">media segments</a> are not identified.</li>
- <li>The decoding capabilities needed to decode each track (i.e. codec and codec parameters) are not provided.</li>
- <li>Encryption parameters necessary to decrypt the content (except the encryption key itself) are not provided for all encrypted tracks.</li>
- <li>All information necessary to decode and render the earliest <a href="#random-access-point">random access point</a> in the sequence of <a href="#media-segment">media segments</a> and all subsequence samples in the sequence
- (in presentation time) are not provided. This includes in particular,
- <ul>
- <li>Information that determines the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-video-intrinsic-width">intrinsic width and height</a> of the video (specifically, this requires either the picture or pixel aspect ratio, together with the encoded
- resolution).</li>
- <li>Information necessary to convert the video decoder output to a format suitable for display</li>
- </ul>
- </li>
- <li>Information necessary to compute the global <a href="#presentation-timestamp">presentation timestamp</a> of every sample in the sequence of <a href="#media-segment">media segments</a> is not provided.</li>
- </ol>
- <p>For example, if I1 is associated with M1, M2, M3 then the above must hold for all the combinations I1+M1, I1+M2, I1+M1+M2, I1+M2+M3, etc.</p>
- </li>
- </ul>
- <p>Byte stream specifications must at a minimum define constraints which ensure that the above requirements hold. Additional constraints may be defined, for example to simplify implementation.</p>
-
- </section>
-
- <section id="examples" typeof="bibo:Chapter" resource="#examples" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_examples"><span class="secno">15. </span>Examples</h2>
- <p>Example use of the Media Source Extensions</p>
- <div class="block">
- <div class="blockContent">
- <pre class="code"><script>
- function onSourceOpen(videoTag, e) {
- var mediaSource = e.target;
-
- if (mediaSource.sourceBuffers.length > 0)
- return;
-
- var sourceBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
-
- videoTag.addEventListener('seeking', onSeeking.bind(videoTag, mediaSource));
- videoTag.addEventListener('progress', onProgress.bind(videoTag, mediaSource));
-
- var initSegment = GetInitializationSegment();
-
- if (initSegment == null) {
- // Error fetching the initialization segment. Signal end of stream with an error.
- mediaSource.endOfStream("network");
- return;
- }
-
- // Append the initialization segment.
- var firstAppendHandler = function(e) {
- var sourceBuffer = e.target;
- sourceBuffer.removeEventListener('updateend', firstAppendHandler);
-
- // Append some initial media data.
- appendNextMediaSegment(mediaSource);
- };
- sourceBuffer.addEventListener('updateend', firstAppendHandler);
- sourceBuffer.appendBuffer(initSegment);
- }
-
- function appendNextMediaSegment(mediaSource) {
- if (mediaSource.readyState == "closed")
- return;
-
- // If we have run out of stream data, then signal end of stream.
- if (!HaveMoreMediaSegments()) {
- mediaSource.endOfStream();
- return;
- }
-
- // Make sure the previous append is not still pending.
- if (mediaSource.sourceBuffers[0].updating)
- return;
-
- var mediaSegment = GetNextMediaSegment();
-
- if (!mediaSegment) {
- // Error fetching the next media segment.
- mediaSource.endOfStream("network");
- return;
- }
-
- // NOTE: If mediaSource.readyState == “ended”, this appendBuffer() call will
- // cause mediaSource.readyState to transition to "open". The web application
- // should be prepared to handle multiple “sourceopen” events.
- mediaSource.sourceBuffers[0].appendBuffer(mediaSegment);
- }
-
- function onSeeking(mediaSource, e) {
- var video = e.target;
-
- if (mediaSource.readyState == "open") {
- // Abort current segment append.
- mediaSource.sourceBuffers[0].abort();
- }
-
- // Notify the media segment loading code to start fetching data at the
- // new playback position.
- SeekToMediaSegmentAt(video.currentTime);
-
- // Append a media segment from the new playback position.
- appendNextMediaSegment(mediaSource);
- }
-
- function onProgress(mediaSource, e) {
- appendNextMediaSegment(mediaSource);
- }
-</script>
-
-<video id="v" autoplay> </video>
-
-<script>
- var video = document.getElementById('v');
- var mediaSource = new MediaSource();
- mediaSource.addEventListener('sourceopen', onSourceOpen.bind(this, video));
- video.src = window.URL.createObjectURL(mediaSource);
-</script>
- </pre>
- </div>
- </div>
- </section>
-
- <section id="acknowledgements" typeof="bibo:Chapter" resource="#acknowledgements" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_acknowledgements"><span class="secno">16. </span>Acknowledgments</h2>
- The editors would like to thank Alex Giladi, Bob Lund, Chris Poole, Cyril Concolato, David Dorwin, David Singer, Duncan Rowden, Frank Galligan, Glenn Adams, Jer Noble, Jerry Smith, Joe Steele, John Simmons, Kevin Streeter, Mark Vickers, Matt Ward, Matt Wolenetz, Matthew Gregan, Michael Thornburgh, Philip Jägenstedt, Pierre Lemieux, Ralph Giles, Steven Robertson, and Tatsuya Igarashi for their contributions to this specification.
- </section>
-
- <section id="revision-history" typeof="bibo:Chapter" resource="#revision-history" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_revision-history"><span class="secno">17. </span>Revision History</h2>
- <table class="old-table">
- <thead>
- <tr>
- <th>Version</th>
- <th>Comment</th>
- </tr>
- </thead>
- <tbody>
- </tbody><tbody>
- <tr>
- <td>11 November 2014</td>
- <td>
- <ul>
- <li>Bug 27296 - Clarify .seekable when duration is Infinity and .buffered is empty.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/af052af0dd5f/media-source/media-source.html">04 November 2014</a></td>
- <td>
- <ul>
- <li>Bug 27241 - Fixed step 1 of the TrackDefault constructor so it doesn't always throw an exception.</li>
- <li>Bug 27240 - Make TrackDefaultList contructor throw an exception on any duplicate (type, byteStreamTrackID) pair.</li>
- <li>Bug 27174 - Added SourceBuffer configuration definition to clarify addSourceBuffer() behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/567b8e0764f8/media-source/media-source.html">06 October 2014</a></td>
- <td>
- <ul>
- <li>Bug 26924 - Run default language algorithm if 'und' BCP 47 value is present in the init segment.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/567b8e0764f8/media-source/media-source.html">29 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26932 - Fix TrackDefault constructor kinds parameter type.</li>
- <li>Update to ReSpec 3.2.20.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/df74aa427173/media-source/media-source.html">10 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26777 - Rename 'first initialization segment flag' to 'first initialization segment received flag'.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9066cfb5ad1d/media-source/media-source.html">09 September 2014</a></td>
- <td>
- <ul>
- <li>Bug 26721 - Add label attribute to TrackDefault object.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/856c321c7a6b/media-source/media-source.html">12 August 2014</a></td>
- <td>
- <ul>
- <li>Bug 26436 - Use HTMLMediaElement.buffered for HTMLMediaElement.readyState transitions instead of individual SourceBuffer.buffered attributes.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/c63fe313d13a/media-source/media-source.html">24 July 2014</a></td>
- <td>
- <ul>
- <li>Bug 26345 - Make activeSourceBuffers order match sourceBuffers order.</li>
- <li>Bug 26316 - Changed duration change algorithm to avoid open transition on endOfStream().</li>
- <li>Bug 26314 - Fixed coded frame removal algorithm to remove dependencies that may lie outside the removal range.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9b4db0f089bf/media-source/media-source.html">20 June 2014</a></td>
- <td>
- <ul>
- <li>Bug 26032 - Set need random access point flag on all track buffers when a new init
- segment is received.</li>
- <li>Bug 25845 - Clarify SourceBuffer.buffered getter behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/a38529a7910d/media-source/media-source.html">13 June 2014</a></td>
- <td>
- <ul>
- <li>Bug 25995 - Fix conditions in "remove existing coded frames" step.</li>
- <li>Bug 25999 - Change appendWindowStart assignments to reference presentation start time.</li>
- <li>Bug 26000 - Make it explicit that SourceBuffer.remove() throws an exception if duration equals NaN.</li>
- <li>Bug 25846 - Update end of stream algorithm to invoke the append error algorithm on decode errors.</li>
- <li>Bug 25850 - Specify SourceBuffer.trackDefaults initial value and setter/getter behavior.</li>
- <li>Bug 25998 - Move presentation & decode timestamp checks after append window filtering steps.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/01c9e30d71b0/media-source/media-source.html">21 May 2014</a></td>
- <td>
- <ul>
- <li>Bug 24370 - Add TrackDefault object and remove kind/language overloads.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3e8dfccbfded/media-source/media-source.html">20 May 2014</a></td>
- <td>
- <ul>
- <li>Bug 25518 - Make remove() end parameter an unrestricted double.</li>
- <li>Bug 25580 - Add informative reference to byte stream format registry.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/29f17705b5c2/media-source/media-source.html">29 April 2014</a></td>
- <td>
- <ul>
- <li>Bug 25347 - Remove unnecessary null & invalid enum value checks.</li>
- <li>Bug 25505 - Introduce "generate timestamps flag" to handle MPEG audio timestamp
- generation.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d471a4412040/media-source/media-source.html">01 April 2014</a></td>
- <td>
- <ul>
- <li>Bug 25157 - Fix typo in coded frame duration example.</li>
- <li>Bug 24854 - Moved negative timestamp checking to allow "sequence" mode to handle
- appending coded frames in reverse order</li>
- <li>Bug 24820 - Renamed highest presentation end timestamp to group end timestamp and
- fixed a few related issues.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/cad94fce3b90/media-source/media-source.html">03 March 2014</a></td>
- <td>
- <ul>
- <li>Bug 24347 - Fix HAVE_FUTURE_DATA transition condition in SourceBuffer monitoring algorithm.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d8ad50e85da3/media-source/media-source.html">10 December 2013</a></td>
- <td>
- <ul>
- <li>Bug 23169 - Restore totalFrameDelay units to seconds.</li>
- <li>Bug 23989 - Update blob URL origin text to remove stale File API reference.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/7c96c97306ce/media-source/media-source.html">02 December 2013</a></td>
- <td>
- <ul>
- <li>Bug 23818 - Make external spec references normative.</li>
- <li>Bug 23441 - Update byte stream format registry text.</li>
- <li>Bug 23169 - Update totalFrameDelay text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/306bb395f94e/media-source/media-source.html">14 November 2013</a></td>
- <td>
- <ul>
- <li>Bug 23663 - Clarify seeking behavior in Section 2.4.3.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/47e74f565722/media-source/media-source.html">04 November 2013</a></td>
- <td>
- <ul>
- <li>Bug 23441 - Established MSE byte stream format registry and extracted byte stream format text into separate documents.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/15e7e8f7eecd/media-source/media-source.html">29 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23553 - Fixed segment parser loop so it doesn't appear to prematurely remove the media segment header.</li>
- <li>Bug 23557 - Update SPS/PPS note to not explicitly recommend specific avc versions.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/bed8606bd0a7/media-source/media-source.html">28 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23549 - Add definitions for decode timestamp, presentation timestamp, an presentation order.</li>
- <li>Bug 23552 - Clarify 'this' in section 3.5.1</li>
- <li>Bug 23554 - Introduced presentation interval and coded frame duration terms to clarify text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3fda61eb902f/media-source/media-source.html">15 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23525 - Fix mvex box error behavior.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/56e209741937/media-source/media-source.html">04 October 2013</a></td>
- <td>
- <ul>
- <li>Bug 23442 - Fix example to work when seeking in the 'ended' state.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9035359fe231/media-source/media-source.html">26 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22136 - Added text for Inband SPS/PPS support.</li>
- <li>Bug 22776 - Clarified that implementations are only required to support one SourceBuffer configuration at a time.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/2b2d8865de83/media-source/media-source.html">18 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22117 - Reword byte stream specs in terms of UA behavior.</li>
- <li>Bug 22148 - Replace VideoPlaybackQuality.playbackJitter with VideoPlaybackQuality.totalFrameDelay.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b98190a4472c/media-source/media-source.html">02 July 2013</a></td>
- <td>
- <ul>
- <li>Bug 22401 - Fix typo</li>
- <li>Bug 22134 - Clarify byte stream format enforcement.</li>
- <li>Bug 22431 - Convert videoPlaybackQuality attribute to getVideoPlaybackQuality() method.</li>
- <li>Bug 22109 - Renamed 'coded frame sequence' to 'coded frame group' to avoid confusion around multiple 'sequence' concepts.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/63675668846c/media-source/media-source.html">05 June 2013</a></td>
- <td>
- <ul>
- <li>Bug 22139 - Added a note clarifying that byte stream specs aren't defining new storage formats.</li>
- <li>Bug 22148 - Added playbackJitter metric.</li>
- <li>Bug 22134 - Added minimal number of SourceBuffers requirements.</li>
- <li>Bug 22115 - Make algorithm abort text consistent.</li>
- <li>Bug 22113 - Address typos.</li>
- <li>Bug 22065 - Fix infinite loop in coded frame processing algorithm.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/1ac9c2205a7b/media-source/media-source.html">01 June 2013</a></td>
- <td>
- <ul>
- <li>Bug 21431 - Updated coded frame processing algorithm for text splicing.</li>
- <li>Bug 22035 - Update addtrack and removetrack event firing text to match HTML5 language.</li>
- <li>Bug 22111 - Remove useless playback sentence from end of stream algorithm.</li>
- <li>Bug 22052 - Add corrupted frame metric.</li>
- <li>Bug 22062 - Added links for filing bugs.</li>
- <li>Bug 22125 - Add "ended" to "open" transition to remove().</li>
- <li>Bug 22143 - Move HTMLMediaElement.playbackQuality to HTMLVideoElement.videoPlaybackQuality.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/71968956733e/media-source/media-source.html">13 May 2013</a></td>
- <td>
- <ul>
- <li>Bug 21954 - Add [EnforceRange] to appendStream's maxSize parameter.</li>
- <li>Bug 21953 - Add NaN handling to appendWindowEnd setter algorithm.</li>
- <li>Alphabetize definitions section.</li>
- <li>Changed endOfStream('decode') references to make it clear that JavaScript can't intercept these calls.</li>
- <li>Fix links for all types in the IDL that are defined in external specifications.</li>
- </ul>
- </td>
- </tr><tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9ff5e42736b6/media-source/media-source.html">06 May 2013</a></td>
- <td>
- <ul>
- <li>Bug 20901 - Remove AbortMode and add AppendMode.</li>
- <li>Bug 21911 - Change MediaPlaybackQuality.creationTime to DOMHighResTimeStamp.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b60bf8077d9c/media-source/media-source.html">02 May 2013</a></td>
- <td>
- <ul>
- <li>Reworked ambiguous text in a variety of places.</li>
- <li>Added Acknowledgements section.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ffb76048861e/media-source/media-source.html">30 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21822 - Fix 'fire ... event ... at the X attribute' text.</li>
- <li>Bug 21819 & 21328 - Remove 'compressed' from coded frame definition.</li>
- </ul>
- </td>
- </tr>
- <tr><td><a href="https://dvcs.w3.org/hg/html-media/raw-file/237133bfdd57/media-source/media-source.html">24 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21796 - Removed issue box from 'Append Error' algorithm.</li>
- <li>Bug 21703 - Changed appendWindowEnd to 'unrestricted double'.</li>
- <li>Bug 20760 - Adding MediaPlaybackQuality object.</li>
- <li>Bug 21536 - Specify the origin of media data appended.</li>
- </ul>
- </td>
- </tr>
- <tr><td><a href="https://dvcs.w3.org/hg/html-media/raw-file/f7f2b7226543/media-source/media-source.html">08 April 2013</a></td>
- <td>
- <ul>
- <li>Bug 21327 - Crossfade clarifications.</li>
- <li>Bug 21334 - Clarified seeking behavoir.</li>
- <li>Bug 21326 - Add a note stating some implementations may choose to add fades to/from silence.</li>
- <li>Bug 21375 - Clarified decode dependency removal.</li>
- <li>Bug 21376 - Replace 100ms limit with 2x last frame duration limit.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/rev/1e6898152c5b">26 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21301 - Change timeline references to "media timeline" links.</li>
- <li>Bug 19676 - Clarified "fade out coded frames" definition.</li>
- <li>Bug 21276 - Convert a few append error scenarios to endOfStream('decode') errors.</li>
- <li>Bug 21376 - Changed 'time' to 'decode time' to append sequence definition.</li>
- <li>Bug 21374 - Clarify the abort() behavior.</li>
- <li>Bug 21373 - Clarified incremental parsing text in segment parser loop.</li>
- <li>Bug 21364 - Remove redundant condition from remove overlapped frame step.</li>
- <li>Bug 21327 - Clarify what to do with a splice that starts with an audio frame with a duration less than 5ms.</li>
- <li>Update to ReSpec 3.1.48</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/f0fb58d45f96/media-source/media-source.html">12 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21112 - Add appendWindowStart & appendWindowEnd attributes.</li>
- <li>Bug 19676 - Clarify overlapped frame definitions and splice logic.</li>
- <li>Bug 21172 - Added coded frame removal and eviction algorithms.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/dcd406812201/media-source/media-source.html">05 March 2013</a></td>
- <td>
- <ul>
- <li>Bug 21170 - Remove 'stream aborted' step from stream append loop algorithm.</li>
- <li>Bug 21171 - Added informative note about when addSourceBuffer() might throw an QUOTA_EXCEEDED_ERR exception.</li>
- <li>Bug 20901 - Add support for 'continuation' and 'timestampOffset' abort modes.</li>
- <li>Bug 21159 - Rename appendArrayBuffer to appendBuffer() and add ArrayBufferView overload.</li>
- <li>Bug 21198 - Remove redundant 'closed' readyState checks.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/668a1c82fb88/media-source/media-source.html">25 February 2013</a></td>
- <td>
- <ul>
- <li>Remove Source Buffer Model section since all the behavior is covered by the algorithms now.</li>
- <li>Bug 20899 - Remove media segments must start with a random access point requirement.</li>
- <li>Bug 21065 - Update example code to use updating attribute instead of old appending attribute.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/d5956e93b991/media-source/media-source.html">19 February 2013</a></td>
- <td>
- <ul>
- <li>Bug 19676, 20327 - Provide more detail for audio & video splicing.</li>
- <li>Bug 20900 - Remove complete access unit constraint.</li>
- <li>Bug 20948 - Setting timestampOffset in 'ended' triggers a transition to 'open'</li>
- <li>Bug 20952 - Added update event.</li>
- <li>Bug 20953 - Move end of append event firing out of segment parser loop.</li>
- <li>Bug 21034 - Add steps to fire addtrack and removetrack events.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
- <td>
- <ul>
- <li>Bug 19676 - Added a note clarifying that the internal timestamp representation doesn't have to be a double.</li>
- <li>Added steps to the coded frame processing algorithm to remove old frames when new ones overlap them.</li>
- <li>Fix isTypeSupported() return type.</li>
- <li>Bug 18933 - Clarify what top-level boxes to ignore for ISO-BMFF.</li>
- <li>Bug 18400 - Add a check to avoid creating huge hidden gaps when out-of-order appends occur w/o calling abort().</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b35722b0cd8f/media-source/media-source.html">31 January 2013</a></td>
- <td>
- <ul>
- <li>Make remove() asynchronous.</li>
- <li>Added steps to various algorithms to throw an INVALID_STATE_ERR exception when async appends or remove() are pending.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/aae26333e7d1/media-source/media-source.html">30 January 2013</a></td>
- <td>
- <ul>
- <li>Remove early abort step on 0-byte appends so the same events fire as a normal append with bytes.</li>
- <li>Added definition for 'enough data to ensure uninterrupted playback'.</li>
- <li>Updated buffered ranges algorithm to properly compute the ranges for Philip's example.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/fd2a58eec443/media-source/media-source.html">15 January 2013</a></td>
- <td>Replace setTrackInfo() and getSourceBuffer() with AudioTrack, VideoTrack, and TextTrack extensions.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/52a85235137b/media-source/media-source.html">04 January 2013</a></td>
- <td>
- <ul>
- <li>Renamed append() to appendArrayBuffer() and made appending asynchronous.</li>
- <li>Added SourceBuffer.appendStream().</li>
- <li>Added SourceBuffer.setTrackInfo() methods.</li>
- <li>Added issue boxes to relevant sections for outstanding bugs.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/53ea7c19edd2/media-source/media-source.html">14 December 2012</a></td>
- <td>
- Pubrules, Link Checker, and Markup Validation fixes.
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e1c91093dfdc/media-source/media-source.html">13 December 2012</a></td>
- <td>
- <ul>
- <li>Added MPEG-2 Transport Stream section.</li>
- <li>Added text to require abort() for out-of-order appends.</li>
- <li>Renamed "track buffer" to "decoder buffer".</li>
- <li>Redefined "track buffer" to mean the per-track buffers that hold the SourceBuffer media data.</li>
- <li>Editorial fixes.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ee6e8ae9337c/media-source/media-source.html">08 December 2012</a></td>
- <td>
- <ul>
- <li>Added MediaSource.getSourceBuffer() methods.</li>
- <li>Section 2 cleanup.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/43be42e69533/media-source/media-source.html">06 December 2012</a></td>
- <td>
- <ul>
- <li>append() now throws a QUOTA_EXCEEDED_ERR when the SourceBuffer is full.</li>
- <li>Added unique ID generation text to Initialization Segment Received algorithm.</li>
- <li>Remove 2.x subsections that are already covered by algorithm text.</li>
- <li>Rework byte stream format text so it doesn't imply that the MediaSource implementation must support all formats supported by the
- HTMLMediaElement.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/0c638da9a67a/media-source/media-source.html">28 November 2012</a></td>
- <td>
- <ul>
- <li>Added transition to HAVE_METADATA when current playback position is removed.</li>
- <li>Added remove() calls to duration change algorithm.</li>
- <li>Added MediaSource.isTypeSupported() method.</li>
- <li>Remove initialization segments are optional text.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/3e4d27b3a98f/media-source/media-source.html">09 November 2012</a></td>
- <td>Converted document to ReSpec.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e029f71aafca/media-source/media-source.html">18 October 2012</a></td>
- <td>Refactored SourceBuffer.append() & added SourceBuffer.remove().</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/6d127e69c9f8/media-source/media-source.html">8 October 2012</a></td>
- <td>
- <ul>
- <li>Defined what HTMLMediaElement.seekable and HTMLMediaElement.buffered should return.</li>
- <li>Updated seeking algorithm to run inside Step 10 of the HTMLMediaElement seeking algorithm.</li>
- <li>Removed transition from "ended" to "open" in the seeking algorithm.</li>
- <li>Clarified all the event targets.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/media-source.html">1 October 2012</a></td>
- <td>Fixed various addsourcebuffer & removesourcebuffer bugs and allow append() in ended state.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/349559debcc3/media-source/media-source.html">13 September 2012</a></td>
- <td>Updated endOfStream() behavior to change based on the value of HTMLMediaElement.readyState.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ca093bbbbefb/media-source/media-source.html">24 August 2012</a></td>
- <td>
- <ul>
- <li>Added early abort on to duration change algorithm.</li>
- <li>Added createObjectURL() IDL & algorithm.</li>
- <li>Added Track ID & Track description definitions.</li>
- <li>Rewrote start overlap for audio frames text.</li>
- <li>Removed rendering silence requirement from section 2.5.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/340786fcae83/media-source/media-source.html">22 August 2012</a></td>
- <td>
- <ul>
- <li>Clarified WebM byte stream requirements.</li>
- <li>Clarified SourceBuffer.buffered return value.</li>
- <li>Clarified addsourcebuffer & removesourcebuffer event targets.</li>
- <li>Clarified when media source attaches to the HTMLMediaElement.</li>
- <li>Introduced duration change algorithm and update relevant algorithms to use it.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/032f7b8681d1/media-source/media-source.html">17 August 2012</a></td>
- <td>Minor editorial fixes.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/29687c019735/media-source/media-source.html">09 August 2012</a></td>
- <td>Change presentation start time to always be 0 instead of using format specific rules about the first media segment appended.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/087ea42f59c8/media-source/media-source.html">30 July 2012</a></td>
- <td>Added SourceBuffer.timestampOffset and MediaSource.duration.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ab36e8e882c6/media-source/media-source.html">17 July 2012</a></td>
- <td>Replaced SourceBufferList.remove() with MediaSource.removeSourceBuffer().</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/b499a199e427/media-source/media-source.html">02 July 2012</a></td>
- <td>Converted to the object-oriented API</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/9bbfe09653e4/media-source/media-source.html">26 June 2012</a></td>
- <td>Converted to Editor's draft.</td>
- </tr>
- <tr>
- <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/e433598d22a7/media-source/media-source.html">0.5</a></td>
- <td>Minor updates before proposing to <abbr title="World Wide Web Consortium">W3C</abbr> HTML-WG.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.4/draft-spec/mediasource-draft-spec.html">0.4</a></td>
- <td>Major revision. Adding source IDs, defining buffer model, and clarifying byte stream formats.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.3/draft-spec/mediasource-draft-spec.html">0.3</a></td>
- <td>Minor text updates.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.2/draft-spec/mediasource-draft-spec.html">0.2</a></td>
- <td>Updates to reflect initial WebKit implementation.</td>
- </tr>
- <tr>
- <td><a href="http://html5-mediasource-api.googlecode.com/svn/tags/0.1/draft-spec/mediasource-draft-spec.html">0.1</a></td>
- <td>Initial Proposal</td>
- </tr>
- </tbody>
- </table>
- </section>
-
-
-<form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form><section id="references" class="appendix" typeof="bibo:Chapter" resource="#references" rel="bibo:Chapter"><!--OddPage--><h2 aria-level="1" role="heading" id="h2_references"><span class="secno">A. </span>References</h2><section id="normative-references" typeof="bibo:Chapter" resource="#normative-references" rel="bibo:Chapter"><h3 aria-level="2" role="heading" id="h3_normative-references"><span class="secno">A.1 </span>Normative references</h3><dl class="bibliography" about=""><dt id="bib-FILE-API">[FILE-API]</dt><dd rel="dcterms:requires">Arun Ranganathan; Jonas Sicking. <a href="http://www.w3.org/TR/FileAPI/"><cite>File API</cite></a>. 12 September 2013. W3C Last Call Working Draft. URL: <a href="http://www.w3.org/TR/FileAPI/">http://www.w3.org/TR/FileAPI/</a>
-</dd><dt id="bib-HTML5">[HTML5]</dt><dd rel="dcterms:requires">Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Edward O'Connor; Silvia Pfeiffer. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 28 October 2014. W3C Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a>
-</dd><dt id="bib-STREAMS-API">[STREAMS-API]</dt><dd rel="dcterms:requires">Feras Moussa; Takeshi Yoshino. <a href="http://www.w3.org/TR/2013/WD-streams-api-20131105/"><cite>Streams API</cite></a>. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2013/WD-streams-api-20131105/">http://www.w3.org/TR/2013/WD-streams-api-20131105/</a>
-</dd><dt id="bib-TYPED-ARRAYS">[TYPED-ARRAYS]</dt><dd rel="dcterms:requires">David Herman; Kenneth Russell. <a href="https://www.khronos.org/registry/typedarray/specs/latest/"><cite>Typed Array Specification</cite></a>. 26 June 2013. Khronos Working Draft. URL: <a href="https://www.khronos.org/registry/typedarray/specs/latest/">https://www.khronos.org/registry/typedarray/specs/latest/</a>
-</dd></dl></section><section id="informative-references" typeof="bibo:Chapter" resource="#informative-references" rel="bibo:Chapter"><h3 aria-level="2" role="heading" id="h3_informative-references"><span class="secno">A.2 </span>Informative references</h3><dl class="bibliography" about=""><dt id="bib-MSE-REGISTRY">[MSE-REGISTRY]</dt><dd rel="dcterms:references">Aaron Colwell. <a href="byte-stream-format-registry.html"><cite>Media Source Extensions Byte Stream Format Registry</cite></a>. URL: <a href="byte-stream-format-registry.html">byte-stream-format-registry.html</a>
-</dd></dl></section></section></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/");
+ </script>
+ </head>
+ <body>
+ The MSE specification has moved to <a href="https://w3c.github.io/media-source/">https://w3c.github.io/media-source/</a>.
+ </body>
+</html>
--- a/media-source/mp2t-byte-stream-format-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>MPEG-2 TS Byte Stream Format</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- (function() {
- var mp2tContainerSpecDefinitions = {
- 'iso-13818-1': { fragment: 'http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169', link_text: 'ISO/IEC 13818-1', },
-
- 'mpeg2ts-timestampOffset': { helper_type: 'var', fragment: '#mpeg2ts-timestampOffset', link_text: 'MPEG2TS_timestampOffset', },
- };
-
- mediaSourceAddDefinitionInfo("mp2t-byte-stream-format", "", mp2tContainerSpecDefinitions);
- })();
- </script>
-
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- { name: "Adrian Bateman", url: "", company: "Microsoft Corporation", companyURL: "http://www.microsoft.com/" },
- { name: "Mark Watson", url: "", company: "Netflix Inc.", companyURL: "http://www.netflix.com/" },
- ],
-
- mseDefGroupName: "mp2t-byte-stream-format",
- mseUnusedGroupNameExcludeList: ["media-source"],
- mseContributors: [
- "Bob Lund",
- "Alex Giladi",
- "Duncan Rowden",
- "Mark Vickers",
- "Glenn Adams",
- "Michael Thornburgh",
- "David Singer",
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {
- SourceBuffer: function() {},
- },
-
- postProcess: [ mediaSourcePostProcessor ]
-
- };
- </script>
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
-
- </head>
- <body>
- <section id="abstract">
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on MPEG-2 Transport Streams.
- </section>
-
- <section id="introduction">
- <h2>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support MPEG-2 Transport Streams
- (MPEG-2 TS) specified in <a def-id="iso-13818-1"></a>.</p> It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a def-id="init-segments"></a>, <a def-id="media-segments"></a>, and <a def-id="random-access-points"></a> required by
- the <a def-id="byte-stream-formats-section"></a> of the Media Source Extensions spec. This document also defines extra behaviors and state that only apply to this
- byte stream format.</p>
- </section>
-
- <section id="mime-parameters">
- <h2>MIME-type info</h2>
- <p>The MIME-type/subtype pair of "video/MP2T", as specified in <a href="http://tools.ietf.org/html/rfc3551">RFC 3551</a>, must be used for byte streams that conform
- to this specification.</p>
-
- <p>This following parameters can be used in the MIME-type passed to <a def-id="isTypeSupported"></a> or <a def-id="addSourceBuffer"></a>.</p>
- <dl>
- <dt>codecs</dt>
- <dd>
- A comma separated list of codec IDs used to specify what codecs will be used in the byte stream. Implementations should accept IDs in the form specified by
- <a href="http://tools.ietf.org/html/rfc6381">RFC 6381</a>.
- <div class="note">Implementations may only implement a subset of the codecs and profiles mentioned in the RFC.</div>
- </dd>
- </dl>
- </section>
-
- <section id="mpeg2ts-general">
- <h4>General Transport Stream Requirements</h4>
- <p>MPEG-2 TS media and initialization segments must conform to the MPEG-2 TS Adaptive Profile (ISO/IEC 13818-1:2012 Amd. 2).</p>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are met:</p>
- <ol>
- <li>Segments do not contain complete MPEG-2 TS packets.</li>
- <li>Segments do not contain complete PES packets and sections.</li>
- <li>Segments contain more than one program.</li>
- <li>At least one MPEG-2 TS packet has a non-zero transport_error_indicator.</li>
- </ol>
- </section>
- <section id="mpeg2ts-init-segments">
- <h4>Initialization Segments</h4>
- <p>An MPEG-2 TS initialization segment consists of a single PAT and a single PMT.</p>
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are met:</p>
- <ol>
- <li>A PAT is not present in the <a def-id="init-segment"></a></li>
- <li>A PMT is not present in the <a def-id="init-segment"></a></li>
- </ol>
- The user agent must accept and ignore other SI, such as CAT, that are invariant for all subsequent media segments.
- </section>
-
- <section id="mpeg2ts-media-segments">
- <h4>Media Segments</h4>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are met:</p>
- <ol>
- <li>A media segment relies on initialization information in another media segment.</li>
- <li>At least one PES packet does not have a PTS timestamp.</li>
- <li>PCR is not present in the Segment prior to the first byte of a TS packet payload containing media data.</li>
- </ol>
-
- The user agent will accept and ignore PSI that is identical to the information in the last initialization segment which may appear repeatedly throughout the segment.
- </section>
-
- <section id="mpeg2ts-random-access-points">
- <h4>Random Access Points</h4>
- <p>A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in
- <a def-id="iso-13818-1"></a>.</p>
- </section>
- <section id="mpeg2ts-discontinuities">
- <h4>Timestamp Rollover & Discontinuities</h4>
- <p>Timestamp rollovers and discontinuities must be handled by the UA. The UA's MPEG-2 TS implementation must maintain an internal offset
- variable, <dfn id="mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</dfn>, to keep track of the offset that needs to be applied to timestamps
- that have rolled over or are part of a discontinuity. <var>MPEG2TS_timestampOffset</var> is initially set to 0 when the <a class="externalDFN">SourceBuffer</a> is
- created. This offset must be applied to the timestamps as part of the conversion process from MPEG-2 TS packets
- into <a def-id="coded-frames"></a> for the <a def-id="coded-frame-processing-algorithm"></a>. This results in the coded frame timestamps
- for a packet being computed by the following equations:</p>
- <pre>
- Coded Frame Presentation Timestamp = (MPEG-2 TS presentation timestamp) + <var>MPEG2TS_timestampOffset</var>
- Coded Frame Decode Timestamp = (MPEG-2 TS decode timestamp) + <var>MPEG2TS_timestampOffset</var></pre>
-
- <p><a def-id="mpeg2ts-timestampOffset"></a> is updated in the following ways:</p>
- <ul>
- <li>Each time a timestamp rollover is detected, 2^33 must be added to <a def-id="mpeg2ts-timestampOffset"></a>.</li>
- <li>When a discontinuity is detected, <a def-id="mpeg2ts-timestampOffset"></a> must be adjusted to make the timestamps after the discontinuity appear
- to come immediately after the timestamps before the discontinuity.</li>
- <li>When <a def-id="abort"></a> is called, <a def-id="mpeg2ts-timestampOffset"></a> must be set to 0.</li>
- <li>When <a def-id="timestampOffset"></a> is successfully set, <a def-id="mpeg2ts-timestampOffset"></a> must be set to 0.</li>
- </ul>
- </section>
-
- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section>
- </body>
-</html>
--- a/media-source/mp2t-byte-stream-format.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/mp2t-byte-stream-format.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,392 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>MPEG-2 TS Byte Stream Format</title>
-
-
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <style>/* --- ISSUES/NOTES --- */
-div.issue-title, div.note-title {
- padding-right: 1em;
- min-width: 7.5em;
- color: #b9ab2d;
-}
-div.issue-title { color: #e05252; }
-div.note-title { color: #2b2; }
-div.issue-title span, div.note-title span {
- text-transform: uppercase;
-}
-div.note, div.issue {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-.note > p:first-child, .issue > p:first-child { margin-top: 0 }
-.issue, .note {
- padding: .5em;
- border-left-width: .5em;
- border-left-style: solid;
-}
-div.issue, div.note {
- padding: 1em 1.2em 0.5em;
- margin: 1em 0;
- position: relative;
- clear: both;
-}
-span.note, span.issue { padding: .1em .5em .15em; }
-
-.issue {
- border-color: #e05252;
- background: #fbe9e9;
-}
-.note {
- border-color: #52e052;
- background: #e9fbe9;
-}
-
-
-</style><link rel="stylesheet" href="mse.css">
-
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" style="" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">MPEG-2 TS Byte Stream Format</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2013-12-03T02:26:55.000Z" id="w3c-editor-s-draft-02-december-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2013-12-02">02 December 2013</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR//">http://www.w3.org/TR//</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html</a></dd>
-
-
-
-
-
-
-
-
- <dt>Editors:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Adrian Bateman</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.microsoft.com/">Microsoft Corporation</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mark Watson</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.netflix.com/">Netflix Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2013
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
- <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2><p>
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on MPEG-2 Transport Streams.
- </p></section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2>
-
-
-
- <p>
- <em>This section describes the status of this document at the time of its publication.
- Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the
- latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at
- http://www.w3.org/TR/.</em>
- </p>
-
- <p>
- This document was published by the <a href="http://www.w3.org/html/wg/">HTML Working Group</a> as an Editor's Draft.
-
-
- If you wish to make comments regarding this document, please send them to
- <a href="mailto:public-html-media@w3.org">public-html-media@w3.org</a>
- (<a href="mailto:public-html-media-request@w3.org?subject=subscribe">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
-
-
-
-
- All comments are welcome.
-
- </p>
-
-
- <p>
- Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
- Membership. This is a draft document and may be updated, replaced or obsoleted by other
- documents at any time. It is inappropriate to cite this document as other than work in
- progress.
- </p>
-
-
- <p>
-
- This document was produced by a group operating under the
- <a id="sotd_patent" about="" rel="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
- Policy</a>.
-
-
-
-
- <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
- disclosures</a>
-
- made in connection with the deliverables of the group; that page also includes
- instructions for disclosing a patent. An individual who has actual knowledge of a patent
- which the individual believes contains
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
- Claim(s)</a> must disclose the information in accordance with
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
- 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
-
-
- </p>
-
-
-
-
-</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#mime-parameters" class="tocxref"><span class="secno">2. </span>MIME-type info</a></li><li class="tocline"><a href="#mpeg2ts-general" class="tocxref"><span class="secno">3. </span>General Transport Stream Requirements</a></li><li class="tocline"><a href="#mpeg2ts-init-segments" class="tocxref"><span class="secno">4. </span>Initialization Segments</a></li><li class="tocline"><a href="#mpeg2ts-media-segments" class="tocxref"><span class="secno">5. </span>Media Segments</a></li><li class="tocline"><a href="#mpeg2ts-random-access-points" class="tocxref"><span class="secno">6. </span>Random Access Points</a></li><li class="tocline"><a href="#mpeg2ts-discontinuities" class="tocxref"><span class="secno">7. </span>Timestamp Rollover & Discontinuities</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">8. </span>Acknowledgments</a></li></ul></section>
-
- <section id="introduction" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_introduction"><span class="secno">1. </span>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support MPEG-2 Transport Streams
- (MPEG-2 TS) specified in <a href="http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169">ISO/IEC 13818-1</a>.</p> It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segments</a>, <a href="http://www.w3.org/TR/media-source/#media-segment">media segments</a>, and <a href="http://www.w3.org/TR/media-source/#random-access-point">random access points</a> required by
- the <a href="http://www.w3.org/TR/media-source/#byte-stream-formats">byte stream formats section</a> of the Media Source Extensions spec. This document also defines extra behaviors and state that only apply to this
- byte stream format.<p></p>
- </section>
-
- <section id="mime-parameters" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mime-parameters"><span class="secno">2. </span>MIME-type info</h2>
- <p>The MIME-type/subtype pair of "video/MP2T", as specified in <a href="http://tools.ietf.org/html/rfc3551">RFC 3551</a>, must be used for byte streams that conform
- to this specification.</p>
-
- <p>This following parameters can be used in the MIME-type passed to <code><a href="http://www.w3.org/TR/media-source/#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported()</a></code> or <code><a href="http://www.w3.org/TR/media-source/#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.</p>
- <dl>
- <dt>codecs</dt>
- <dd>
- A comma separated list of codec IDs used to specify what codecs will be used in the byte stream. Implementations should accept IDs in the form specified by
- <a href="http://tools.ietf.org/html/rfc6381">RFC 6381</a>.
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_1"><span>Note</span></div><div class="">Implementations may only implement a subset of the codecs and profiles mentioned in the RFC.</div></div>
- </dd>
- </dl>
- </section>
-
- <section id="mpeg2ts-general" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg2ts-general"><span class="secno">3. </span>General Transport Stream Requirements</h2>
- <p>MPEG-2 TS media and initialization segments must conform to the MPEG-2 TS Adaptive Profile (ISO/IEC 13818-1:2012 Amd. 2).</p>
-
- <p>The user agent must run the <a href="http://www.w3.org/TR/media-source/#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="http://www.w3.org/TR/media-source/#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are met:</p>
- <ol>
- <li>Segments do not contain complete MPEG-2 TS packets.</li>
- <li>Segments do not contain complete PES packets and sections.</li>
- <li>Segments contain more than one program.</li>
- <li>At least one MPEG-2 TS packet has a non-zero transport_error_indicator.</li>
- </ol>
- </section>
- <section id="mpeg2ts-init-segments" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg2ts-init-segments"><span class="secno">4. </span>Initialization Segments</h2>
- <p>An MPEG-2 TS initialization segment consists of a single PAT and a single PMT.</p>
- <p>The user agent must run the <a href="http://www.w3.org/TR/media-source/#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="http://www.w3.org/TR/media-source/#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are met:</p>
- <ol>
- <li>A PAT is not present in the <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segment</a></li>
- <li>A PMT is not present in the <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segment</a></li>
- </ol>
- The user agent must accept and ignore other SI, such as CAT, that are invariant for all subsequent media segments.
- </section>
-
- <section id="mpeg2ts-media-segments" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg2ts-media-segments"><span class="secno">5. </span>Media Segments</h2>
-
- <p>The user agent must run the <a href="http://www.w3.org/TR/media-source/#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="http://www.w3.org/TR/media-source/#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are met:</p>
- <ol>
- <li>A media segment relies on initialization information in another media segment.</li>
- <li>At least one PES packet does not have a PTS timestamp.</li>
- <li>PCR is not present in the Segment prior to the first byte of a TS packet payload containing media data.</li>
- </ol>
-
- The user agent will accept and ignore PSI that is identical to the information in the last initialization segment which may appear repeatedly throughout the segment.
- </section>
-
- <section id="mpeg2ts-random-access-points" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg2ts-random-access-points"><span class="secno">6. </span>Random Access Points</h2>
- <p>A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in
- <a href="http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169">ISO/IEC 13818-1</a>.</p>
- </section>
- <section id="mpeg2ts-discontinuities" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg2ts-discontinuities"><span class="secno">7. </span>Timestamp Rollover & Discontinuities</h2>
- <p>Timestamp rollovers and discontinuities must be handled by the UA. The UA's MPEG-2 TS implementation must maintain an internal offset
- variable, <dfn id="mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</dfn>, to keep track of the offset that needs to be applied to timestamps
- that have rolled over or are part of a discontinuity. <var>MPEG2TS_timestampOffset</var> is initially set to 0 when the <code><a href="http://www.w3.org/TR/media-source/#idl-def-SourceBuffer" class="idlType">SourceBuffer</a></code> is
- created. This offset must be applied to the timestamps as part of the conversion process from MPEG-2 TS packets
- into <a href="http://www.w3.org/TR/media-source/#coded-frame">coded frames</a> for the <a href="http://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a>. This results in the coded frame timestamps
- for a packet being computed by the following equations:</p>
- <pre> Coded Frame Presentation Timestamp = (MPEG-2 TS presentation timestamp) + <var>MPEG2TS_timestampOffset</var>
- Coded Frame Decode Timestamp = (MPEG-2 TS decode timestamp) + <var>MPEG2TS_timestampOffset</var></pre>
-
- <p><var><a href="#mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</a></var> is updated in the following ways:</p>
- <ul>
- <li>Each time a timestamp rollover is detected, 2^33 must be added to <var><a href="#mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</a></var>.</li>
- <li>When a discontinuity is detected, <var><a href="#mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</a></var> must be adjusted to make the timestamps after the discontinuity appear
- to come immediately after the timestamps before the discontinuity.</li>
- <li>When <code><a href="http://www.w3.org/TR/media-source/#widl-SourceBuffer-abort-void">abort()</a></code> is called, <var><a href="#mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</a></var> must be set to 0.</li>
- <li>When <code><a href="http://www.w3.org/TR/media-source/#widl-SourceBuffer-timestampOffset">timestampOffset</a></code> is successfully set, <var><a href="#mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</a></var> must be set to 0.</li>
- </ul>
- </section>
-
- <section id="acknowledgements" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_acknowledgements"><span class="secno">8. </span>Acknowledgments</h2>
- The editors would like to thank Alex Giladi, Bob Lund, David Singer, Duncan Rowden, Glenn Adams, Mark Vickers, and Michael Thornburgh for their contributions to this specification.
- </section>
-
-
-<form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/mp2t-byte-stream-format.html");
+ </script>
+ </head>
+ <body>
+ The MPEG-2 TS Byte Stream Format spec has moved to <a href="https://w3c.github.io/media-source/mp2t-byte-stream-format.html">https://w3c.github.io/media-source/mp2t-byte-stream-format.html</a>.
+ </body>
+</html>
--- a/media-source/mpeg-audio-byte-stream-format-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>MPEG Audio Byte Stream Format</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- (function() {
- var mpegContainerSpecDefinitions = {
- 'iso-11172-3': { fragment: 'http://www.iso.org/iso/catalogue_detail.htm?csnumber=22412', link_text: 'ISO/IEC 11172-3:1993', },
- 'iso-13818-3': { fragment: 'http://www.iso.org/iso/catalogue_detail.htm?csnumber=26797', link_text: 'ISO/IEC 13818-3:1998', },
- 'iso-14496-3': { fragment: 'http://www.iso.org/iso/catalogue_detail.htm?csnumber=53943', link_text: 'ISO/IEC 14496-3:2009', },
- 'id3v1': { fragment: 'http://id3.org/ID3v1', link_text: 'ID3v1', },
- 'id3v2': { fragment: 'http://id3.org/id3v2.3.0', link_text: 'ID3v2', },
- 'icecast-headers': { fragment: '#icecast-header', link_text: 'Icecast headers', },
- 'mpeg-mime-type': { fragment: '#mime-types', link_text: 'MIME-type', },
- 'mpeg-mime-types': { fragment: '#mime-types', link_text: 'MIME-types', },
- 'mpeg-audio-frame': { fragment: '#mpeg-audio-frame', link_text: 'MPEG Audio Frame', },
- 'mpeg-audio-frames': { fragment: '#mpeg-audio-frame', link_text: 'MPEG Audio Frames', },
- 'mpeg-audio-metadata-frames': { fragment: '#mpeg-metadata', link_text: 'Metadata Frames', },
- };
-
- mediaSourceAddDefinitionInfo("mpeg-byte-stream-format", "", mpegContainerSpecDefinitions);
- })();
- </script>
-
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mpeg-audio-byte-stream-format.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- //publishDate: "2014-07-17",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- { name: "Dale Curtis", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- ],
-
- mseDefGroupName: "mpeg-byte-stream-format",
- mseUnusedGroupNameExcludeList: ["media-source"],
- mseContributors: [
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {
- SourceBuffer: function() {},
- },
-
- postProcess: [ mediaSourcePostProcessor ]
-
- };
- </script>
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
-
- </head>
- <body>
- <section id="abstract">
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on MPEG audio streams.
- </section>
-
- <section id="introduction">
- <h2>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support MPEG audio streams specified in <a def-id="iso-11172-3"></a>, <a def-id="iso-13818-3"></a>, and <a def-id="iso-14496-3"></a>.</p>
- <p>It defines the <a def-id="mpeg-mime-types"></a> used to signal codecs, and provides the necessary format specific definitions for <a def-id="init-segments"></a>, <a def-id="media-segments"></a>, and <a def-id="random-access-points"></a> required by the <a def-id="byte-stream-formats-section"></a> of the Media Source Extensions spec. It also defines extra behaviors and state that only apply to this byte stream format.</p>
- </section>
-
- <section id="mime-types">
- <h2>MIME-types</h2>
- <p>This section specifies the MIME-types that may be passed to <a def-id="isTypeSupported"></a> or <a def-id="addSourceBuffer"></a> for byte streams that conform to this specification.</p>
- <ul>
- <li>"audio/aac" for sequences of ADTS frames, as specified in <a def-id="iso-14496-3"></a>.</li>
- <li>"audio/mpeg" for MPEG-1/2/2.5 Layer I/II/III streams, as specified in <a href="http://tools.ietf.org/html/rfc3003">RFC 3003</a>.</li>
- </ul>
- <p>The "codecs" MIME-type parameter must not be used with these MIME-types.</p>
- </section>
-
- <section id="mpeg-audio-frames">
- <h2>MPEG Audio Frames</h2>
- <p>The format of an <dfn id="mpeg-audio-frame">MPEG Audio Frame</dfn> depends on the <a def-id="mpeg-mime-type"></a> used.</p>
- <ul>
- <li>If the "audio/aac" MIME-type is used, an MPEG Audio Frame is a sequence of bytes that conform to the adts_frame() syntax specified in Table 1.A.5 of <a def-id="iso-14496-3"></a>.</li>
- <li>If the "audio/mpeg" MIME-type is used, an MPEG Audio Frame is a sequence of bytes that conform to the frame() syntax element specified in Section 2.4.1.2 of <a def-id="iso-11172-3"></a> or the corresponding definition in <a def-id="iso-13818-3"></a>.</li>
- </ul>
- </section>
-
- <section id="mpeg-metadata">
- <h4>Metadata Frames</h4>
- <p>Since <a def-id="id3v1"></a>, <a def-id="id3v2"></a> metadata frames, and <a def-id="icecast-headers"></a> are common in existing MPEG audio streams, implementations should gracefully handle such frames. Zero or more of these metadata frames are allowed to occur before, after, or between <a def-id="mpeg-audio-frames"></a>. Minimal implementations must accept, consume, and ignore these frames. More advanced implementations may choose to expose the metadata information via an inband <a def-id="text-track"></a> or some other mechanism.</p>
-
- <section id="icecast">
- <h3>Icecast headers</h3>
- <p>There is no normative spec for <a href="http://en.wikipedia.org/wiki/Icecast">Icecast</a>/<a href="http://en.wikipedia.org/wiki/SHOUTcast">SHOUTcast</a> headers, just <a href="http://forums.radiotoolbox.com/viewtopic.php?t=74">examples</a>. For the purpose of this specification, an <dfn id="icecast-header">Icecast header</dfn> is defined as beginning with the 4 character sequence "ICY "(U+0049 I, U+0043 C, U+0059 Y, U+0020 SPACE) and ending with a pair of carriage-return line-feed sequences (U+000D CARRIAGE RETURN, U+000A LINE FEED, U+000D CARRIAGE RETURN, U+000A LINE FEED).</p>
- <p class="note">Icecast headers are allowed in the byte streams because some Icecast and SHOUTcast
- servers return a status line that looks like "ICY OK 200" instead of a standard HTTP status line.
- User-agent network stacks typically interpret this as an HTTP 0.9 response and include the
- header in the response body. Allowing these headers to appear provides a simple way to
- interoperate with these servers.</p>
- </section>
- </section>
-
- <section id="mpeg-segments">
- <h4>Segment Definitions</h4>
- <p>The MPEG audio byte stream is a combination of one or more <a def-id="mpeg-audio-frames"></a> and zero or more <a def-id="mpeg-audio-metadata-frames"></a>.</p>
- <ul>
- <li>Every <a def-id="mpeg-audio-frame"></a> is a <a def-id="random-access-point"></a>.</li>
- <li>Every <a def-id="mpeg-audio-frame"></a> header is an <a def-id="init-segment"></a>.</li>
- <li>The coded audio in each <a def-id="mpeg-audio-frame"></a> is a <a def-id="media-segment"></a>.</li>
- </ul>
- </section>
-
-<!-- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section> -->
- </body>
-</html>
--- a/media-source/mpeg-audio-byte-stream-format.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/mpeg-audio-byte-stream-format.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,353 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>MPEG Audio Byte Stream Format</title>
-
-
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <style>/* --- ISSUES/NOTES --- */
-div.issue-title, div.note-title {
- padding-right: 1em;
- min-width: 7.5em;
- color: #b9ab2d;
-}
-div.issue-title { color: #e05252; }
-div.note-title { color: #2b2; }
-div.issue-title span, div.note-title span {
- text-transform: uppercase;
-}
-div.note, div.issue {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-.note > p:first-child, .issue > p:first-child { margin-top: 0 }
-.issue, .note {
- padding: .5em;
- border-left-width: .5em;
- border-left-style: solid;
-}
-div.issue, div.note {
- padding: 1em 1.2em 0.5em;
- margin: 1em 0;
- position: relative;
- clear: both;
-}
-span.note, span.issue { padding: .1em .5em .15em; }
-
-.issue {
- border-color: #e05252;
- background: #fbe9e9;
-}
-.note {
- border-color: #52e052;
- background: #e9fbe9;
-}
-
-
-</style><link rel="stylesheet" href="mse.css">
-
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">MPEG Audio Byte Stream Format</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-04-30T03:33:49.000Z" id="w3c-editor-s-draft-29-april-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-04-29">29 April 2014</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mpeg-audio-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-audio-source/mpeg-byte-stream-format.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR//">http://www.w3.org/TR//</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mpeg-audio-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mpeg-audio-byte-stream-format.html</a></dd>
-
-
-
-
-
-
-
-
- <dt>Editors:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Dale Curtis</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2014
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
- <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2><p>
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on MPEG audio streams.
- </p></section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2>
-
-
-
- <p>
- <em>This section describes the status of this document at the time of its publication.
- Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the
- latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at
- http://www.w3.org/TR/.</em>
- </p>
-
- <p>
- This document was published by the <a href="http://www.w3.org/html/wg/">HTML Working Group</a> as an Editor's Draft.
-
-
- If you wish to make comments regarding this document, please send them to
- <a href="mailto:public-html-media@w3.org">public-html-media@w3.org</a>
- (<a href="mailto:public-html-media-request@w3.org?subject=subscribe">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
-
-
-
-
- All comments are welcome.
-
- </p>
-
-
- <p>
- Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
- Membership. This is a draft document and may be updated, replaced or obsoleted by other
- documents at any time. It is inappropriate to cite this document as other than work in
- progress.
- </p>
-
-
- <p>
-
- This document was produced by a group operating under the
- <a id="sotd_patent" about="" rel="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
- Policy</a>.
-
-
-
-
- <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
- disclosures</a>
-
- made in connection with the deliverables of the group; that page also includes
- instructions for disclosing a patent. An individual who has actual knowledge of a patent
- which the individual believes contains
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
- Claim(s)</a> must disclose the information in accordance with
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
- 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
-
-
- </p>
-
-
-
-
-</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#mime-types" class="tocxref"><span class="secno">2. </span>MIME-types</a></li><li class="tocline"><a href="#mpeg-audio-frames" class="tocxref"><span class="secno">3. </span>MPEG Audio Frames</a></li><li class="tocline"><a href="#mpeg-metadata" class="tocxref"><span class="secno">4. </span>Metadata Frames</a><ul class="toc"><li class="tocline"><a href="#icecast" class="tocxref"><span class="secno">4.1 </span>Icecast headers</a></li></ul></li><li class="tocline"><a href="#mpeg-segments" class="tocxref"><span class="secno">5. </span>Segment Definitions</a></li></ul></section>
-
- <section id="introduction" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_introduction"><span class="secno">1. </span>Introduction</h2>
- <p>This specification defines segment formats for implementations that choose to support MPEG audio streams specified in <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=22412">ISO/IEC 11172-3:1993</a>, <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=26797">ISO/IEC 13818-3:1998</a>, and <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=53943">ISO/IEC 14496-3:2009</a>.</p>
- <p>It defines the <a href="#mime-types">MIME-types</a> used to signal codecs, and provides the necessary format specific definitions for <a href="media-source.html#init-segment">initialization segments</a>, <a href="media-source.html#media-segment">media segments</a>, and <a href="media-source.html#random-access-point">random access points</a> required by the <a href="media-source.html#byte-stream-formats">byte stream formats section</a> of the Media Source Extensions spec. It also defines extra behaviors and state that only apply to this byte stream format.</p>
- </section>
-
- <section id="mime-types" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mime-types"><span class="secno">2. </span>MIME-types</h2>
- <p>This section specifies the MIME-types that may be passed to <code><a href="media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported()</a></code> or <code><a href="media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> for byte streams that conform to this specification.</p>
- <ul>
- <li>"audio/aac" for sequences of ADTS frames, as specified in <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=53943">ISO/IEC 14496-3:2009</a>.</li>
- <li>"audio/mpeg" for MPEG-1/2/2.5 Layer I/II/III streams, as specified in <a href="http://tools.ietf.org/html/rfc3003">RFC 3003</a>.</li>
- </ul>
- <p>The "codecs" MIME-type parameter must not be used with these MIME-types.</p>
- </section>
-
- <section id="mpeg-audio-frames" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg-audio-frames"><span class="secno">3. </span>MPEG Audio Frames</h2>
- <p>The format of an <dfn id="mpeg-audio-frame">MPEG Audio Frame</dfn> depends on the <a href="#mime-types">MIME-type</a> used.</p>
- <ul>
- <li>If the "audio/aac" MIME-type is used, an MPEG Audio Frame is a sequence of bytes that conform to the adts_frame() syntax specified in Table 1.A.5 of <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=53943">ISO/IEC 14496-3:2009</a>.</li>
- <li>If the "audio/mpeg" MIME-type is used, an MPEG Audio Frame is a sequence of bytes that conform to the frame() syntax element specified in Section 2.4.1.2 of <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=22412">ISO/IEC 11172-3:1993</a> or the corresponding definition in <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=26797">ISO/IEC 13818-3:1998</a>.</li>
- </ul>
- </section>
-
- <section id="mpeg-metadata" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg-metadata"><span class="secno">4. </span>Metadata Frames</h2>
- <p>Since <a href="http://id3.org/ID3v1">ID3v1</a>, <a href="http://id3.org/id3v2.3.0">ID3v2</a> metadata frames, and <a href="#icecast-header">Icecast headers</a> are common in existing MPEG audio streams, implementations should gracefully handle such frames. Zero or more of these metadata frames are allowed to occur before, after, or between <a href="#mpeg-audio-frame">MPEG Audio Frames</a>. Minimal implementations must accept, consume, and ignore these frames. More advanced implementations may choose to expose the metadata information via an inband <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> or some other mechanism.</p>
-
- <section id="icecast" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <h3 aria-level="2" role="heading" id="h3_icecast"><span class="secno">4.1 </span>Icecast headers</h3>
- <p>There is no normative spec for <a href="http://en.wikipedia.org/wiki/Icecast">Icecast</a>/<a href="http://en.wikipedia.org/wiki/SHOUTcast">SHOUTcast</a> headers, just <a href="http://forums.radiotoolbox.com/viewtopic.php?t=74">examples</a>. For the purpose of this specification, an <dfn id="icecast-header">Icecast header</dfn> is defined as beginning with the 4 character sequence "ICY "(U+0049 I, U+0043 C, U+0059 Y, U+0020 SPACE) and ending with a pair of carriage-return line-feed sequences (U+000D CARRIAGE RETURN, U+000A LINE FEED, U+000D CARRIAGE RETURN, U+000A LINE FEED).</p>
- <div class="note"><div class="note-title" aria-level="3" role="heading" id="h_note_1"><span>Note</span></div><p class="">Icecast headers are allowed in the byte streams because some Icecast and SHOUTcast
- servers return a status line that looks like "ICY OK 200" instead of a standard HTTP status line.
- User-agent network stacks typically interpret this as an HTTP 0.9 response and include the
- header in the response body. Allowing these headers to appear provides a simple way to
- interoperate with these servers.</p></div>
- </section>
- </section>
-
- <section id="mpeg-segments" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_mpeg-segments"><span class="secno">5. </span>Segment Definitions</h2>
- <p>The MPEG audio byte stream is a combination of one or more <a href="#mpeg-audio-frame">MPEG Audio Frames</a> and zero or more <a href="#mpeg-metadata">Metadata Frames</a>.</p>
- <ul>
- <li>Every <a href="#mpeg-audio-frame">MPEG Audio Frame</a> is a <a href="media-source.html#random-access-point">random access point</a>.</li>
- <li>Every <a href="#mpeg-audio-frame">MPEG Audio Frame</a> header is an <a href="media-source.html#init-segment">initialization segment</a>.</li>
- <li>The coded audio in each <a href="#mpeg-audio-frame">MPEG Audio Frame</a> is a <a href="media-source.html#media-segment">media segment</a>.</li>
- </ul>
- </section>
-
-<!-- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section> -->
-
-
-<form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/mpeg-audio-byte-stream-format.html");
+ </script>
+ </head>
+ <body>
+ The MPEG Audio Byte Stream Format spec has moved to <a href="https://w3c.github.io/media-source/mpeg-audio-byte-stream-format.html">https://w3c.github.io/media-source/mpeg-audio-byte-stream-format.html</a>.
+ </body>
+</html>
--- a/media-source/webm-byte-stream-format-respec.html Mon Nov 17 16:21:58 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>WebM Byte Stream Format</title>
- <script src="respec-w3c-common.js" class="remove"></script>
- <script src="media-source.js" class="remove"></script>
- <script class="remove">
- (function() {
- var webmContainerSpecDefinitions = {
- 'webm-spec': { fragment: '#webm-guidelines', link_text: 'WebM spec', },
- 'webm-ebml-header': { fragment: '#ebml-basics', link_text: 'EBML Header', },
- 'webm-segment': { fragment: '#segment', link_text: 'Segment', },
- 'webm-info': { fragment: '#segment-information', link_text: 'Segment Information', },
- 'webm-tracks': { fragment: '#track', link_text: 'Tracks', },
- 'webm-cues': { fragment: '#cueing-data', link_text: 'Cues', },
- 'webm-chapters': { fragment: '#chapters', link_text: 'Chapters', },
- 'webm-cluster': { fragment: '#cluster', link_text: 'Cluster', },
- 'webm-muxer-guidelines': { fragment: '#muxer-guidelines', link_text: 'WebM Muxer Guidelines', },
- };
-
- var webmByteStreamFormatDefinitions = {
- 'webm-init-segment': { fragment: '#webm-init-segments', link_text: 'WebM initialization segment', },
- };
-
- mediaSourceAddDefinitionInfo("webm-container-spec", "http://www.webmproject.org/code/specs/container/", webmContainerSpecDefinitions);
- mediaSourceAddDefinitionInfo("webm-byte-stream-format", "", webmByteStreamFormatDefinitions);
- })();
- </script>
-
- <script class="remove">
- var respecConfig = {
- // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
- specStatus: "ED",
-
- // the specification's short name, as in http://www.w3.org/TR/short-name/
- shortName: "",
-
- // if there a publicly available Editor's Draft, this is the link
- edDraftURI: "http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/webm-byte-stream-format.html",
-
- // if this is a LCWD, uncomment and set the end of its review period
- // lcEnd: "2009-08-05",
-
- // editors, add as many as you like
- // only "name" is required
- editors: [
- { name: "Aaron Colwell", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
- ],
-
- mseDefGroupName: "webm-byte-stream-format",
- mseUnusedGroupNameExcludeList: ["media-source"],
- mseContributors: [
- "Frank Galligan",
- "Philip Jägenstedt",
- ],
-
- // name of the WG
- wg: "HTML Working Group",
-
- // URI of the public WG page
- wgURI: "http://www.w3.org/html/wg/",
-
- // name (without the @w3c.org) of the public mailing to which comments are due
- wgPublicList: "public-html-media",
-
- // URI of the patent status for this WG, for Rec-track documents
- // !!!! IMPORTANT !!!!
- // This is important for Rec-track documents, do not copy a patent URI from a random
- // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
- // Team Contact.
- wgPatentURI: "http://www.w3.org/2004/01/pp-impl/40318/status",
-
- noIDLIn: true,
-
- scheme: "https",
-
- preProcess: [ mediaSourcePreProcessor ],
-
- // Empty definitions for objects declared in the document are here to
- // prevent error messages from being displayed for references to these objects.
- definitionMap: {},
-
- postProcess: [ mediaSourcePostProcessor ]
-
- };
- </script>
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <link rel="stylesheet" href="mse.css">
- </head>
- <body>
- <section id="abstract">
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on the WebM container format.
- </section>
-
- <section id="introduction">
- <h2>Introduction</h2>
- <p>This specification describes a byte stream format based on the WebM container format. It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a def-id="init-segments"></a>, <a def-id="media-segments"></a>, and <a def-id="random-access-points"></a> required by
- the <a def-id="byte-stream-formats-section"></a> of the Media Source Extensions spec.</p>
- </section>
-
- <section id="webm-mime-parameters">
- <h2>MIME-type parameters</h2>
- <p>This section specifies the parameters that can be used in the MIME-type passed to <a def-id="isTypeSupported"></a> or <a def-id="addSourceBuffer"></a>.</p>
- <dl>
- <dt>codecs</dt>
- <dd>
- A comma separated list of codec IDs used to specify what codecs will be used in the byte stream.
- <table class="old-table">
- <thead>
- <tr>
- <th>Codec ID</th>
- <th>Valid with "audio/webm"</th>
- <th>Valid with "video/webm"</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>vorbis</td>
- <td>true</td>
- <td>true</td>
- </tr>
- <tr>
- <td>opus</td>
- <td>true</td>
- <td>true</td>
- </tr>
- <tr>
- <td>vp8</td>
- <td>false</td>
- <td>true</td>
- </tr>
- <tr>
- <td>vp9</td>
- <td>false</td>
- <td>true</td>
- </tr>
- </tbody>
- </table>
- <div class="note">
- Implementations should support all of the codec IDs mentioned in the table above.
- </div>
-
- <p>Examples of valid MIME-types with a codecs parameter.</p>
- <ul>
- <li>audio/webm;codecs="vorbis"</li>
- <li>video/webm;codecs="vorbis"</li>
- <li>video/webm;codecs="vp8"</li>
- <li>video/webm;codecs="vp8,vorbis"</li>
- <li>video/webm;codecs="vp9,opus"</li>
- </ul>
- </dd>
- </dl>
- </section>
-
- <section id="webm-init-segments">
- <h2>Initialization Segments</h2>
- <p>A WebM <a def-id="init-segment"></a> must contain a subset of the elements at the start of a typical WebM file.</p>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are not met:</p>
- <ol>
- <li>The <a def-id="init-segment"></a> must start with an <a def-id="webm-ebml-header"></a> element, followed by a <a def-id="webm-segment"></a> header.</li>
- <li>The size value in the <a def-id="webm-segment"></a> header must signal an "unknown size" or contain a value large enough to include the <a def-id="webm-info"></a> and <a def-id="webm-tracks"></a> elements that follow.</li>
- <li>A <a def-id="webm-info"></a> element and a <a def-id="webm-tracks"></a> element must appear, in that order, after the <a def-id="webm-segment"></a> header and before any further <a def-id="webm-ebml-header"></a> or <a def-id="webm-cluster"></a> elements.
- </li>
- </ol>
- The user agent must accept and ignore any elements other than an <a def-id="webm-ebml-header"></a> or a <a def-id="webm-cluster"></a> that occur before, in between, or after the <a def-id="webm-info"></a> and
- <a def-id="webm-tracks"></a> elements.
- </section>
-
- <section id="webm-media-segments">
- <h2>Media Segments</h2>
- <p>A WebM <a def-id="media-segment"></a> is a single <a def-id="webm-cluster"></a> element.</p>
-
- <p>The user agent uses the following rules when interpreting content in a <a def-id="webm-cluster"></a>:</p>
- <ol>
- <li>The TimecodeScale in the <a def-id="webm-init-segment"></a> most recently appended applies to all timestamps in the <a def-id="webm-cluster"></a></li>
- <li>The Timecode element in the <a def-id="webm-cluster"></a> contains a <a def-id="presentation-timestamp"></a> in TimecodeScale units.</li>
- <li>The Cluster header may contain an "unknown" size value. If it does then the end of the cluster is reached when another <a def-id="webm-cluster"></a> header or an element header that indicates the start
- of an <a def-id="webm-init-segment"></a> is encountered.</li>
- </ol>
-
- <p>The user agent must run the <a def-id="eos-decode"></a> if any of the following conditions are not met:</p>
- <ol>
- <li>The Timecode element must appear before any Block & SimpleBlock elements in a <a def-id="webm-cluster"></a>.</li>
- <li>Block & SimpleBlock elements are in time increasing order consistent with the <a def-id="webm-spec"></a>.</li>
- <li>If the most recent <a def-id="webm-init-segment"></a> describes multiple tracks, then blocks from all the tracks must be interleaved in time increasing order. At least one block from all audio and video
- tracks must be present.</li>
- </ol>
-
- The user agent must accept and ignore <a def-id="webm-cues"></a> or <a def-id="webm-chapters"></a> elements that follow a <a def-id="webm-cluster"></a> element.
- </section>
-
- <section id="webm-random-access-points">
- <h2>Random Access Points</h2>
- <p>A SimpleBlock element with its Keyframe flag set signals the location of a <a def-id="random-access-point"></a> for that track. Media segments containing multiple tracks are only considered a random access
- point if the first SimpleBlock for each track has its Keyframe flag set. The order of the multiplexed blocks must conform to the <a def-id="webm-muxer-guidelines"></a>.</p>
- </section>
-
- <section id="acknowledgements">
- <h2>Acknowledgments</h2>
- The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
- </section>
- </body>
-</html>
--- a/media-source/webm-byte-stream-format.html Mon Nov 17 16:21:58 2014 -0800
+++ b/media-source/webm-byte-stream-format.html Tue Nov 18 11:50:39 2014 -0800
@@ -1,405 +1,13 @@
<!DOCTYPE html>
-<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<html lang="en">
+ <head>
+ <meta charset='utf-8'/>
<title>WebM Byte Stream Format</title>
-
-
-
-
-
- <!-- script to register bugs -->
- <script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
- <meta name="bug.short_desc" content="[MSE] ">
- <meta name="bug.product" content="HTML WG">
- <meta name="bug.component" content="Media Source Extensions">
-
- <style>/* --- ISSUES/NOTES --- */
-div.issue-title, div.note-title {
- padding-right: 1em;
- min-width: 7.5em;
- color: #b9ab2d;
-}
-div.issue-title { color: #e05252; }
-div.note-title { color: #2b2; }
-div.issue-title span, div.note-title span {
- text-transform: uppercase;
-}
-div.note, div.issue {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-.note > p:first-child, .issue > p:first-child { margin-top: 0 }
-.issue, .note {
- padding: .5em;
- border-left-width: .5em;
- border-left-style: solid;
-}
-div.issue, div.note {
- padding: 1em 1.2em 0.5em;
- margin: 1em 0;
- position: relative;
- clear: both;
-}
-span.note, span.issue { padding: .1em .5em .15em; }
-
-.issue {
- border-color: #e05252;
- background: #fbe9e9;
-}
-.note {
- border-color: #52e052;
- background: #e9fbe9;
-}
-
-
-</style><link rel="stylesheet" href="mse.css">
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
- <body class="h-entry" style="" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
- <p>
-
- <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
-
- </p>
- <h1 class="title p-name" id="title" property="dcterms:title">WebM Byte Stream Format</h1>
-
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2013-12-03T02:35:25.000Z" id="w3c-editor-s-draft-02-december-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2013-12-02">02 December 2013</time></h2>
- <dl>
-
- <dt>This version:</dt>
- <dd><a class="u-url" href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/webm-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/webm-byte-stream-format.html</a></dd>
- <dt>Latest published version:</dt>
- <dd><a href="http://www.w3.org/TR//">http://www.w3.org/TR//</a></dd>
-
-
- <dt>Latest editor's draft:</dt>
- <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/webm-byte-stream-format.html">http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/webm-byte-stream-format.html</a></dd>
-
-
-
-
-
-
-
-
- <dt>Editor:</dt>
- <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
-</dd>
-
-
-
- </dl>
-
-
-
-
-
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
- 2013
-
- <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
- (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
- <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
- <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>),
-
- All Rights Reserved.
-
- <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
-
- <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
-
- rules apply.
- </p>
-
-
- <hr>
-</div>
- <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2><p>
- This specification defines a <a href="http://www.w3.org/TR/media-source/">Media Source Extensions</a> byte stream format specification based on the WebM container format.
- </p></section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2>
-
-
-
- <p>
- <em>This section describes the status of this document at the time of its publication.
- Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the
- latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at
- http://www.w3.org/TR/.</em>
- </p>
-
- <p>
- This document was published by the <a href="http://www.w3.org/html/wg/">HTML Working Group</a> as an Editor's Draft.
-
-
- If you wish to make comments regarding this document, please send them to
- <a href="mailto:public-html-media@w3.org">public-html-media@w3.org</a>
- (<a href="mailto:public-html-media-request@w3.org?subject=subscribe">subscribe</a>,
- <a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
-
-
-
-
- All comments are welcome.
-
- </p>
-
-
- <p>
- Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
- Membership. This is a draft document and may be updated, replaced or obsoleted by other
- documents at any time. It is inappropriate to cite this document as other than work in
- progress.
- </p>
-
-
- <p>
-
- This document was produced by a group operating under the
- <a id="sotd_patent" about="" rel="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
- Policy</a>.
-
-
-
-
- <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
- disclosures</a>
-
- made in connection with the deliverables of the group; that page also includes
- instructions for disclosing a patent. An individual who has actual knowledge of a patent
- which the individual believes contains
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
- Claim(s)</a> must disclose the information in accordance with
- <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
- 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
-
-
- </p>
-
-
-
-
-</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#webm-mime-parameters" class="tocxref"><span class="secno">2. </span>MIME-type parameters</a></li><li class="tocline"><a href="#webm-init-segments" class="tocxref"><span class="secno">3. </span>Initialization Segments</a></li><li class="tocline"><a href="#webm-media-segments" class="tocxref"><span class="secno">4. </span>Media Segments</a></li><li class="tocline"><a href="#webm-random-access-points" class="tocxref"><span class="secno">5. </span>Random Access Points</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">6. </span>Acknowledgments</a></li></ul></section>
-
- <section id="introduction" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_introduction"><span class="secno">1. </span>Introduction</h2>
- <p>This specification describes a byte stream format based on the WebM container format. It defines the MIME-type parameters used to signal codecs, and provides
- the necessary format specific definitions for <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segments</a>, <a href="http://www.w3.org/TR/media-source/#media-segment">media segments</a>, and <a href="http://www.w3.org/TR/media-source/#random-access-point">random access points</a> required by
- the <a href="http://www.w3.org/TR/media-source/#byte-stream-formats">byte stream formats section</a> of the Media Source Extensions spec.</p>
- </section>
-
- <section id="webm-mime-parameters" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_webm-mime-parameters"><span class="secno">2. </span>MIME-type parameters</h2>
- <p>This section specifies the parameters that can be used in the MIME-type passed to <code><a href="http://www.w3.org/TR/media-source/#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported()</a></code> or <code><a href="http://www.w3.org/TR/media-source/#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.</p>
- <dl>
- <dt>codecs</dt>
- <dd>
- A comma separated list of codec IDs used to specify what codecs will be used in the byte stream.
- <table class="old-table">
- <thead>
- <tr>
- <th>Codec ID</th>
- <th>Valid with "audio/webm"</th>
- <th>Valid with "video/webm"</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>vorbis</td>
- <td>true</td>
- <td>true</td>
- </tr>
- <tr>
- <td>opus</td>
- <td>true</td>
- <td>true</td>
- </tr>
- <tr>
- <td>vp8</td>
- <td>false</td>
- <td>true</td>
- </tr>
- <tr>
- <td>vp9</td>
- <td>false</td>
- <td>true</td>
- </tr>
- </tbody>
- </table>
- <div class="note"><div class="note-title" aria-level="2" role="heading" id="h_note_1"><span>Note</span></div><div class="">
- Implementations should support all of the codec IDs mentioned in the table above.
- </div></div>
-
- <p>Examples of valid MIME-types with a codecs parameter.</p>
- <ul>
- <li>audio/webm;codecs="vorbis"</li>
- <li>video/webm;codecs="vorbis"</li>
- <li>video/webm;codecs="vp8"</li>
- <li>video/webm;codecs="vp8,vorbis"</li>
- <li>video/webm;codecs="vp9,opus"</li>
- </ul>
- </dd>
- </dl>
- </section>
-
- <section id="webm-init-segments" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_webm-init-segments"><span class="secno">3. </span>Initialization Segments</h2>
- <p>A WebM <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segment</a> must contain a subset of the elements at the start of a typical WebM file.</p>
-
- <p>The user agent must run the <a href="http://www.w3.org/TR/media-source/#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="http://www.w3.org/TR/media-source/#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are not met:</p>
- <ol>
- <li>The <a href="http://www.w3.org/TR/media-source/#init-segment">initialization segment</a> must start with an <a href="http://www.webmproject.org/code/specs/container/#ebml-basics">EBML Header</a> element, followed by a <a href="http://www.webmproject.org/code/specs/container/#segment">Segment</a> header.</li>
- <li>The size value in the <a href="http://www.webmproject.org/code/specs/container/#segment">Segment</a> header must signal an "unknown size" or contain a value large enough to include the <a href="http://www.webmproject.org/code/specs/container/#segment-information">Segment Information</a> and <a href="http://www.webmproject.org/code/specs/container/#track">Tracks</a> elements that follow.</li>
- <li>A <a href="http://www.webmproject.org/code/specs/container/#segment-information">Segment Information</a> element and a <a href="http://www.webmproject.org/code/specs/container/#track">Tracks</a> element must appear, in that order, after the <a href="http://www.webmproject.org/code/specs/container/#segment">Segment</a> header and before any further <a href="http://www.webmproject.org/code/specs/container/#ebml-basics">EBML Header</a> or <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> elements.
- </li>
- </ol>
- The user agent must accept and ignore any elements other than an <a href="http://www.webmproject.org/code/specs/container/#ebml-basics">EBML Header</a> or a <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> that occur before, in between, or after the <a href="http://www.webmproject.org/code/specs/container/#segment-information">Segment Information</a> and
- <a href="http://www.webmproject.org/code/specs/container/#track">Tracks</a> elements.
- </section>
-
- <section id="webm-media-segments" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_webm-media-segments"><span class="secno">4. </span>Media Segments</h2>
- <p>A WebM <a href="http://www.w3.org/TR/media-source/#media-segment">media segment</a> is a single <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> element.</p>
-
- <p>The user agent uses the following rules when interpreting content in a <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a>:</p>
- <ol>
- <li>The TimecodeScale in the <a href="#webm-init-segments">WebM initialization segment</a> most recently appended applies to all timestamps in the <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a></li>
- <li>The Timecode element in the <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> contains a <a href="http://www.w3.org/TR/media-source/#presentation-timestamp">presentation timestamp</a> in TimecodeScale units.</li>
- <li>The Cluster header may contain an "unknown" size value. If it does then the end of the cluster is reached when another <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> header or an element header that indicates the start
- of an <a href="#webm-init-segments">WebM initialization segment</a> is encountered.</li>
- </ol>
-
- <p>The user agent must run the <a href="http://www.w3.org/TR/media-source/#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <code><a href="http://www.w3.org/TR/media-source/#idl-def-EndOfStreamError.decode">"decode"</a></code> if any of the following conditions are not met:</p>
- <ol>
- <li>The Timecode element must appear before any Block & SimpleBlock elements in a <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a>.</li>
- <li>Block & SimpleBlock elements are in time increasing order consistent with the <a href="http://www.webmproject.org/code/specs/container/#webm-guidelines">WebM spec</a>.</li>
- <li>If the most recent <a href="#webm-init-segments">WebM initialization segment</a> describes multiple tracks, then blocks from all the tracks must be interleaved in time increasing order. At least one block from all audio and video
- tracks must be present.</li>
- </ol>
-
- The user agent must accept and ignore <a href="http://www.webmproject.org/code/specs/container/#cueing-data">Cues</a> or <a href="http://www.webmproject.org/code/specs/container/#chapters">Chapters</a> elements that follow a <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> element.
- </section>
-
- <section id="webm-random-access-points" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_webm-random-access-points"><span class="secno">5. </span>Random Access Points</h2>
- <p>A SimpleBlock element with its Keyframe flag set signals the location of a <a href="http://www.w3.org/TR/media-source/#random-access-point">random access point</a> for that track. Media segments containing multiple tracks are only considered a random access
- point if the first SimpleBlock for each track has its Keyframe flag set. The order of the multiplexed blocks must conform to the <a href="http://www.webmproject.org/code/specs/container/#muxer-guidelines">WebM Muxer Guidelines</a>.</p>
- </section>
-
- <section id="acknowledgements" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter">
- <!--OddPage--><h2 aria-level="1" role="heading" id="h2_acknowledgements"><span class="secno">6. </span>Acknowledgments</h2>
- The editors would like to thank Frank Galligan, and Philip Jägenstedt for their contributions to this specification.
- </section>
-
-
-<form id="bug-assist-form" action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
\ No newline at end of file
+ <script>
+ location.replace("https://w3c.github.io/media-source/webm-byte-stream-format.html");
+ </script>
+ </head>
+ <body>
+ The WebM Byte Stream Format spec has moved to <a href="https://w3c.github.io/media-source/webm-byte-stream-format.html">https://w3c.github.io/media-source/webm-byte-stream-format.html</a>.
+ </body>
+</html>