CINXE.COM

Media Source Extensions™

<!DOCTYPE html><html lang="en" dir="ltr"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="generator" content="ReSpec 35.1.1"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style> span.example-title{text-transform:none} :is(aside,div).example,div.illegal-example{padding:.5em;margin:1em 0;position:relative;clear:both} div.illegal-example{color:red} div.illegal-example p{color:#000} aside.example div.example{border-left-width:.1em;border-color:#999;background:#fff} </style> <style> .issue-label{text-transform:initial} .warning>p:first-child{margin-top:0} .warning{padding:.5em;border-left-width:.5em;border-left-style:solid} span.warning{padding:.1em .5em .15em} .issue.closed span.issue-number{text-decoration:line-through} .issue.closed span.issue-number::after{content:" (Closed)";font-size:smaller} .warning{border-color:#f11;border-color:var(--warning-border,#f11);border-width:.2em;border-style:solid;background:#fbe9e9;background:var(--warning-bg,#fbe9e9);color:#000;color:var(--text,#000)} .warning-title:before{content:"⚠";font-size:1.3em;float:left;padding-right:.3em;margin-top:-.3em} li.task-list-item{list-style:none} input.task-list-item-checkbox{margin:0 .35em .25em -1.6em;vertical-align:middle} .issue a.respec-gh-label{padding:5px;margin:0 2px 0 2px;font-size:10px;text-transform:none;text-decoration:none;font-weight:700;border-radius:4px;position:relative;bottom:2px;border:none;display:inline-block} </style> <style> pre.idl{padding:1em;position:relative} pre.idl>code{color:#000;color:var(--text,#000)} @media print{ pre.idl{white-space:pre-wrap} } .idlHeader{display:block;width:150px;background:#8ccbf2;background:var(--def-border,#8ccbf2);color:#fff;color:var(--defrow-border,#fff);font-family:sans-serif;font-weight:700;margin:-1em 0 1em -1em;height:28px;line-height:28px} .idlHeader a.self-link{margin-left:.3cm;text-decoration:none;border-bottom:none;color:inherit} .idlID{font-weight:700;color:#005a9c} .idlType{color:#005a9c} .idlName{color:#ff4500} .idlName a{color:#ff4500;border-bottom:1px dotted #ff4500;text-decoration:none} a.idlEnumItem{color:#000;border-bottom:1px dotted #ccc;text-decoration:none} .idlSuperclass{font-style:italic;color:#005a9c} .idlDefaultValue,.idlParamName{font-style:italic} .extAttr{color:#666} .idlSectionComment{color:gray} .idlIncludes a{font-weight:700} .respec-button-copy-paste:focus{text-decoration:none;border-color:#51a7e8;outline:0;box-shadow:0 0 5px rgba(81,167,232,.5)} .respec-button-copy-paste:is(:focus:hover,.selected:focus){border-color:#51a7e8} .respec-button-copy-paste:is(:hover,:active,.zeroclipboard-is-hover,.zeroclipboard-is-active){text-decoration:none;background-color:#ddd;background-image:linear-gradient(#eee,#ddd);border-color:#ccc} .respec-button-copy-paste:is(:active,.selected,.zeroclipboard-is-active){background-color:#dcdcdc;background-image:none;border-color:#b5b5b5;box-shadow:inset 0 2px 4px rgba(0,0,0,.15)} .respec-button-copy-paste.selected:hover{background-color:#cfcfcf} .respec-button-copy-paste:is(:disabled,:disabled:hover,.disabled,.disabled:hover){color:rgba(102,102,102,.5);cursor:default;background-color:rgba(229,229,229,.5);background-image:none;border-color:rgba(197,197,197,.5);box-shadow:none} @media print{ .respec-button-copy-paste{visibility:hidden} } </style> <style> dfn{cursor:pointer} .dfn-panel{position:absolute;z-index:35;min-width:300px;max-width:500px;padding:.5em .75em;margin-top:.6em;font-family:"Helvetica Neue",sans-serif;font-size:small;background:#fff;background:var(--indextable-hover-bg,#fff);color:#000;color:var(--text,#000);box-shadow:0 1em 3em -.4em rgba(0,0,0,.3),0 0 1px 1px rgba(0,0,0,.05);box-shadow:0 1em 3em -.4em var(--tocsidebar-shadow,rgba(0,0,0,.3)),0 0 1px 1px var(--tocsidebar-shadow,rgba(0,0,0,.05));border-radius:2px} .dfn-panel:not(.docked)>.caret{position:absolute;top:-9px} .dfn-panel:not(.docked)>.caret::after,.dfn-panel:not(.docked)>.caret::before{content:"";position:absolute;border:10px solid transparent;border-top:0;border-bottom:10px solid #fff;border-bottom-color:var(--indextable-hover-bg,#fff);top:0} .dfn-panel:not(.docked)>.caret::before{border-bottom:9px solid #a2a9b1;border-bottom-color:var(--indextable-hover-bg,#a2a9b1)} .dfn-panel *{margin:0} .dfn-panel b{display:block;color:#000;color:var(--text,#000);margin-top:.25em} .dfn-panel ul a[href]{color:#333;color:var(--text,#333)} .dfn-panel>div{display:flex} .dfn-panel a.self-link{font-weight:700;margin-right:auto} .dfn-panel .marker{padding:.1em;margin-left:.5em;border-radius:.2em;text-align:center;white-space:nowrap;font-size:90%;color:#040b1c} .dfn-panel .marker.dfn-exported{background:#d1edfd;box-shadow:0 0 0 .125em #1ca5f940} .dfn-panel .marker.idl-block{background:#8ccbf2;box-shadow:0 0 0 .125em #0670b161} .dfn-panel a:not(:hover){text-decoration:none!important;border-bottom:none!important} .dfn-panel a[href]:hover{border-bottom-width:1px} .dfn-panel ul{padding:0} .dfn-panel li{margin-left:1em} .dfn-panel.docked{position:fixed;left:.5em;top:unset;bottom:2em;margin:0 auto;max-width:calc(100vw - .75em * 2 - .5em - .2em * 2);max-height:30vh;overflow:auto} </style> <title>Media Source Extensions™</title> <style id="respec-mainstyle"> @keyframes pop{ 0%{transform:scale(1,1)} 25%{transform:scale(1.25,1.25);opacity:.75} 100%{transform:scale(1,1)} } 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} .respec-offending-element:target{animation:pop .25s ease-in-out 0s 1} .respec-offending-element,a[href].respec-offending-element{text-decoration:red wavy underline} @supports not (text-decoration:red wavy underline){ .respec-offending-element:not(pre){display:inline-block} .respec-offending-element{background:url(data:image/gif;base64,R0lGODdhBAADAPEAANv///8AAP///wAAACwAAAAABAADAEACBZQjmIAFADs=) bottom repeat-x} } #references :target{background:#eaf3ff;animation:pop .4s ease-in-out 0s 1} cite .bibref{font-style:normal} a[href].orcid{padding-left:4px;padding-right:4px} a[href].orcid>svg{margin-bottom:-2px} ol.tof,ul.tof{list-style:none outside none} .caption{margin-top:.5em;font-style:italic} #issue-summary>ul{column-count:2} #issue-summary li{list-style:none;display:inline-block} details.respec-tests-details{margin-left:1em;display:inline-block;vertical-align:top} details.respec-tests-details>*{padding-right:2em} details.respec-tests-details[open]{z-index:999999;position:absolute;border:thin solid #cad3e2;border-radius:.3em;background-color:#fff;padding-bottom:.5em} details.respec-tests-details[open]>summary{border-bottom:thin solid #cad3e2;padding-left:1em;margin-bottom:1em;line-height:2em} details.respec-tests-details>ul{width:100%;margin-top:-.3em} details.respec-tests-details>li{padding-left:1em} .self-link:hover{opacity:1;text-decoration:none;background-color:transparent} aside.example .marker>a.self-link{color:inherit} .header-wrapper{display:flex;align-items:baseline} :is(h2,h3,h4,h5,h6):not(#toc>h2,#abstract>h2,#sotd>h2,.head>h2){position:relative;left:-.5em} :is(h2,h3,h4,h5,h6):not(#toch2)+a.self-link{color:inherit;order:-1;position:relative;left:-1.1em;font-size:1rem;opacity:.5} :is(h2,h3,h4,h5,h6)+a.self-link::before{content:"§";text-decoration:none;color:var(--heading-text)} :is(h2,h3)+a.self-link{top:-.2em} :is(h4,h5,h6)+a.self-link::before{color:#000} @media (max-width:767px){ dd{margin-left:0} } @media print{ .removeOnSave{display:none} } </style> <link rel="stylesheet" href="mse.css"> <meta name="color-scheme" content="light"> <meta name="revision" content="7f70e5741e62b59b852b1616fbbcd74cf8ccd239"> <style> .hljs{--base:#fafafa;--mono-1:#383a42;--mono-2:#686b77;--mono-3:#717277;--hue-1:#0b76c5;--hue-2:#336ae3;--hue-3:#a626a4;--hue-4:#42803c;--hue-5:#ca4706;--hue-5-2:#c91243;--hue-6:#986801;--hue-6-2:#9a6a01} @media (prefers-color-scheme:dark){ .hljs{--base:#282c34;--mono-1:#abb2bf;--mono-2:#818896;--mono-3:#5c6370;--hue-1:#56b6c2;--hue-2:#61aeee;--hue-3:#c678dd;--hue-4:#98c379;--hue-5:#e06c75;--hue-5-2:#be5046;--hue-6:#d19a66;--hue-6-2:#e6c07b} } .hljs{display:block;overflow-x:auto;padding:.5em;color:#383a42;color:var(--mono-1,#383a42);background:#fafafa;background:var(--base,#fafafa)} .hljs-comment,.hljs-quote{color:#717277;color:var(--mono-3,#717277);font-style:italic} .hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4;color:var(--hue-3,#a626a4)} .hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#ca4706;color:var(--hue-5,#ca4706);font-weight:700} .hljs-literal{color:#0b76c5;color:var(--hue-1,#0b76c5)} .hljs-addition,.hljs-attribute,.hljs-meta-string,.hljs-regexp,.hljs-string{color:#42803c;color:var(--hue-4,#42803c)} .hljs-built_in,.hljs-class .hljs-title{color:#9a6a01;color:var(--hue-6-2,#9a6a01)} .hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801;color:var(--hue-6,#986801)} .hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#336ae3;color:var(--hue-2,#336ae3)} .hljs-emphasis{font-style:italic} .hljs-strong{font-weight:700} .hljs-link{text-decoration:underline} </style> <style> var{position:relative;cursor:pointer} var[data-type]::after,var[data-type]::before{position:absolute;left:50%;top:-6px;opacity:0;transition:opacity .4s;pointer-events:none} var[data-type]::before{content:"";transform:translateX(-50%);border-width:4px 6px 0 6px;border-style:solid;border-color:transparent;border-top-color:#222} var[data-type]::after{content:attr(data-type);transform:translateX(-50%) translateY(-100%);background:#222;text-align:center;font-family:"Dank Mono","Fira Code",monospace;font-style:normal;padding:6px;border-radius:3px;color:#daca88;text-indent:0;font-weight:400} var[data-type]:hover::after,var[data-type]:hover::before{opacity:1} </style> <script id="initialUserConfig" type="application/json">{ "specStatus": "ED", "shortName": "media-source-2", "prevRecURI": "https://www.w3.org/TR/2016/REC-media-source-20161117/", "editors": [ { "name": "Jean-Yves Avenard", "mailto": "jya@apple.com", "company": "Apple Inc.", "companyURL": "https://www.apple.com/", "w3cid": "115886", "url": "mailto:jya@apple.com" }, { "name": "Mark Watson", "company": "Netflix Inc.", "companyURL": "https://www.netflix.com/", "w3cid": "46379" } ], "formerEditors": [ { "name": "Matthew Wolenetz", "retiredDate": "2024-02-01", "mailto": "matt.wolenetz@gmail.com", "company": "W3C Invited Expert", "url": "mailto:matt.wolenetz@gmail.com" }, { "name": "Jerry Smith", "retiredDate": "2017-09-01", "company": "Microsoft Corporation", "companyURL": "https://www.microsoft.com/" }, { "name": "Aaron Colwell", "retiredDate": "2015-04-01", "company": "Google Inc.", "companyURL": "https://www.google.com/" }, { "name": "Adrian Bateman", "retiredDate": "2015-04-01", "company": "Microsoft Corporation", "companyURL": "https://www.microsoft.com/" } ], "mseDefGroupName": "media-source", "group": "media", "github": "w3c/media-source", "caniuse": "mediasource", "testsuiteURI": "https://wpt.live/media-source/", "wgPublicList": "public-media-wg", "preProcess": [ null ], "postProcess": [ null ], "gitRevision": "7f70e5741e62b59b852b1616fbbcd74cf8ccd239", "publishISODate": "2024-07-04T00:00:00.000Z", "generatedSubtitle": "W3C Editor's Draft 04 July 2024" }</script> <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED"></head> <body data-cite="WEBIDL html dom url fileapi infra" class="h-entry"><div class="head"> <p class="logos"><a class="logo" href="https://www.w3.org/"><img crossorigin="" alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a></p> <h1 id="title" class="title">Media Source Extensions™</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">W3C Editor's Draft</a> <time class="dt-published" datetime="2024-07-04">04 July 2024</time></p> <details open=""> <summary>More details about this document</summary> <dl> <dt>This version:</dt><dd> <a class="u-url" href="https://w3c.github.io/media-source/">https://w3c.github.io/media-source/</a> </dd> <dt>Latest published version:</dt><dd> <a href="https://www.w3.org/TR/media-source-2/">https://www.w3.org/TR/media-source-2/</a> </dd> <dt>Latest editor's draft:</dt><dd><a href="https://w3c.github.io/media-source/">https://w3c.github.io/media-source/</a></dd> <dt>History:</dt><dd> <a href="https://www.w3.org/standards/history/media-source-2/">https://www.w3.org/standards/history/media-source-2/</a> </dd><dd> <a href="https://github.com/w3c/media-source/commits/">Commit history</a> </dd> <dt>Latest Recommendation:</dt><dd><a href="https://www.w3.org/TR/2016/REC-media-source-20161117/">https://www.w3.org/TR/2016/REC-media-source-20161117/</a></dd> <dt>Editors:</dt><dd class="editor p-author h-card vcard" data-editor-id="115886"> <a class="ed_mailto u-email email p-name" href="mailto:jya@apple.com">Jean-Yves Avenard</a> (<a class="p-org org h-org" href="https://www.apple.com/">Apple Inc.</a>) </dd><dd class="editor p-author h-card vcard" data-editor-id="46379"> <span class="p-name fn">Mark Watson</span> (<a class="p-org org h-org" href="https://www.netflix.com/">Netflix Inc.</a>) </dd> <dt> Former editors: </dt><dd class="editor p-author h-card vcard"> <a class="ed_mailto u-email email p-name" href="mailto:matt.wolenetz@gmail.com">Matthew Wolenetz</a> (<span class="p-org org h-org">W3C Invited Expert</span>) - Until <time datetime="2024-02-01">01 February 2024</time> </dd><dd class="editor p-author h-card vcard"> <span class="p-name fn">Jerry Smith</span> (<a class="p-org org h-org" href="https://www.microsoft.com/">Microsoft Corporation</a>) - Until <time datetime="2017-09-01">01 September 2017</time> </dd><dd class="editor p-author h-card vcard"> <span class="p-name fn">Aaron Colwell</span> (<a class="p-org org h-org" href="https://www.google.com/">Google Inc.</a>) - Until <time datetime="2015-04-01">01 April 2015</time> </dd><dd class="editor p-author h-card vcard"> <span class="p-name fn">Adrian Bateman</span> (<a class="p-org org h-org" href="https://www.microsoft.com/">Microsoft Corporation</a>) - Until <time datetime="2015-04-01">01 April 2015</time> </dd> <dt>Feedback:</dt><dd> <a href="https://github.com/w3c/media-source/">GitHub w3c/media-source</a> (<a href="https://github.com/w3c/media-source/pulls/">pull requests</a>, <a href="https://github.com/w3c/media-source/issues/new/choose">new issue</a>, <a href="https://github.com/w3c/media-source/issues/">open issues</a>) </dd><dd><a href="mailto:public-media-wg@w3.org?subject=%5Bmedia-source-2%5D%20YOUR%20TOPIC%20HERE">public-media-wg@w3.org</a> with subject line <kbd>[media-source-2] <em>… message topic …</em></kbd> (<a rel="discussion" href="https://lists.w3.org/Archives/Public/public-media-wg">archives</a>)</dd> <dt class="caniuse-title">Browser support:</dt><dd class="caniuse-stats"><a href="https://caniuse.com/mediasource">caniuse.com</a></dd></dl> </details> <p class="copyright"> <a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a rel="license" href="https://www.w3.org/copyright/software-license-2023/" title="W3C Software and Document Notice and License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> This specification extends <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] 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. </section> <section id="sotd" class="introductory"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. 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="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em></p> <p> On top of editorial updates, substantive changes since publication as a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation in <a href="https://www.w3.org/TR/2016/REC-media-source-20161117/">November 2016</a> are: </p> <ul> <li>the addition of a <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-1"><code>changeType</code></a><code>()</code> method to switch among codecs or bytestreams </li> <li>the possibility to create and use <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-1"><code>MediaSource</code></a> objects off the main thread in dedicated workers </li> <li>the removal of the <a data-link-type="idl" data-lt="createObjectURL()" data-type="method" href="https://www.w3.org/TR/FileAPI/#dfn-createObjectURL"><code>createObjectURL</code></a><code>()</code> extension to the <a data-link-type="idl" data-lt="URL" data-type="interface" href="https://url.spec.whatwg.org/#url"><code>URL</code></a> object following its integration in the File API [<cite><a class="bibref" data-link-type="biblio" href="#bib-fileapi" title="File API">FILEAPI</a></cite>] </li> <li>the addition of <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-1"><code>ManagedMediaSource</code></a>, <a data-link-type="idl" data-lt="ManagedSourceBuffer" href="#dom-managedsourcebuffer" class="internalDFN" id="ref-for-dom-managedsourcebuffer-1"><code>ManagedSourceBuffer</code></a>, and <a data-link-type="idl" data-lt="BufferedChangeEvent" href="#dom-bufferedchangeevent" class="internalDFN" id="ref-for-dom-bufferedchangeevent-1"><code>BufferedChangeEvent</code></a> interfaces supporting power-efficient streaming and active buffered media cleanup by the user agent </li> </ul> <p> For a full list of changes made since the previous version, see the <a href="https://github.com/w3c/media-source/commits/main">commits</a>. </p> <p> The working group maintains <a href="https://github.com/w3c/media-source/issues">a list of all bug reports that the editors have not yet tried to address</a>. </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 track the <a href="https://github.com/w3c/media-source">GitHub repository</a> and take part in the discussions. </p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/media">Media Working Group</a> as an Editor's Draft. </p><p>Publication as an Editor's Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. </p><p> 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 href="https://www.w3.org/policies/patent-policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a rel="disclosure" href="https://www.w3.org/groups/wg/media/ipr">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="https://www.w3.org/policies/patent-policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/policies/patent-policy/#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="https://www.w3.org/policies/process/20231103/">03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>. </p></section><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a class="tocxref" href="#abstract">Abstract</a></li><li class="tocline"><a class="tocxref" href="#sotd">Status of This Document</a></li><li class="tocline"><a class="tocxref" href="#introduction"><bdi class="secno">1. </bdi> Introduction </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#goals"><bdi class="secno">1.1 </bdi> Goals </a></li></ol></li><li class="tocline"><a class="tocxref" href="#definitions"><bdi class="secno">2. </bdi> Definitions </a></li><li class="tocline"><a class="tocxref" href="#mediasource"><bdi class="secno">3. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MediaSource" data-dfn-for=""><code>MediaSource</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#handle-attribute"><bdi class="secno">3.1 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="handle" data-dfn-for="MediaSource" data-type="MediaSourceHandle" data-lt="handle" data-local-lt="MediaSource.handle"><code>handle</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffers-attribute"><bdi class="secno">3.2 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="sourceBuffers" data-dfn-for="MediaSource" data-type="SourceBufferList" data-lt="sourceBuffers" data-local-lt="MediaSource.sourceBuffers"><code>sourceBuffers</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#activesourcebuffers-attribute"><bdi class="secno">3.3 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="activeSourceBuffers" data-dfn-for="MediaSource" data-type="SourceBufferList" data-lt="activeSourceBuffers" data-local-lt="MediaSource.activeSourceBuffers"><code>activeSourceBuffers</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#readystate-attribute"><bdi class="secno">3.4 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="readyState" data-dfn-for="MediaSource" data-type="ReadyState" data-lt="readyState" data-local-lt="MediaSource.readyState"><code>readyState</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#duration-attribute"><bdi class="secno">3.5 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="duration" data-dfn-for="MediaSource" data-type="unrestricted double" data-lt="duration" data-local-lt="MediaSource.duration"><code>duration</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#canconstructindedicatedworker-attribute"><bdi class="secno">3.6 </bdi> <span data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="canConstructInDedicatedWorker" data-dfn-for="MediaSource" data-type="boolean" data-lt="canConstructInDedicatedWorker" data-local-lt="MediaSource.canConstructInDedicatedWorker"><code>canConstructInDedicatedWorker</code></span> attribute </a></li><li class="tocline"><a class="tocxref" href="#addsourcebuffer-method"><bdi class="secno">3.7 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="addSourceBuffer()" data-dfn-for="MediaSource" data-type="SourceBuffer" data-lt="addSourceBuffer()|addSourceBuffer(type)" data-local-lt="MediaSource.addSourceBuffer|MediaSource.addSourceBuffer()|addSourceBuffer"><code>addSourceBuffer()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#removesourcebuffer-method"><bdi class="secno">3.8 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="removeSourceBuffer()" data-dfn-for="MediaSource" data-type="undefined" data-lt="removeSourceBuffer()|removeSourceBuffer(sourceBuffer)" data-local-lt="MediaSource.removeSourceBuffer|MediaSource.removeSourceBuffer()|removeSourceBuffer"><code>removeSourceBuffer()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#endofstream-method"><bdi class="secno">3.9 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="endOfStream()" data-dfn-for="MediaSource" data-type="undefined" data-lt="endOfStream()|endOfStream(error)" data-local-lt="MediaSource.endOfStream|MediaSource.endOfStream()|endOfStream"><code>endOfStream()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#setliveseekablerange-method"><bdi class="secno">3.10 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="setLiveSeekableRange()" data-dfn-for="MediaSource" data-type="undefined" data-lt="setLiveSeekableRange()|setLiveSeekableRange(start, end)" data-local-lt="MediaSource.setLiveSeekableRange|MediaSource.setLiveSeekableRange()|setLiveSeekableRange"><code>setLiveSeekableRange()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#clearliveseekablerange-method"><bdi class="secno">3.11 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="clearLiveSeekableRange()" data-dfn-for="MediaSource" data-type="undefined" data-lt="clearLiveSeekableRange()" data-local-lt="MediaSource.clearLiveSeekableRange|MediaSource.clearLiveSeekableRange()|clearLiveSeekableRange"><code>clearLiveSeekableRange()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#istypesupported-method"><bdi class="secno">3.12 </bdi> <span data-export="" data-dfn-type="method" data-idl="operation" data-title="isTypeSupported()" data-dfn-for="MediaSource" data-type="boolean" data-lt="isTypeSupported()|isTypeSupported(type)" data-local-lt="MediaSource.isTypeSupported|MediaSource.isTypeSupported()|isTypeSupported"><code>isTypeSupported()</code></span> method </a></li><li class="tocline"><a class="tocxref" href="#mediasource-events"><bdi class="secno">3.13 </bdi> Event Summary </a></li><li class="tocline"><a class="tocxref" href="#mediasource-in-worker-communication-model"><bdi class="secno">3.14 </bdi> <span>Cross-context communication model</span> </a></li><li class="tocline"><a class="tocxref" href="#mediasource-algorithms"><bdi class="secno">3.15 </bdi> Algorithms </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#mediasource-attach"><bdi class="secno">3.15.1 </bdi> <span>Attaching to a media element</span> </a></li><li class="tocline"><a class="tocxref" href="#mediasource-detach"><bdi class="secno">3.15.2 </bdi> <span>Detaching from a media element</span> </a></li><li class="tocline"><a class="tocxref" href="#mediasource-seeking"><bdi class="secno">3.15.3 </bdi> <span>Seeking</span> </a></li><li class="tocline"><a class="tocxref" href="#buffer-monitoring"><bdi class="secno">3.15.4 </bdi> <span>SourceBuffer Monitoring</span> </a></li><li class="tocline"><a class="tocxref" href="#active-source-buffer-changes"><bdi class="secno">3.15.5 </bdi> <span>Changes to selected/enabled track state</span> </a></li><li class="tocline"><a class="tocxref" href="#duration-change-algorithm"><bdi class="secno">3.15.6 </bdi> <span>Duration change</span> </a></li><li class="tocline"><a class="tocxref" href="#end-of-stream-algorithm"><bdi class="secno">3.15.7 </bdi> <span>End of stream</span> </a></li><li class="tocline"><a class="tocxref" href="#mirror-if-necessary-algorithm"><bdi class="secno">3.15.8 </bdi> <span>Mirror if necessary</span> </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#mediasourcehandle"><bdi class="secno">4. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MediaSourceHandle" data-dfn-for=""><code>MediaSourceHandle</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#transfer"><bdi class="secno">4.1 </bdi> Transfer </a></li></ol></li><li class="tocline"><a class="tocxref" href="#sourcebuffer"><bdi class="secno">5. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="SourceBuffer" data-dfn-for=""><code>SourceBuffer</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><bdi class="secno">5.1 </bdi> Attributes </a></li><li class="tocline"><a class="tocxref" href="#methods"><bdi class="secno">5.2 </bdi> Methods </a></li><li class="tocline"><a class="tocxref" href="#track-buffers"><bdi class="secno">5.3 </bdi> Track Buffers </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-events"><bdi class="secno">5.4 </bdi> Event Summary </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-algorithms"><bdi class="secno">5.5 </bdi> Algorithms </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#sourcebuffer-segment-parser-loop"><bdi class="secno">5.5.1 </bdi> <span>Segment Parser Loop</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-reset-parser-state"><bdi class="secno">5.5.2 </bdi> <span>Reset Parser State</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-append-error"><bdi class="secno">5.5.3 </bdi> <span data-export="">Append Error</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-prepare-append"><bdi class="secno">5.5.4 </bdi> <span>Prepare Append</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-buffer-append"><bdi class="secno">5.5.5 </bdi> <span>Buffer Append</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-range-removal"><bdi class="secno">5.5.6 </bdi> <span>Range Removal</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-init-segment-received"><bdi class="secno">5.5.7 </bdi> <span>Initialization Segment Received</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-coded-frame-processing"><bdi class="secno">5.5.8 </bdi> <span data-export="">Coded Frame Processing</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-coded-frame-removal"><bdi class="secno">5.5.9 </bdi> <span>Coded Frame Removal</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-coded-frame-eviction"><bdi class="secno">5.5.10 </bdi> <span>Coded Frame Eviction</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-audio-splice-frame-algorithm"><bdi class="secno">5.5.11 </bdi> <span>Audio Splice Frame</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-audio-splice-rendering-algorithm"><bdi class="secno">5.5.12 </bdi> <span>Audio Splice Rendering</span> </a></li><li class="tocline"><a class="tocxref" href="#sourcebuffer-text-splice-frame-algorithm"><bdi class="secno">5.5.13 </bdi> <span>Text Splice Frame</span> </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#sourcebufferlist"><bdi class="secno">6. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="SourceBufferList" data-dfn-for=""><code>SourceBufferList</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#attributes-0"><bdi class="secno">6.1 </bdi> Attributes </a></li><li class="tocline"><a class="tocxref" href="#methods-0"><bdi class="secno">6.2 </bdi> Methods </a></li><li class="tocline"><a class="tocxref" href="#sourcebufferlist-events"><bdi class="secno">6.3 </bdi> Event Summary </a></li></ol></li><li class="tocline"><a class="tocxref" href="#managedmediasource-interface"><bdi class="secno">7. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="ManagedMediaSource" data-dfn-for=""><code>ManagedMediaSource</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><bdi class="secno">7.1 </bdi> Attributes </a></li><li class="tocline"><a class="tocxref" href="#event-summary"><bdi class="secno">7.2 </bdi> Event Summary </a></li><li class="tocline"><a class="tocxref" href="#algorithms"><bdi class="secno">7.3 </bdi> Algorithms </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#managedsourcebuffer-monitoring"><bdi class="secno">7.3.1 </bdi> <code>ManagedSourceBuffer</code> Monitoring </a></li><li class="tocline"><a class="tocxref" href="#memory-cleanup"><bdi class="secno">7.3.2 </bdi> <span data-dfn-for="ManagedMediaSource">Memory Cleanup</span> </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#bufferedchangeevent-interface"><bdi class="secno">8. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="BufferedChangeEvent" data-dfn-for=""><code>BufferedChangeEvent</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#attributes-2"><bdi class="secno">8.1 </bdi> Attributes </a></li></ol></li><li class="tocline"><a class="tocxref" href="#managedsourcebuffer-interface"><bdi class="secno">9. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="ManagedSourceBuffer" data-dfn-for=""><code>ManagedSourceBuffer</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#attributes-3"><bdi class="secno">9.1 </bdi> Attributes </a></li><li class="tocline"><a class="tocxref" href="#event-summary-0"><bdi class="secno">9.2 </bdi> Event Summary </a></li><li class="tocline"><a class="tocxref" href="#algorithms-0"><bdi class="secno">9.3 </bdi> Algorithms </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#buffered-change"><bdi class="secno">9.3.1 </bdi> Buffered Change </a></li><li class="tocline"><a class="tocxref" href="#memory-cleanup-0"><bdi class="secno">9.3.2 </bdi> <span data-dfn-for="ManagedSourceBuffer">Memory cleanup</span> </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#htmlmediaelement-extensions"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#htmlmediaelement-extensions-seekable"><bdi class="secno">10.1 </bdi> <span data-xref-type="_IDL_" data-link-type="idl" data-lt="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="htmlmediaelement" data-type="interface" class="formerLink"><code>HTMLMediaElement</code></span>'s <span data-link-type="idl" data-xref-type="attribute|dict-member|const" data-link-for="HTMLMediaElement" data-xref-for="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="dom-media-seekable" data-type="attribute" class="formerLink"><code>seekable</code></span> </a></li><li class="tocline"><a class="tocxref" href="#htmlmediaelement-extensions-buffered"><bdi class="secno">10.2 </bdi> <span data-xref-type="_IDL_" data-link-type="idl" data-lt="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="htmlmediaelement" data-type="interface" class="formerLink"><code>HTMLMediaElement</code></span>'s <span data-link-type="idl" data-xref-type="attribute|dict-member|const" data-link-for="HTMLMediaElement" data-xref-for="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="dom-media-buffered" data-type="attribute" class="formerLink"><code>buffered</code></span> </a></li><li class="tocline"><a class="tocxref" href="#htmlmediaelement-extensions-srcobject"><bdi class="secno">10.3 </bdi> <span data-xref-type="_IDL_" data-link-type="idl" data-lt="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="htmlmediaelement" data-type="interface" class="formerLink"><code>HTMLMediaElement</code></span>'s <span data-link-type="idl" data-xref-type="attribute|dict-member|const" data-link-for="HTMLMediaElement" data-xref-for="HTMLMediaElement" data-cite="html" data-cite-path="/media.html" data-cite-frag="dom-media-srcobject" data-type="attribute" class="formerLink"><code>srcObject</code></span> </a></li></ol></li><li class="tocline"><a class="tocxref" href="#audio-track-extensions"><bdi class="secno">11. </bdi> <code>AudioTrack</code> extensions </a></li><li class="tocline"><a class="tocxref" href="#video-track-extensions"><bdi class="secno">12. </bdi> <code>VideoTrack</code> extensions </a></li><li class="tocline"><a class="tocxref" href="#text-track-extensions"><bdi class="secno">13. </bdi> <code>TextTrack</code> extensions </a></li><li class="tocline"><a class="tocxref" href="#byte-stream-formats"><bdi class="secno">14. </bdi> <span data-export="">Byte Stream Formats</span> </a></li><li class="tocline"><a class="tocxref" href="#conformance"><bdi class="secno">15. </bdi>Conformance</a></li><li class="tocline"><a class="tocxref" href="#examples"><bdi class="secno">16. </bdi> Examples </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#using-media-source-extensions"><bdi class="secno">16.1 </bdi> Using Media Source Extensions </a></li><li class="tocline"><a class="tocxref" href="#using-a-managed-media-source"><bdi class="secno">16.2 </bdi> Using a Managed Media Source </a></li></ol></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><bdi class="secno">17. </bdi> Acknowledgments </a></li><li class="tocline"><a class="tocxref" href="#VideoPlaybackQuality"><bdi class="secno">A. </bdi> VideoPlaybackQuality </a></li><li class="tocline"><a class="tocxref" href="#issue-summary"><bdi class="secno">B. </bdi>Issue summary</a></li><li class="tocline"><a class="tocxref" href="#references"><bdi class="secno">C. </bdi>References</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><bdi class="secno">C.1 </bdi>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><bdi class="secno">C.2 </bdi>Informative references</a></li></ol></li></ol></nav> <section id="introduction" class="informative"><div class="header-wrapper"><h2 id="x1-introduction"><bdi class="secno">1. </bdi> Introduction </h2><a class="self-link" href="#introduction" aria-label="Permalink for Section 1."></a></div><p><em>This section is non-normative.</em></p> <p> This specification allows JavaScript to dynamically construct media streams for &lt;audio&gt; and &lt;video&gt;. It defines a MediaSource object that can serve as a source of media data for an HTMLMediaElement. MediaSource objects have one or more <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-1"><code>SourceBuffer</code></a> objects. Applications append data segments to the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-2"><code>SourceBuffer</code></a> objects, and can adapt the quality of appended data based on system performance and other factors. Data from the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-3"><code>SourceBuffer</code></a> objects is managed as track buffers for audio, video and text data that is decoded and played. Byte stream specifications used with these extensions are available in the byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format Registry">MSE-REGISTRY</a></cite>]. </p> <figure id="fig-media-source-pipeline-model-diagram"> <a href="https://w3c.github.io/media-source/pipeline_model_description.html#pipelinedesc"><picture><img src="pipeline_model.svg" alt="Media Source Pipeline Model Diagram"></picture></a> <figcaption><a class="self-link" href="#fig-media-source-pipeline-model-diagram">Figure <bdi class="figno">1</bdi></a> <span class="fig-title"> Media Source Pipeline Model Diagram </span></figcaption> </figure> <section id="goals"><div class="header-wrapper"><h3 id="x1-1-goals"><bdi class="secno">1.1 </bdi> Goals </h3><a class="self-link" href="#goals" aria-label="Permalink for Section 1.1"></a></div> <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> <section id="definitions"><div class="header-wrapper"><h2 id="x2-definitions"><bdi class="secno">2. </bdi> Definitions </h2><a class="self-link" href="#definitions" aria-label="Permalink for Section 2."></a></div> <dl> <dt> <dfn id="dfn-active-track-buffers" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Active Track Buffers</dfn> </dt> <dd> <p> The <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-1">track buffers</a> that provide <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-1">coded frames</a> for the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks"><code>audioTracks</code></a>, the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks"><code>videoTracks</code></a>, and the <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code> <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks"><code>textTracks</code></a>. All these tracks are associated with <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-4"><code>SourceBuffer</code></a> objects in the <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-1"><code>activeSourceBuffers</code></a> list. </p> </dd> <dt> <dfn id="dfn-append-window" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Append Window</dfn> </dt> <dd> <p> A <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-1">presentation timestamp</a> range used to filter out <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-2">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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-2">presentation timestamp</a> within this range are allowed to be appended to the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-5"><code>SourceBuffer</code></a> while coded frames outside this range are filtered out. The append window start and end times are controlled by the <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-1"><code>appendWindowStart</code></a> and <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-1"><code>appendWindowEnd</code></a> attributes respectively. </p> </dd> <dt> <dfn class="export" data-export="" data-plurals="coded frames" id="dfn-coded-frame" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame</dfn> </dt> <dd> <p> A unit of media data that has a <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-3">presentation timestamp</a>, a <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-1">decode timestamp</a>, and a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-1">coded frame duration</a>. </p> </dd> <dt> <dfn id="dfn-coded-frame-duration" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame Duration</dfn> </dt> <dd> <p> The duration of a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-3">coded frame</a>. For video and text, the duration indicates how long the video frame or text <em class="rfc2119">SHOULD</em> 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> <dfn id="dfn-coded-frame-end-timestamp" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame End Timestamp</dfn> </dt> <dd> <p> The sum of a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-4">coded frame</a> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-4">presentation timestamp</a> and its <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-2">coded frame duration</a>. It represents the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-5">presentation timestamp</a> that immediately follows the coded frame. </p> </dd> <dt> <dfn id="dfn-coded-frame-group" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame Group</dfn> </dt> <dd> <p> A group of <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-5">coded frames</a> that are adjacent and have monotonically increasing <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-2">decode timestamps</a> without any gaps. Discontinuities detected by the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-1">coded frame processing</a> algorithm and <a data-link-type="idl" data-lt="abort()" href="#dom-sourcebuffer-abort" class="internalDFN" id="ref-for-dom-sourcebuffer-abort-1"><code>abort</code></a><code>()</code> calls trigger the start of a new coded frame group. </p> </dd> <dt> <dfn data-plurals="decode timestamps" id="dfn-decode-timestamp" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Decode Timestamp</dfn> </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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-6">presentation timestamp</a> of the earliest frame, in <a data-link-type="dfn|abstract-op" href="#presentation-order" class="internalDFN" id="ref-for-presentation-order-1">presentation order</a>, that is dependant on this frame). If frames can be decoded out of <a data-link-type="dfn|abstract-op" href="#presentation-order" class="internalDFN" id="ref-for-presentation-order-2">presentation order</a>, then the decode timestamp <em class="rfc2119">MUST</em> be present in or derivable from the byte stream. The user agent <em class="rfc2119">MUST</em> run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-1">append error</a> algorithm if this is not the case. If frames cannot be decoded out of <a data-link-type="dfn|abstract-op" href="#presentation-order" class="internalDFN" id="ref-for-presentation-order-3">presentation order</a> and a decode timestamp is not present in the byte stream, then the decode timestamp is equal to the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-7">presentation timestamp</a>. </p> </dd> <dt> <dfn class="export" data-export="" data-plurals="initialization segments" id="dfn-initialization-segment" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Initialization Segment</dfn> </dt> <dd> <p> A sequence of bytes that contain all of the initialization information required to decode a sequence of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-1">media segments</a>. This includes codec initialization data, <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-1">Track ID</a> mappings for multiplexed segments, and timestamp offsets (e.g., edit lists). </p> <div class="note" role="note" id="issue-container-generatedID"><div role="heading" class="note-title marker" id="h-note" aria-level="3"><span>Note</span></div><p class=""> The <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-1">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format Registry">MSE-REGISTRY</a></cite>] contain format specific examples. </p></div> </dd> <dt> <dfn class="export" data-export="" data-plurals="media segments" id="dfn-media-segment" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Media Segment</dfn> </dt> <dd> <p> A sequence of bytes that contain packetized &amp; timestamped media data for a portion of the <a href="https://html.spec.whatwg.org/multipage/media.html#media-timeline">media timeline</a>. Media segments are always associated with the most recently appended <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-1">initialization segment</a>. </p> <div class="note" role="note" id="issue-container-generatedID-0"><div role="heading" class="note-title marker" id="h-note-0" aria-level="3"><span>Note</span></div><p class=""> The <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-2">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format Registry">MSE-REGISTRY</a></cite>] contain format specific examples. </p></div> </dd> <dt> <dfn id="mediasource-object-url" data-plurals="mediasource object urls" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MediaSource object URL</dfn> </dt> <dd> <p> A <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-2"><code>MediaSource</code></a> object URL is a unique <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/FileAPI/#blob-url">blob URL</a> created by <a data-link-type="idl" data-lt="createObjectURL()" data-type="method" href="https://www.w3.org/TR/FileAPI/#dfn-createObjectURL"><code>createObjectURL</code></a><code>()</code>. It is used to attach a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-3"><code>MediaSource</code></a> object to an HTMLMediaElement. </p> <p> These URLs are the same as a <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/FileAPI/#blob-url">blob URLs</a>, except that anything in the definition of that feature that refers to <a data-link-type="idl" data-lt="File" data-type="interface" href="https://www.w3.org/TR/FileAPI/#dfn-file"><code>File</code></a> and <a data-link-type="idl" data-lt="Blob" data-type="interface" href="https://www.w3.org/TR/FileAPI/#dfn-Blob"><code>Blob</code></a> objects is hereby extended to also apply to <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-4"><code>MediaSource</code></a> objects. </p> <p> The <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#concept-origin">origin</a> of the MediaSource object URL is the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object">relevant settings object</a> of <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a> during the call to <a data-link-type="idl" data-lt="createObjectURL()" data-type="method" href="https://www.w3.org/TR/FileAPI/#dfn-createObjectURL"><code>createObjectURL</code></a><code>()</code>. </p> <div class="note" role="note" id="issue-container-generatedID-1"><div role="heading" class="note-title marker" id="h-note-1" aria-level="3"><span>Note</span></div><p class=""> For example, the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#concept-origin">origin</a> of the MediaSource object URL affects the way that the media element is <a href="https://html.spec.whatwg.org/multipage/canvas.html#security-with-canvas-elements">consumed by canvas</a>. </p></div> </dd> <dt> <dfn id="parent-media-source" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Parent Media Source</dfn> </dt> <dd> <p> The parent media source of a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-6"><code>SourceBuffer</code></a> object is the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-5"><code>MediaSource</code></a> object that created it. </p> </dd> <dt> <dfn id="presentation-start-time" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Presentation Start Time</dfn> </dt> <dd> <p> The presentation start time is the earliest time point in the presentation and specifies the initial <a href="https://html.spec.whatwg.org/multipage/media.html#current-playback-position">playback position</a> and <a href="https://html.spec.whatwg.org/multipage/media.html#earliest-possible-position">earliest possible position</a>. All presentations created using this specification have a presentation start time of 0. </p> <div class="note" role="note" id="issue-container-generatedID-2"><div role="heading" class="note-title marker" id="h-note-2" aria-level="3"><span>Note</span></div><p class=""> For the purposes of determining if <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> contains a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> that includes the current playback position, implementations <em class="rfc2119">MAY</em> choose to allow a current playback position at or after <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-1">presentation start time</a> and before the first <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> to play the first <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> if that <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> starts within a reasonably short time, like 1 second, after <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-2">presentation start time</a>. This allowance accommodates the reality that muxed streams commonly do not begin all tracks precisely at <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-3">presentation start time</a>. Implementations <em class="rfc2119">MUST</em> report the actual buffered range, regardless of this allowance. </p></div> </dd> <dt> <dfn id="presentation-interval" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Presentation Interval</dfn> </dt> <dd> <p> The presentation interval of a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-6">coded frame</a> is the time interval from its <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-8">presentation timestamp</a> to the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-9">presentation timestamp</a> plus the <a data-link-type="dfn|abstract-op" data-lt="coded frame duration" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-3">coded frame's duration</a>. For example, if a coded frame has a presentation timestamp of 10 seconds and a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-4">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> <dfn id="presentation-order" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Presentation Order</dfn> </dt> <dd> <p> The order that <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-7">coded frames</a> are rendered in the presentation. The presentation order is achieved by ordering <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-8">coded frames</a> in monotonically increasing order by their <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-10">presentation timestamps</a>. </p> </dd> <dt> <dfn id="presentation-timestamp" data-export="" data-plurals="presentation timestamps" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Presentation Timestamp</dfn> </dt> <dd> <p> A reference to a specific time in the presentation. The presentation timestamp in a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-9">coded frame</a> indicates when the frame <em class="rfc2119">SHOULD</em> be rendered. </p> </dd> <dt> <dfn id="random-access-point" data-export="" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Random Access Point</dfn> </dt> <dd> <p> A position in a <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-2">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> <dfn id="dfn-sourcebuffer-byte-stream-format-specification" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">SourceBuffer byte stream format specification</dfn> </dt> <dd> <p> The specific <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-3">byte stream format specification</a> that describes the format of the byte stream accepted by a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-7"><code>SourceBuffer</code></a> instance. The <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-4">byte stream format specification</a>, for a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-8"><code>SourceBuffer</code></a> object, is initially selected based on the <var data-type="DOMString">type</var> passed to the <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-1"><code>addSourceBuffer</code></a><code>()</code> call that created the object, and can be updated by <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-2"><code>changeType</code></a><code>()</code> calls on the object. </p> </dd> <dt> <dfn id="dfn-sourcebuffer-configuration" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn"><code>SourceBuffer</code> configuration</dfn> </dt> <dd> <p> A specific set of tracks distributed across one or more <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-9"><code>SourceBuffer</code></a> objects owned by a single <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-6"><code>MediaSource</code></a> instance. </p> <p> Implementations <em class="rfc2119">MUST</em> support at least 1 <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-7"><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 <em class="rfc2119">MUST</em> 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> <dfn data-plurals="track descriptions" id="dfn-track-description" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Track Description</dfn> </dt> <dd> <p> A byte stream format specific structure that provides the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-2">Track ID</a>, codec configuration, and other metadata for a single track. Each track description inside a single <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-2">initialization segment</a> has a unique <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-3">Track ID</a>. The user agent <em class="rfc2119">MUST</em> run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-2">append error</a> algorithm if the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-4">Track ID</a> is not unique within the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-3">initialization segment</a>. </p> </dd> <dt> <dfn data-plurals="track ids" id="dfn-track-id" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Track ID</dfn> </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 data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-1">track description</a> identifies which sections of a <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-3">media segment</a> belong to that track. </p> </dd> </dl> </section> <section id="mediasource" data-dfn-for="MediaSource"><div class="header-wrapper"><h2 id="x3-mediasource-interface"><bdi class="secno">3. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-mediasource" data-idl="interface" data-title="MediaSource" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MediaSource</code></dfn> interface </h2><a class="self-link" href="#mediasource" aria-label="Permalink for Section 3."></a></div> <p> The <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-8"><code>MediaSource</code></a> interface represents a source of media data for an <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>. It keeps track of the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-1"><code>readyState</code></a> for this source as well as a list of <a href="#dom-sourcebuffer" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebuffer-10"><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="#dom-sourcebuffer" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebuffer-11"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-1"><code>sourceBuffers</code></a> to add media data to this source. The HTMLMediaElement fetches this media data from the <a href="#dom-mediasource" class="internalDFN" data-link-type="idl" id="ref-for-dom-mediasource-9"><code>MediaSource</code></a> object when it is needed during playback. </p> <p> Each <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-10"><code>MediaSource</code></a> object has a <dfn data-dfn-for="MediaSource" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-live-seekable-range" tabindex="0" aria-haspopup="dialog">[[live seekable range]]</dfn> internal slot that stores a <a href="https://html.spec.whatwg.org/multipage/media.html#normalised-timeranges-object">normalized TimeRanges object</a>. It is initialized to an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object when the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-11"><code>MediaSource</code></a> object is created, is maintained by <a data-link-type="idl" data-lt="setLiveSeekableRange()" href="#dom-mediasource-setliveseekablerange" class="internalDFN" id="ref-for-dom-mediasource-setliveseekablerange-1"><code>setLiveSeekableRange</code></a><code>()</code> and <a data-link-type="idl" data-lt="clearLiveSeekableRange()" href="#dom-mediasource-clearliveseekablerange" class="internalDFN" id="ref-for-dom-mediasource-clearliveseekablerange-1"><code>clearLiveSeekableRange</code></a><code>()</code>, and is used in <a href="#htmlmediaelement-extensions" data-matched-text="[[[#htmlmediaelement-extensions]]]" class="sec-ref"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions</a> to modify <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> behavior. </p> <p> Each <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-12"><code>MediaSource</code></a> object has a <dfn data-dfn-for="MediaSource" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-has-ever-been-attached" tabindex="0" aria-haspopup="dialog">[[has ever been attached]]</dfn> internal slot that stores a <a data-link-type="idl" data-lt="boolean" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><code>boolean</code></a>. It is initialized to false when the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-13"><code>MediaSource</code></a> object is created, and is set true in the extended <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> as described in the <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-1">attaching to a media element</a> algorithm. The extended <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> uses this internal slot to conditionally fail attachment of a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-14"><code>MediaSource</code></a> using a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-1"><code>MediaSourceHandle</code></a> set on a <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> attribute. </p> <pre class="idl def" id="webidl-26865842"><span class="idlHeader"><a class="self-link" href="#webidl-26865842">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-readystate" data-title="ReadyState">enum <dfn data-export="" data-dfn-type="enum" id="dom-readystate" data-idl="enum" data-title="ReadyState" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>ReadyState</code></dfn> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-readystate-closed" id="ref-for-dom-readystate-closed-1"><code>closed</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-readystate-open" id="ref-for-dom-readystate-open-1"><code>open</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-readystate-ended" id="ref-for-dom-readystate-ended-1"><code>ended</code></a>"</span>, };</span></code></pre> <dl data-dfn-for="ReadyState"> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-readystate-closed" data-idl="enum-value" data-title="closed" data-dfn-for="ReadyState" tabindex="0" aria-haspopup="dialog"><code>closed</code></dfn> </dt> <dd> Indicates the source is not currently attached to a media element. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-readystate-open" data-idl="enum-value" data-title="open" data-dfn-for="ReadyState" tabindex="0" aria-haspopup="dialog"><code>open</code></dfn> </dt> <dd> The source has been opened by a media element and is ready for data to be appended to the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-12"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-15"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-2"><code>sourceBuffers</code></a>. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-readystate-ended" data-idl="enum-value" data-title="ended" data-dfn-for="ReadyState" tabindex="0" aria-haspopup="dialog"><code>ended</code></dfn> </dt> <dd> The source is still attached to a media element, but <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-16"><code>MediaSource</code></a>'s <a data-link-type="idl" data-lt="endOfStream()" href="#dom-mediasource-endofstream" class="internalDFN" id="ref-for-dom-mediasource-endofstream-1"><code>endOfStream</code></a><code>()</code> has been called. </dd> </dl> <div class="issue" id="issue-container-number-276"><div role="heading" class="issue-title marker" id="h-issue" aria-level="3"><a href="https://github.com/w3c/media-source/issues/276"><span class="issue-number">Issue 276</span></a><span class="issue-label">: MSE-in-Workers: Consider adding a "closing" readyState to explain new `InvalidStateError` exception when closing underway</span></div><aside class=""> <p> Consider adding a "<code>closing</code>" <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-2"><code>ReadyState</code></a> to indicate the source is in the process of being concurrently detached from a media element. This would be useful for some implementations of <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-17"><code>MediaSource</code></a> and <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-13"><code>SourceBuffer</code></a> in <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>. </p> </aside></div> <pre class="idl def" id="webidl-1031259774"><span class="idlHeader"><a class="self-link" href="#webidl-1031259774">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-endofstreamerror" data-title="EndOfStreamError">enum <dfn data-export="" data-dfn-type="enum" id="dom-endofstreamerror" data-idl="enum" data-title="EndOfStreamError" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>EndOfStreamError</code></dfn> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-endofstreamerror-network" id="ref-for-dom-endofstreamerror-network-1"><code>network</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-endofstreamerror-decode" id="ref-for-dom-endofstreamerror-decode-1"><code>decode</code></a>"</span>, };</span></code></pre> <dl data-dfn-for="EndOfStreamError"> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-endofstreamerror-network" data-idl="enum-value" data-title="network" data-dfn-for="EndOfStreamError" tabindex="0" aria-haspopup="dialog"><code>network</code></dfn> </dt> <dd> <p> Terminates playback and signals that a network error has occurred. </p> <div class="note" role="note" id="issue-container-generatedID-3"><div role="heading" class="note-title marker" id="h-note-3" aria-level="3"><span>Note</span></div><p class=""> JavaScript applications <em class="rfc2119">SHOULD</em> use this status code to terminate playback with a network error. For example, if a network error occurs while fetching media data. </p></div> </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-endofstreamerror-decode" data-idl="enum-value" data-title="decode" data-dfn-for="EndOfStreamError" tabindex="0" aria-haspopup="dialog"><code>decode</code></dfn> </dt> <dd> <p> Terminates playback and signals that a decoding error has occurred. </p> <div class="note" role="note" id="issue-container-generatedID-4"><div role="heading" class="note-title marker" id="h-note-4" aria-level="3"><span>Note</span></div><p class=""> JavaScript applications <em class="rfc2119">SHOULD</em> 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> </dd> </dl> <pre class="idl def" id="webidl-1502719514"><span class="idlHeader"><a class="self-link" href="#webidl-1502719514">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-mediasource" data-title="MediaSource">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-mediasource" id="ref-for-dom-mediasource-18"><code>MediaSource</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-mediasource-constructor" data-title="constructor" data-dfn-for="MediaSource"> <dfn data-export="" data-dfn-type="constructor" id="dom-mediasource-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="MediaSource" data-lt="constructor()" data-local-lt="MediaSource.constructor|MediaSource.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>();</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-handle" data-title="handle" data-dfn-for="MediaSource"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=DedicatedWorker</span>] readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-2"><code>MediaSourceHandle</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-handle" id="ref-for-dom-mediasource-handle-1"><code>handle</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-sourcebuffers" data-title="sourceBuffers" data-dfn-for="MediaSource"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-sourcebufferlist" class="internalDFN" id="ref-for-dom-sourcebufferlist-1"><code>SourceBufferList</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-sourcebuffers" id="ref-for-dom-mediasource-sourcebuffers-3"><code>sourceBuffers</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-activesourcebuffers" data-title="activeSourceBuffers" data-dfn-for="MediaSource"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-sourcebufferlist" class="internalDFN" id="ref-for-dom-sourcebufferlist-2"><code>SourceBufferList</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-activesourcebuffers" id="ref-for-dom-mediasource-activesourcebuffers-2"><code>activeSourceBuffers</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-readystate" data-title="readyState" data-dfn-for="MediaSource"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-1"><code>ReadyState</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-readystate" id="ref-for-dom-mediasource-readystate-3"><code>readyState</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-duration" data-title="duration" data-dfn-for="MediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double">unrestricted double</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-duration" id="ref-for-dom-mediasource-duration-1"><code>duration</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-onsourceopen" data-title="onsourceopen" data-dfn-for="MediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-onsourceopen" data-idl="attribute" data-title="onsourceopen" data-dfn-for="MediaSource" data-type="EventHandler" data-lt="onsourceopen" data-local-lt="MediaSource.onsourceopen" class="idlName" tabindex="0" aria-haspopup="dialog"><code>onsourceopen</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-onsourceended" data-title="onsourceended" data-dfn-for="MediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-onsourceended" data-idl="attribute" data-title="onsourceended" data-dfn-for="MediaSource" data-type="EventHandler" data-lt="onsourceended" data-local-lt="MediaSource.onsourceended" class="idlName" tabindex="0" aria-haspopup="dialog"><code>onsourceended</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-onsourceclose" data-title="onsourceclose" data-dfn-for="MediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-onsourceclose" data-idl="attribute" data-title="onsourceclose" data-dfn-for="MediaSource" data-type="EventHandler" data-lt="onsourceclose" data-local-lt="MediaSource.onsourceclose" class="idlName" tabindex="0" aria-haspopup="dialog"><code>onsourceclose</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-mediasource-canconstructindedicatedworker" data-title="canConstructInDedicatedWorker" data-dfn-for="MediaSource"> static readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-mediasource-canconstructindedicatedworker" id="ref-for-dom-mediasource-canconstructindedicatedworker-1"><code>canConstructInDedicatedWorker</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-addsourcebuffer-type" data-title="addSourceBuffer" data-dfn-for="MediaSource"><span class="idlType"> <a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-14"><code>SourceBuffer</code></a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-addsourcebuffer" id="ref-for-dom-mediasource-addsourcebuffer-2"><code>addSourceBuffer</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>);</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-removesourcebuffer-sourcebuffer" data-title="removeSourceBuffer" data-dfn-for="MediaSource"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-removesourcebuffer" id="ref-for-dom-mediasource-removesourcebuffer-1"><code>removeSourceBuffer</code></a>(<span class="idlType"><a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-15"><code>SourceBuffer</code></a></span> <span class="idlParamName">sourceBuffer</span>);</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-endofstream-error" data-title="endOfStream" data-dfn-for="MediaSource"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-endofstream" id="ref-for-dom-mediasource-endofstream-2"><code>endOfStream</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-endofstreamerror" class="internalDFN" id="ref-for-dom-endofstreamerror-1"><code>EndOfStreamError</code></a></span> <span class="idlParamName">error</span>);</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-setliveseekablerange-start-end" data-title="setLiveSeekableRange" data-dfn-for="MediaSource"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-setliveseekablerange" id="ref-for-dom-mediasource-setliveseekablerange-2"><code>setLiveSeekableRange</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double">double</a></span> <span class="idlParamName">start</span>,<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double">double</a></span> <span class="idlParamName">end</span>);</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-clearliveseekablerange" data-title="clearLiveSeekableRange" data-dfn-for="MediaSource"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-clearliveseekablerange" id="ref-for-dom-mediasource-clearliveseekablerange-2"><code>clearLiveSeekableRange</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-mediasource-istypesupported-type" data-title="isTypeSupported" data-dfn-for="MediaSource"> static<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-mediasource-istypesupported" id="ref-for-dom-mediasource-istypesupported-1"><code>isTypeSupported</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>);</span> };</span></code></pre> <section id="handle-attribute"><div class="header-wrapper"><h3 id="x3-1-handle-attribute"><bdi class="secno">3.1 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-handle" data-idl="attribute" data-title="handle" data-dfn-for="MediaSource" data-type="MediaSourceHandle" data-lt="handle" data-local-lt="MediaSource.handle" tabindex="0" aria-haspopup="dialog"><code>handle</code></dfn> attribute </h3><a class="self-link" href="#handle-attribute" aria-label="Permalink for Section 3.1"></a></div> <p> Contains a handle useful for attachment of a dedicated worker <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-19"><code>MediaSource</code></a> object to an <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> via <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a>. The handle remains the same object for this <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-20"><code>MediaSource</code></a> object across accesses of this attribute, but it is distinct for each <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-21"><code>MediaSource</code></a> object. </p> <div class="note" role="note" id="issue-container-generatedID-5"><div role="heading" class="note-title marker" id="h-note-5" aria-level="3"><span>Note</span></div><p class=""> This specification may eventually enable visibility of this attribute on <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-22"><code>MediaSource</code></a> objects on the main Window context. If so, specification care will be necessary to prevent potential backwards incompatible changes, such as could happen if exceptions were thrown on accesses to this attribute. </p></div> <p> On getting, run the following steps: </p> <ol> <li>If the handle for this <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-23"><code>MediaSource</code></a> object has not yet been created, then run the following steps: <ol> <li>Let <var data-type="MediaSourceHandle">created handle</var> be the result of creating a new <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-3"><code>MediaSourceHandle</code></a> object and associated resources, linked internally to this <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-24"><code>MediaSource</code></a>. </li> <li>Update the attribute to be <var data-type="MediaSourceHandle">created handle</var>. </li> </ol> </li> <li>Return the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-4"><code>MediaSourceHandle</code></a> object that is this attribute's value. </li> </ol> </section><section id="sourcebuffers-attribute"><div class="header-wrapper"><h3 id="x3-2-sourcebuffers-attribute"><bdi class="secno">3.2 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-sourcebuffers" data-idl="attribute" data-title="sourceBuffers" data-dfn-for="MediaSource" data-type="SourceBufferList" data-lt="sourceBuffers" data-local-lt="MediaSource.sourceBuffers" tabindex="0" aria-haspopup="dialog"><code>sourceBuffers</code></dfn> attribute </h3><a class="self-link" href="#sourcebuffers-attribute" aria-label="Permalink for Section 3.2"></a></div> <p> Contains the list of <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-16"><code>SourceBuffer</code></a> objects associated with this <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-25"><code>MediaSource</code></a>. When <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-26"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-4"><code>readyState</code></a> equals "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-2"><code>closed</code></a>" this list will be empty. Once <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-5"><code>readyState</code></a> transitions to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-2"><code>open</code></a>" SourceBuffer objects can be added to this list by using <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-3"><code>addSourceBuffer</code></a><code>()</code>. </p> </section><section id="activesourcebuffers-attribute"><div class="header-wrapper"><h3 id="x3-3-activesourcebuffers-attribute"><bdi class="secno">3.3 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-activesourcebuffers" data-idl="attribute" data-title="activeSourceBuffers" data-dfn-for="MediaSource" data-type="SourceBufferList" data-lt="activeSourceBuffers" data-local-lt="MediaSource.activeSourceBuffers" tabindex="0" aria-haspopup="dialog"><code>activeSourceBuffers</code></dfn> attribute </h3><a class="self-link" href="#activesourcebuffers-attribute" aria-label="Permalink for Section 3.3"></a></div> <p> Contains the subset of <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-4"><code>sourceBuffers</code></a> that are providing the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> video track, the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> audio track(s), and the <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code> text track(s). </p> <p> <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-17"><code>SourceBuffer</code></a> objects in this list <em class="rfc2119">MUST</em> appear in the same order as they appear in the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-5"><code>sourceBuffers</code></a> attribute; e.g., if only sourceBuffers[0] and sourceBuffers[3] are in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-3"><code>activeSourceBuffers</code></a>, then activeSourceBuffers[0] <em class="rfc2119">MUST</em> equal sourceBuffers[0] and activeSourceBuffers[1] <em class="rfc2119">MUST</em> equal sourceBuffers[3]. </p> <div class="note" role="note" id="issue-container-generatedID-6"><div role="heading" class="note-title marker" id="h-note-6" aria-level="3"><span>Note</span></div><p class=""> Section <a href="#active-source-buffer-changes" data-matched-text="[[[#active-source-buffer-changes]]]" class="sec-ref"><bdi class="secno">3.15.5 </bdi> <span>Changes to selected/enabled track state</span></a> describes how this attribute gets updated. </p></div> </section><section id="readystate-attribute"><div class="header-wrapper"><h3 id="x3-4-readystate-attribute"><bdi class="secno">3.4 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-readystate" data-idl="attribute" data-title="readyState" data-dfn-for="MediaSource" data-type="ReadyState" data-lt="readyState" data-local-lt="MediaSource.readyState" tabindex="0" aria-haspopup="dialog"><code>readyState</code></dfn> attribute </h3><a class="self-link" href="#readystate-attribute" aria-label="Permalink for Section 3.4"></a></div> <p> Indicates the current state of the <a href="#dom-mediasource" class="internalDFN" data-link-type="idl" id="ref-for-dom-mediasource-27"><code>MediaSource</code></a> object. When the <a href="#dom-mediasource" class="internalDFN" data-link-type="idl" id="ref-for-dom-mediasource-28"><code>MediaSource</code></a> is created <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-6"><code>readyState</code></a> <em class="rfc2119">MUST</em> be set to "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-3"><code>closed</code></a>". </p> </section><section id="duration-attribute"><div class="header-wrapper"><h3 id="x3-5-duration-attribute"><bdi class="secno">3.5 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-duration" data-idl="attribute" data-title="duration" data-dfn-for="MediaSource" data-type="unrestricted double" data-lt="duration" data-local-lt="MediaSource.duration" tabindex="0" aria-haspopup="dialog"><code>duration</code></dfn> attribute </h3><a class="self-link" href="#duration-attribute" aria-label="Permalink for Section 3.5"></a></div> <p> Allows the web application to set the presentation duration. The duration is initially set to NaN when the <a href="#dom-mediasource" class="internalDFN" data-link-type="idl" id="ref-for-dom-mediasource-29"><code>MediaSource</code></a> object is created. </p> <p> On getting, run the following steps: </p> <ol> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-7"><code>readyState</code></a> attribute is "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-4"><code>closed</code></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 a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-8"><code>readyState</code></a> attribute is not "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-3"><code>open</code></a>" then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-1"><code>updating</code></a> attribute equals true on any <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-18"><code>SourceBuffer</code></a> in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-6"><code>sourceBuffers</code></a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-1">duration change</a> algorithm with <var data-type="unrestricted double">new duration</var> set to the value being assigned to this attribute. <div class="note" role="note" id="issue-container-generatedID-7"><div role="heading" class="note-title marker" id="h-note-7" aria-level="3"><span>Note</span></div><p class=""> The <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-2">duration change</a> algorithm will adjust <var data-type="unrestricted double">new duration</var> higher if there is any currently buffered coded frame with a higher end time. </p></div> <div class="note" role="note" id="issue-container-generatedID-8"><div role="heading" class="note-title marker" id="h-note-8" aria-level="3"><span>Note</span></div><p class=""> <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-1"><code>appendBuffer</code></a><code>()</code> and <a data-link-type="idl" data-lt="endOfStream()" href="#dom-mediasource-endofstream" class="internalDFN" id="ref-for-dom-mediasource-endofstream-3"><code>endOfStream</code></a><code>()</code> can update the duration under certain circumstances. </p></div> </li> </ol> </section><section id="canconstructindedicatedworker-attribute"><div class="header-wrapper"><h3 id="x3-6-canconstructindedicatedworker-attribute"><bdi class="secno">3.6 </bdi> <dfn data-export="" data-dfn-type="attribute" id="dom-mediasource-canconstructindedicatedworker" data-idl="attribute" data-title="canConstructInDedicatedWorker" data-dfn-for="MediaSource" data-type="boolean" data-lt="canConstructInDedicatedWorker" data-local-lt="MediaSource.canConstructInDedicatedWorker" tabindex="0" aria-haspopup="dialog"><code>canConstructInDedicatedWorker</code></dfn> attribute </h3><a class="self-link" href="#canconstructindedicatedworker-attribute" aria-label="Permalink for Section 3.6"></a></div> <p> Returns true. </p> <div class="note" role="note" id="issue-container-generatedID-9"><div role="heading" class="note-title marker" id="h-note-9" aria-level="3"><span>Note</span></div><p class=""> This attribute enables main thread and dedicated worker feature detection of support for creating and using a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-30"><code>MediaSource</code></a> object in a dedicated worker, and mitigates the need for higher latency detection polyfills like attempting creation of a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-31"><code>MediaSource</code></a> object from a dedicated worker, especially if the feature is not supported. </p></div> </section><section id="addsourcebuffer-method"><div class="header-wrapper"><h3 id="x3-7-addsourcebuffer-method"><bdi class="secno">3.7 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-addsourcebuffer" data-idl="operation" data-title="addSourceBuffer()" data-dfn-for="MediaSource" data-type="SourceBuffer" data-lt="addSourceBuffer()|addSourceBuffer(type)" data-local-lt="MediaSource.addSourceBuffer|MediaSource.addSourceBuffer()|addSourceBuffer" tabindex="0" aria-haspopup="dialog"><code>addSourceBuffer()</code></dfn> method </h3><a class="self-link" href="#addsourcebuffer-method" aria-label="Permalink for Section 3.7"></a></div> <p> Adds a new <a href="#dom-sourcebuffer" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebuffer-19"><code>SourceBuffer</code></a> to <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-7"><code>sourceBuffers</code></a>. </p> <ol class="algorithm"> <li>If <var data-type="DOMString">type</var> is an empty string then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>If <var data-type="DOMString">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 data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-20"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-8"><code>sourceBuffers</code></a>, then throw a <a data-link-type="idl" data-lt="NotSupportedError" data-type="exception" href="https://webidl.spec.whatwg.org/#notsupportederror"><code>NotSupportedError</code></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 data-type="DOMString">type</var> would result in an unsupported <a data-link-type="dfn|abstract-op" href="#dfn-sourcebuffer-configuration" class="internalDFN" id="ref-for-dfn-sourcebuffer-configuration-1">SourceBuffer configuration</a>, then throw a <a data-link-type="idl" data-lt="QuotaExceededError" data-type="exception" href="https://webidl.spec.whatwg.org/#quotaexceedederror"><code>QuotaExceededError</code></a> exception and abort these steps. <div class="note" role="note" id="issue-container-generatedID-10"><div role="heading" class="note-title marker" id="h-note-10" aria-level="3"><span>Note</span></div><p class=""> For example, a user agent <em class="rfc2119">MAY</em> throw a <a data-link-type="idl" data-lt="QuotaExceededError" data-type="exception" href="https://webidl.spec.whatwg.org/#quotaexceedederror"><code>QuotaExceededError</code></a> exception if the media element has reached the <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a> 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 <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-9"><code>readyState</code></a> attribute is not in the "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-4"><code>open</code></a>" state then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Let <var>buffer</var> be a new instance of a <a data-link-type="idl" data-lt="ManagedSourceBuffer" href="#dom-managedsourcebuffer" class="internalDFN" id="ref-for-dom-managedsourcebuffer-2"><code>ManagedSourceBuffer</code></a> if <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a> is a <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-2"><code>ManagedMediaSource</code></a>, or a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-21"><code>SourceBuffer</code></a> otherwise, with their respective associated resources. </li> <li>Set <var>buffer</var>'s <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-1"><code>[[generate timestamps flag]]</code></a> to the value in the "Generate Timestamps Flag" column of the <cite><a data-matched-text="[[[MSE-REGISTRY]]]" href="https://w3c.github.io/mse-byte-stream-format-registry/">Media Source Extensions™ Byte Stream Format Registry</a></cite> entry that is associated with <var data-type="DOMString">type</var>. </li> <li>If <var>buffer</var>'s <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-2"><code>[[generate timestamps flag]]</code></a> is true, set <var>buffer</var>'s <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-1"><code>mode</code></a> to "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-1"><code>sequence</code></a>". Otherwise, set <var>buffer</var>'s <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-2"><code>mode</code></a> to "<a data-link-type="idl" href="#dom-appendmode-segments" class="internalDFN" id="ref-for-dom-appendmode-segments-1"><code>segments</code></a>". </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://infra.spec.whatwg.org/#list-append">Append</a> <var>buffer</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-9"><code>sourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-1"><code>addsourcebuffer</code></a> at <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-10"><code>sourceBuffers</code></a>. </li> <li>Return <var>buffer</var>. </li> </ol> </section><section id="removesourcebuffer-method"><div class="header-wrapper"><h3 id="x3-8-removesourcebuffer-method"><bdi class="secno">3.8 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-removesourcebuffer" data-idl="operation" data-title="removeSourceBuffer()" data-dfn-for="MediaSource" data-type="undefined" data-lt="removeSourceBuffer()|removeSourceBuffer(sourceBuffer)" data-local-lt="MediaSource.removeSourceBuffer|MediaSource.removeSourceBuffer()|removeSourceBuffer" tabindex="0" aria-haspopup="dialog"><code>removeSourceBuffer()</code></dfn> method </h3><a class="self-link" href="#removesourcebuffer-method" aria-label="Permalink for Section 3.8"></a></div> <p> Removes a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-22"><code>SourceBuffer</code></a> from <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-11"><code>sourceBuffers</code></a>. </p> <ol class="algorithm"> <li>If <var data-type="SourceBuffer">sourceBuffer</var> specifies an object that is not in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-12"><code>sourceBuffers</code></a> then throw a <a data-link-type="idl" data-lt="NotFoundError" data-type="exception" href="https://webidl.spec.whatwg.org/#notfounderror"><code>NotFoundError</code></a> exception and abort these steps. </li> <li>If the <var data-type="SourceBuffer">sourceBuffer</var>.<a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-2"><code>updating</code></a> attribute equals true, then run the following steps: <ol> <li>Abort the <a data-link-type="dfn|abstract-op" href="#dfn-buffer-append" class="internalDFN" id="ref-for-dfn-buffer-append-1">buffer append</a> algorithm if it is running. </li> <li>Set the <var data-type="SourceBuffer">sourceBuffer</var>.<a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-3"><code>updating</code></a> attribute to false. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="abort" href="#dfn-abort" class="internalDFN" id="ref-for-dfn-abort-1"><code>abort</code></a> at <var data-type="SourceBuffer">sourceBuffer</var>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-1"><code>updateend</code></a> at <var data-type="SourceBuffer">sourceBuffer</var>. </li> </ol> </li> <li>Let <var data-type="AudioTrackList">SourceBuffer audioTracks list</var> equal the <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> object returned by <var data-type="SourceBuffer">sourceBuffer</var>.<a data-link-type="idl" href="#dom-sourcebuffer-audiotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-audiotracks-1"><code>audioTracks</code></a>. </li> <li>If the <var data-type="AudioTrackList">SourceBuffer audioTracks list</var> is not empty, then run the following steps: <ol> <li>For each <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object in the <var data-type="AudioTrackList">SourceBuffer audioTracks list</var>, run the following steps: <ol> <li>Set the <a data-link-type="idl" href="#dom-audiotrack-sourcebuffer" class="internalDFN" id="ref-for-dom-audiotrack-sourcebuffer-1"><code>sourceBuffer</code></a> attribute on the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object to null. </li> <li>Remove the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object from the <var data-type="AudioTrackList">SourceBuffer audioTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-11"><div role="heading" class="note-title marker" id="h-note-11" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object, at the <var data-type="AudioTrackList">SourceBuffer audioTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> attribute on the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object was true at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var data-type="AudioTrackList">SourceBuffer audioTracks list</var>. </p></div> </li> <li>Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-1">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>, to remove the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object (or instead, the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> mirror of it if the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-32"><code>MediaSource</code></a> object was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>) from the media element: <ol> <li>Let <var data-type="AudioTrackList">HTMLMediaElement audioTracks list</var> equal the <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> object returned by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks"><code>audioTracks</code></a> attribute on the HTMLMediaElement. </li> <li>Remove the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object from the <var>HTMLMediaElement audioTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-12"><div role="heading" class="note-title marker" id="h-note-12" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object, at the <var data-type="AudioTrackList">HTMLMediaElement audioTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> attribute on the <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object was true at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var data-type="AudioTrackList">HTMLMediaElement audioTracks list</var>. </p></div> </li> </ol> </li> </ol> </li> </ol> </li> <li>Let <var data-type="VideoTrackList">SourceBuffer videoTracks list</var> equal the <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> object returned by <var data-type="SourceBuffer">sourceBuffer</var>.<a data-link-type="idl" href="#dom-sourcebuffer-videotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-videotracks-1"><code>videoTracks</code></a>. </li> <li>If the <var data-type="VideoTrackList">SourceBuffer videoTracks list</var> is not empty, then run the following steps: <ol> <li>For each <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object in the <var data-type="VideoTrackList">SourceBuffer videoTracks list</var>, run the following steps: <ol> <li>Set the <a data-link-type="idl" href="#dom-videotrack-sourcebuffer" class="internalDFN" id="ref-for-dom-videotrack-sourcebuffer-1"><code>sourceBuffer</code></a> attribute on the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object to null. </li> <li>Remove the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object from the <var data-type="VideoTrackList">SourceBuffer videoTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-13"><div role="heading" class="note-title marker" id="h-note-13" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object, at the <var data-type="VideoTrackList">SourceBuffer videoTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> attribute on the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object was true at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var data-type="VideoTrackList">SourceBuffer videoTracks list</var>. </p></div> </li> <li>Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-2">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>, to remove the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object (or instead, the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> mirror of it if the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-33"><code>MediaSource</code></a> object was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>) from the media element: <ol> <li>Let <var data-type="VideoTrackList">HTMLMediaElement videoTracks list</var> equal the <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> object returned by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks"><code>videoTracks</code></a> attribute on the HTMLMediaElement. </li> <li>Remove the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object from the <var>HTMLMediaElement videoTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-14"><div role="heading" class="note-title marker" id="h-note-14" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object, at the <var data-type="VideoTrackList">HTMLMediaElement videoTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> attribute on the <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object was true at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var data-type="VideoTrackList">HTMLMediaElement videoTracks list</var>. </p></div> </li> </ol> </li> </ol> </li> </ol> </li> <li>Let <var data-type="TextTrackList">SourceBuffer textTracks list</var> equal the <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> object returned by <var data-type="SourceBuffer">sourceBuffer</var>.<a data-link-type="idl" href="#dom-sourcebuffer-texttracks" class="internalDFN" id="ref-for-dom-sourcebuffer-texttracks-1"><code>textTracks</code></a>. </li> <li>If the <var data-type="TextTrackList">SourceBuffer textTracks list</var> is not empty, then run the following steps: <ol> <li>For each <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object in the <var data-type="TextTrackList">SourceBuffer textTracks list</var>, run the following steps: <ol> <li>Set the <a data-link-type="idl" href="#dom-texttrack-sourcebuffer" class="internalDFN" id="ref-for-dom-texttrack-sourcebuffer-1"><code>sourceBuffer</code></a> attribute on the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object to null. </li> <li>Remove the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object from the <var data-type="TextTrackList">SourceBuffer textTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-15"><div role="heading" class="note-title marker" id="h-note-15" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object, at the <var data-type="TextTrackList">SourceBuffer textTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> attribute on the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object was <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code> at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var>SourceBuffer textTracks list</var>. </p></div> </li> <li>Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-3">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>, to remove the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object (or instead, the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> mirror of it if the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-34"><code>MediaSource</code></a> object was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>) from the media element: <ol> <li>Let <var data-type="TextTrackList">HTMLMediaElement textTracks list</var> equal the <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> object returned by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks"><code>textTracks</code></a> attribute on the HTMLMediaElement. </li> <li>Remove the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object from the <var>HTMLMediaElement textTracks list</var>. <div class="note" role="note" id="issue-container-generatedID-16"><div role="heading" class="note-title marker" id="h-note-16" aria-level="3"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-removetrack">removetrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object, at the <var data-type="TextTrackList">HTMLMediaElement textTracks list</var>. If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> attribute on the <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object was <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code> at the beginning of this removal step, then this should also trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-change">change</a> at the <var data-type="TextTrackList">HTMLMediaElement textTracks list</var>. </p></div> </li> </ol> </li> </ol> </li> </ol> </li> <li>If <var data-type="SourceBuffer">sourceBuffer</var> is in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-4"><code>activeSourceBuffers</code></a>, then remove <var data-type="SourceBuffer">sourceBuffer</var> from <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-5"><code>activeSourceBuffers</code></a> and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-1"><code>removesourcebuffer</code></a> at the <a href="#dom-sourcebufferlist" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebufferlist-3"><code>SourceBufferList</code></a> returned by <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-6"><code>activeSourceBuffers</code></a>. </li> <li>Remove <var data-type="SourceBuffer">sourceBuffer</var> from <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-13"><code>sourceBuffers</code></a> and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-2"><code>removesourcebuffer</code></a> at the <a href="#dom-sourcebufferlist" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebufferlist-4"><code>SourceBufferList</code></a> returned by <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-14"><code>sourceBuffers</code></a>. </li> <li>Destroy all resources for <var data-type="SourceBuffer">sourceBuffer</var>. </li> </ol> </section><section id="endofstream-method"><div class="header-wrapper"><h3 id="x3-9-endofstream-method"><bdi class="secno">3.9 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-endofstream" data-idl="operation" data-title="endOfStream()" data-dfn-for="MediaSource" data-type="undefined" data-lt="endOfStream()|endOfStream(error)" data-local-lt="MediaSource.endOfStream|MediaSource.endOfStream()|endOfStream" tabindex="0" aria-haspopup="dialog"><code>endOfStream()</code></dfn> method </h3><a class="self-link" href="#endofstream-method" aria-label="Permalink for Section 3.9"></a></div> <p> Signals the end of the stream. </p> <ol class="algorithm"> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-10"><code>readyState</code></a> attribute is not in the "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-5"><code>open</code></a>" state then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-4"><code>updating</code></a> attribute equals true on any <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-23"><code>SourceBuffer</code></a> in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-15"><code>sourceBuffers</code></a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-end-of-stream" class="internalDFN" id="ref-for-dfn-end-of-stream-1">end of stream</a> algorithm with the error parameter set to <var data-type="EndOfStreamError">error</var>. </li> </ol> </section><section id="setliveseekablerange-method"><div class="header-wrapper"><h3 id="x3-10-setliveseekablerange-method"><bdi class="secno">3.10 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-setliveseekablerange" data-idl="operation" data-title="setLiveSeekableRange()" data-dfn-for="MediaSource" data-type="undefined" data-lt="setLiveSeekableRange()|setLiveSeekableRange(start, end)" data-local-lt="MediaSource.setLiveSeekableRange|MediaSource.setLiveSeekableRange()|setLiveSeekableRange" tabindex="0" aria-haspopup="dialog"><code>setLiveSeekableRange()</code></dfn> method </h3><a class="self-link" href="#setliveseekablerange-method" aria-label="Permalink for Section 3.10"></a></div> <p> Updates <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-1"><code>[[live seekable range]]</code></a> that is used in section <a href="#htmlmediaelement-extensions" data-matched-text="[[[#htmlmediaelement-extensions]]]" class="sec-ref"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions</a> to modify <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> behavior. </p> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-11"><code>readyState</code></a> attribute is not "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-6"><code>open</code></a>" then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If <var data-type="double">start</var> is negative or greater than <var data-type="double">end</var>, then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>Set <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-2"><code>[[live seekable range]]</code></a> to be a new <a href="https://html.spec.whatwg.org/multipage/media.html#normalised-timeranges-object">normalized TimeRanges object</a> containing a single range whose start position is <var data-type="double">start</var> and end position is <var data-type="double">end</var>. </li> </ol></section><section id="clearliveseekablerange-method"><div class="header-wrapper"><h3 id="x3-11-clearliveseekablerange-method"><bdi class="secno">3.11 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-clearliveseekablerange" data-idl="operation" data-title="clearLiveSeekableRange()" data-dfn-for="MediaSource" data-type="undefined" data-lt="clearLiveSeekableRange()" data-local-lt="MediaSource.clearLiveSeekableRange|MediaSource.clearLiveSeekableRange()|clearLiveSeekableRange" tabindex="0" aria-haspopup="dialog"><code>clearLiveSeekableRange()</code></dfn> method </h3><a class="self-link" href="#clearliveseekablerange-method" aria-label="Permalink for Section 3.11"></a></div> <p> Updates <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-3"><code>[[live seekable range]]</code></a> that is used in section <a href="#htmlmediaelement-extensions" data-matched-text="[[[#htmlmediaelement-extensions]]]" class="sec-ref"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions</a> to modify <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> behavior. </p> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-12"><code>readyState</code></a> attribute is not "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-7"><code>open</code></a>" then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-4"><code>[[live seekable range]]</code></a> contains a range, then set <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-5"><code>[[live seekable range]]</code></a> to be a new empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object. </li> </ol></section><section id="istypesupported-method"><div class="header-wrapper"><h3 id="x3-12-istypesupported-method"><bdi class="secno">3.12 </bdi> <dfn data-export="" data-dfn-type="method" id="dom-mediasource-istypesupported" data-idl="operation" data-title="isTypeSupported()" data-dfn-for="MediaSource" data-type="boolean" data-lt="isTypeSupported()|isTypeSupported(type)" data-local-lt="MediaSource.isTypeSupported|MediaSource.isTypeSupported()|isTypeSupported" tabindex="0" aria-haspopup="dialog"><code>isTypeSupported()</code></dfn> method </h3><a class="self-link" href="#istypesupported-method" aria-label="Permalink for Section 3.12"></a></div> <p> Check to see whether the <a href="#dom-mediasource" class="internalDFN" data-link-type="idl" id="ref-for-dom-mediasource-35"><code>MediaSource</code></a> is capable of creating <a href="#dom-sourcebuffer" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebuffer-24"><code>SourceBuffer</code></a> objects for the specified MIME type. </p> <div class="note" role="note" id="issue-container-generatedID-17"><div role="heading" class="note-title marker" id="h-note-17" aria-level="3"><span>Note</span></div><p class=""> If true is returned from this method, it only indicates that the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-36"><code>MediaSource</code></a> implementation is capable of creating <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-25"><code>SourceBuffer</code></a> objects for the specified MIME type. An <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-4"><code>addSourceBuffer</code></a><code>()</code> call <em class="rfc2119">SHOULD</em> still fail if sufficient resources are not available to support the addition of a new <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-26"><code>SourceBuffer</code></a>. </p></div> <div class="note" role="note" id="issue-container-generatedID-18"><div role="heading" class="note-title marker" id="h-note-18" aria-level="3"><span>Note</span></div><p class=""> This method returning true implies that <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-lt="canPlayType()" data-type="method" href="https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype"><code>canPlayType</code></a><code>()</code> will return "maybe" or "probably" since it does not make sense for a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-37"><code>MediaSource</code></a> to support a type the HTMLMediaElement knows it cannot play. </p></div> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>If <var data-type="DOMString">type</var> is an empty string, then return false. </li> <li>If <var data-type="DOMString">type</var> does not contain a valid MIME type string, then return false. </li> <li>If <var data-type="DOMString">type</var> contains a media type or media subtype that the MediaSource does not support, then return false. </li> <li>If <var data-type="DOMString">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></section><section id="mediasource-events"><div class="header-wrapper"><h3 id="x3-13-event-summary"><bdi class="secno">3.13 </bdi> Event Summary </h3><a class="self-link" href="#mediasource-events" aria-label="Permalink for Section 3.13"></a></div> <table class="data"> <thead> <tr> <th> Event name </th> <th> Interface </th> <th> Dispatched when... </th> </tr> </thead> <tbody><tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-sourceopen" tabindex="0" aria-haspopup="dialog" data-export="">sourceopen</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-38"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-13"><code>readyState</code></a> transitions from "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-5"><code>closed</code></a>" to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-8"><code>open</code></a>" or from "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-2"><code>ended</code></a>" to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-9"><code>open</code></a>". </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-sourceended" tabindex="0" aria-haspopup="dialog" data-export="">sourceended</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-39"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-14"><code>readyState</code></a> transitions from "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-10"><code>open</code></a>" to "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-3"><code>ended</code></a>". </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-sourceclose" tabindex="0" aria-haspopup="dialog" data-export="">sourceclose</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-40"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-15"><code>readyState</code></a> transitions from "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-11"><code>open</code></a>" to "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-6"><code>closed</code></a>" or "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-4"><code>ended</code></a>" to "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-7"><code>closed</code></a>". </td> </tr> </tbody></table> </section> <section id="mediasource-in-worker-communication-model"><div class="header-wrapper"><h3 id="x3-14-cross-context-communication-model"><bdi class="secno">3.14 </bdi> <dfn id="dfn-cross-context-communication-model" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Cross-context communication model</dfn> </h3><a class="self-link" href="#mediasource-in-worker-communication-model" aria-label="Permalink for Section 3.14"></a></div> <p> When a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> is attached to a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-41"><code>MediaSource</code></a>, each context has algorithms that depend on information from the other. </p> <div class="note" role="note" id="issue-container-generatedID-19"><div role="heading" class="note-title marker" id="h-note-19" aria-level="4"><span>Note</span></div><p class=""> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> is exposed only to <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> contexts, but <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-42"><code>MediaSource</code></a> and related objects defined in this specification are exposed in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> and <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> contexts. This lets applications construct a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-43"><code>MediaSource</code></a> object in either of those types of context and attach it to an <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> object in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> context using a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-1">MediaSource object URL</a> or a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-5"><code>MediaSourceHandle</code></a> as described in the <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-2">attaching to a media element</a> algorithm. A <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-44"><code>MediaSource</code></a> object is not <a data-link-type="idl" data-lt="Transferable" data-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><code>Transferable</code></a>; it is only visible in the context where it was created. </p></div> <p> The rest of this section describes a model for bounding information latency for attachments of a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> media element to a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-45"><code>MediaSource</code></a>. While the model describes communication using message passing, implementations <em class="rfc2119">MAY</em> choose to communicate in potentially faster ways, such as using shared memory and locks. Attachments to a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-46"><code>MediaSource</code></a> synchronously have the information already without communicating it across contexts. </p> <p> A <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-47"><code>MediaSource</code></a> that is constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> has a <dfn data-dfn-for="MediaSource" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-port-to-main" tabindex="0" aria-haspopup="dialog">[[port to main]]</dfn> internal slot that stores a <a data-link-type="idl" data-lt="MessagePort" data-type="interface" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport"><code>MessagePort</code></a> setup during attachment and nulled during detachment. A <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-1"><code>[[port to main]]</code></a> is always null. </p> <p> An <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> extended by this specification and attached to a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-48"><code>MediaSource</code></a> similarly has a <dfn data-dfn-for="HTMLMediaElement" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-port-to-worker" tabindex="0" aria-haspopup="dialog">[[port to worker]]</dfn> internal slot that stores a <a data-link-type="idl" data-lt="MessagePort" data-type="interface" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport"><code>MessagePort</code></a> and a <dfn data-dfn-for="HTMLMediaElement" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-channel-with-worker" tabindex="0" aria-haspopup="dialog">[[channel with worker]]</dfn> internal slot that stores a <a data-link-type="idl" data-lt="MessageChannel" data-type="interface" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messagechannel"><code>MessageChannel</code></a>, both setup during attachment and nulled during detachment. Both <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-1"><code>[[port to worker]]</code></a> and <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-1"><code>[[channel with worker]]</code></a> are null unless attached to a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-49"><code>MediaSource</code></a>. </p> <p> Algorithms in this specification that need to communicate information from a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> to an attached <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-50"><code>MediaSource</code></a>, or vice versa, will use these internal ports implicitly to post a message to their counterpart, where the implicit handler of the message runs steps as described in the algorithms. </p> </section> <section id="mediasource-algorithms"><div class="header-wrapper"><h3 id="x3-15-algorithms"><bdi class="secno">3.15 </bdi> Algorithms </h3><a class="self-link" href="#mediasource-algorithms" aria-label="Permalink for Section 3.15"></a></div> <section id="mediasource-attach"><div class="header-wrapper"><h4 id="x3-15-1-attaching-to-a-media-element"><bdi class="secno">3.15.1 </bdi> <dfn id="dfn-attaching-to-a-media-element" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Attaching to a media element</dfn> </h4><a class="self-link" href="#mediasource-attach" aria-label="Permalink for Section 3.15.1"></a></div> <p> There are distinct mechanisms for attaching a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-51"><code>MediaSource</code></a> to a media element depending on where the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-52"><code>MediaSource</code></a> object was constructed, in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> versus in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </p> <ul> <li> <p> Attaching a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-53"><code>MediaSource</code></a> that was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> can be done by assigning a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-2">MediaSource object URL</a> for that <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-54"><code>MediaSource</code></a> to the media element <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-src"><code>src</code></a> attribute or the src attribute of a &lt;source&gt; inside a media element. A <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-3">MediaSource object URL</a> is created by passing a MediaSource object to <a data-link-type="idl" data-lt="createObjectURL()" data-type="method" href="https://www.w3.org/TR/FileAPI/#dfn-createObjectURL"><code>createObjectURL</code></a><code>()</code>. </p> <p> Though implementations <em class="rfc2119">MAY</em> allow <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-4">MediaSource object URL</a> creation in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> for a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-55"><code>MediaSource</code></a> constructed in that worker, attempting to use that <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-5">MediaSource object URL</a> to attach to a media element using either the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-src"><code>src</code></a> attribute or the src attribute of a &lt;source&gt; inside a media element <em class="rfc2119">MUST</em> fail in the media element's <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>, as extended below. </p> <div class="note" role="note" id="issue-container-generatedID-20"><div role="heading" class="note-title marker" id="h-note-20" aria-level="5"><span>Note</span></div><p class=""> Extending the object URL attachment mechanism to worker MediaSource object URLs would further propagate this idiom that is less preferred versus using srcObject, and would unnecessarily increase user agent interoperability risk and implementation complexity. </p></div> </li> <li>Attaching a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-56"><code>MediaSource</code></a> that was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> can only be done by obtaining a handle from it using <a data-link-type="idl" href="#dom-mediasource-handle" class="internalDFN" id="ref-for-dom-mediasource-handle-2"><code>handle</code></a>, transferring that <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-6"><code>MediaSourceHandle</code></a> to the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> context and assigning it to the media element <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> attribute. For the purposes of aligning this specification with <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> resource loading and fetching algorithms, the underlying <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-57"><code>MediaSource</code></a> is the MediaSource object mentioned there, and the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-7"><code>MediaSourceHandle</code></a> object is the media provider object. </li> </ul> <p> If the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> was invoked with a media provider object that is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-58"><code>MediaSource</code></a> object, a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-8"><code>MediaSourceHandle</code></a> object or a URL record whose object is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-59"><code>MediaSource</code></a> object, then let mode be local, skip the first step in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> (which may otherwise set mode to remote) and continue the execution of the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>. </p> <div class="note" role="note" id="issue-container-generatedID-21"><div role="heading" class="note-title marker" id="h-note-21" aria-level="5"><span>Note</span></div><p class=""> The first step of the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> is expected to eventually align with selecting local mode for URL records whose objects are media provider objects. The intent is that if the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-src"><code>src</code></a> attribute or selected child <code><a data-link-type="element" data-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element">source</a></code>'s <code><a data-link-type="element-attr" data-type="element-attr" href="https://html.spec.whatwg.org/multipage/embedded-content.html#attr-source-src">src</a></code> attribute is a <code>blob:</code> URL matching a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-6">MediaSource object URL</a> when the respective <code>src</code> attribute was last changed, then that <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-60"><code>MediaSource</code></a> object is used as the media provider object and current media resource in the local mode logic in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>. This also means that the remote mode logic that includes observance of any preload attribute is skipped when a MediaSource object is attached. Even with that eventual change to [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>], the execution of the following steps at the beginning of the local mode logic is still required when the current media resource is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-61"><code>MediaSource</code></a> object. </p></div> <p> At the beginning of the "Otherwise (mode is local)" section of the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>, execute the additional steps, below. </p> <div class="note" role="note" id="issue-container-generatedID-22"><div role="heading" class="note-title marker" id="h-note-22" aria-level="5"><span>Note</span></div><p class=""> Relative to the action which triggered the media element's resource selection algorithm, these steps are asynchronous. The <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> is run after the task that invoked the resource selection algorithm is allowed to continue and a stable state is reached. Implementations may delay the steps in the "<i>Otherwise</i>" clause, below, until the MediaSource object is ready for use. </p></div> <ol> <li>If the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> was invoked with a media provider object that is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-62"><code>MediaSource</code></a> object, a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-9"><code>MediaSourceHandle</code></a> object or a URL record whose object is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-63"><code>MediaSource</code></a> object, then: <dl class="switch"> <dt> If the media provider object is a URL record whose object is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-64"><code>MediaSource</code></a> that was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>, such as would occur if attempting to use a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-7">MediaSource object URL</a> from a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-65"><code>MediaSource</code></a> </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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. <div class="note" role="note" id="issue-container-generatedID-23"><div role="heading" class="note-title marker" id="h-note-23" aria-level="5"><span>Note</span></div><div class=""> This prevents using <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-8">MediaSource object URLs</a> for DedicatedWorker MediaSource attachments. Transferring <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-66"><code>MediaSource</code></a>'s <a data-link-type="idl" href="#dom-mediasource-handle" class="internalDFN" id="ref-for-dom-mediasource-handle-3"><code>handle</code></a> from the DedicatedWorker to the Window context and assigning it to the media element's <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> attribute is the only way to attach such a MediaSource. </div></div> </dd> <dt> If the media provider object is a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-10"><code>MediaSourceHandle</code></a> whose <a data-link-type="attribute" data-lt="[[Detached]]" href="#dfn-detached" class="internalDFN" id="ref-for-dfn-detached-1"><code>[[Detached]]</code></a> internal slot is true </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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> <dt> If the media provider object is a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-11"><code>MediaSourceHandle</code></a> whose underlying <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-67"><code>MediaSource</code></a>'s <a data-link-type="attribute" data-lt="[[has ever been attached]]" href="#dfn-has-ever-been-attached" class="internalDFN" id="ref-for-dfn-has-ever-been-attached-1"><code>[[has ever been attached]]</code></a> internal slot is true </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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. <div class="note" role="note" id="issue-container-generatedID-24"><div role="heading" class="note-title marker" id="h-note-24" aria-level="5"><span>Note</span></div><div class=""> This prevents loading an underlying <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-68"><code>MediaSource</code></a> more than once using a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-12"><code>MediaSourceHandle</code></a>, even if the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-69"><code>MediaSource</code></a> was constructed on <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> and had been loaded previously using a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-9">MediaSource object URL</a>. This doesn't preclude subsequent use of a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-10">MediaSource object URL</a> for a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-70"><code>MediaSource</code></a> from succeeding though. </div></div> </dd> <dt> If <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-16"><code>readyState</code></a> is NOT set to "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-8"><code>closed</code></a>" </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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> <dt> Otherwise </dt> <dd> <ol> <li>Set the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-71"><code>MediaSource</code></a>'s <a data-link-type="attribute" data-lt="[[has ever been attached]]" href="#dfn-has-ever-been-attached" class="internalDFN" id="ref-for-dfn-has-ever-been-attached-2"><code>[[has ever been attached]]</code></a> internal slot to true. </li> <li>Set the media element's <a href="https://html.spec.whatwg.org/multipage/media.html#delaying-the-load-event-flag">delaying-the-load-event-flag</a> to false. </li> <li> <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-72"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>, then setup worker attachment communication and open the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-73"><code>MediaSource</code></a>: </dt> <dd> <ol> <li>Set <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-2"><code>[[channel with worker]]</code></a> to be a new <a data-link-type="idl" data-lt="MessageChannel" data-type="interface" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messagechannel"><code>MessageChannel</code></a>. </li> <li>Set <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-2"><code>[[port to worker]]</code></a> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/web-messaging.html#dom-messagechannel-port1"><code>port1</code></a> value of <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-3"><code>[[channel with worker]]</code></a>. </li> <li>Execute <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer">StructuredSerializeWithTransfer</a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/web-messaging.html#dom-messagechannel-port2"><code>port2</code></a> of <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-4"><code>[[channel with worker]]</code></a> as both the value and the sole member of the <var>transferList</var>, and let the result be <var data-type="MessagePort">serialized port2</var>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> on the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-74"><code>MediaSource</code></a>'s <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> that will <ol> <li>Execute <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer">StructuredDeserializeWithTransfer</a> with <var>serialized port2</var> and <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>'s <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object's-realm">realm</a>, and set <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-2"><code>[[port to main]]</code></a> to be the resulting deserialized clone of the transferred <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/web-messaging.html#dom-messagechannel-port2"><code>port2</code></a> value of <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-5"><code>[[channel with worker]]</code></a>. </li> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-17"><code>readyState</code></a> attribute to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-12"><code>open</code></a>". </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-1"><code>sourceopen</code></a> at the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-75"><code>MediaSource</code></a>. </li> </ol> </li> </ol> </dd> <dt> Otherwise, the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-76"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: </dt> <dd> <ol> <li>Set <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-6"><code>[[channel with worker]]</code></a> null. </li> <li>Set <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-3"><code>[[port to worker]]</code></a> null. </li> <li>Set <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-3"><code>[[port to main]]</code></a> null. </li> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-18"><code>readyState</code></a> attribute to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-13"><code>open</code></a>". </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-2"><code>sourceopen</code></a> at the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-77"><code>MediaSource</code></a>. </li> </ol> </dd> </dl> </li> <li>Continue the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> by running the remaining <span>"<i>Otherwise (mode is local)</i>"</span> steps, with these requirements: <ol> <li>Text in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> or the <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a> that refers to "the download", "bytes received", or "whenever new data for the current media resource becomes available" refers to data passed in via <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-2"><code>appendBuffer</code></a><code>()</code>. </li> <li>References to HTTP in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> and the <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a> shall not apply because the HTMLMediaElement does not fetch media data via HTTP when a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-78"><code>MediaSource</code></a> is attached. </li> </ol> </li> </ol> </dd> </dl> </li> </ol> <div class="note" role="note" id="issue-container-generatedID-25"><div role="heading" class="note-title marker" id="h-note-25" aria-level="5"><span>Note</span></div><p class=""> An attached MediaSource does not use the remote mode steps in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>, so the media element will not fire "suspend" events. Though future versions of this specification will likely remove "progress" and "stalled" events from a media element with an attached MediaSource, user agents conforming to this version of the specification may still fire these two events as these [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] references changed after implementations of this specification stabilized. </p></div> </section> <section id="mediasource-detach"><div class="header-wrapper"><h4 id="x3-15-2-detaching-from-a-media-element"><bdi class="secno">3.15.2 </bdi> <dfn id="dfn-detaching-from-a-media-element" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn" class="respec-offending-element" title="Found definition for &quot;Detaching from a media element&quot;, but nothing links to it. This is usually a spec bug!">Detaching from a media element</dfn> </h4><a class="self-link" href="#mediasource-detach" aria-label="Permalink for Section 3.15.2"></a></div> <p> The following steps are run in any case where the media element is going to transition to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-network_empty"><code>NETWORK_EMPTY</code></a> and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-emptied">emptied</a> at the media element. These steps <em class="rfc2119">SHOULD</em> be run right before the transition. </p> <ol> <li> <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-79"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </dt> <dd> <ol> <li>Notify the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-80"><code>MediaSource</code></a> using an internal <code>detach</code> message posted to <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-4"><code>[[port to worker]]</code></a>. </li> <li>Set <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-5"><code>[[port to worker]]</code></a> null. </li> <li>Set <a data-link-type="attribute" data-lt="[[channel with worker]]" href="#dfn-channel-with-worker" class="internalDFN" id="ref-for-dfn-channel-with-worker-7"><code>[[channel with worker]]</code></a> null. </li> <li>The implicit message handler for this <code>detach</code> notification runs the remainder of these steps in the <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-81"><code>MediaSource</code></a>. </li> </ol> </dd> <dt> Otherwise, the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-82"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: </dt> <dd> Continue the remainder of these steps on the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-83"><code>MediaSource</code></a>. </dd> </dl> </li> <li>Set <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-4"><code>[[port to main]]</code></a> null. </li> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-19"><code>readyState</code></a> attribute to "<a data-link-type="idl" href="#dom-readystate-closed" class="internalDFN" id="ref-for-dom-readystate-closed-9"><code>closed</code></a>". </li> <li>If <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a> is a <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-3"><code>ManagedMediaSource</code></a>, then set <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-1"><code>streaming</code></a> attribute to <code>false</code>. </li> <li>Update <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-2"><code>duration</code></a> to NaN. </li> <li>Remove all the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-27"><code>SourceBuffer</code></a> objects from <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-7"><code>activeSourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-3"><code>removesourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-8"><code>activeSourceBuffers</code></a>. </li> <li>Remove all the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-28"><code>SourceBuffer</code></a> objects from <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-16"><code>sourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-4"><code>removesourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-17"><code>sourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceclose" href="#dfn-sourceclose" class="internalDFN" id="ref-for-dfn-sourceclose-1"><code>sourceclose</code></a> at the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-84"><code>MediaSource</code></a>. </li> </ol> <div class="note" role="note" id="issue-container-generatedID-26"><div role="heading" class="note-title marker" id="h-note-26" aria-level="5"><span>Note</span></div><p class=""> Going forward, this algorithm is intended to be externally called and run in any case where the attached <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-85"><code>MediaSource</code></a>, if any, must be detached from the media element. It <em class="rfc2119">MAY</em> be called on HTMLMediaElement [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] operations like load() and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a> failures in addition to, or in place of, when the media element transitions to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-network_empty"><code>NETWORK_EMPTY</code></a>. Resource fetch algorithm failures are those which abort either the resource fetch algorithm or the resource selection algorithm, with the exception that the "Final step" [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] is not considered a failure that triggers detachment. </p></div> </section> <section id="mediasource-seeking"><div class="header-wrapper"><h4 id="x3-15-3-seeking"><bdi class="secno">3.15.3 </bdi> <dfn id="dfn-seeking" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn" class="respec-offending-element" title="Found definition for &quot;Seeking&quot;, but nothing links to it. This is usually a spec bug!">Seeking</dfn> </h4><a class="self-link" href="#mediasource-seeking" aria-label="Permalink for Section 3.15.3"></a></div> <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="https://html.spec.whatwg.org/multipage/media.html#dom-media-seek">seek algorithm</a>: </p> <ol> <li> <div class="note" role="note" id="issue-container-generatedID-27"><div role="heading" class="note-title marker" id="h-note-27" aria-level="5"><span>Note</span></div><p class=""> The media element looks for <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-4">media segments</a> containing the <var data-type="double">new playback position</var> in each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-29"><code>SourceBuffer</code></a> object in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-9"><code>activeSourceBuffers</code></a>. Any position within a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> in the current value of the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute has all necessary media segments buffered for that position. </p></div> <dl class="switch"> <dt> If <var>new playback position</var> is not in any <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> of <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> </dt> <dd> <ol> <li>If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-2"><code>readyState</code></a> attribute is greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-3"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-28"><div role="heading" class="note-title marker" id="h-note-28" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-4"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>The media element waits until an <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-3"><code>appendBuffer</code></a><code>()</code> call causes the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-2">coded frame processing</a> algorithm to set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-5"><code>readyState</code></a> attribute to a value greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-29"><div role="heading" class="note-title marker" id="h-note-29" aria-level="5"><span>Note</span></div><p class=""> The web application can use <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-1"><code>buffered</code></a> and <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> to determine what the media element needs to resume playback. </p></div> </li> </ol> </dd> <dt> Otherwise </dt> <dd> Continue <div class="note" role="note" id="issue-container-generatedID-30"><div role="heading" class="note-title marker" id="h-note-30" aria-level="5"><span>Note</span></div><p class=""> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-20"><code>readyState</code></a> attribute is "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-5"><code>ended</code></a>" and the <var>new playback position</var> is within a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> currently in <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a>, then the seek operation must continue to completion here even if one or more currently selected or enabled track buffers' largest range end timestamp is less than <var>new playback position</var>. This condition should only occur due to logic in <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-2"><code>buffered</code></a> when <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-21"><code>readyState</code></a> is "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-6"><code>ended</code></a>". </p></div> </dd> </dl> </li> <li>The media element resets all decoders and initializes each one with data from the appropriate <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-4">initialization segment</a>. </li> <li>The media element feeds <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-10">coded frames</a> from the <a data-link-type="dfn|abstract-op" href="#dfn-active-track-buffers" class="internalDFN" id="ref-for-dfn-active-track-buffers-1">active track buffers</a> into the decoders starting with the closest <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-1">random access point</a> before the <var>new playback position</var>. </li> <li>Resume the <a href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seek">seek algorithm</a> at the "<i>Await a stable state</i>" step. </li> </ol> </section> <section id="buffer-monitoring"><div class="header-wrapper"><h4 id="x3-15-4-sourcebuffer-monitoring"><bdi class="secno">3.15.4 </bdi> <dfn id="dfn-sourcebuffer-monitoring" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">SourceBuffer Monitoring</dfn> </h4><a class="self-link" href="#buffer-monitoring" aria-label="Permalink for Section 3.15.4"></a></div> <p> The following steps are periodically run during playback to make sure that all of the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-30"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-10"><code>activeSourceBuffers</code></a> have <a data-link-type="dfn|abstract-op" href="#enough-data" class="internalDFN" id="ref-for-enough-data-1">enough data to ensure uninterrupted playback</a>. Changes to <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-11"><code>activeSourceBuffers</code></a> also cause these steps to run because they affect the conditions that trigger state transitions. </p> <p> Having <dfn id="enough-data" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">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 data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_enough_data"><code>HAVE_ENOUGH_DATA</code></a> 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" role="note" id="issue-container-generatedID-31"><div role="heading" class="note-title marker" id="h-note-31" aria-level="5"><span>Note</span></div><p class=""> An implementation <em class="rfc2119">MAY</em> 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 <em class="rfc2119">MAY</em> change during playback so web applications <em class="rfc2119">SHOULD</em> only rely on the value of <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-6"><code>readyState</code></a> to determine whether more data is needed or not. </p></div> <div class="note" role="note" id="issue-container-generatedID-32"><div role="heading" class="note-title marker" id="h-note-32" aria-level="5"><span>Note</span></div><p class=""> When the media element needs more data, the user agent <em class="rfc2119">SHOULD</em> transition it from <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_enough_data"><code>HAVE_ENOUGH_DATA</code></a> to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_future_data"><code>HAVE_FUTURE_DATA</code></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></div> <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-7"><code>readyState</code></a> attribute equals <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></a>: </dt> <dd> <ol> <li>Abort these steps. </li> </ol> </dd> <dt> If <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> does not contain a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> for the current playback position: </dt> <dd> <ol> <li>Set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-8"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-33"><div role="heading" class="note-title marker" id="h-note-33" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-9"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>Abort these steps. </li> </ol> </dd> <dt> If <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> contains a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> that includes the current playback position and <a data-link-type="dfn|abstract-op" href="#enough-data" class="internalDFN" id="ref-for-enough-data-2">enough data to ensure uninterrupted playback</a>: </dt> <dd> <ol> <li>Set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-10"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_enough_data"><code>HAVE_ENOUGH_DATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-34"><div role="heading" class="note-title marker" id="h-note-34" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-11"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>Playback may resume at this point if it was previously suspended by a transition to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a>. </li> <li>Abort these steps. </li> </ol> </dd> <dt> If <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> contains a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></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 data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-12"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_future_data"><code>HAVE_FUTURE_DATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-35"><div role="heading" class="note-title marker" id="h-note-35" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-13"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>Playback may resume at this point if it was previously suspended by a transition to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a>. </li> <li>Abort these steps. </li> </ol> </dd> <dt> If <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> contains a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></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 data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-14"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-36"><div role="heading" class="note-title marker" id="h-note-36" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-15"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>Playback is suspended at this point since the media element doesn't have enough data to advance the <a href="https://html.spec.whatwg.org/multipage/media.html#media-timeline">media timeline</a>. </li> <li>Abort these steps. </li> </ol> </dd> </dl> </section> <section id="active-source-buffer-changes"><div class="header-wrapper"><h4 id="x3-15-5-changes-to-selected-enabled-track-state"><bdi class="secno">3.15.5 </bdi> <dfn id="dfn-changes-to-selected-enabled-track-state" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn" class="respec-offending-element" title="Found definition for &quot;Changes to selected/enabled track state&quot;, but nothing links to it. This is usually a spec bug!">Changes to selected/enabled track state</dfn> </h4><a class="self-link" href="#active-source-buffer-changes" aria-label="Permalink for Section 3.15.5"></a></div> <p> During playback <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-12"><code>activeSourceBuffers</code></a> needs to be updated if the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> video track, the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> audio track(s), or a text track <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> changes. When one or more of these changes occur the following steps need to be followed. Also, when <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-86"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>, then each change that occurs to a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> mirror of a track created previously by the implicit handler for the internal <code>create track mirror</code> message <em class="rfc2119">MUST</em> also be made to the corresponding <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> track using an internal <code>update track state</code> message posted to <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-6"><code>[[port to worker]]</code></a> whose implicit handler makes the change and runs the following steps. Likewise, each change that occurs to a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> track <em class="rfc2119">MUST</em> also be made to the corresponding <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> mirror of the track using an internal <code>update track state</code> message posted to <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-5"><code>[[port to main]]</code></a> whose implicit handler makes the change to the mirror. </p> <dl class="switch"> <dt> If the selected video track changes, then run the following steps: </dt> <dd> <ol> <li>If the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-31"><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 data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-32"><code>SourceBuffer</code></a> from <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-13"><code>activeSourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-5"><code>removesourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-14"><code>activeSourceBuffers</code></a> </li> </ol> </li> <li>If the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-33"><code>SourceBuffer</code></a> associated with the newly selected video track is not already in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-15"><code>activeSourceBuffers</code></a>, run the following steps: <ol> <li>Add the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-34"><code>SourceBuffer</code></a> to <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-16"><code>activeSourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-2"><code>addsourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-17"><code>activeSourceBuffers</code></a> </li> </ol> </li> </ol> </dd> <dt> If an audio track becomes disabled and the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-35"><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 data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-36"><code>SourceBuffer</code></a> associated with the audio track from <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-18"><code>activeSourceBuffers</code></a> </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-6"><code>removesourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-19"><code>activeSourceBuffers</code></a> </li> </ol> </dd> <dt> If an audio track becomes enabled and the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-37"><code>SourceBuffer</code></a> associated with this track is not already in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-20"><code>activeSourceBuffers</code></a>, then run the following steps: </dt> <dd> <ol> <li>Add the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-38"><code>SourceBuffer</code></a> associated with the audio track to <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-21"><code>activeSourceBuffers</code></a> </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-3"><code>addsourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-22"><code>activeSourceBuffers</code></a> </li> </ol> </dd> <dt> If a text track <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> becomes <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-disabled">"disabled"</a></code> and the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-39"><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 data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-40"><code>SourceBuffer</code></a> associated with the text track from <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-23"><code>activeSourceBuffers</code></a> </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-7"><code>removesourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-24"><code>activeSourceBuffers</code></a> </li> </ol> </dd> <dt> If a text track <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> becomes <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code> and the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-41"><code>SourceBuffer</code></a> associated with this track is not already in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-25"><code>activeSourceBuffers</code></a>, then run the following steps: </dt> <dd> <ol> <li>Add the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-42"><code>SourceBuffer</code></a> associated with the text track to <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-26"><code>activeSourceBuffers</code></a> </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-4"><code>addsourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-27"><code>activeSourceBuffers</code></a> </li> </ol> </dd> </dl> </section> <section id="duration-change-algorithm"><div class="header-wrapper"><h4 id="x3-15-6-duration-change"><bdi class="secno">3.15.6 </bdi> <dfn id="dfn-duration-change" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Duration change</dfn> </h4><a class="self-link" href="#duration-change-algorithm" aria-label="Permalink for Section 3.15.6"></a></div> <p> Follow these steps when <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-3"><code>duration</code></a> needs to change to a <var data-type="unrestricted double">new duration</var>. </p> <ol> <li>If the current value of <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-4"><code>duration</code></a> is equal to <var>new duration</var>, then return. </li> <li>If <var>new duration</var> is less than the highest <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-11">presentation timestamp</a> of any buffered <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-11">coded frames</a> for all <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-43"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-18"><code>sourceBuffers</code></a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. <div class="note" role="note" id="issue-container-generatedID-37"><div role="heading" class="note-title marker" id="h-note-37" aria-level="5"><span>Note</span></div><p class=""> Duration reductions that would truncate currently buffered media are disallowed. When truncation is necessary, use <a data-link-type="idl" data-lt="remove()" href="#dom-sourcebuffer-remove" class="internalDFN" id="ref-for-dom-sourcebuffer-remove-1"><code>remove</code></a><code>()</code> to reduce the buffered range before updating <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-5"><code>duration</code></a>. </p></div> </li> <li>Let <var data-type="unrestricted double">highest end time</var> be the largest <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-1">track buffer ranges</a> end time across all the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-2">track buffers</a> across all <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-44"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-19"><code>sourceBuffers</code></a>. </li> <li>If <var>new duration</var> is less than <var data-type="unrestricted double">highest end time</var>, then <div class="note" role="note" id="issue-container-generatedID-38"><div role="heading" class="note-title marker" id="h-note-38" aria-level="5"><span>Note</span></div><p class=""> This condition can occur because the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-1">coded frame removal</a> algorithm preserves coded frames that start before the start of the removal range. </p></div> <ol> <li>Update <var>new duration</var> to equal <var data-type="unrestricted double">highest end time</var>. </li> </ol> </li> <li>Update <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-6"><code>duration</code></a> to <var>new duration</var>. </li> <li>Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-4">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> to update the media element's duration: <ol> <li>Update the media element's <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-duration"><code>duration</code></a> to <var>new duration</var>. </li> <li>Run the <a href="https://html.spec.whatwg.org/multipage/media.html#durationChange">HTMLMediaElement duration change algorithm</a>. </li> </ol> </li> </ol> </section> <section id="end-of-stream-algorithm"><div class="header-wrapper"><h4 id="x3-15-7-end-of-stream"><bdi class="secno">3.15.7 </bdi> <dfn id="dfn-end-of-stream" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">End of stream</dfn> </h4><a class="self-link" href="#end-of-stream-algorithm" aria-label="Permalink for Section 3.15.7"></a></div> <p> This algorithm gets called when the application signals the end of stream via an <a data-link-type="idl" data-lt="endOfStream()" href="#dom-mediasource-endofstream" class="internalDFN" id="ref-for-dom-mediasource-endofstream-4"><code>endOfStream</code></a><code>()</code> call or an algorithm needs to signal a decode error. This algorithm takes an <var data-type="EndOfStreamError">error</var> parameter that indicates whether an error will be signalled. </p> <ol> <li>Change the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-22"><code>readyState</code></a> attribute value to "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-7"><code>ended</code></a>". </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceended" href="#dfn-sourceended" class="internalDFN" id="ref-for-dfn-sourceended-1"><code>sourceended</code></a> at the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-87"><code>MediaSource</code></a>. </li> <li> <dl class="switch"> <dt> If <var data-type="EndOfStreamError">error</var> is not set </dt> <dd> <ol> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-3">duration change</a> algorithm with <var data-type="unrestricted double">new duration</var> set to the largest <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-2">track buffer ranges</a> end time across all the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-3">track buffers</a> across all <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-45"><code>SourceBuffer</code></a> objects in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-20"><code>sourceBuffers</code></a>. <div class="note" role="note" id="issue-container-generatedID-39"><div role="heading" class="note-title marker" id="h-note-39" aria-level="5"><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 data-type="EndOfStreamError">error</var> is set to "<a data-link-type="idl" href="#dom-endofstreamerror-network" class="internalDFN" id="ref-for-dom-endofstreamerror-network-2"><code>network</code></a>" </dt> <dd> Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-5">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-16"><code>readyState</code></a> attribute equals <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></a> </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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> <dt> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-17"><code>readyState</code></a> attribute is greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> </dl> </dd> <dt> If <var data-type="EndOfStreamError">error</var> is set to "<a data-link-type="idl" href="#dom-endofstreamerror-decode" class="internalDFN" id="ref-for-dom-endofstreamerror-decode-2"><code>decode</code></a>" </dt> <dd> Use the <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-6">mirror if necessary</a> algorithm to run the following steps in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-18"><code>readyState</code></a> attribute equals <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></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 data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> <dt> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-19"><code>readyState</code></a> attribute is greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></a> </dt> <dd> Run the <a href="https://html.spec.whatwg.org/multipage/media.html#fatal-decode-error">media data is corrupted</a> steps of the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource">resource fetch algorithm</a>'s <a href="https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list">media data processing steps list</a>. </dd> </dl> </dd> </dl> </li> </ol> </section> <section id="mirror-if-necessary-algorithm"><div class="header-wrapper"><h4 id="x3-15-8-mirror-if-necessary"><bdi class="secno">3.15.8 </bdi> <dfn id="dfn-mirror-if-necessary" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Mirror if necessary</dfn> </h4><a class="self-link" href="#mirror-if-necessary-algorithm" aria-label="Permalink for Section 3.15.8"></a></div> <p> This algorithm is used to run steps on <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> from a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-88"><code>MediaSource</code></a> attached from either the same <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> or from a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>, usually to update the state of the attached <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>. This algorithm takes a <var>steps</var> parameter that lists the steps to run on <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>. </p> <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-89"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </dt> <dd> Post an internal <code>mirror on window</code> message to <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-6"><code>[[port to main]]</code></a> whose implicit handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> will run <var>steps</var>. Return control to the caller without awaiting that handler's receipt of the message. <div class="note" role="note" id="issue-container-generatedID-40"><div role="heading" class="note-title marker" id="h-note-40" aria-level="5"><span>Note</span></div><div class=""> The purpose of the mirror message mechanism is to ensure that: <ol> <li><var>steps</var> run asynchronously as their own task on <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> rather than these <var>steps</var> somehow happening in the middle of some other <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> task's execution, and </li> <li><var>steps</var> are run without blocking the synchronous execution and return of this algorithm on <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>. </li> </ol> </div></div> </dd> <dt> Otherwise: </dt> <dd> Run <var>steps</var>. </dd> </dl> </section> </section> </section> <section id="mediasourcehandle"><div class="header-wrapper"><h2 id="x4-mediasourcehandle-interface"><bdi class="secno">4. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-mediasourcehandle" data-idl="interface" data-title="MediaSourceHandle" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MediaSourceHandle</code></dfn> interface </h2><a class="self-link" href="#mediasourcehandle" aria-label="Permalink for Section 4."></a></div> <p> The <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-13"><code>MediaSourceHandle</code></a> interface represents a proxy for a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-90"><code>MediaSource</code></a> object that is useful for attaching a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-91"><code>MediaSource</code></a> to a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> using <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> as described in the <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-3">attaching to a media element</a> algorithm. </p> <div class="note" role="note" id="issue-container-generatedID-41"><div role="heading" class="note-title marker" id="h-note-41" aria-level="3"><span>Note</span></div><p class=""> This distinct object is necessary to attach a cross-context <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-92"><code>MediaSource</code></a> to a media element because <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-93"><code>MediaSource</code></a> objects themselves are not transferable since they are event targets. </p></div> <p> Each <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-14"><code>MediaSourceHandle</code></a> object has a <dfn data-dfn-for="MediaSourceHandle" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-has-ever-been-assigned-as-srcobject" tabindex="0" aria-haspopup="dialog">[[has ever been assigned as srcobject]]</dfn> internal slot that stores a <a data-link-type="idl" data-lt="boolean" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><code>boolean</code></a>. It is initialized to false when the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-15"><code>MediaSourceHandle</code></a> object is created, is set true in the extended <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> setter as described in section <a href="#htmlmediaelement-extensions" data-matched-text="[[[#htmlmediaelement-extensions]]]" class="sec-ref"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions</a>, and if true, prevents successful transfer of the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-16"><code>MediaSourceHandle</code></a> as described in section <a href="#transfer" data-matched-text="[[[#transfer]]]" class="sec-ref"><bdi class="secno">4.1 </bdi> Transfer</a>. </p> <p> <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-17"><code>MediaSourceHandle</code></a> objects are <a data-link-type="idl" data-lt="Transferable" data-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><code>Transferable</code></a>, each having a <dfn data-dfn-for="MediaSourceHandle" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-detached" tabindex="0" aria-haspopup="dialog">[[Detached]]</dfn> internal slot that is used to ensure that once the handle object instance has been transferred, that instance cannot be transferred again. </p> <pre class="idl def" id="webidl-1737388085"><span class="idlHeader"><a class="self-link" href="#webidl-1737388085">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-mediasourcehandle" data-title="MediaSourceHandle">[<span class="extAttr"><a data-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable">Transferable</a></span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-mediasourcehandle" id="ref-for-dom-mediasourcehandle-18"><code>MediaSourceHandle</code></a> {};</span></code></pre> <section id="transfer"><div class="header-wrapper"><h3 id="x4-1-transfer"><bdi class="secno">4.1 </bdi> Transfer </h3><a class="self-link" href="#transfer" aria-label="Permalink for Section 4.1"></a></div> <p> The <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-19"><code>MediaSourceHandle</code></a> <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps">transfer steps</a> and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps">transfer-receiving steps</a> require the implementation to maintain an implicit internal slot referencing the underlying <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-94"><code>MediaSource</code></a> to enable <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-4">attaching to a media element</a> using <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> and consequent setup of an attachment's <a data-link-type="dfn|abstract-op" href="#dfn-cross-context-communication-model" class="internalDFN" id="ref-for-dfn-cross-context-communication-model-1">cross-context communication model</a>. </p> <div class="note" role="note" id="issue-container-generatedID-42"><div role="heading" class="note-title marker" id="h-note-42" aria-level="4"><span>Note</span></div><p class=""> Implementors should be aware that assumption of "move" semantics implied by <a data-link-type="idl" data-lt="Transferable" data-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><code>Transferable</code></a> is not always reality. For example, extensions or internal implementations of postMessage using broadcast may cause unintended multiple recipients of a transferred <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-20"><code>MediaSourceHandle</code></a>. For this reason, implementations are guided to not resolve which potential clone of a transferred <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-21"><code>MediaSourceHandle</code></a> is still valid for attachment until and unless any handle for the underlying <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-95"><code>MediaSource</code></a> object is used in the asynchronous portion of the media element's resource selection algorithm. This is similar to the existing behavior for attachment via <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-11">MediaSource object URLs</a>, which can be cloned easily, where such a URL is valid for at most one attachment start (across all of its potentially many clones). </p></div> <p> Implementations <em class="rfc2119">MUST</em> support at most one attachment (load) via <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> ever for the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-96"><code>MediaSource</code></a> object underlying a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-22"><code>MediaSourceHandle</code></a>, regardless of potential cloning of the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-23"><code>MediaSourceHandle</code></a> due to varying implementations of <a data-link-type="idl" data-lt="Transferable" data-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><code>Transferable</code></a>. </p> <div class="note" role="note" id="issue-container-generatedID-43"><div role="heading" class="note-title marker" id="h-note-43" aria-level="4"><span>Note</span></div><p class=""> See <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-5">attaching to a media element</a> for how this is enforced during the asynchronous portion of the media element's resource selection algorithm. </p></div> <p> <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-24"><code>MediaSourceHandle</code></a> is only exposed on <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> and <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> contexts, and cannot successfully transfer between different <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-agent-clusters">agent clusters</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecmascript" title="ECMAScript Language Specification">ECMASCRIPT</a></cite>]. Transfer of a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-25"><code>MediaSourceHandle</code></a> object can only succeed within the same <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-agent-clusters">agent cluster</a>. </p> <div class="note" role="note" id="issue-container-generatedID-44"><div role="heading" class="note-title marker" id="h-note-44" aria-level="4"><span>Note</span></div><p class=""> For example, transfer of a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-26"><code>MediaSourceHandle</code></a> object from either a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> or <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> to either a SharedWorker or a ServiceWorker will not succeed. Developers should be aware of this difference versus <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-12">MediaSource object URLs</a> which are <a data-link-type="idl" data-lt="DOMString" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><code>DOMString</code></a>s that can be communicated many ways. Even so, <a data-link-type="dfn|abstract-op" href="#dfn-attaching-to-a-media-element" class="internalDFN" id="ref-for-dfn-attaching-to-a-media-element-6">attaching to a media element</a> using a <a data-link-type="dfn|abstract-op" href="#mediasource-object-url" class="internalDFN" id="ref-for-mediasource-object-url-13">MediaSource object URL</a> can only succeed for a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-97"><code>MediaSource</code></a> that was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> context. See also the integration of the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#agent">agent</a> and <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-agent-clusters">agent cluster</a> formalisms for Web Application APIs [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] where related concepts such as <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#dedicated-worker-agent">dedicated worker agents</a> are defined. </p></div> <p> <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps">Transfer steps</a> for a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-27"><code>MediaSourceHandle</code></a> object <em class="rfc2119">MUST</em> include the following step: </p> <ol> <li>If the <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-28"><code>MediaSourceHandle</code></a>'s <a data-link-type="attribute" data-lt="[[has ever been assigned as srcobject]]" href="#dfn-has-ever-been-assigned-as-srcobject" class="internalDFN" id="ref-for-dfn-has-ever-been-assigned-as-srcobject-1"><code>[[has ever been assigned as srcobject]]</code></a> internal slot is true, then the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps">transfer steps</a> must fail by throwing a <a data-link-type="idl" data-lt="DataCloneError" data-type="exception" href="https://webidl.spec.whatwg.org/#datacloneerror"><code>DataCloneError</code></a> exception. </li> </ol> </section> </section> <section id="sourcebuffer"><div class="header-wrapper"><h2 id="x5-sourcebuffer-interface"><bdi class="secno">5. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-sourcebuffer" data-idl="interface" data-title="SourceBuffer" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>SourceBuffer</code></dfn> interface </h2><a class="self-link" href="#sourcebuffer" aria-label="Permalink for Section 5."></a></div> <pre class="idl def" id="webidl-955395090"><span class="idlHeader"><a class="self-link" href="#webidl-955395090">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-appendmode" data-title="AppendMode">enum <dfn data-export="" data-dfn-type="enum" id="dom-appendmode" data-idl="enum" data-title="AppendMode" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>AppendMode</code></dfn> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-appendmode-segments" id="ref-for-dom-appendmode-segments-2"><code>segments</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-appendmode-sequence" id="ref-for-dom-appendmode-sequence-2"><code>sequence</code></a>"</span>, };</span></code></pre> <dl data-dfn-for="AppendMode"> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-appendmode-segments" data-idl="enum-value" data-title="segments" data-dfn-for="AppendMode" tabindex="0" aria-haspopup="dialog"><code>segments</code></dfn> </dt> <dd> The timestamps in the media segment determine where the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-12">coded frames</a> are placed in the presentation. Media segments can be appended in any order. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-appendmode-sequence" data-idl="enum-value" data-title="sequence" data-dfn-for="AppendMode" tabindex="0" aria-haspopup="dialog"><code>sequence</code></dfn> </dt> <dd> 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 data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-1"><code>timestampOffset</code></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 data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-2"><code>timestampOffset</code></a> attribute in "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-3"><code>sequence</code></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. </dd> </dl> <pre class="idl def" id="webidl-544711679"><span class="idlHeader"><a class="self-link" href="#webidl-544711679">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-sourcebuffer" data-title="SourceBuffer">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-sourcebuffer" id="ref-for-dom-sourcebuffer-46"><code>SourceBuffer</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a></span> {<span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-mode" data-title="mode" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" href="#dom-appendmode" class="internalDFN" id="ref-for-dom-appendmode-1"><code>AppendMode</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-mode" id="ref-for-dom-sourcebuffer-mode-3"><code>mode</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-updating" data-title="updating" data-dfn-for="SourceBuffer"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-updating" id="ref-for-dom-sourcebuffer-updating-5"><code>updating</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-buffered" data-title="buffered" data-dfn-for="SourceBuffer"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges">TimeRanges</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-buffered" id="ref-for-dom-sourcebuffer-buffered-3"><code>buffered</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-timestampoffset" data-title="timestampOffset" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double">double</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-timestampoffset" id="ref-for-dom-sourcebuffer-timestampoffset-3"><code>timestampOffset</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-audiotracks" data-title="audioTracks" data-dfn-for="SourceBuffer"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist">AudioTrackList</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-audiotracks" id="ref-for-dom-sourcebuffer-audiotracks-2"><code>audioTracks</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-videotracks" data-title="videoTracks" data-dfn-for="SourceBuffer"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist">VideoTrackList</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-videotracks" id="ref-for-dom-sourcebuffer-videotracks-2"><code>videoTracks</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-texttracks" data-title="textTracks" data-dfn-for="SourceBuffer"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist">TextTrackList</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-texttracks" id="ref-for-dom-sourcebuffer-texttracks-2"><code>textTracks</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-appendwindowstart" data-title="appendWindowStart" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double">double</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-appendwindowstart" id="ref-for-dom-sourcebuffer-appendwindowstart-2"><code>appendWindowStart</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-appendwindowend" data-title="appendWindowEnd" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double">unrestricted double</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-appendwindowend" id="ref-for-dom-sourcebuffer-appendwindowend-2"><code>appendWindowEnd</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-onupdatestart" data-title="onupdatestart" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-onupdatestart" id="ref-for-dom-sourcebuffer-onupdatestart-1"><code>onupdatestart</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-onupdate" data-title="onupdate" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-onupdate" id="ref-for-dom-sourcebuffer-onupdate-1"><code>onupdate</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-onupdateend" data-title="onupdateend" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-onupdateend" id="ref-for-dom-sourcebuffer-onupdateend-1"><code>onupdateend</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-onerror" data-title="onerror" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-onerror" id="ref-for-dom-sourcebuffer-onerror-1"><code>onerror</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebuffer-onabort" data-title="onabort" data-dfn-for="SourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebuffer-onabort" id="ref-for-dom-sourcebuffer-onabort-1"><code>onabort</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-sourcebuffer-appendbuffer-data" data-title="appendBuffer" data-dfn-for="SourceBuffer"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-sourcebuffer-appendbuffer" id="ref-for-dom-sourcebuffer-appendbuffer-4"><code>appendBuffer</code></a>(<span class="idlType"><a data-link-type="idl" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource">BufferSource</a></span> <span class="idlParamName">data</span>);</span><span data-idl="" class="idlMethod" id="idl-def-sourcebuffer-abort" data-title="abort" data-dfn-for="SourceBuffer"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-sourcebuffer-abort" id="ref-for-dom-sourcebuffer-abort-2"><code>abort</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-sourcebuffer-changetype-type" data-title="changeType" data-dfn-for="SourceBuffer"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-sourcebuffer-changetype" id="ref-for-dom-sourcebuffer-changetype-3"><code>changeType</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>);</span><span data-idl="" class="idlMethod" id="idl-def-sourcebuffer-remove-start-end" data-title="remove" data-dfn-for="SourceBuffer"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-sourcebuffer-remove" id="ref-for-dom-sourcebuffer-remove-2"><code>remove</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double">double</a></span> <span class="idlParamName">start</span>,<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double">unrestricted double</a></span> <span class="idlParamName">end</span>);</span> };</span></code></pre> <div class="issue" id="issue-container-number-280"><div role="heading" class="issue-title marker" id="h-issue-0" aria-level="3"><a href="https://github.com/w3c/media-source/issues/280"><span class="issue-number">Issue 280</span></a><span class="issue-label">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></div><div class=""> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a>, <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> and <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> need Window+DedicatedWorker exposure. </div></div> <section id="attributes"><div class="header-wrapper"><h3 id="x5-1-attributes"><bdi class="secno">5.1 </bdi> Attributes </h3><a class="self-link" href="#attributes" aria-label="Permalink for Section 5.1"></a></div> <dl class="attributes" data-dfn-for="SourceBuffer"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-mode" data-idl="attribute" data-title="mode" data-dfn-for="SourceBuffer" data-type="AppendMode" data-lt="mode" data-local-lt="SourceBuffer.mode" tabindex="0" aria-haspopup="dialog"><code>mode</code></dfn> of type <a href="#dom-appendmode" class="internalDFN" data-link-type="idl" id="ref-for-dom-appendmode-2"><code>AppendMode</code></a> </dt> <dd> <p> Controls how a sequence of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-5">media segments</a> are handled. This attribute is initially set by <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-5"><code>addSourceBuffer</code></a><code>()</code> after the object is created, and can be updated by <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-4"><code>changeType</code></a><code>()</code> or setting this attribute. </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 data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-21"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-1">parent media source</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-6"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Let <var data-type="AppendMode">new mode</var> equal the new value being assigned to this attribute. </li> <li>If <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-3"><code>[[generate timestamps flag]]</code></a> equals true and <var data-type="AppendMode">new mode</var> equals "<a data-link-type="idl" href="#dom-appendmode-segments" class="internalDFN" id="ref-for-dom-appendmode-segments-3"><code>segments</code></a>", then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li> <p> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-23"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-2">parent media source</a> is in the "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-8"><code>ended</code></a>" state then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-24"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-3">parent media source</a> to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-14"><code>open</code></a>" </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-3"><code>sourceopen</code></a> at the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-4">parent media source</a>. </li> </ol> </li> <li>If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-1"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-media-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-media-segment-1">PARSING_MEDIA_SEGMENT</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> and abort these steps. </li> <li>If the <var data-type="AppendMode">new mode</var> equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-4"><code>sequence</code></a>", then set the <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-1"><code>[[group start timestamp]]</code></a> to the <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-1"><code>[[group end timestamp]]</code></a>. </li> <li>Update the attribute to <var data-type="AppendMode">new mode</var>. </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-updating" data-idl="attribute" data-title="updating" data-dfn-for="SourceBuffer" data-type="boolean" data-lt="updating" data-local-lt="SourceBuffer.updating" tabindex="0" aria-haspopup="dialog"><code>updating</code></dfn> of type <a data-link-type="idl" data-lt="boolean" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><code>boolean</code></a>, readonly </dt> <dd> <p> Indicates whether the asynchronous continuation of an <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-5"><code>appendBuffer</code></a><code>()</code> or <a data-link-type="idl" data-lt="remove()" href="#dom-sourcebuffer-remove" class="internalDFN" id="ref-for-dom-sourcebuffer-remove-3"><code>remove</code></a><code>()</code> operation is still being processed. This attribute is initially set to false when the object is created. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-buffered" data-idl="attribute" data-title="buffered" data-dfn-for="SourceBuffer" data-type="TimeRanges" data-lt="buffered" data-local-lt="SourceBuffer.buffered" tabindex="0" aria-haspopup="dialog"><code>buffered</code></dfn> of type <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a>, readonly </dt> <dd> <p> Indicates what <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> are buffered in the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-47"><code>SourceBuffer</code></a>. This attribute is initially set to an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object when the object is created. </p> <p> When the attribute is read the following steps <em class="rfc2119">MUST</em> occur: </p> <ol> <li>If this object has been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-22"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-5">parent media source</a> then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Let <var data-type="double">highest end time</var> be the largest <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-3">track buffer ranges</a> end time across all the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-4">track buffers</a> managed by this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-48"><code>SourceBuffer</code></a> object. </li> <li>Let <var data-type="normalized TimeRanges">intersection ranges</var> equal a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object containing a single range from 0 to <var data-type="double">highest end time</var>. </li> <li>For each audio and video <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-5">track buffer</a> managed by this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-49"><code>SourceBuffer</code></a>, run the following steps: <div class="note" role="note" id="issue-container-generatedID-45"><div role="heading" class="note-title marker" id="h-note-45" aria-level="4"><span>Note</span></div><p class=""> Text <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-6">track buffers</a> are included in the calculation of <var data-type="double">highest end time</var>, above, but excluded from the buffered range calculation here. They are not necessarily continuous, nor should any discontinuity within them trigger playback stall when the other media tracks are continuous over the same time range. </p></div> <ol> <li>Let <var data-type="normalized TimeRanges">track ranges</var> equal the <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-4">track buffer ranges</a> for the current <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-7">track buffer</a>. </li> <li>If <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-25"><code>readyState</code></a> is "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-9"><code>ended</code></a>", then set the end time on the last range in <var data-type="normalized TimeRanges">track ranges</var> to <var data-type="double">highest end time</var>. </li> <li>Let <var data-type="normalized TimeRanges">new intersection ranges</var> equal the intersection between the <var data-type="normalized TimeRanges">intersection ranges</var> and the <var data-type="normalized TimeRanges">track ranges</var>. </li> <li>Replace the ranges in <var data-type="normalized TimeRanges">intersection ranges</var> with the <var>new intersection ranges</var>. </li> </ol> </li> <li>If <var data-type="normalized TimeRanges">intersection ranges</var> does not contain the exact same range information as the current value of this attribute, then update the current value of this attribute to <var data-type="normalized TimeRanges">intersection ranges</var>. </li> <li>Return the current value of this attribute. </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-timestampoffset" data-idl="attribute" data-title="timestampOffset" data-dfn-for="SourceBuffer" data-type="double" data-lt="timestampOffset" data-local-lt="SourceBuffer.timestampOffset" tabindex="0" aria-haspopup="dialog"><code>timestampOffset</code></dfn> of type <a data-link-type="idl" data-lt="double" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double"><code>double</code></a> </dt> <dd> <p> Controls the offset applied to timestamps inside subsequent <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-6">media segments</a> that are appended to this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-50"><code>SourceBuffer</code></a>. The <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-4"><code>timestampOffset</code></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 data-type="double">new timestamp offset</var> equal the new value being assigned to this attribute. </li> <li>If this object has been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-23"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-6">parent media source</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-7"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li> <p> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-26"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-7">parent media source</a> is in the "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-10"><code>ended</code></a>" state then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-27"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-8">parent media source</a> to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-15"><code>open</code></a>" </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-4"><code>sourceopen</code></a> at the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-9">parent media source</a>. </li> </ol> </li> <li>If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-2"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-media-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-media-segment-2">PARSING_MEDIA_SEGMENT</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-4"><code>mode</code></a> attribute equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-5"><code>sequence</code></a>", then set the <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-2"><code>[[group start timestamp]]</code></a> to <var data-type="double">new timestamp offset</var>. </li> <li>Update the attribute to <var data-type="double">new timestamp offset</var>. </li> </ol> </dd> <dt> <dfn data-plurals="audiotrack" data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-audiotracks" data-idl="attribute" data-title="audioTracks" data-dfn-for="SourceBuffer" data-type="AudioTrackList" data-lt="audioTracks" data-local-lt="SourceBuffer.audioTracks" tabindex="0" aria-haspopup="dialog"><code>audioTracks</code></dfn> of type <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a>, readonly </dt> <dd> The list of <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> objects created by this object. </dd> <dt> <dfn data-plurals="videotrack" data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-videotracks" data-idl="attribute" data-title="videoTracks" data-dfn-for="SourceBuffer" data-type="VideoTrackList" data-lt="videoTracks" data-local-lt="SourceBuffer.videoTracks" tabindex="0" aria-haspopup="dialog"><code>videoTracks</code></dfn> of type <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a>, readonly </dt> <dd> The list of <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> objects created by this object. </dd> <dt> <dfn data-plurals="texttrack" data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-texttracks" data-idl="attribute" data-title="textTracks" data-dfn-for="SourceBuffer" data-type="TextTrackList" data-lt="textTracks" data-local-lt="SourceBuffer.textTracks" tabindex="0" aria-haspopup="dialog"><code>textTracks</code></dfn> of type <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a>, readonly </dt> <dd> The list of <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> objects created by this object. </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-appendwindowstart" data-idl="attribute" data-title="appendWindowStart" data-dfn-for="SourceBuffer" data-type="double" data-lt="appendWindowStart" data-local-lt="SourceBuffer.appendWindowStart" tabindex="0" aria-haspopup="dialog"><code>appendWindowStart</code></dfn> of type <a data-link-type="idl" data-lt="double" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-double"><code>double</code></a> </dt> <dd> <p> The <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-12">presentation timestamp</a> for the start of the <a data-link-type="dfn|abstract-op" href="#dfn-append-window" class="internalDFN" id="ref-for-dfn-append-window-1">append window</a>. This attribute is initially set to the <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-4">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 data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-24"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-10">parent media source</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-8"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the new value is less than 0 or greater than or equal to <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-3"><code>appendWindowEnd</code></a> then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>Update the attribute to the new value. </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-appendwindowend" data-idl="attribute" data-title="appendWindowEnd" data-dfn-for="SourceBuffer" data-type="unrestricted double" data-lt="appendWindowEnd" data-local-lt="SourceBuffer.appendWindowEnd" tabindex="0" aria-haspopup="dialog"><code>appendWindowEnd</code></dfn> of type <a data-link-type="idl" data-lt="unrestricted double" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><code>unrestricted double</code></a> </dt> <dd> <p> The <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-13">presentation timestamp</a> for the end of the <a data-link-type="dfn|abstract-op" href="#dfn-append-window" class="internalDFN" id="ref-for-dfn-append-window-2">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 data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-25"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-11">parent media source</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-9"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the new value equals NaN, then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> and abort these steps. </li> <li>If the new value is less than or equal to <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-3"><code>appendWindowStart</code></a> then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>Update the attribute to the new value. </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-onupdatestart" data-idl="attribute" data-title="onupdatestart" data-dfn-for="SourceBuffer" data-type="EventHandler" data-lt="onupdatestart" data-local-lt="SourceBuffer.onupdatestart" tabindex="0" aria-haspopup="dialog"><code>onupdatestart</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="updatestart" href="#dfn-updatestart" class="internalDFN" id="ref-for-dfn-updatestart-1"><code>updatestart</code></a> event. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-onupdate" data-idl="attribute" data-title="onupdate" data-dfn-for="SourceBuffer" data-type="EventHandler" data-lt="onupdate" data-local-lt="SourceBuffer.onupdate" tabindex="0" aria-haspopup="dialog"><code>onupdate</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="update" href="#dfn-update" class="internalDFN" id="ref-for-dfn-update-1"><code>update</code></a> event. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-onupdateend" data-idl="attribute" data-title="onupdateend" data-dfn-for="SourceBuffer" data-type="EventHandler" data-lt="onupdateend" data-local-lt="SourceBuffer.onupdateend" tabindex="0" aria-haspopup="dialog"><code>onupdateend</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-2"><code>updateend</code></a> event. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-onerror" data-idl="attribute" data-title="onerror" data-dfn-for="SourceBuffer" data-type="EventHandler" data-lt="onerror" data-local-lt="SourceBuffer.onerror" tabindex="0" aria-haspopup="dialog"><code>onerror</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="error" href="#dfn-error" class="internalDFN" id="ref-for-dfn-error-1"><code>error</code></a> event. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebuffer-onabort" data-idl="attribute" data-title="onabort" data-dfn-for="SourceBuffer" data-type="EventHandler" data-lt="onabort" data-local-lt="SourceBuffer.onabort" tabindex="0" aria-haspopup="dialog"><code>onabort</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="abort" href="#dfn-abort" class="internalDFN" id="ref-for-dfn-abort-2"><code>abort</code></a> event. </p> </dd> </dl> </section> <section id="methods"><div class="header-wrapper"><h3 id="x5-2-methods"><bdi class="secno">5.2 </bdi> Methods </h3><a class="self-link" href="#methods" aria-label="Permalink for Section 5.2"></a></div> <dl class="methods" data-dfn-for="SourceBuffer"> <dt> <dfn id="dom-sourcebuffer-appendbuffer" data-export="" data-dfn-type="method" data-idl="operation" data-title="appendBuffer" data-dfn-for="SourceBuffer" data-type="undefined" data-lt="appendBuffer()|appendBuffer(data)" data-local-lt="SourceBuffer.appendBuffer|SourceBuffer.appendBuffer()|appendBuffer" tabindex="0" aria-haspopup="dialog"><code>appendBuffer</code></dfn> </dt> <dd> <p> Appends the segment data in an <code><a href="https://www.w3.org/TR/WebIDL-1/#common-BufferSource" class="idlType">BufferSource</a></code>[<cite><a class="bibref" data-link-type="biblio" href="#bib-webidl" title="Web IDL Standard">WEBIDL</a></cite>] to the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-51"><code>SourceBuffer</code></a>. </p> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-prepare-append" class="internalDFN" id="ref-for-dfn-prepare-append-1">prepare append</a> algorithm. </li> <li>Add <var data-type="BufferSource">data</var> to the end of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-1"><code>[[input buffer]]</code></a>. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-10"><code>updating</code></a> attribute to true. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updatestart" href="#dfn-updatestart" class="internalDFN" id="ref-for-dfn-updatestart-2"><code>updatestart</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-52"><code>SourceBuffer</code></a> object. </li> <li>Asynchronously run the <a data-link-type="dfn|abstract-op" href="#dfn-buffer-append" class="internalDFN" id="ref-for-dfn-buffer-append-2">buffer append</a> algorithm. </li> </ol></dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-sourcebuffer-abort" data-idl="operation" data-title="abort" data-dfn-for="SourceBuffer" data-type="undefined" data-lt="abort()" data-local-lt="SourceBuffer.abort|SourceBuffer.abort()|abort" tabindex="0" aria-haspopup="dialog"><code>abort</code></dfn> </dt> <dd> <p> Aborts the current segment and resets the segment parser. </p> <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 <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-26"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-12">parent media source</a> then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-28"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-13">parent media source</a> is not in the "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-16"><code>open</code></a>" state then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="dfn|abstract-op" href="#dfn-range-removal" class="internalDFN" id="ref-for-dfn-range-removal-1">range removal</a> algorithm is running, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-11"><code>updating</code></a> attribute equals true, then run the following steps: <ol> <li>Abort the <a data-link-type="dfn|abstract-op" href="#dfn-buffer-append" class="internalDFN" id="ref-for-dfn-buffer-append-3">buffer append</a> algorithm if it is running. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-12"><code>updating</code></a> attribute to false. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="abort" href="#dfn-abort" class="internalDFN" id="ref-for-dfn-abort-3"><code>abort</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-53"><code>SourceBuffer</code></a> object. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-3"><code>updateend</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-54"><code>SourceBuffer</code></a> object. </li> </ol> </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-reset-parser-state" class="internalDFN" id="ref-for-dfn-reset-parser-state-1">reset parser state</a> algorithm. </li> <li>Set <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-4"><code>appendWindowStart</code></a> to the <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-5">presentation start time</a>. </li> <li>Set <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-4"><code>appendWindowEnd</code></a> to positive Infinity. </li> </ol></dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-sourcebuffer-changetype" data-idl="operation" data-title="changeType" data-dfn-for="SourceBuffer" data-type="undefined" data-lt="changeType()|changeType(type)" data-local-lt="SourceBuffer.changeType|SourceBuffer.changeType()|changeType" tabindex="0" aria-haspopup="dialog"><code>changeType</code></dfn> </dt> <dd> <p> Changes the MIME type associated with this object. Subsequent <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-6"><code>appendBuffer</code></a><code>()</code> calls will expect the newly appended bytes to conform to the new type. </p> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>If <var data-type="DOMString">type</var> is an empty string then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>If this object has been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-27"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-14">parent media source</a>, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-13"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If <var data-type="DOMString">type</var> contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified (currently or previously) of <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-55"><code>SourceBuffer</code></a> objects in the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-28"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-15">parent media source</a>, then throw a <a data-link-type="idl" data-lt="NotSupportedError" data-type="exception" href="https://webidl.spec.whatwg.org/#notsupportederror"><code>NotSupportedError</code></a> exception and abort these steps. </li> <li> <p> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-29"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-16">parent media source</a> is in the "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-11"><code>ended</code></a>" state then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-30"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-17">parent media source</a> to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-17"><code>open</code></a>". </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-5"><code>sourceopen</code></a> at the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-18">parent media source</a>. </li> </ol> </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-reset-parser-state" class="internalDFN" id="ref-for-dfn-reset-parser-state-2">reset parser state</a> algorithm. </li> <li>Update the <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-4"><code>[[generate timestamps flag]]</code></a> on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-56"><code>SourceBuffer</code></a> object to the value in the "Generate Timestamps Flag" column of the byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format Registry">MSE-REGISTRY</a></cite>] entry that is associated with <var data-type="DOMString">type</var>. </li> <li> <dl class="switch"> <dt> If the <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-5"><code>[[generate timestamps flag]]</code></a> equals true: </dt> <dd> Set the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-5"><code>mode</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-57"><code>SourceBuffer</code></a> object to "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-6"><code>sequence</code></a>", including running the associated steps for that attribute being set. </dd> <dt> Otherwise: </dt> <dd> Keep the previous value of the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-6"><code>mode</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-58"><code>SourceBuffer</code></a> object, without running any associated steps for that attribute being set. </dd> </dl> </li> <li>Set the <a data-link-type="attribute" data-lt="[[pending initialization segment for changeType flag]]" href="#dfn-pending-initialization-segment-for-changetype-flag" class="internalDFN" id="ref-for-dfn-pending-initialization-segment-for-changetype-flag-1"><code>[[pending initialization segment for changeType flag]]</code></a> on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-59"><code>SourceBuffer</code></a> object to true. </li> </ol></dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-sourcebuffer-remove" data-idl="operation" data-title="remove" data-dfn-for="SourceBuffer" data-type="undefined" data-lt="remove()|remove(start, end)" data-local-lt="SourceBuffer.remove|SourceBuffer.remove()|remove" tabindex="0" aria-haspopup="dialog"><code>remove</code></dfn> </dt> <dd> <p> Removes media for a specific time range. The <var>start</var> of the removal range, in seconds measured from <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-6">presentation start time</a> The <var>end</var> of the removal range, in seconds measured from <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-7">presentation start time</a>. </p> <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 <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-29"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-19">parent media source</a> then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-14"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-7"><code>duration</code></a> equals NaN, then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>If <var data-type="double">start</var> is negative or greater than <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-8"><code>duration</code></a>, then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li>If <var data-type="unrestricted double">end</var> is less than or equal to <var data-type="double">start</var> or <var data-type="unrestricted double">end</var> equals NaN, then throw a <a data-link-type="idl" data-lt="TypeError" data-type="exception" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror"><code>TypeError</code></a> exception and abort these steps. </li> <li> <p> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-31"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-20">parent media source</a> is in the "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-12"><code>ended</code></a>" state then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-32"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-21">parent media source</a> to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-18"><code>open</code></a>" </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-6"><code>sourceopen</code></a> at the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-22">parent media source</a>. </li> </ol> </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-range-removal" class="internalDFN" id="ref-for-dfn-range-removal-2">range removal</a> algorithm with <var data-type="double">start</var> and <var data-type="unrestricted double">end</var> as the start and end of the removal range. </li> </ol></dd> </dl> </section> <section id="track-buffers"><div class="header-wrapper"><h3 id="x5-3-track-buffers"><bdi class="secno">5.3 </bdi> Track Buffers </h3><a class="self-link" href="#track-buffers" aria-label="Permalink for Section 5.3"></a></div> <p> A <dfn id="track-buffer" data-plurals="track buffers" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">track buffer</dfn> stores the <a data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-2">track descriptions</a> and <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-13">coded frames</a> for an individual track. The track buffer is updated as <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-5">initialization segments</a> and <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-7">media segments</a> are appended to the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-60"><code>SourceBuffer</code></a>. </p> <p> Each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-8">track buffer</a> has a <dfn id="last-decode-timestamp" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">last decode timestamp</dfn> variable that stores the decode timestamp of the last <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-14">coded frame</a> appended in the current <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-group" class="internalDFN" id="ref-for-dfn-coded-frame-group-1">coded frame group</a>. The variable is initially unset to indicate that no <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-15">coded frames</a> have been appended yet. </p> <p> Each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-9">track buffer</a> has a <dfn id="last-frame-duration" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">last frame duration</dfn> variable that stores the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-5">coded frame duration</a> of the last <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-16">coded frame</a> appended in the current <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-group" class="internalDFN" id="ref-for-dfn-coded-frame-group-2">coded frame group</a>. The variable is initially unset to indicate that no <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-17">coded frames</a> have been appended yet. </p> <p> Each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-10">track buffer</a> has a <dfn id="highest-end-timestamp" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">highest end timestamp</dfn> variable that stores the highest <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-end-timestamp" class="internalDFN" id="ref-for-dfn-coded-frame-end-timestamp-1">coded frame end timestamp</a> across all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-18">coded frames</a> in the current <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-group" class="internalDFN" id="ref-for-dfn-coded-frame-group-3">coded frame group</a> that were appended to this track buffer. The variable is initially unset to indicate that no <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-19">coded frames</a> have been appended yet. </p> <p> Each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-11">track buffer</a> has a <dfn id="need-RAP-flag" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">need random access point flag</dfn> variable that keeps track of whether the track buffer is waiting for a <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-2">random access point</a> <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-20">coded frame</a>. The variable is initially set to true to indicate that <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-3">random access point</a> <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-21">coded frame</a> is needed before anything can be added to the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-12">track buffer</a>. </p> <p> Each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-13">track buffer</a> has a <dfn id="track-buffer-ranges" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">track buffer ranges</dfn> variable that represents the presentation time ranges occupied by the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-22">coded frames</a> currently stored in the track buffer. </p> <div class="note" role="note" id="issue-container-generatedID-46"><div role="heading" class="note-title marker" id="h-note-46" aria-level="4"><span>Note</span></div><p class=""> For track buffer ranges, these presentation time ranges are based on <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-14">presentation timestamps</a>, frame durations, and potentially coded frame group start times for coded frame groups across track buffers in a muxed <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-61"><code>SourceBuffer</code></a>. </p></div> <p> For specification purposes, this information is treated as if it were stored in a <a href="https://html.spec.whatwg.org/multipage/media.html#normalised-timeranges-object">normalized TimeRanges object</a>. Intersected <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-5">track buffer ranges</a> are used to report <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a>, and <em class="rfc2119">MUST</em> therefore support uninterrupted playback within each range of <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a>. </p> <div class="note" role="note" id="issue-container-generatedID-47"><div role="heading" class="note-title marker" id="h-note-47" aria-level="4"><span>Note</span></div><p class=""> These coded frame group start times differ slightly from those mentioned in the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-3">coded frame processing</a> algorithm in that they are the earliest <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-15">presentation timestamp</a> across all track buffers following a discontinuity. Discontinuities can occur within the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-4">coded frame processing</a> algorithm or result from the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-2">coded frame removal</a> algorithm, regardless of <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-7"><code>mode</code></a>. The threshold for determining disjointness of <a data-link-type="dfn|abstract-op" href="#track-buffer-ranges" class="internalDFN" id="ref-for-track-buffer-ranges-6">track buffer ranges</a> is implementation-specific. For example, to reduce unexpected playback stalls, implementations <em class="rfc2119">MAY</em> approximate the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-5">coded frame processing</a> algorithm's discontinuity detection logic by coalescing adjacent ranges separated by a gap smaller than 2 times the maximum frame duration buffered so far in this <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-14">track buffer</a>. Implementations <em class="rfc2119">MAY</em> also use coded frame group start times as range start times across <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-15">track buffers</a> in a muxed <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-62"><code>SourceBuffer</code></a> to further reduce unexpected playback stalls. </p></div> </section> <section id="sourcebuffer-events"><div class="header-wrapper"><h3 id="x5-4-event-summary"><bdi class="secno">5.4 </bdi> Event Summary </h3><a class="self-link" href="#sourcebuffer-events" aria-label="Permalink for Section 5.4"></a></div> <table class="data"> <thead> <tr> <th> Event name </th> <th> Interface </th> <th> Dispatched when... </th> </tr> </thead> <tbody><tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-updatestart" tabindex="0" aria-haspopup="dialog" data-export="">updatestart</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-63"><code>SourceBuffer</code></a>'s <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-15"><code>updating</code></a> transitions from false to true. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-update" tabindex="0" aria-haspopup="dialog" data-export="">update</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> A <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-64"><code>SourceBuffer</code></a>'s append or remove successfully completed. <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-65"><code>SourceBuffer</code></a>'s <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-16"><code>updating</code></a> transitions from true to false. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-updateend" tabindex="0" aria-haspopup="dialog" data-export="">updateend</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> The append or remove of a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-66"><code>SourceBuffer</code></a> ended. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-error" tabindex="0" aria-haspopup="dialog" data-export="">error</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> An error occurred during the append to a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-67"><code>SourceBuffer</code></a>. <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-17"><code>updating</code></a> transitions from true to false. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-abort" tabindex="0" aria-haspopup="dialog" data-export="">abort</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> The <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-68"><code>SourceBuffer</code></a>'s append was aborted by an <a data-link-type="idl" data-lt="abort()" href="#dom-sourcebuffer-abort" class="internalDFN" id="ref-for-dom-sourcebuffer-abort-3"><code>abort</code></a><code>()</code> call. <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-18"><code>updating</code></a> transitions from true to false. </td> </tr> </tbody></table> </section> <section id="sourcebuffer-algorithms"><div class="header-wrapper"><h3 id="x5-5-algorithms"><bdi class="secno">5.5 </bdi> Algorithms </h3><a class="self-link" href="#sourcebuffer-algorithms" aria-label="Permalink for Section 5.5"></a></div> <section id="sourcebuffer-segment-parser-loop"><div class="header-wrapper"><h4 id="x5-5-1-segment-parser-loop"><bdi class="secno">5.5.1 </bdi> <dfn id="dfn-segment-parser-loop" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Segment Parser Loop</dfn> </h4><a class="self-link" href="#sourcebuffer-segment-parser-loop" aria-label="Permalink for Section 5.5.1"></a></div> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-69"><code>SourceBuffer</code></a> object has an <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-append-state" tabindex="0" aria-haspopup="dialog">[[append state]]</dfn> internal slot that keeps track of the high-level segment parsing state. It is initially set to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-waiting-for-segment" class="internalDFN" id="ref-for-sourcebuffer-waiting-for-segment-1">WAITING_FOR_SEGMENT</a> and can transition to the following states as data is appended. </p> <table class="data"> <thead> <tr> <th> Append state name </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <dfn id="sourcebuffer-waiting-for-segment" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">WAITING_FOR_SEGMENT</dfn> </td> <td> Waiting for the start of an <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-6">initialization segment</a> or <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-8">media segment</a> to be appended. </td> </tr> <tr> <td> <dfn id="sourcebuffer-parsing-init-segment" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">PARSING_INIT_SEGMENT</dfn> </td> <td> Currently parsing an <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-7">initialization segment</a>. </td> </tr> <tr> <td> <dfn id="sourcebuffer-parsing-media-segment" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">PARSING_MEDIA_SEGMENT</dfn> </td> <td> Currently parsing a <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-9">media segment</a>. </td> </tr> </tbody> </table> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-70"><code>SourceBuffer</code></a> object has an <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-input-buffer" tabindex="0" aria-haspopup="dialog">[[input buffer]]</dfn> internal slot that is a byte buffer that holds unparsed bytes across <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-7"><code>appendBuffer</code></a><code>()</code> calls. The buffer is empty when the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-71"><code>SourceBuffer</code></a> object is created. </p> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-72"><code>SourceBuffer</code></a> object has a <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-buffer-full-flag" tabindex="0" aria-haspopup="dialog">[[buffer full flag]]</dfn> internal slot that keeps track of whether <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-8"><code>appendBuffer</code></a><code>()</code> is allowed to accept more bytes. It is set to false when the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-73"><code>SourceBuffer</code></a> object is created and gets updated as data is appended and removed. </p> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-74"><code>SourceBuffer</code></a> object has a <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-group-start-timestamp" tabindex="0" aria-haspopup="dialog">[[group start timestamp]]</dfn> internal slot that keeps track of the starting timestamp for a new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-group" class="internalDFN" id="ref-for-dfn-coded-frame-group-4">coded frame group</a> in the "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-7"><code>sequence</code></a>" mode. It is unset when the SourceBuffer object is created and gets updated when the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-8"><code>mode</code></a> attribute equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-8"><code>sequence</code></a>" and the <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-5"><code>timestampOffset</code></a> attribute is set, or the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-6">coded frame processing</a> algorithm runs. </p> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-75"><code>SourceBuffer</code></a> object has a <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-group-end-timestamp" tabindex="0" aria-haspopup="dialog">[[group end timestamp]]</dfn> internal slot that stores the highest <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-end-timestamp" class="internalDFN" id="ref-for-dfn-coded-frame-end-timestamp-2">coded frame end timestamp</a> across all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-23">coded frames</a> in the current <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-group" class="internalDFN" id="ref-for-dfn-coded-frame-group-5">coded frame group</a>. It is set to 0 when the SourceBuffer object is created and gets updated by the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-7">coded frame processing</a> algorithm. </p> <div class="note" role="note" id="issue-container-generatedID-48"><div role="heading" class="note-title marker" id="h-note-48" aria-level="5"><span>Note</span></div><p class=""> The <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-2"><code>[[group end timestamp]]</code></a> stores the highest <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-end-timestamp" class="internalDFN" id="ref-for-dfn-coded-frame-end-timestamp-3">coded frame end timestamp</a> across all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-16">track buffers</a> in a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-76"><code>SourceBuffer</code></a>. Therefore, care should be taken in setting the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-9"><code>mode</code></a> attribute when appending multiplexed segments in which the timestamps are not aligned across tracks. </p></div> <p> Each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-77"><code>SourceBuffer</code></a> object has a <dfn data-dfn-for="SourceBuffer" data-export="" data-idl="" data-dfn-type="attribute" id="dfn-generate-timestamps-flag" tabindex="0" aria-haspopup="dialog">[[generate timestamps flag]]</dfn> internal slot that is a boolean that keeps track of whether timestamps need to be generated for the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-24">coded frames</a> passed to the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-8">coded frame processing</a> algorithm. This flag is set by <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-6"><code>addSourceBuffer</code></a><code>()</code> when the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-78"><code>SourceBuffer</code></a> object is created and is updated by <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-5"><code>changeType</code></a><code>()</code>. </p> <p> When the segment parser loop algorithm is invoked, run the following steps: </p> <ol> <li> <i>Loop Top:</i> If the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-2"><code>[[input buffer]]</code></a> is empty, then jump to the <i>need more data</i> step below. </li> <li>If the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-3"><code>[[input buffer]]</code></a> contains bytes that violate the <a data-link-type="dfn|abstract-op" href="#dfn-sourcebuffer-byte-stream-format-specification" class="internalDFN" id="ref-for-dfn-sourcebuffer-byte-stream-format-specification-1">SourceBuffer byte stream format specification</a>, then run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-3">append error</a> algorithm and abort this algorithm. </li> <li>Remove any bytes that the <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-5">byte stream format specifications</a> say <em class="rfc2119">MUST</em> be ignored from the start of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-4"><code>[[input buffer]]</code></a>. </li> <li> <p> If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-3"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-waiting-for-segment" class="internalDFN" id="ref-for-sourcebuffer-waiting-for-segment-2">WAITING_FOR_SEGMENT</a>, then run the following steps: </p> <ol> <li>If the beginning of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-5"><code>[[input buffer]]</code></a> indicates the start of an <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-8">initialization segment</a>, set the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-4"><code>[[append state]]</code></a> to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-init-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-init-segment-1">PARSING_INIT_SEGMENT</a>. </li> <li>If the beginning of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-6"><code>[[input buffer]]</code></a> indicates the start of a <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-10">media segment</a>, set <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-5"><code>[[append state]]</code></a> to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-media-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-media-segment-3">PARSING_MEDIA_SEGMENT</a>. </li> <li>Jump to the <i>loop top</i> step above. </li> </ol> </li> <li> <p> If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-6"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-init-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-init-segment-2">PARSING_INIT_SEGMENT</a>, then run the following steps: </p> <ol> <li>If the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-7"><code>[[input buffer]]</code></a> does not contain a complete <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-9">initialization segment</a> yet, then jump to the <i>need more data</i> step below. </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment-received" class="internalDFN" id="ref-for-dfn-initialization-segment-received-1">initialization segment received</a> algorithm. </li> <li>Remove the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-10">initialization segment</a> bytes from the beginning of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-8"><code>[[input buffer]]</code></a>. </li> <li>Set <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-7"><code>[[append state]]</code></a> to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-waiting-for-segment" class="internalDFN" id="ref-for-sourcebuffer-waiting-for-segment-3">WAITING_FOR_SEGMENT</a>. </li> <li>Jump to the <i>loop top</i> step above. </li> </ol> </li> <li> <p> If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-8"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-media-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-media-segment-4">PARSING_MEDIA_SEGMENT</a>, then run the following steps: </p> <ol> <li>If the <a data-link-type="attribute" data-lt="[[first initialization segment received flag]]" href="#dfn-first-initialization-segment-received-flag" class="internalDFN" id="ref-for-dfn-first-initialization-segment-received-flag-1"><code>[[first initialization segment received flag]]</code></a> is false or the <a data-link-type="attribute" data-lt="[[pending initialization segment for changeType flag]]" href="#dfn-pending-initialization-segment-for-changetype-flag" class="internalDFN" id="ref-for-dfn-pending-initialization-segment-for-changetype-flag-2"><code>[[pending initialization segment for changeType flag]]</code></a> is true, then run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-4">append error</a> algorithm and abort this algorithm. </li> <li>If the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-9"><code>[[input buffer]]</code></a> contains one or more complete <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-25">coded frames</a>, then run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-9">coded frame processing</a> algorithm. <div class="note" role="note" id="issue-container-generatedID-49"><div role="heading" class="note-title marker" id="h-note-49" aria-level="5"><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 <em class="rfc2119">MAY</em> be called when the input buffer contains the complete media segment or it <em class="rfc2119">MAY</em> be called multiple times as complete coded frames are added to the input buffer. </p></div> </li> <li>If this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-79"><code>SourceBuffer</code></a> is full and cannot accept more media data, then set the <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-1"><code>[[buffer full flag]]</code></a> to true. </li> <li>If the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-10"><code>[[input buffer]]</code></a> does not contain a complete <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-11">media segment</a>, then jump to the <i>need more data</i> step below. </li> <li>Remove the <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-12">media segment</a> bytes from the beginning of the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-11"><code>[[input buffer]]</code></a>. </li> <li>Set <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-9"><code>[[append state]]</code></a> to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-waiting-for-segment" class="internalDFN" id="ref-for-sourcebuffer-waiting-for-segment-4">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"><div class="header-wrapper"><h4 id="x5-5-2-reset-parser-state"><bdi class="secno">5.5.2 </bdi> <dfn id="dfn-reset-parser-state" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Reset Parser State</dfn> </h4><a class="self-link" href="#sourcebuffer-reset-parser-state" aria-label="Permalink for Section 5.5.2"></a></div> <p> When the parser state needs to be reset, run the following steps: </p> <ol> <li>If the <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-10"><code>[[append state]]</code></a> equals <a data-link-type="dfn|abstract-op" href="#sourcebuffer-parsing-media-segment" class="internalDFN" id="ref-for-sourcebuffer-parsing-media-segment-5">PARSING_MEDIA_SEGMENT</a> and the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-12"><code>[[input buffer]]</code></a> contains some complete <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-26">coded frames</a>, then run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-10">coded frame processing</a> algorithm until all of these complete <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-27">coded frames</a> have been processed. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-1">last decode timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-17">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-frame-duration" class="internalDFN" id="ref-for-last-frame-duration-1">last frame duration</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-18">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-1">highest end timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-19">track buffers</a>. </li> <li>Set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-1">need random access point flag</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-20">track buffers</a> to true. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-10"><code>mode</code></a> attribute equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-9"><code>sequence</code></a>", then set the <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-3"><code>[[group start timestamp]]</code></a> to the <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-3"><code>[[group end timestamp]]</code></a> </li> <li>Remove all bytes from the <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-13"><code>[[input buffer]]</code></a>. </li> <li>Set <a data-link-type="attribute" data-lt="[[append state]]" href="#dfn-append-state" class="internalDFN" id="ref-for-dfn-append-state-11"><code>[[append state]]</code></a> to <a data-link-type="dfn|abstract-op" href="#sourcebuffer-waiting-for-segment" class="internalDFN" id="ref-for-sourcebuffer-waiting-for-segment-5">WAITING_FOR_SEGMENT</a>. </li> </ol> </section> <section id="sourcebuffer-append-error"><div class="header-wrapper"><h4 id="x5-5-3-append-error"><bdi class="secno">5.5.3 </bdi> <dfn data-export="" id="dfn-append-error" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Append Error</dfn> </h4><a class="self-link" href="#sourcebuffer-append-error" aria-label="Permalink for Section 5.5.3"></a></div> <p> This algorithm is called when an error occurs during an append. </p> <ol> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-reset-parser-state" class="internalDFN" id="ref-for-dfn-reset-parser-state-3">reset parser state</a> algorithm. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-19"><code>updating</code></a> attribute to false. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="error" href="#dfn-error" class="internalDFN" id="ref-for-dfn-error-2"><code>error</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-80"><code>SourceBuffer</code></a> object. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-4"><code>updateend</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-81"><code>SourceBuffer</code></a> object. </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-end-of-stream" class="internalDFN" id="ref-for-dfn-end-of-stream-2">end of stream</a> algorithm with the <var data-type="EndOfStreamError">error</var> parameter set to "<a data-link-type="idl" href="#dom-endofstreamerror-decode" class="internalDFN" id="ref-for-dom-endofstreamerror-decode-3"><code>decode</code></a>". </li> </ol> </section> <section id="sourcebuffer-prepare-append"><div class="header-wrapper"><h4 id="x5-5-4-prepare-append"><bdi class="secno">5.5.4 </bdi> <dfn id="dfn-prepare-append" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Prepare Append</dfn> </h4><a class="self-link" href="#sourcebuffer-prepare-append" aria-label="Permalink for Section 5.5.4"></a></div> <p> When an append operation begins, the following steps are run to validate and prepare the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-82"><code>SourceBuffer</code></a>. </p> <ol> <li>If the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-83"><code>SourceBuffer</code></a> has been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-30"><code>sourceBuffers</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-23">parent media source</a> then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>If the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-20"><code>updating</code></a> attribute equals true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li>Let <var data-type="boolean">recent element error</var> be determined as follows: <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-98"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> </dt> <dd> Let <var data-type="boolean">recent element error</var> be true if the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dfn-error" class="internalDFN" id="ref-for-dfn-error-3"><code>error</code></a> attribute is not null. If that attribute is null, then let <var data-type="boolean">recent element error</var> be false. </dd> <dt> Otherwise </dt> <dd> Let <var data-type="boolean">recent element error</var> be the value resulting from the steps for the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> case, but run on the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> on any change to its <a data-link-type="idl" href="#dfn-error" class="internalDFN" id="ref-for-dfn-error-4"><code>error</code></a> attribute and communicated by using <a data-link-type="attribute" data-lt="[[port to worker]]" href="#dfn-port-to-worker" class="internalDFN" id="ref-for-dfn-port-to-worker-7"><code>[[port to worker]]</code></a> implicit messages. If such a message has not yet been received, then let <var data-type="boolean">recent element error</var> be false. </dd> </dl> </li> <li>If <var data-type="boolean">recent element error</var> is true, then throw an <a data-link-type="idl" data-lt="InvalidStateError" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a> exception and abort these steps. </li> <li> <p> If the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-33"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-24">parent media source</a> is in the "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-13"><code>ended</code></a>" state then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-34"><code>readyState</code></a> attribute of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-25">parent media source</a> to "<a data-link-type="idl" href="#dom-readystate-open" class="internalDFN" id="ref-for-dom-readystate-open-19"><code>open</code></a>" </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="sourceopen" href="#dfn-sourceopen" class="internalDFN" id="ref-for-dfn-sourceopen-7"><code>sourceopen</code></a> at the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-26">parent media source</a>. </li> </ol> </li> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-eviction" class="internalDFN" id="ref-for-dfn-coded-frame-eviction-1">coded frame eviction</a> algorithm. </li> <li> <p> If the <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-2"><code>[[buffer full flag]]</code></a> equals true, then throw a <a data-link-type="idl" data-lt="QuotaExceededError" data-type="exception" href="https://webidl.spec.whatwg.org/#quotaexceedederror"><code>QuotaExceededError</code></a> exception and abort these steps. </p> <div class="note" role="note" id="issue-container-generatedID-50"><div role="heading" class="note-title marker" id="h-note-50" aria-level="5"><span>Note</span></div><p class=""> This is the signal that the implementation was unable to evict enough data to accommodate the append or the append is too big. The web application <em class="rfc2119">SHOULD</em> use <a data-link-type="idl" data-lt="remove()" href="#dom-sourcebuffer-remove" class="internalDFN" id="ref-for-dom-sourcebuffer-remove-4"><code>remove</code></a><code>()</code> to explicitly free up space and/or reduce the size of the append. </p></div> </li> </ol> </section> <section id="sourcebuffer-buffer-append"><div class="header-wrapper"><h4 id="x5-5-5-buffer-append"><bdi class="secno">5.5.5 </bdi> <dfn id="dfn-buffer-append" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Buffer Append</dfn> </h4><a class="self-link" href="#sourcebuffer-buffer-append" aria-label="Permalink for Section 5.5.5"></a></div> <p> When <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-9"><code>appendBuffer</code></a><code>()</code> is called, the following steps are run to process the appended data. </p> <ol> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-segment-parser-loop" class="internalDFN" id="ref-for-dfn-segment-parser-loop-1">segment parser loop</a> algorithm. </li> <li>If the <a data-link-type="dfn|abstract-op" href="#dfn-segment-parser-loop" class="internalDFN" id="ref-for-dfn-segment-parser-loop-2">segment parser loop</a> algorithm in the previous step was aborted, then abort this algorithm. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-21"><code>updating</code></a> attribute to false. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="update" href="#dfn-update" class="internalDFN" id="ref-for-dfn-update-2"><code>update</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-84"><code>SourceBuffer</code></a> object. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-5"><code>updateend</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-85"><code>SourceBuffer</code></a> object. </li> </ol> </section> <section id="sourcebuffer-range-removal"><div class="header-wrapper"><h4 id="x5-5-6-range-removal"><bdi class="secno">5.5.6 </bdi> <dfn id="dfn-range-removal" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Range Removal</dfn> </h4><a class="self-link" href="#sourcebuffer-range-removal" aria-label="Permalink for Section 5.5.6"></a></div> <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 data-type="double">start</var> equal the starting <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-16">presentation timestamp</a> for the removal range, in seconds measured from <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-8">presentation start time</a>. </li> <li>Let <var data-type="unrestricted double">end</var> equal the end <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-17">presentation timestamp</a> for the removal range, in seconds measured from <a data-link-type="dfn|abstract-op" href="#presentation-start-time" class="internalDFN" id="ref-for-presentation-start-time-9">presentation start time</a>. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-22"><code>updating</code></a> attribute to true. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updatestart" href="#dfn-updatestart" class="internalDFN" id="ref-for-dfn-updatestart-3"><code>updatestart</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-86"><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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-3">coded frame removal</a> algorithm with <var data-type="double">start</var> and <var data-type="unrestricted double">end</var> as the start and end of the removal range. </li> <li>Set the <a data-link-type="idl" href="#dom-sourcebuffer-updating" class="internalDFN" id="ref-for-dom-sourcebuffer-updating-23"><code>updating</code></a> attribute to false. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="update" href="#dfn-update" class="internalDFN" id="ref-for-dfn-update-3"><code>update</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-87"><code>SourceBuffer</code></a> object. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-6"><code>updateend</code></a> at this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-88"><code>SourceBuffer</code></a> object. </li> </ol> </section> <section id="sourcebuffer-init-segment-received"><div class="header-wrapper"><h4 id="x5-5-7-initialization-segment-received"><bdi class="secno">5.5.7 </bdi> <dfn id="dfn-initialization-segment-received" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Initialization Segment Received</dfn> </h4><a class="self-link" href="#sourcebuffer-init-segment-received" aria-label="Permalink for Section 5.5.7"></a></div> <p> The following steps are run when the <a data-link-type="dfn|abstract-op" href="#dfn-segment-parser-loop" class="internalDFN" id="ref-for-dfn-segment-parser-loop-3">segment parser loop</a> successfully parses a complete <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-11">initialization segment</a>: </p> <p> Each SourceBuffer object has a <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-first-initialization-segment-received-flag" tabindex="0" aria-haspopup="dialog">[[first initialization segment received flag]]</dfn> internal slot that tracks whether the first <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-12">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> <p> Each SourceBuffer object has a <dfn data-dfn-for="SourceBuffer" data-idl="" data-noexport="" data-dfn-type="attribute" id="dfn-pending-initialization-segment-for-changetype-flag" tabindex="0" aria-haspopup="dialog">[[pending initialization segment for changeType flag]]</dfn> internal slot that tracks whether an <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-13">initialization segment</a> is needed since the most recent <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-6"><code>changeType</code></a><code>()</code>. This flag is set to false when the SourceBuffer is created, set to true by <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-7"><code>changeType</code></a><code>()</code> and reset to false by the algorithm below. </p> <ol> <li>Update the <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-9"><code>duration</code></a> attribute if it currently equals NaN: <dl class="switch"> <dt> If the initialization segment contains a duration: </dt> <dd> Run the <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-4">duration change</a> algorithm with <var data-type="unrestricted double">new duration</var> set to the duration in the initialization segment. </dd> <dt> Otherwise: </dt> <dd> Run the <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-5">duration change</a> algorithm with <var data-type="unrestricted double">new duration</var> set to positive Infinity. </dd> </dl> </li> <li>If the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-14">initialization segment</a> has no audio, video, or text tracks, then run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-5">append error</a> algorithm and abort these steps. </li> <li>If the <a data-link-type="attribute" data-lt="[[first initialization segment received flag]]" href="#dfn-first-initialization-segment-received-flag" class="internalDFN" id="ref-for-dfn-first-initialization-segment-received-flag-2"><code>[[first initialization segment received flag]]</code></a> is true, then run the following steps: <ol> <li>Verify the following properties. If any of the checks fail then run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-6">append error</a> algorithm and abort these steps. <ul> <li>The number of audio, video, and text tracks match what was in the first <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-15">initialization segment</a>. </li> <li>If more than one track for a single type are present (e.g., 2 audio tracks), then the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-5">Track IDs</a> match the ones in the first <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-16">initialization segment</a>. </li> <li>The codecs for each track are supported by the user agent. <div class="note" role="note" id="issue-container-generatedID-51"><div role="heading" class="note-title marker" id="h-note-51" aria-level="5"><span>Note</span></div><p class=""> User agents <em class="rfc2119">MAY</em> consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not specified in <var data-type="DOMString">type</var> parameter passed to (a) the most recently successful <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-8"><code>changeType</code></a><code>()</code> on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-89"><code>SourceBuffer</code></a> object, or (b) if no successful <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-9"><code>changeType</code></a><code>()</code> has yet occurred on this object, the <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-7"><code>addSourceBuffer</code></a><code>()</code> that created this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-90"><code>SourceBuffer</code></a> object. For example, if the most recently successful <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-10"><code>changeType</code></a><code>()</code> was called with <code>'video/webm'</code> or <code>'video/webm; codecs="vp8"'</code>, and a video track containing vp9 appears in the initialization segment, then the user agent <em class="rfc2119">MAY</em> use this step to trigger a decode error even if the other two properties' checks, above, pass. Implementations are encouraged to trigger error in such cases only when the codec is indeed not supported or the other two properties' checks fail. Web authors are encouraged to use <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-11"><code>changeType</code></a><code>()</code>, <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-8"><code>addSourceBuffer</code></a><code>()</code> and <a data-link-type="idl" data-lt="isTypeSupported()" href="#dom-mediasource-istypesupported" class="internalDFN" id="ref-for-dom-mediasource-istypesupported-2"><code>isTypeSupported</code></a><code>()</code> with precise codec parameters to more proactively detect user agent support. <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-12"><code>changeType</code></a><code>()</code> is required if the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-91"><code>SourceBuffer</code></a> object's bytestream format is changing. </p></div> </li> </ul> </li> <li>Add the appropriate <a data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-3">track descriptions</a> from this <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-17">initialization segment</a> to each of the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-21">track buffers</a>. </li> <li>Set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-2">need random access point flag</a> on all track buffers to true. </li> </ol> </li> <li>Let <var data-type="boolean">active track flag</var> equal false. </li> <li> <p> If the <a data-link-type="attribute" data-lt="[[first initialization segment received flag]]" href="#dfn-first-initialization-segment-received-flag" class="internalDFN" id="ref-for-dfn-first-initialization-segment-received-flag-3"><code>[[first initialization segment received flag]]</code></a> is false, then run the following steps: </p> <ol> <li>If the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-18">initialization segment</a> contains tracks with codecs the user agent does not support, then run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-7">append error</a> algorithm and abort these steps. <div class="note" role="note" id="issue-container-generatedID-52"><div role="heading" class="note-title marker" id="h-note-52" aria-level="5"><span>Note</span></div><p class=""> User agents <em class="rfc2119">MAY</em> consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not specified in <var data-type="DOMString">type</var> parameter passed to (a) the most recently successful <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-13"><code>changeType</code></a><code>()</code> on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-92"><code>SourceBuffer</code></a> object, or (b) if no successful <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-14"><code>changeType</code></a><code>()</code> has yet occurred on this object, the <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-9"><code>addSourceBuffer</code></a><code>()</code> that created this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-93"><code>SourceBuffer</code></a> object. For example, <code>MediaSource.isTypeSupported('video/webm;codecs="vp8,vorbis"')</code> may return true, but if <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-10"><code>addSourceBuffer</code></a><code>()</code> was called with <code>'video/webm;codecs="vp8"'</code> and a Vorbis track appears in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-19">initialization segment</a>, then the user agent <em class="rfc2119">MAY</em> use this step to trigger a decode error. Implementations are encouraged to trigger error in such cases only when the codec is indeed not supported. Web authors are encouraged to use <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-15"><code>changeType</code></a><code>()</code>, <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-11"><code>addSourceBuffer</code></a><code>()</code> and <a data-link-type="idl" data-lt="isTypeSupported()" href="#dom-mediasource-istypesupported" class="internalDFN" id="ref-for-dom-mediasource-istypesupported-3"><code>isTypeSupported</code></a><code>()</code> with precise codec parameters to more proactively detect user agent support. <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-16"><code>changeType</code></a><code>()</code> is required if the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-94"><code>SourceBuffer</code></a> object's bytestream format is changing. </p></div> </li> <li> <p> For each audio track in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-20">initialization segment</a>, run following steps: </p> <ol> <li>Let <var>audio byte stream track ID</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-6">Track ID</a> for the current track being processed. </li> <li>Let <var data-type="DOMString">audio language</var> be a BCP 47 language tag for the language specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-21">initialization segment</a> for this track or an empty string if no language info is present. </li> <li>If <var data-type="DOMString">audio language</var> equals the 'und' BCP 47 value, then assign an empty string to <var data-type="DOMString">audio language</var>. </li> <li>Let <var data-type="DOMString">audio label</var> be a label specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-22">initialization segment</a> for this track or an empty string if no label info is present. </li> <li>Let <var data-type="DOMString sequence">audio kinds</var> be a sequence of kind strings specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-23">initialization segment</a> for this track or a sequence with a single empty string element in it if no kind information is provided. </li> <li>For each value in <var data-type="DOMString sequence">audio kinds</var>, run the following steps: <ol> <li>Let <var data-type="DOMString">current audio kind</var> equal the value from <var data-type="DOMString sequence">audio kinds</var> for this iteration of the loop. </li> <li>Let <var data-type="AudioTrack">new audio track</var> be a new <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object. </li> <li>Generate a unique ID and assign it to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-id"><code>id</code></a> property on <var data-type="AudioTrack">new audio track</var>. </li> <li>Assign <var data-type="DOMString">audio language</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-language"><code>language</code></a> property on <var>new audio track</var>. </li> <li>Assign <var data-type="DOMString">audio label</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-label"><code>label</code></a> property on <var>new audio track</var>. </li> <li>Assign <var data-type="DOMString">current audio kind</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-kind"><code>kind</code></a> property on <var>new audio track</var>. </li> <li> <p> If this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-95"><code>SourceBuffer</code></a> object's <a data-link-type="idl" href="#dom-sourcebuffer-audiotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-audiotracks-3"><code>audioTracks</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotracklist-length"><code>length</code></a> equals 0, then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-enabled"><code>enabled</code></a> property on <var data-type="AudioTrack">new audio track</var> to true. </li> <li>Set <var data-type="boolean">active track flag</var> to true. </li> </ol> </li> <li>Add <var data-type="AudioTrack">new audio track</var> to the <a data-link-type="idl" href="#dom-sourcebuffer-audiotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-audiotracks-4"><code>audioTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-96"><code>SourceBuffer</code></a> object. <div class="note" role="note" id="issue-container-generatedID-53"><div role="heading" class="note-title marker" id="h-note-53" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="AudioTrack">new audio track</var>, at the <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> object referenced by the <a data-link-type="idl" href="#dom-sourcebuffer-audiotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-audiotracks-5"><code>audioTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-97"><code>SourceBuffer</code></a> object. </p></div> </li> <li> <dl class="switch"> <dt> If the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-27">parent media source</a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </dt> <dd> Post an internal <code>create track mirror</code> message to <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-7"><code>[[port to main]]</code></a> whose implicit handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> runs the following steps: <ol> <li>Let <var data-type="AudioTrack">mirrored audio track</var> be a new <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> object. </li> <li>Assign the same property values to <var data-type="AudioTrack">mirrored audio track</var> as were determined for <var data-type="AudioTrack">new audio track</var>. </li> <li>Add <var data-type="AudioTrack">mirrored audio track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks"><code>audioTracks</code></a> attribute on the HTMLMediaElement. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Add <var data-type="AudioTrack">new audio track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks"><code>audioTracks</code></a> attribute on the HTMLMediaElement. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-54"><div role="heading" class="note-title marker" id="h-note-54" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="AudioTrack">mirrored audio track</var> or <var data-type="AudioTrack">new audio track</var>, at the <a data-link-type="idl" data-lt="AudioTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotracklist"><code>AudioTrackList</code></a> object referenced by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks"><code>audioTracks</code></a> attribute on the HTMLMediaElement. </p></div> </li> </ol> </li> <li>Create a new <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-22">track buffer</a> to store <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-28">coded frames</a> for this track. </li> <li>Add the <a data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-4">track description</a> for this track to the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-23">track buffer</a>. </li> </ol> </li> <li> <p> For each video track in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-24">initialization segment</a>, run following steps: </p> <ol> <li>Let <var>video byte stream track ID</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-7">Track ID</a> for the current track being processed. </li> <li>Let <var data-type="DOMString">video language</var> be a BCP 47 language tag for the language specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-25">initialization segment</a> for this track or an empty string if no language info is present. </li> <li>If <var data-type="DOMString">video language</var> equals the 'und' BCP 47 value, then assign an empty string to <var data-type="DOMString">video language</var>. </li> <li>Let <var data-type="DOMString">video label</var> be a label specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-26">initialization segment</a> for this track or an empty string if no label info is present. </li> <li>Let <var data-type="DOMString sequence">video kinds</var> be a sequence of kind strings specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-27">initialization segment</a> for this track or a sequence with a single empty string element in it if no kind information is provided. </li> <li>For each value in <var data-type="DOMString sequence">video kinds</var>, run the following steps: <ol> <li>Let <var data-type="DOMString">current video kind</var> equal the value from <var data-type="DOMString sequence">video kinds</var> for this iteration of the loop. </li> <li>Let <var data-type="VideoTrack">new video track</var> be a new <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object. </li> <li>Generate a unique ID and assign it to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-id"><code>id</code></a> property on <var data-type="VideoTrack">new video track</var>. </li> <li>Assign <var data-type="DOMString">video language</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-language"><code>language</code></a> property on <var>new video track</var>. </li> <li>Assign <var data-type="DOMString">video label</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-label"><code>label</code></a> property on <var>new video track</var>. </li> <li>Assign <var data-type="DOMString">current video kind</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-kind"><code>kind</code></a> property on <var>new video track</var>. </li> <li> <p> If this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-98"><code>SourceBuffer</code></a> object's <a data-link-type="idl" href="#dom-sourcebuffer-videotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-videotracks-3"><code>videoTracks</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotracklist-length"><code>length</code></a> equals 0, then run the following steps: </p> <ol> <li>Set the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected"><code>selected</code></a> property on <var data-type="VideoTrack">new video track</var> to true. </li> <li>Set <var data-type="boolean">active track flag</var> to true. </li> </ol> </li> <li>Add <var data-type="VideoTrack">new video track</var> to the <a data-link-type="idl" href="#dom-sourcebuffer-videotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-videotracks-4"><code>videoTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-99"><code>SourceBuffer</code></a> object. <div class="note" role="note" id="issue-container-generatedID-55"><div role="heading" class="note-title marker" id="h-note-55" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="VideoTrack">new video track</var>, at the <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> object referenced by the <a data-link-type="idl" href="#dom-sourcebuffer-videotracks" class="internalDFN" id="ref-for-dom-sourcebuffer-videotracks-5"><code>videoTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-100"><code>SourceBuffer</code></a> object. </p></div> </li> <li> <dl class="switch"> <dt> If the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-28">parent media source</a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </dt> <dd> Post an internal <code>create track mirror</code> message to <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-8"><code>[[port to main]]</code></a> whose implicit handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> runs the following steps: <ol> <li>Let <var data-type="VideoTrack">mirrored video track</var> be a new <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> object. </li> <li>Assign the same property values to <var data-type="VideoTrack">mirrored video track</var> as were determined for <var data-type="VideoTrack">new video track</var>. </li> <li>Add <var data-type="VideoTrack">mirrored video track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks"><code>videoTracks</code></a> attribute on the HTMLMediaElement. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Add <var data-type="VideoTrack">new video track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks"><code>videoTracks</code></a> attribute on the HTMLMediaElement. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-56"><div role="heading" class="note-title marker" id="h-note-56" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="VideoTrack">mirrored video track</var> or <var data-type="VideoTrack">new video track</var>, at the <a data-link-type="idl" data-lt="VideoTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotracklist"><code>VideoTrackList</code></a> object referenced by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks"><code>videoTracks</code></a> attribute on the HTMLMediaElement. </p></div> </li> </ol> </li> <li>Create a new <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-24">track buffer</a> to store <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-29">coded frames</a> for this track. </li> <li>Add the <a data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-5">track description</a> for this track to the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-25">track buffer</a>. </li> </ol> </li> <li> <p> For each text track in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-28">initialization segment</a>, run following steps: </p> <ol> <li>Let <var>text byte stream track ID</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-8">Track ID</a> for the current track being processed. </li> <li>Let <var data-type="DOMString">text language</var> be a BCP 47 language tag for the language specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-29">initialization segment</a> for this track or an empty string if no language info is present. </li> <li>If <var data-type="DOMString">text language</var> equals the 'und' BCP 47 value, then assign an empty string to <var data-type="DOMString">text language</var>. </li> <li>Let <var data-type="DOMString">text label</var> be a label specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-30">initialization segment</a> for this track or an empty string if no label info is present. </li> <li>Let <var data-type="DOMString sequence">text kinds</var> be a sequence of kind strings specified in the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-31">initialization segment</a> for this track or a sequence with a single empty string element in it if no kind information is provided. </li> <li>For each value in <var data-type="DOMString sequence">text kinds</var>, run the following steps: <ol> <li>Let <var data-type="DOMString">current text kind</var> equal the value from <var data-type="DOMString sequence">text kinds</var> for this iteration of the loop. </li> <li>Let <var data-type="TextTrack">new text track</var> be a new <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object. </li> <li>Generate a unique ID and assign it to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-id"><code>id</code></a> property on <var data-type="TextTrack">new text track</var>. </li> <li>Assign <var data-type="DOMString">text language</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-language"><code>language</code></a> property on <var>new text track</var>. </li> <li>Assign <var data-type="DOMString">text label</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-label"><code>label</code></a> property on <var>new text track</var>. </li> <li>Assign <var data-type="DOMString">current text kind</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-kind"><code>kind</code></a> property on <var>new text track</var>. </li> <li>Populate the remaining properties on <var data-type="TextTrack">new text track</var> with the appropriate information from the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-32">initialization segment</a>. </li> <li>If the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode"><code>mode</code></a> property on <var data-type="TextTrack">new text track</var> equals <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-hidden">"hidden"</a></code>, then set <var data-type="boolean">active track flag</var> to true. </li> <li>Add <var data-type="TextTrack">new text track</var> to the <a data-link-type="idl" href="#dom-sourcebuffer-texttracks" class="internalDFN" id="ref-for-dom-sourcebuffer-texttracks-3"><code>textTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-101"><code>SourceBuffer</code></a> object. <div class="note" role="note" id="issue-container-generatedID-57"><div role="heading" class="note-title marker" id="h-note-57" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="TextTrack">new text track</var>, at the <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> object referenced by the <a data-link-type="idl" href="#dom-sourcebuffer-texttracks" class="internalDFN" id="ref-for-dom-sourcebuffer-texttracks-4"><code>textTracks</code></a> attribute on this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-102"><code>SourceBuffer</code></a> object. </p></div> </li> <li> <dl class="switch"> <dt> If the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-29">parent media source</a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a>: </dt> <dd> Post an internal <code>create track mirror</code> message to <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-9"><code>[[port to main]]</code></a> whose implicit handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> runs the following steps: <ol> <li>Let <var data-type="TextTrack">mirrored text track</var> be a new <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> object. </li> <li>Assign the same property values to <var data-type="TextTrack">mirrored text track</var> as were determined for <var data-type="TextTrack">new text track</var>. </li> <li>Add <var data-type="TextTrack">mirrored text track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks"><code>textTracks</code></a> attribute on the HTMLMediaElement. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Add <var data-type="TextTrack">new text track</var> to the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks"><code>textTracks</code></a> attribute on the HTMLMediaElement. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-58"><div role="heading" class="note-title marker" id="h-note-58" aria-level="5"><span>Note</span></div><p class=""> This should trigger <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-addtrack">addtrack</a> using <a data-link-type="idl" data-lt="TrackEvent" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#trackevent"><code>TrackEvent</code></a> with the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-trackevent-track"><code>track</code></a> attribute initialized to <var data-type="TextTrack">mirrored text track</var> or <var data-type="TextTrack">new text track</var>, at the <a data-link-type="idl" data-lt="TextTrackList" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttracklist"><code>TextTrackList</code></a> object referenced by the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks"><code>textTracks</code></a> attribute on the HTMLMediaElement. </p></div> </li> </ol> </li> <li>Create a new <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-26">track buffer</a> to store <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-30">coded frames</a> for this track. </li> <li>Add the <a data-link-type="dfn|abstract-op" href="#dfn-track-description" class="internalDFN" id="ref-for-dfn-track-description-6">track description</a> for this track to the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-27">track buffer</a>. </li> </ol> </li> <li>If <var data-type="boolean">active track flag</var> equals true, then run the following steps: <ol> <li>Add this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-103"><code>SourceBuffer</code></a> to <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-28"><code>activeSourceBuffers</code></a>. </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-5"><code>addsourcebuffer</code></a> at <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-29"><code>activeSourceBuffers</code></a> </li> </ol> </li> <li>Set <a data-link-type="attribute" data-lt="[[first initialization segment received flag]]" href="#dfn-first-initialization-segment-received-flag" class="internalDFN" id="ref-for-dfn-first-initialization-segment-received-flag-4"><code>[[first initialization segment received flag]]</code></a> to true. </li> </ol> </li> <li>Set <a data-link-type="attribute" data-lt="[[pending initialization segment for changeType flag]]" href="#dfn-pending-initialization-segment-for-changetype-flag" class="internalDFN" id="ref-for-dfn-pending-initialization-segment-for-changetype-flag-3"><code>[[pending initialization segment for changeType flag]]</code></a> to false. </li> <li>If the <var data-type="boolean">active track flag</var> equals true, then run the following steps: </li> <li>Use the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-30">parent media source</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-7">mirror if necessary</a> algorithm to run the following step in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: <ol> <li>If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-20"><code>readyState</code></a> attribute is greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a>, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-21"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-59"><div role="heading" class="note-title marker" id="h-note-59" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-22"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> </ol> </li> <li>If each object in <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-31"><code>sourceBuffers</code></a> of the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-31">parent media source</a> has <a data-link-type="attribute" data-lt="[[first initialization segment received flag]]" href="#dfn-first-initialization-segment-received-flag" class="internalDFN" id="ref-for-dfn-first-initialization-segment-received-flag-5"><code>[[first initialization segment received flag]]</code></a> equal to true, then use the <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-32">parent media source</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-mirror-if-necessary" class="internalDFN" id="ref-for-dfn-mirror-if-necessary-8">mirror if necessary</a> algorithm to run the following step in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a>: <ol> <li>If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-23"><code>readyState</code></a> attribute is <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></a>, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-24"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>. <div class="note" role="note" id="issue-container-generatedID-60"><div role="heading" class="note-title marker" id="h-note-60" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-25"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. If transition from <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_nothing"><code>HAVE_NOTHING</code></a> to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a> occurs, it should trigger HTMLMediaElement logic to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="dfn|abstract-op" data-type="event" href="https://html.spec.whatwg.org/multipage/media.html#event-media-loadedmetadata">loadedmetadata</a> at the media element. </p></div> </li> </ol> </li> </ol> </section> <section id="sourcebuffer-coded-frame-processing"><div class="header-wrapper"><h4 id="x5-5-8-coded-frame-processing"><bdi class="secno">5.5.8 </bdi> <dfn data-export="" id="dfn-coded-frame-processing" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame Processing</dfn> </h4><a class="self-link" href="#sourcebuffer-coded-frame-processing" aria-label="Permalink for Section 5.5.8"></a></div> <p> When complete <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-31">coded frames</a> have been parsed by the <a data-link-type="dfn|abstract-op" href="#dfn-segment-parser-loop" class="internalDFN" id="ref-for-dfn-segment-parser-loop-4">segment parser loop</a> then the following steps are run: </p> <ol> <li> <p> For each <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-32">coded frame</a> in the <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-13">media segment</a> run the following steps: </p> <ol> <li> <i>Loop Top:</i> <dl class="switch"> <dt> If <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-6"><code>[[generate timestamps flag]]</code></a> equals true: </dt> <dd> <ol> <li>Let <var data-type="double">presentation timestamp</var> equal 0. </li> <li>Let <var data-type="double">decode timestamp</var> equal 0. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> <ol> <li>Let <var data-type="double">presentation timestamp</var> be a double precision floating point representation of the coded frame's <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-18">presentation timestamp</a> in seconds. <div class="note" role="note" id="issue-container-generatedID-61"><div role="heading" class="note-title marker" id="h-note-61" aria-level="5"><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 <em class="rfc2119">SHOULD</em> be in the <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-6">byte stream format specifications</a> or in separate extension specifications. </p></div> </li> <li>Let <var data-type="double">decode timestamp</var> be a double precision floating point representation of the coded frame's decode timestamp in seconds. <div class="note" role="note" id="issue-container-generatedID-62"><div role="heading" class="note-title marker" id="h-note-62" aria-level="5"><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 representation 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 <em class="rfc2119">SHOULD</em> 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 data-type="double">frame duration</var> be a double precision floating point representation of the <a data-link-type="dfn|abstract-op" data-lt="coded frame duration" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-6">coded frame's duration</a> in seconds. </li> <li>If <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-11"><code>mode</code></a> equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-10"><code>sequence</code></a>" and <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-4"><code>[[group start timestamp]]</code></a> is set, then run the following steps: <ol> <li>Set <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-6"><code>timestampOffset</code></a> equal to <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-5"><code>[[group start timestamp]]</code></a> minus <var data-type="double">presentation timestamp</var>. </li> <li>Set <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-4"><code>[[group end timestamp]]</code></a> equal to <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-6"><code>[[group start timestamp]]</code></a>. </li> <li>Set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-3">need random access point flag</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-28">track buffers</a> to true. </li> <li>Unset <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-7"><code>[[group start timestamp]]</code></a>. </li> </ol> </li> <li> <p> If <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-7"><code>timestampOffset</code></a> is not 0, then run the following steps: </p> <ol> <li>Add <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-8"><code>timestampOffset</code></a> to the <var data-type="double">presentation timestamp</var>. </li> <li>Add <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-9"><code>timestampOffset</code></a> to the <var data-type="double">decode timestamp</var>. </li> </ol> </li> <li>Let <var>track buffer</var> equal the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-29">track buffer</a> that the coded frame will be added to. </li> <li> <dl class="switch"> <dt> If <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-2">last decode timestamp</a> for <var>track buffer</var> is set and <var data-type="double">decode timestamp</var> is less than <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-3">last decode timestamp</a>: </dt> <dd> OR </dd> <dt> If <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-4">last decode timestamp</a> for <var>track buffer</var> is set and the difference between <var data-type="double">decode timestamp</var> and <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-5">last decode timestamp</a> is greater than 2 times <a data-link-type="dfn|abstract-op" href="#last-frame-duration" class="internalDFN" id="ref-for-last-frame-duration-2">last frame duration</a>: </dt> <dd> <ol> <li> <dl class="switch"> <dt> If <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-12"><code>mode</code></a> equals "<a data-link-type="idl" href="#dom-appendmode-segments" class="internalDFN" id="ref-for-dom-appendmode-segments-4"><code>segments</code></a>": </dt> <dd> Set <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-5"><code>[[group end timestamp]]</code></a> to <var>presentation timestamp</var>. </dd> <dt> If <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-13"><code>mode</code></a> equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-11"><code>sequence</code></a>": </dt> <dd> Set <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-8"><code>[[group start timestamp]]</code></a> equal to the <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-6"><code>[[group end timestamp]]</code></a>. </dd> </dl> </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-6">last decode timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-30">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-frame-duration" class="internalDFN" id="ref-for-last-frame-duration-3">last frame duration</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-31">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-2">highest end timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-32">track buffers</a>. </li> <li>Set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-4">need random access point flag</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-33">track buffers</a> to true. </li> <li>Jump to the <i>Loop Top</i> step above to restart processing of the current <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-33">coded frame</a>. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Continue. </dd> </dl> </li> <li>Let <var data-type="double">frame end timestamp</var> equal the sum of <var data-type="double">presentation timestamp</var> and <var data-type="double">frame duration</var>. </li> <li>If <var data-type="double">presentation timestamp</var> is less than <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-5"><code>appendWindowStart</code></a>, then set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-5">need random access point flag</a> to true, drop the coded frame, and jump to the top of the loop to start processing the next coded frame. <div class="note" role="note" id="issue-container-generatedID-63"><div role="heading" class="note-title marker" id="h-note-63" aria-level="5"><span>Note</span></div><p class=""> Some implementations <em class="rfc2119">MAY</em> choose to collect some of these coded frames with <var data-type="double">presentation timestamp</var> less than <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-6"><code>appendWindowStart</code></a> and use them to generate a splice at the first coded frame that has a <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-19">presentation timestamp</a> greater than or equal to <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-7"><code>appendWindowStart</code></a> even if that frame is not a <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-4">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 data-type="double">frame end timestamp</var> is greater than <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-5"><code>appendWindowEnd</code></a>, then set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-6">need random access point flag</a> to true, drop the coded frame, and jump to the top of the loop to start processing the next coded frame. <div class="note" role="note" id="issue-container-generatedID-64"><div role="heading" class="note-title marker" id="h-note-64" aria-level="5"><span>Note</span></div><p class=""> Some implementations <em class="rfc2119">MAY</em> choose to collect coded frames with <var>presentation timestamp</var> less than <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-6"><code>appendWindowEnd</code></a> and <var data-type="double">frame end timestamp</var> greater than <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowend" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowend-7"><code>appendWindowEnd</code></a> and use them to generate a splice across the portion of the collected coded frames within the append window at time of collection, and the beginning portion of later processed frames which only partially overlap the end of the collected coded frames. Supporting this requires multiple decoders or faster than real-time decoding so for now this behavior will not be a normative requirement. In conjunction with collecting coded frames that span <a data-link-type="idl" href="#dom-sourcebuffer-appendwindowstart" class="internalDFN" id="ref-for-dom-sourcebuffer-appendwindowstart-8"><code>appendWindowStart</code></a>, implementations <em class="rfc2119">MAY</em> thus support gapless audio splicing. </p></div> </li> <li>If the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-7">need random access point flag</a> on <var>track buffer</var> equals true, then run the following steps: <ol> <li>If the coded frame is not a <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-5">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 data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-8">need random access point 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 data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-7">last decode timestamp</a> for <var>track buffer</var> is unset and <var>presentation timestamp</var> falls within the <a data-link-type="dfn|abstract-op" href="#presentation-interval" class="internalDFN" id="ref-for-presentation-interval-1">presentation interval</a> of a <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-34">coded frame</a> in <var>track buffer</var>, then run the following steps: <ol> <li>Let <var>overlapped frame</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-35">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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-36">coded frames</a>: </dt> <dd> Run the <a data-link-type="dfn|abstract-op" href="#dfn-audio-splice-frame" class="internalDFN" id="ref-for-dfn-audio-splice-frame-1">audio splice frame</a> algorithm 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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-37">coded frames</a>: </dt> <dd> <ol> <li>Let <var data-type="double">remove window timestamp</var> equal the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-20">presentation timestamp</a> plus 1 microsecond. </li> <li>If the <var data-type="double">presentation timestamp</var> is less than the <var>remove window timestamp</var>, then remove <var>overlapped frame</var> from <var>track buffer</var>. <div class="note" role="note" id="issue-container-generatedID-65"><div role="heading" class="note-title marker" id="h-note-65" aria-level="5"><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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-38">coded frames</a>: </dt> <dd> Run the <a data-link-type="dfn|abstract-op" href="#dfn-text-splice-frame" class="internalDFN" id="ref-for-dfn-text-splice-frame-1">text splice frame</a> algorithm 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 data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-3">highest end timestamp</a> for <var>track buffer</var> is not set: </dt> <dd> Remove all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-39">coded frames</a> from <var>track buffer</var> that have a <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-21">presentation timestamp</a> greater than or equal to <var data-type="double">presentation timestamp</var> and less than <var data-type="double">frame end timestamp</var>. </dd> <dt> If <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-4">highest end timestamp</a> for <var>track buffer</var> is set and less than or equal to <var data-type="double">presentation timestamp</var>: </dt> <dd> Remove all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-40">coded frames</a> from <var>track buffer</var> that have a <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-22">presentation timestamp</a> greater than or equal to <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-5">highest end timestamp</a> and less than <var data-type="double">frame end timestamp</var>. </dd> </dl> </li> <li>Remove all possible decoding dependencies on the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-41">coded frames</a> removed in the previous two steps by removing all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-42">coded frames</a> from <var>track buffer</var> between those frames removed in the previous two steps and the next <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-6">random access point</a> after those removed frames. <div class="note" role="note" id="issue-container-generatedID-66"><div role="heading" class="note-title marker" id="h-note-66" aria-level="5"><span>Note</span></div><p class=""> Removing all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-43">coded frames</a> until the next <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-7">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> </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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-44">coded frame</a> with the <var data-type="double">presentation timestamp</var>, <var>decode timestamp</var>, and <var data-type="double">frame duration</var> to the <var>track buffer</var>. </dd> </dl> </li> <li>Set <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-8">last decode timestamp</a> for <var>track buffer</var> to <var data-type="double">decode timestamp</var>. </li> <li>Set <a data-link-type="dfn|abstract-op" href="#last-frame-duration" class="internalDFN" id="ref-for-last-frame-duration-4">last frame duration</a> for <var>track buffer</var> to <var data-type="double">frame duration</var>. </li> <li>If <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-6">highest end timestamp</a> for <var>track buffer</var> is unset or <var>frame end timestamp</var> is greater than <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-7">highest end timestamp</a>, then set <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-8">highest end timestamp</a> for <var>track buffer</var> to <var data-type="double">frame end timestamp</var>. <div class="note" role="note" id="issue-container-generatedID-67"><div role="heading" class="note-title marker" id="h-note-67" aria-level="5"><span>Note</span></div><p class=""> The greater than check is needed because bidirectional prediction between coded frames can cause <var data-type="double">presentation timestamp</var> to not be monotonically increasing even though the decode timestamps are monotonically increasing. </p></div> </li> <li>If <var data-type="double">frame end timestamp</var> is greater than <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-7"><code>[[group end timestamp]]</code></a>, then set <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-8"><code>[[group end timestamp]]</code></a> equal to <var>frame end timestamp</var>. </li> <li>If <a data-link-type="attribute" data-lt="[[generate timestamps flag]]" href="#dfn-generate-timestamps-flag" class="internalDFN" id="ref-for-dfn-generate-timestamps-flag-7"><code>[[generate timestamps flag]]</code></a> equals true, then set <a data-link-type="idl" href="#dom-sourcebuffer-timestampoffset" class="internalDFN" id="ref-for-dom-sourcebuffer-timestampoffset-10"><code>timestampOffset</code></a> equal to <var data-type="double">frame end timestamp</var>. </li> </ol> </li> <li> <p> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-26"><code>readyState</code></a> attribute is <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a> and the new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-45">coded frames</a> cause <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> to have a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> for the current playback position, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-27"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a>. </p> <div class="note" role="note" id="issue-container-generatedID-68"><div role="heading" class="note-title marker" id="h-note-68" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-28"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li> <p> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-29"><code>readyState</code></a> attribute is <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data"><code>HAVE_CURRENT_DATA</code></a> and the new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-46">coded frames</a> cause <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> to have a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> that includes the current playback position and some time beyond the current playback position, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-30"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_future_data"><code>HAVE_FUTURE_DATA</code></a>. </p> <div class="note" role="note" id="issue-container-generatedID-69"><div role="heading" class="note-title marker" id="h-note-69" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-31"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li> <p> If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-32"><code>readyState</code></a> attribute is <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_future_data"><code>HAVE_FUTURE_DATA</code></a> and the new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-47">coded frames</a> cause <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> to have a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> that includes the current playback position and <a data-link-type="dfn|abstract-op" href="#enough-data" class="internalDFN" id="ref-for-enough-data-3">enough data to ensure uninterrupted playback</a>, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-33"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_enough_data"><code>HAVE_ENOUGH_DATA</code></a>. </p> <div class="note" role="note" id="issue-container-generatedID-70"><div role="heading" class="note-title marker" id="h-note-70" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-34"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> </li> <li>If the <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-14">media segment</a> contains data beyond the current <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-10"><code>duration</code></a>, then run the <a data-link-type="dfn|abstract-op" href="#dfn-duration-change" class="internalDFN" id="ref-for-dfn-duration-change-6">duration change</a> algorithm with <var data-type="unrestricted double">new duration</var> set to the maximum of the current duration and the <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-9"><code>[[group end timestamp]]</code></a>. </li> </ol> </section> <section id="sourcebuffer-coded-frame-removal"><div class="header-wrapper"><h4 id="x5-5-9-coded-frame-removal"><bdi class="secno">5.5.9 </bdi> <dfn id="dfn-coded-frame-removal" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame Removal</dfn> </h4><a class="self-link" href="#sourcebuffer-coded-frame-removal" aria-label="Permalink for Section 5.5.9"></a></div> <p> Follow these steps when <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-48">coded frames</a> for a specific time range need to be removed from the SourceBuffer: </p> <ol> <li>Let <var data-type="double">start</var> be the starting <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-23">presentation timestamp</a> for the removal range. </li> <li>Let <var data-type="unrestricted double">end</var> be the end <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-24">presentation timestamp</a> for the removal range. </li> <li> <p> For each <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-34">track buffer</a> in this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-104"><code>SourceBuffer</code></a>, run the following steps: </p> <ol> <li>Let <var data-type="unrestricted double">remove end timestamp</var> be the current value of <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-11"><code>duration</code></a> </li> <li> <p> If this <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-35">track buffer</a> has a <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-8">random access point</a> timestamp that is greater than or equal to <var data-type="unrestricted double">end</var>, then update <var data-type="unrestricted double">remove end timestamp</var> to that random access point timestamp. </p> <div class="note" role="note" id="issue-container-generatedID-71"><div role="heading" class="note-title marker" id="h-note-71" aria-level="5"><span>Note</span></div><p class=""> Random access point timestamps can be different across tracks because the dependencies between <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-49">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 data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-36">track buffer</a>, that contain starting timestamps greater than or equal to <var data-type="double">start</var> and less than the <var>remove end timestamp</var>. <ol> <li> <p> For each removed frame, if the frame has a <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-3">decode timestamp</a> equal to the <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-9">last decode timestamp</a> for the frame's track, run the following steps: </p> <dl class="switch"> <dt> If <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-14"><code>mode</code></a> equals "<a data-link-type="idl" href="#dom-appendmode-segments" class="internalDFN" id="ref-for-dom-appendmode-segments-5"><code>segments</code></a>": </dt> <dd> Set <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-10"><code>[[group end timestamp]]</code></a> to <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-25">presentation timestamp</a>. </dd> <dt> If <a data-link-type="idl" href="#dom-sourcebuffer-mode" class="internalDFN" id="ref-for-dom-sourcebuffer-mode-15"><code>mode</code></a> equals "<a data-link-type="idl" href="#dom-appendmode-sequence" class="internalDFN" id="ref-for-dom-appendmode-sequence-12"><code>sequence</code></a>": </dt> <dd> Set <a data-link-type="attribute" data-lt="[[group start timestamp]]" href="#dfn-group-start-timestamp" class="internalDFN" id="ref-for-dfn-group-start-timestamp-9"><code>[[group start timestamp]]</code></a> equal to the <a data-link-type="attribute" data-lt="[[group end timestamp]]" href="#dfn-group-end-timestamp" class="internalDFN" id="ref-for-dfn-group-end-timestamp-11"><code>[[group end timestamp]]</code></a>. </dd> </dl> </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-decode-timestamp" class="internalDFN" id="ref-for-last-decode-timestamp-10">last decode timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-37">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#last-frame-duration" class="internalDFN" id="ref-for-last-frame-duration-5">last frame duration</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-38">track buffers</a>. </li> <li>Unset the <a data-link-type="dfn|abstract-op" href="#highest-end-timestamp" class="internalDFN" id="ref-for-highest-end-timestamp-9">highest end timestamp</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-39">track buffers</a>. </li> <li>Set the <a data-link-type="dfn|abstract-op" href="#need-RAP-flag" class="internalDFN" id="ref-for-need-RAP-flag-9">need random access point flag</a> on all <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-40">track buffers</a> to true. </li> </ol> </li> <li>Remove all possible decoding dependencies on the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-50">coded frames</a> removed in the previous step by removing all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-51">coded frames</a> from this <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-41">track buffer</a> between those frames removed in the previous step and the next <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-9">random access point</a> after those removed frames. <div class="note" role="note" id="issue-container-generatedID-72"><div role="heading" class="note-title marker" id="h-note-72" aria-level="5"><span>Note</span></div><p class=""> Removing all <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-52">coded frames</a> until the next <a data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-10">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> </li> <li> <p> If this object is in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-30"><code>activeSourceBuffers</code></a>, the <a href="https://html.spec.whatwg.org/multipage/media.html#current-playback-position">current playback position</a> is greater than or equal to <var data-type="double">start</var> and less than the <var data-type="unrestricted double">remove end timestamp</var>, and <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-35"><code>readyState</code></a> is greater than <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a>, then set the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-36"><code>readyState</code></a> attribute to <a data-link-type="idl" data-type="const" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-have_metadata"><code>HAVE_METADATA</code></a> and stall playback. </p> <div class="note" role="note" id="issue-container-generatedID-73"><div role="heading" class="note-title marker" id="h-note-73" aria-level="5"><span>Note</span></div><p class=""> Per <code><a href="https://html.spec.whatwg.org/multipage/media.html#ready-states">HTMLMediaElement ready states</a></code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] logic, <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" href="#dom-readystate" class="internalDFN" id="ref-for-dom-readystate-37"><code>readyState</code></a> changes may trigger events on the HTMLMediaElement. </p></div> <div class="note" role="note" id="issue-container-generatedID-74"><div role="heading" class="note-title marker" id="h-note-74" aria-level="5"><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="https://html.spec.whatwg.org/multipage/media.html#current-playback-position">current playback position</a> is appended or the <a href="#active-source-buffer-changes" data-matched-text="[[[#active-source-buffer-changes]]]" class="sec-ref"><bdi class="secno">3.15.5 </bdi> <span>Changes to selected/enabled track state</span></a>. </p></div> </li> </ol> </li> <li>If the <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-3"><code>[[buffer full flag]]</code></a> equals true and this object is ready to accept more bytes, then set the <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-4"><code>[[buffer full flag]]</code></a> to false. </li> </ol> </section> <section id="sourcebuffer-coded-frame-eviction"><div class="header-wrapper"><h4 id="x5-5-10-coded-frame-eviction"><bdi class="secno">5.5.10 </bdi> <dfn id="dfn-coded-frame-eviction" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Coded Frame Eviction</dfn> </h4><a class="self-link" href="#sourcebuffer-coded-frame-eviction" aria-label="Permalink for Section 5.5.10"></a></div> <p> This algorithm is run to free up space in this <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-105"><code>SourceBuffer</code></a> when new data is appended. </p> <ol> <li>Let <var data-type="BufferSource">new data</var> equal the data that is about to be appended to this SourceBuffer. <div class="issue" id="issue-container-number-289"><div role="heading" class="issue-title marker" id="h-issue-1" aria-level="5"><a href="https://github.com/w3c/media-source/issues/289"><span class="issue-number">Issue 289</span></a><span class="issue-label">: Editorial? Coded Frame eviction algorithm needs to note that "buffer full flag" may be updated immediately based on |new data|</span></div><div class=""> <p> Need to recognize step here that implementations <em class="rfc2119">MAY</em> decide to set <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-5"><code>[[buffer full flag]]</code></a> true here if it predicts that processing <var data-type="BufferSource">new data</var> in addition to any existing bytes in <a data-link-type="attribute" data-lt="[[input buffer]]" href="#dfn-input-buffer" class="internalDFN" id="ref-for-dfn-input-buffer-14"><code>[[input buffer]]</code></a> would exceed the capacity of the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-106"><code>SourceBuffer</code></a>. Such a step enables more proactive push-back from implementations before accepting <var data-type="BufferSource">new data</var> which would overflow resources, for example. In practice, at least one implementation already does this. </p> </div></div> </li> <li>If the <a data-link-type="attribute" data-lt="[[buffer full flag]]" href="#dfn-buffer-full-flag" class="internalDFN" id="ref-for-dfn-buffer-full-flag-6"><code>[[buffer full flag]]</code></a> equals false, then abort these steps. </li> <li>Let <var data-type="normalized TimeRanges">removal ranges</var> equal a list of presentation time ranges that can be evicted from the presentation to make room for the <var data-type="BufferSource">new data</var>. <div class="note" role="note" id="issue-container-generatedID-75"><div role="heading" class="note-title marker" id="h-note-75" aria-level="5"><span>Note</span></div><p class=""> Implementations <em class="rfc2119">MAY</em> use different methods for selecting <var data-type="normalized TimeRanges">removal ranges</var> so web applications <em class="rfc2119">SHOULD NOT</em> depend on a specific behavior. The web application can use the <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-4"><code>buffered</code></a> attribute to observe whether portions of the buffered data have been evicted. </p></div> </li> <li>For each range in <var data-type="normalized TimeRanges">removal ranges</var>, run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-4">coded frame removal</a> algorithm with <var data-type="double">start</var> and <var data-type="unrestricted double">end</var> equal to the removal range start and end timestamp respectively. </li> </ol> </section> <section id="sourcebuffer-audio-splice-frame-algorithm"><div class="header-wrapper"><h4 id="x5-5-11-audio-splice-frame"><bdi class="secno">5.5.11 </bdi> <dfn id="dfn-audio-splice-frame" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Audio Splice Frame</dfn> </h4><a class="self-link" href="#sourcebuffer-audio-splice-frame-algorithm" aria-label="Permalink for Section 5.5.11"></a></div> <p> Follow these steps when the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-11">coded frame processing</a> algorithm needs to generate a splice frame for two overlapping audio <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-53">coded frames</a>: </p> <ol> <li>Let <var>track buffer</var> be the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-42">track buffer</a> that will contain the splice. </li> <li>Let <var>new coded frame</var> be the new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-54">coded frame</a>, that is being added to <var>track buffer</var>, which triggered the need for a splice. </li> <li>Let <var data-type="double">presentation timestamp</var> be the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-26">presentation timestamp</a> for <var>new coded frame</var>. </li> <li>Let <var data-type="double">decode timestamp</var> be the decode timestamp for <var>new coded frame</var>. </li> <li>Let <var data-type="double">frame duration</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-7">coded frame duration</a> of <var>new coded frame</var>. </li> <li>Let <var>overlapped frame</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-55">coded frame</a> in <var>track buffer</var> with a <a data-link-type="dfn|abstract-op" href="#presentation-interval" class="internalDFN" id="ref-for-presentation-interval-2">presentation interval</a> that contains <var data-type="double">presentation timestamp</var>. </li> <li>Update <var data-type="double">presentation timestamp</var> and <var data-type="double">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 (e.g., <code>floor(x * sample_rate + 0.5) / sample_rate</code>). <div class="note" role="note" id="issue-container-generatedID-76"><div role="heading" class="note-title marker" id="h-note-76" aria-level="5"><span>Note</span></div><div class=""> <p> For example, given the following values: </p> <ul> <li>The <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-27">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 data-type="double">presentation timestamp</var> equals 10.01255 </li> <li><var data-type="double">decode timestamp</var> equals 10.01255 </li> </ul> <p> <var data-type="double">presentation timestamp</var> and <var data-type="double">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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-28">presentation timestamp</a> set to the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-29">presentation timestamp</a>. </li> <li>The <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-4">decode timestamp</a> set to the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-5">decode timestamp</a>. </li> <li>The <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-8">coded frame duration</a> set to difference between <var>presentation timestamp</var> and the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-30">presentation timestamp</a>. </li> </ul> <div class="note" role="note" id="issue-container-generatedID-77"><div role="heading" class="note-title marker" id="h-note-77" aria-level="5"><span>Note</span></div><p class=""> Some implementations <em class="rfc2119">MAY</em> 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" role="note" id="issue-container-generatedID-78"><div role="heading" class="note-title marker" id="h-note-78" aria-level="5"><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 data-type="double">frame end timestamp</var> equal the sum of <var data-type="double">presentation timestamp</var> and <var data-type="double">frame duration</var>. </li> <li>Let <var data-type="double">splice end timestamp</var> equal the sum of <var data-type="double">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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-31">presentation timestamp</a> greater than <var data-type="double">presentation timestamp</var> and less than <var data-type="double">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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-32">presentation timestamp</a> set to the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-33">presentation timestamp</a>. </li> <li>The <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-6">decode timestamp</a> set to the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#dfn-decode-timestamp" class="internalDFN" id="ref-for-dfn-decode-timestamp-7">decode timestamp</a>. </li> <li>The <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-9">coded frame duration</a> set to difference between <var data-type="double">frame end timestamp</var> and the <var>overlapped frame</var> <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-34">presentation timestamp</a>. </li> <li>The fade out coded frames equals <var>fade out coded frames</var>. </li> <li>The fade in coded frame equals <var>new coded frame</var>. <div class="note" role="note" id="issue-container-generatedID-79"><div role="heading" class="note-title marker" id="h-note-79" aria-level="5"><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 data-type="double">presentation timestamp</var>. </li> </ul> <div class="note" role="note" id="issue-container-generatedID-80"><div role="heading" class="note-title marker" id="h-note-80" aria-level="5"><span>Note</span></div><p class=""> See the <a data-link-type="dfn|abstract-op" href="#dfn-audio-splice-rendering" class="internalDFN" id="ref-for-dfn-audio-splice-rendering-1">audio splice rendering</a> algorithm for details on how this splice frame is rendered. </p></div> </li> </ol> </section> <section id="sourcebuffer-audio-splice-rendering-algorithm"><div class="header-wrapper"><h4 id="x5-5-12-audio-splice-rendering"><bdi class="secno">5.5.12 </bdi> <dfn id="dfn-audio-splice-rendering" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Audio Splice Rendering</dfn> </h4><a class="self-link" href="#sourcebuffer-audio-splice-rendering-algorithm" aria-label="Permalink for Section 5.5.12"></a></div> <p> The following steps are run when a spliced frame, generated by the <a data-link-type="dfn|abstract-op" href="#dfn-audio-splice-frame" class="internalDFN" id="ref-for-dfn-audio-splice-frame-2">audio splice frame</a> algorithm, needs to be rendered by the media element: </p> <ol> <li>Let <var>fade out coded frames</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-56">coded frames</a> that are faded out during the splice. </li> <li>Let <var>fade in coded frames</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-57">coded frames</a> that are faded in during the splice. </li> <li>Let <var data-type="double">presentation timestamp</var> be the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-35">presentation timestamp</a> of the first coded frame in <var>fade out coded frames</var>. </li> <li>Let <var data-type="double">end timestamp</var> be the sum of the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-36">presentation timestamp</a> and the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-10">coded frame duration</a> of the last frame in <var>fade in coded frames</var>. </li> <li>Let <var data-type="double">splice timestamp</var> be the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-37">presentation timestamp</a> where the splice starts. This corresponds with the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-38">presentation timestamp</a> of the first frame in <var>fade in coded frames</var>. </li> <li>Let <var data-type="double">splice end timestamp</var> equal <var data-type="double">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 data-type="double">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 data-type="double">splice timestamp</var> and <var data-type="double">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 data-type="double">splice timestamp</var> and <var data-type="double">splice end timestamp</var> in <var>fade in samples</var>. </li> <li>Copy samples between <var data-type="double">presentation timestamp</var> to <var data-type="double">splice timestamp</var> from <var>fade out samples</var> into <var>output samples</var>. </li> <li>For each sample between <var data-type="double">splice timestamp</var> and <var data-type="double">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 data-type="double">splice end timestamp</var> to <var data-type="double">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" role="note" id="issue-container-generatedID-81"><div role="heading" class="note-title marker" id="h-note-81" aria-level="5"><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"><div class="header-wrapper"><h4 id="x5-5-13-text-splice-frame"><bdi class="secno">5.5.13 </bdi> <dfn id="dfn-text-splice-frame" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Text Splice Frame</dfn> </h4><a class="self-link" href="#sourcebuffer-text-splice-frame-algorithm" aria-label="Permalink for Section 5.5.13"></a></div> <p> Follow these steps when the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-12">coded frame processing</a> algorithm needs to generate a splice frame for two overlapping timed text <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-58">coded frames</a>: </p> <ol> <li>Let <var>track buffer</var> be the <a data-link-type="dfn|abstract-op" href="#track-buffer" class="internalDFN" id="ref-for-track-buffer-43">track buffer</a> that will contain the splice. </li> <li>Let <var>new coded frame</var> be the new <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-59">coded frame</a>, that is being added to <var>track buffer</var>, which triggered the need for a splice. </li> <li>Let <var data-type="double">presentation timestamp</var> be the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-39">presentation timestamp</a> for <var>new coded frame</var> </li> <li>Let <var data-type="double">decode timestamp</var> be the decode timestamp for <var>new coded frame</var>. </li> <li>Let <var data-type="double">frame duration</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-11">coded frame duration</a> of <var>new coded frame</var>. </li> <li>Let <var data-type="double">frame end timestamp</var> equal the sum of <var data-type="double">presentation timestamp</var> and <var data-type="double">frame duration</var>. </li> <li>Let <var>first overlapped frame</var> be the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame" class="internalDFN" id="ref-for-dfn-coded-frame-60">coded frame</a> in <var>track buffer</var> with a <a data-link-type="dfn|abstract-op" href="#presentation-interval" class="internalDFN" id="ref-for-presentation-interval-3">presentation interval</a> that contains <var data-type="double">presentation timestamp</var>. </li> <li>Let <var data-type="double">overlapped presentation timestamp</var> be the <a data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-40">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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-41">presentation timestamp</a> greater than <var data-type="double">presentation timestamp</var> and less than <var data-type="double">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 data-link-type="dfn|abstract-op" href="#dfn-coded-frame-duration" class="internalDFN" id="ref-for-dfn-coded-frame-duration-12">coded frame duration</a> of the <var>first overlapped frame</var> to <var data-type="double">presentation timestamp</var> minus <var data-type="double">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" role="note" id="issue-container-generatedID-82"><div role="heading" class="note-title marker" id="h-note-82" aria-level="5"><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"><div class="header-wrapper"><h2 id="x6-sourcebufferlist-interface"><bdi class="secno">6. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-sourcebufferlist" data-idl="interface" data-title="SourceBufferList" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>SourceBufferList</code></dfn> interface </h2><a class="self-link" href="#sourcebufferlist" aria-label="Permalink for Section 6."></a></div> <p> <a data-link-type="idl" data-lt="SourceBufferList" href="#dom-sourcebufferlist" class="internalDFN" id="ref-for-dom-sourcebufferlist-5"><code>SourceBufferList</code></a> is a simple container object for <a href="#dom-sourcebuffer" class="internalDFN" data-link-type="idl" id="ref-for-dom-sourcebuffer-107"><code>SourceBuffer</code></a> objects. It provides read-only array access and fires events when the list is modified. </p> <pre class="idl def" id="webidl-2108728413"><span class="idlHeader"><a class="self-link" href="#webidl-2108728413">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-sourcebufferlist" data-title="SourceBufferList">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-sourcebufferlist" id="ref-for-dom-sourcebufferlist-6"><code>SourceBufferList</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a></span> {<span data-idl="" class="idlAttribute" id="idl-def-sourcebufferlist-length" data-title="length" data-dfn-for="SourceBufferList"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long">unsigned long</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebufferlist-length" id="ref-for-dom-sourcebufferlist-length-1"><code>length</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebufferlist-onaddsourcebuffer" data-title="onaddsourcebuffer" data-dfn-for="SourceBufferList"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebufferlist-onaddsourcebuffer" id="ref-for-dom-sourcebufferlist-onaddsourcebuffer-1"><code>onaddsourcebuffer</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-sourcebufferlist-onremovesourcebuffer" data-title="onremovesourcebuffer" data-dfn-for="SourceBufferList"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-sourcebufferlist-onremovesourcebuffer" id="ref-for-dom-sourcebufferlist-onremovesourcebuffer-1"><code>onremovesourcebuffer</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-sourcebufferlist-anonymous-getter-index" data-title="getter" data-dfn-for="SourceBufferList"> <dfn data-export="" data-dfn-type="method" id="dom-sourcebufferlist-getter" data-idl="operation" data-title="getter" data-dfn-for="SourceBufferList" data-type="SourceBuffer" data-lt="getter()|getter(index)" data-local-lt="SourceBufferList.getter|SourceBufferList.getter()|getter" tabindex="0" aria-haspopup="dialog"><code>getter</code></dfn><span class="idlType"> <a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-108"><code>SourceBuffer</code></a></span> (<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long">unsigned long</a></span> <span class="idlParamName">index</span>);</span> };</span></code></pre> <section id="attributes-0"><div class="header-wrapper"><h3 id="x6-1-attributes"><bdi class="secno">6.1 </bdi> Attributes </h3><a class="self-link" href="#attributes-0" aria-label="Permalink for Section 6.1"></a></div> <dl class="attributes" data-dfn-for="SourceBufferList"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebufferlist-length" data-idl="attribute" data-title="length" data-dfn-for="SourceBufferList" data-type="unsigned long" data-lt="length" data-local-lt="SourceBufferList.length" tabindex="0" aria-haspopup="dialog"><code>length</code></dfn> of type <a data-link-type="idl" data-lt="unsigned long" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long"><code>unsigned long</code></a>, readonly </dt> <dd> <p> Indicates the number of <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-109"><code>SourceBuffer</code></a> objects in the list. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebufferlist-onaddsourcebuffer" data-idl="attribute" data-title="onaddsourcebuffer" data-dfn-for="SourceBufferList" data-type="EventHandler" data-lt="onaddsourcebuffer" data-local-lt="SourceBufferList.onaddsourcebuffer" tabindex="0" aria-haspopup="dialog"><code>onaddsourcebuffer</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="addsourcebuffer" href="#dfn-addsourcebuffer" class="internalDFN" id="ref-for-dfn-addsourcebuffer-6"><code>addsourcebuffer</code></a> event. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-sourcebufferlist-onremovesourcebuffer" data-idl="attribute" data-title="onremovesourcebuffer" data-dfn-for="SourceBufferList" data-type="EventHandler" data-lt="onremovesourcebuffer" data-local-lt="SourceBufferList.onremovesourcebuffer" tabindex="0" aria-haspopup="dialog"><code>onremovesourcebuffer</code></dfn> of type <a data-link-type="idl" data-lt="EventHandler" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> </dt> <dd> <p> The event handler for the <a data-link-type="idl" data-lt="removesourcebuffer" href="#dfn-removesourcebuffer" class="internalDFN" id="ref-for-dfn-removesourcebuffer-8"><code>removesourcebuffer</code></a> event. </p> </dd> </dl> </section> <section id="methods-0"><div class="header-wrapper"><h3 id="x6-2-methods"><bdi class="secno">6.2 </bdi> Methods </h3><a class="self-link" href="#methods-0" aria-label="Permalink for Section 6.2"></a></div> <dl class="methods" data-dfn-for="SourceBufferList"> <dt> <dfn data-lt-nodefault="" data-lt="sourcebufferlist-getter" id="dfn-sourcebufferlist-getter" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn" class="respec-offending-element" title="Found definition for &quot;getter&quot;, but nothing links to it. This is usually a spec bug!">getter</dfn> </dt> <dd> <p> Allows the SourceBuffer objects in the list to be accessed with an array operator (i.e., []). </p> <p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm"> <li>If <var data-type="unsigned long">index</var> is greater than or equal to the <a data-link-type="idl" href="#dom-sourcebufferlist-length" class="internalDFN" id="ref-for-dom-sourcebufferlist-length-2"><code>length</code></a> attribute then return undefined and abort these steps. </li> <li>Return the <var data-type="unsigned long">index</var>'th <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-110"><code>SourceBuffer</code></a> object in the list. </li> </ol></dd> </dl> </section> <section id="sourcebufferlist-events"><div class="header-wrapper"><h3 id="x6-3-event-summary"><bdi class="secno">6.3 </bdi> Event Summary </h3><a class="self-link" href="#sourcebufferlist-events" aria-label="Permalink for Section 6.3"></a></div> <table class="data"> <thead> <tr> <th> Event name </th> <th> Interface </th> <th> Dispatched when... </th> </tr> </thead> <tbody><tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-addsourcebuffer" tabindex="0" aria-haspopup="dialog" data-export="">addsourcebuffer</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> When a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-111"><code>SourceBuffer</code></a> is added to the list. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-removesourcebuffer" tabindex="0" aria-haspopup="dialog" data-export="">removesourcebuffer</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> When a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-112"><code>SourceBuffer</code></a> is removed from the list. </td> </tr> </tbody></table> </section> </section> <section data-cite="WEBIDL mimesniff" data-dfn-for="ManagedMediaSource" id="managedmediasource-interface"><div class="header-wrapper"><h2 id="x7-managedmediasource-interface"><bdi class="secno">7. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-managedmediasource" data-idl="interface" data-title="ManagedMediaSource" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>ManagedMediaSource</code></dfn> interface </h2><a class="self-link" href="#managedmediasource-interface" aria-label="Permalink for Section 7."></a></div> <p> A <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-4"><code>ManagedMediaSource</code></a> is a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-99"><code>MediaSource</code></a> that actively manages its memory content. Unlike a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-100"><code>MediaSource</code></a>, the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://infra.spec.whatwg.org/#user-agent">user agent</a> can evict content through the <a data-link-type="dfn|abstract-op" href="#dfn-memory-cleanup" class="internalDFN" id="ref-for-dfn-memory-cleanup-1">memory cleanup</a> algorithm from its <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-32"><code>sourceBuffers</code></a> (populated with <a data-link-type="idl" data-lt="ManagedSourceBuffer" href="#dom-managedsourcebuffer" class="internalDFN" id="ref-for-dom-managedsourcebuffer-3"><code>ManagedSourceBuffer</code></a>) for any reason. </p> <div class="note" role="note" id="issue-container-generatedID-83"><div role="heading" class="note-title marker" id="h-note-83" aria-level="3"><span>Note</span><span class="issue-label">: Eviction reasons</span></div><aside class=""> <p> Reasons that the user agent might evict content are implementation specific and can include, but are not limited to, memory and/or hardware limitations, change in environmental conditions, and so on. Developers shouldn't make assumptions as to why, how, or when a user agent might evict content. Instead, developers need to write scripts with the assumption that content is constantly and randomly being evicted to avoid stalled video playback (i.e., code defensibly and listen for the <a data-link-type="idl" data-lt="bufferedchange" href="#dfn-bufferedchange" class="internalDFN" id="ref-for-dfn-bufferedchange-1"><code>bufferedchange</code></a> event!). </p> </aside></div> <pre class="idl def" id="webidl-1619111096"><span class="idlHeader"><a class="self-link" href="#webidl-1619111096">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-managedmediasource" data-title="ManagedMediaSource">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-managedmediasource" id="ref-for-dom-managedmediasource-5"><code>ManagedMediaSource</code></a> : <span class="idlSuperclass"><a data-link-type="idl" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-101"><code>MediaSource</code></a></span> {<span data-idl="" class="idlConstructor" id="idl-def-managedmediasource-constructor" data-title="constructor" data-dfn-for="ManagedMediaSource"> <dfn data-export="" data-dfn-type="constructor" id="dom-managedmediasource-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="ManagedMediaSource" data-lt="constructor()" data-local-lt="ManagedMediaSource.constructor|ManagedMediaSource.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>();</span><span data-idl="" class="idlAttribute" id="idl-def-managedmediasource-streaming" data-title="streaming" data-dfn-for="ManagedMediaSource"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-managedmediasource-streaming" id="ref-for-dom-managedmediasource-streaming-2"><code>streaming</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-managedmediasource-onstartstreaming" data-title="onstartstreaming" data-dfn-for="ManagedMediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-managedmediasource-onstartstreaming" data-idl="attribute" data-title="onstartstreaming" data-dfn-for="ManagedMediaSource" data-type="EventHandler" data-lt="onstartstreaming" data-local-lt="ManagedMediaSource.onstartstreaming" class="idlName" tabindex="0" aria-haspopup="dialog"><code>onstartstreaming</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-managedmediasource-onendstreaming" data-title="onendstreaming" data-dfn-for="ManagedMediaSource"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-managedmediasource-onendstreaming" data-idl="attribute" data-title="onendstreaming" data-dfn-for="ManagedMediaSource" data-type="EventHandler" data-lt="onendstreaming" data-local-lt="ManagedMediaSource.onendstreaming" class="idlName" tabindex="0" aria-haspopup="dialog"><code>onendstreaming</code></dfn>;</span> };</span></code></pre> <section id="attributes-1"><div class="header-wrapper"><h3 id="x7-1-attributes"><bdi class="secno">7.1 </bdi> Attributes </h3><a class="self-link" href="#attributes-1" aria-label="Permalink for Section 7.1"></a></div> <dl class="attributes" data-dfn-for="ManagedMediaSource"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-managedmediasource-streaming" data-idl="attribute" data-title="streaming" data-dfn-for="ManagedMediaSource" data-type="boolean" data-lt="streaming" data-local-lt="ManagedMediaSource.streaming" tabindex="0" aria-haspopup="dialog"><code>streaming</code></dfn> </dt> <dd> <p> On getting: </p> <ol> <li>Return the current value of the attribute. </li> </ol> </dd> </dl> </section><section id="event-summary"><div class="header-wrapper"><h3 id="x7-2-event-summary"><bdi class="secno">7.2 </bdi> Event Summary </h3><a class="self-link" href="#event-summary" aria-label="Permalink for Section 7.2"></a></div> <table class="old-table"> <thead> <tr> <th> Event name </th> <th> Interface </th> <th> Dispatched when... </th> </tr> </thead> <tbody> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-startstreaming" tabindex="0" aria-haspopup="dialog" data-export="">startstreaming</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> A <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-6"><code>ManagedMediaSource</code></a>'s <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-3"><code>streaming</code></a> attribute changed from <code>false</code> to <code>true</code>. </td> </tr> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-endstreaming" tabindex="0" aria-haspopup="dialog" data-export="">endstreaming</dfn> </td> <td> <a data-link-type="idl" data-lt="Event" data-type="interface" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> </td> <td> A <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-7"><code>ManagedMediaSource</code></a>'s <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-4"><code>streaming</code></a> attribute changed from <code>true</code> to <code>false</code>. </td> </tr> </tbody> </table> </section><section id="algorithms"><div class="header-wrapper"><h3 id="x7-3-algorithms"><bdi class="secno">7.3 </bdi> Algorithms </h3><a class="self-link" href="#algorithms" aria-label="Permalink for Section 7.3"></a></div> <section id="managedsourcebuffer-monitoring"><div class="header-wrapper"><h4 id="x7-3-1-managedsourcebuffer-monitoring"><bdi class="secno">7.3.1 </bdi> <code>ManagedSourceBuffer</code> Monitoring </h4><a class="self-link" href="#managedsourcebuffer-monitoring" aria-label="Permalink for Section 7.3.1"></a></div> <p> The following steps are run periodically, whenever the <a data-link-type="dfn|abstract-op" href="#dfn-sourcebuffer-monitoring" class="internalDFN" id="ref-for-dfn-sourcebuffer-monitoring-1">SourceBuffer Monitoring</a> algorithm is scheduled to run. </p> <p> Having <dfn id="dfn-enough-managed-data-to-ensure-uninterrupted-playback" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">enough managed data to ensure uninterrupted playback</dfn> is an implementation defined 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 value of <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-5"><code>streaming</code></a>. These transitions indicate when the user agent believes it has enough data buffered or it needs more data respectively. </p> <p> Being <dfn id="dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">able to retrieve and buffer data in an efficient way</dfn> is an implementation defined condition where the user agent determines that it can fetch new data in an energy efficient manner while able to achieve the desired memory usage. </p> <ol class="algorithm"> <li>Run the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-102"><code>MediaSource</code></a> <a data-link-type="dfn|abstract-op" href="#dfn-sourcebuffer-monitoring" class="internalDFN" id="ref-for-dfn-sourcebuffer-monitoring-2">SourceBuffer Monitoring</a> algorithm. </li> <li>Let <var>can play uninterrupted and efficiently</var> be a flag that is true if the <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute contains a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> that includes the current playback position and <a data-link-type="dfn|abstract-op" href="#dfn-enough-managed-data-to-ensure-uninterrupted-playback" class="internalDFN" id="ref-for-dfn-enough-managed-data-to-ensure-uninterrupted-playback-1">enough managed data to ensure uninterrupted playback</a> and is <a data-link-type="dfn|abstract-op" href="#dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way" class="internalDFN" id="ref-for-dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way-1">able to retrieve and buffer data in an efficient way</a> <dl class="switch"> <dt> If <var>can play uninterrupted and efficiently</var> is not equal to <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-6"><code>streaming</code></a>, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task">queue an element task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#media-element">media element</a> that runs the following steps: </dt> <dd> <ol> <li>Set <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a> <a data-link-type="idl" href="#dom-managedmediasource-streaming" class="internalDFN" id="ref-for-dom-managedmediasource-streaming-7"><code>streaming</code></a> attribute to <var>can play uninterrupted and efficiently</var>. </li> <li>If <var>can play uninterrupted and efficiently</var> is false <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> called <a data-link-type="idl" data-lt="startstreaming" href="#dfn-startstreaming" class="internalDFN" id="ref-for-dfn-startstreaming-1"><code>startstreaming</code></a> at the <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-8"><code>ManagedMediaSource</code></a>. </li> <li>Otherwise, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> called <a data-link-type="idl" data-lt="endstreaming" href="#dfn-endstreaming" class="internalDFN" id="ref-for-dfn-endstreaming-1"><code>endstreaming</code></a> at the <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-9"><code>ManagedMediaSource</code></a>. </li> </ol> </dd> </dl> </li> </ol> </section><section id="memory-cleanup"><div class="header-wrapper"><h4 id="x7-3-2-memory-cleanup"><bdi class="secno">7.3.2 </bdi> <dfn data-dfn-for="ManagedMediaSource" id="dfn-memory-cleanup" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Memory Cleanup</dfn> </h4><a class="self-link" href="#memory-cleanup" aria-label="Permalink for Section 7.3.2"></a></div> <ol> <li> <dl class="switch"> <dt> For each <var data-type="ManagedSourceBuffer">buffer</var> in <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-33"><code>sourceBuffers</code></a>: </dt> <dd> <ol> <li>Run the <var data-type="ManagedSourceBuffer">buffer</var>'s <a data-link-type="dfn|abstract-op" href="#dfn-memory-cleanup-0" class="internalDFN" id="ref-for-dfn-memory-cleanup-0-1">memory cleanup</a> algorithm. </li> </ol> </dd> </dl> </li> </ol> </section></section></section> <section data-dfn-for="BufferedChangeEvent" id="bufferedchangeevent-interface"><div class="header-wrapper"><h2 id="x8-bufferedchangeevent-interface"><bdi class="secno">8. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-bufferedchangeevent" data-idl="interface" data-title="BufferedChangeEvent" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>BufferedChangeEvent</code></dfn> interface </h2><a class="self-link" href="#bufferedchangeevent-interface" aria-label="Permalink for Section 8."></a></div> <pre class="idl def" id="webidl-2057880103"><span class="idlHeader"><a class="self-link" href="#webidl-2057880103">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-bufferedchangeevent" data-title="BufferedChangeEvent">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-bufferedchangeevent" id="ref-for-dom-bufferedchangeevent-2"><code>BufferedChangeEvent</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://dom.spec.whatwg.org/#event">Event</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-bufferedchangeevent-constructor-type-eventinitdict" data-title="constructor" data-dfn-for="BufferedChangeEvent"> <dfn data-export="" data-dfn-type="constructor" id="dom-bufferedchangeevent-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="BufferedChangeEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="BufferedChangeEvent.constructor|BufferedChangeEvent.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-bufferedchangeeventinit" class="internalDFN" id="ref-for-dom-bufferedchangeeventinit-1"><code>BufferedChangeEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" id="idl-def-bufferedchangeevent-addedranges" data-title="addedRanges" data-dfn-for="BufferedChangeEvent"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges">TimeRanges</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-bufferedchangeevent-addedranges" id="ref-for-dom-bufferedchangeevent-addedranges-1"><code>addedRanges</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-bufferedchangeevent-removedranges" data-title="removedRanges" data-dfn-for="BufferedChangeEvent"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges">TimeRanges</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-bufferedchangeevent-removedranges" id="ref-for-dom-bufferedchangeevent-removedranges-1"><code>removedRanges</code></a>;</span> };</span><span data-idl="" class="idlDictionary" id="idl-def-bufferedchangeeventinit" data-title="BufferedChangeEventInit"> dictionary <dfn data-export="" data-dfn-type="dictionary" id="dom-bufferedchangeeventinit" data-idl="dictionary" data-title="BufferedChangeEventInit" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>BufferedChangeEventInit</code></dfn> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://dom.spec.whatwg.org/#dictdef-eventinit">EventInit</a></span> {<span data-idl="" class="idlMember" id="idl-def-bufferedchangeeventinit-addedranges" data-title="addedRanges" data-dfn-for="BufferedChangeEventInit"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges">TimeRanges</a></span> <dfn data-export="" data-dfn-type="dict-member" id="dom-bufferedchangeeventinit-addedranges" data-idl="field" data-title="addedRanges" data-dfn-for="BufferedChangeEventInit" data-type="TimeRanges" class="idlName" tabindex="0" aria-haspopup="dialog"><code>addedRanges</code></dfn>;</span><span data-idl="" class="idlMember" id="idl-def-bufferedchangeeventinit-removedranges" data-title="removedRanges" data-dfn-for="BufferedChangeEventInit"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges">TimeRanges</a></span> <dfn data-export="" data-dfn-type="dict-member" id="dom-bufferedchangeeventinit-removedranges" data-idl="field" data-title="removedRanges" data-dfn-for="BufferedChangeEventInit" data-type="TimeRanges" class="idlName" tabindex="0" aria-haspopup="dialog"><code>removedRanges</code></dfn>;</span> };</span></code></pre> <section id="attributes-2"><div class="header-wrapper"><h3 id="x8-1-attributes"><bdi class="secno">8.1 </bdi> Attributes </h3><a class="self-link" href="#attributes-2" aria-label="Permalink for Section 8.1"></a></div> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-bufferedchangeevent-addedranges" data-idl="attribute" data-title="addedRanges" data-dfn-for="BufferedChangeEvent" data-type="TimeRanges" data-lt="addedRanges" data-local-lt="BufferedChangeEvent.addedRanges" tabindex="0" aria-haspopup="dialog"><code>addedRanges</code></dfn> </dt> <dd> The time ranges added between the last <a data-link-type="idl" data-lt="updatestart" href="#dfn-updatestart" class="internalDFN" id="ref-for-dfn-updatestart-4"><code>updatestart</code></a> and <a data-link-type="idl" data-lt="updateend" href="#dfn-updateend" class="internalDFN" id="ref-for-dfn-updateend-7"><code>updateend</code></a> events (which would have occurred during the last run of the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-processing" class="internalDFN" id="ref-for-dfn-coded-frame-processing-13">coded frame processing</a> algorithm). </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-bufferedchangeevent-removedranges" data-idl="attribute" data-title="removedRanges" data-dfn-for="BufferedChangeEvent" data-type="TimeRanges" data-lt="removedRanges" data-local-lt="BufferedChangeEvent.removedRanges" tabindex="0" aria-haspopup="dialog"><code>removedRanges</code></dfn> </dt> <dd> The time ranges removed between the last <code>updatestart</code> and <code>updateend</code> events (which would have occurred during the last run of the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-5">coded frame removal</a> or <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-eviction" class="internalDFN" id="ref-for-dfn-coded-frame-eviction-2">coded frame eviction</a> algorithm or if the user agent evicted content in response to a <a data-link-type="dfn|abstract-op" href="#dfn-memory-cleanup-0" class="internalDFN" id="ref-for-dfn-memory-cleanup-0-2">memory cleanup</a>). </dd> </dl> </section></section> <section id="managedsourcebuffer-interface"><div class="header-wrapper"><h2 id="x9-managedsourcebuffer-interface"><bdi class="secno">9. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-managedsourcebuffer" data-idl="interface" data-title="ManagedSourceBuffer" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>ManagedSourceBuffer</code></dfn> interface </h2><a class="self-link" href="#managedsourcebuffer-interface" aria-label="Permalink for Section 9."></a></div> <pre class="idl def" id="webidl-1682162223"><span class="idlHeader"><a class="self-link" href="#webidl-1682162223">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-managedsourcebuffer" data-title="ManagedSourceBuffer">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-managedsourcebuffer" id="ref-for-dom-managedsourcebuffer-4"><code>ManagedSourceBuffer</code></a> : <span class="idlSuperclass"><a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-113"><code>SourceBuffer</code></a></span> {<span data-idl="" class="idlAttribute" id="idl-def-managedsourcebuffer-onbufferedchange" data-title="onbufferedchange" data-dfn-for="ManagedSourceBuffer"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-managedsourcebuffer-onbufferedchange" id="ref-for-dom-managedsourcebuffer-onbufferedchange-1"><code>onbufferedchange</code></a>;</span> };</span></code></pre> <section id="attributes-3"><div class="header-wrapper"><h3 id="x9-1-attributes"><bdi class="secno">9.1 </bdi> Attributes </h3><a class="self-link" href="#attributes-3" aria-label="Permalink for Section 9.1"></a></div> <dl class="attributes" data-dfn-for="ManagedSourceBuffer"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-managedsourcebuffer-onbufferedchange" data-idl="attribute" data-title="onbufferedchange" data-dfn-for="ManagedSourceBuffer" data-type="EventHandler" data-lt="onbufferedchange" data-local-lt="ManagedSourceBuffer.onbufferedchange" tabindex="0" aria-haspopup="dialog"><code>onbufferedchange</code></dfn> </dt> <dd> <p> An <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes">event handler IDL attribute</a> whose <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">event handler event type</a> is <a data-link-type="idl" data-lt="bufferedchange" href="#dfn-bufferedchange" class="internalDFN" id="ref-for-dfn-bufferedchange-2"><code>bufferedchange</code></a>. </p> </dd> </dl> </section><section id="event-summary-0"><div class="header-wrapper"><h3 id="x9-2-event-summary"><bdi class="secno">9.2 </bdi> Event Summary </h3><a class="self-link" href="#event-summary-0" aria-label="Permalink for Section 9.2"></a></div> <table class="old-table"> <thead> <tr> <th> Event name </th> <th> Interface </th> <th> Dispatched when... </th> </tr> </thead> <tbody> <tr> <td> <dfn class="event" data-dfn-type="event" id="dfn-bufferedchange" tabindex="0" aria-haspopup="dialog" data-export="">bufferedchange</dfn> </td> <td> <a data-link-type="idl" data-lt="BufferedChangeEvent" href="#dom-bufferedchangeevent" class="internalDFN" id="ref-for-dom-bufferedchangeevent-3"><code>BufferedChangeEvent</code></a> </td> <td> The <a data-link-type="idl" data-lt="ManagedSourceBuffer" href="#dom-managedsourcebuffer" class="internalDFN" id="ref-for-dom-managedsourcebuffer-5"><code>ManagedSourceBuffer</code></a>'s buffered range changed following a call to <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-10"><code>appendBuffer</code></a><code>()</code>, <a data-link-type="idl" data-lt="remove()" href="#dom-sourcebuffer-remove" class="internalDFN" id="ref-for-dom-sourcebuffer-remove-5"><code>remove</code></a><code>()</code>, <a data-link-type="idl" data-lt="endOfStream()" href="#dom-mediasource-endofstream" class="internalDFN" id="ref-for-dom-mediasource-endofstream-5"><code>endOfStream</code></a><code>()</code>, or as a consequence of the user agent running the <a data-link-type="dfn|abstract-op" href="#dfn-memory-cleanup-0" class="internalDFN" id="ref-for-dfn-memory-cleanup-0-3">memory cleanup</a> algorithm. </td> </tr> </tbody> </table> </section><section id="algorithms-0"><div class="header-wrapper"><h3 id="x9-3-algorithms"><bdi class="secno">9.3 </bdi> Algorithms </h3><a class="self-link" href="#algorithms-0" aria-label="Permalink for Section 9.3"></a></div> <section id="buffered-change"><div class="header-wrapper"><h4 id="x9-3-1-buffered-change"><bdi class="secno">9.3.1 </bdi> Buffered Change </h4><a class="self-link" href="#buffered-change" aria-label="Permalink for Section 9.3.1"></a></div> <p> The following steps are run at the completion of all operations to the <a data-link-type="idl" data-lt="ManagedSourceBuffer" href="#dom-managedsourcebuffer" class="internalDFN" id="ref-for-dom-managedsourcebuffer-6"><code>ManagedSourceBuffer</code></a> <var data-type="ManagedSourceBuffer">buffer</var> that would cause a <var data-type="ManagedSourceBuffer">buffer</var>'s <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-5"><code>buffered</code></a> to change. That is once <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-11"><code>appendBuffer</code></a><code>()</code>, <a data-link-type="idl" data-lt="remove()" href="#dom-sourcebuffer-remove" class="internalDFN" id="ref-for-dom-sourcebuffer-remove-6"><code>remove</code></a><code>()</code> or <a data-link-type="dfn|abstract-op" href="#dfn-memory-cleanup-0" class="internalDFN" id="ref-for-dfn-memory-cleanup-0-4">memory cleanup</a> algorithm have completed. </p> <ol> <li>Let <var data-type="normalized TimeRanges">previous buffered ranges</var> equal the <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-6"><code>buffered</code></a> attribute before the changes occurred. </li> <li>Let <var data-type="normalized TimeRanges">new buffered ranges</var> equal the new <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-7"><code>buffered</code></a> <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a>. </li> <li>Let <var data-type="normalized TimeRanges">added</var> equal the <var data-type="normalized TimeRanges">previous buffered ranges</var> subtracted from <var data-type="normalized TimeRanges">new buffered ranges</var>. </li> <li>Let <var data-type="normalized TimeRanges">removed</var> equal the <var data-type="normalized TimeRanges">new buffered ranges</var> subtracted from <var data-type="normalized TimeRanges">previous buffered ranges</var>. </li> <li>Let <var>eventInitDict</var> be a new <a data-link-type="idl" data-lt="BufferedChangeEventInit" href="#dom-bufferedchangeeventinit" class="internalDFN" id="ref-for-dom-bufferedchangeeventinit-2"><code>BufferedChangeEventInit</code></a> dictionary initialized with <var data-type="normalized TimeRanges">added</var> as its <a data-link-type="idl" href="#dom-bufferedchangeeventinit-addedranges" class="internalDFN" id="ref-for-dom-bufferedchangeeventinit-addedranges-1"><code>addedRanges</code></a> and <var data-type="normalized TimeRanges">removed</var> as its <a data-link-type="idl" href="#dom-bufferedchangeeventinit-removedranges" class="internalDFN" id="ref-for-dom-bufferedchangeeventinit-removedranges-1"><code>removedRanges</code></a> </li> <li><a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <a data-link-type="idl" data-lt="bufferedchange" href="#dfn-bufferedchange" class="internalDFN" id="ref-for-dfn-bufferedchange-3"><code>bufferedchange</code></a> at <var data-type="ManagedSourceBuffer">buffer</var> using the <a data-link-type="idl" data-lt="BufferedChangeEvent" href="#dom-bufferedchangeevent" class="internalDFN" id="ref-for-dom-bufferedchangeevent-4"><code>BufferedChangeEvent</code></a> interface, initialized with <var>eventInitDict</var>. </li> </ol> </section><section id="memory-cleanup-0"><div class="header-wrapper"><h4 id="x9-3-2-memory-cleanup"><bdi class="secno">9.3.2 </bdi> <dfn data-dfn-for="ManagedSourceBuffer" id="dfn-memory-cleanup-0" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Memory cleanup</dfn> </h4><a class="self-link" href="#memory-cleanup-0" aria-label="Permalink for Section 9.3.2"></a></div> <ol> <li> <dl class="switch"> <dt> If <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a> is not in <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="idl" data-lt="ManagedMediaSource" href="#dom-managedmediasource" class="internalDFN" id="ref-for-dom-managedmediasource-10"><code>ManagedMediaSource</code></a> parent <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-31"><code>activeSourceBuffers</code></a>: </dt> <dd> <ol> <li>Run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-6">coded frame removal</a> algorithm with start set to 0, end set to positive infinity, and abort these steps. </li> </ol> </dd> </dl> </li> <li>Let <var data-type="normalized TimeRanges">removal ranges</var> equal a list of presentation time ranges that can be evicted from the presentation to ensure uninterrupted playback from <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-currenttime"><code>currentTime</code></a> until such presentation could be retrieved again. <div class="note" role="note" id="issue-container-generatedID-84"><div role="heading" class="note-title marker" id="h-note-84" aria-level="3"><span>Note</span></div><p class=""> Implementations can use different strategies for selecting <var data-type="normalized TimeRanges">removal ranges</var> so web applications shouldn't depend on a specific behavior. The web application would listen to the <a data-link-type="idl" data-lt="bufferedchange" href="#dfn-bufferedchange" class="internalDFN" id="ref-for-dfn-bufferedchange-4"><code>bufferedchange</code></a> event to observe whether portions of the buffered data have been evicted. </p></div> </li> <li>For each range in <var data-type="normalized TimeRanges">removal ranges</var>, run the <a data-link-type="dfn|abstract-op" href="#dfn-coded-frame-removal" class="internalDFN" id="ref-for-dfn-coded-frame-removal-7">coded frame removal</a> algorithm with <var data-type="double">start</var> and <var data-type="unrestricted double">end</var> equal to the removal range start and end timestamp respectively. </li> </ol> </section></section></section> <section id="htmlmediaelement-extensions"><div class="header-wrapper"><h2 id="x10-htmlmediaelement-extensions"><bdi class="secno">10. </bdi> HTMLMediaElement Extensions </h2><a class="self-link" href="#htmlmediaelement-extensions" aria-label="Permalink for Section 10."></a></div> <p> This section specifies what existing <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> and <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attributes on the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a> <em class="rfc2119">MUST</em> return when a <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-103"><code>MediaSource</code></a> is attached to the element, and what the existing <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> attribute <em class="rfc2119">MUST</em> also do when it is set to be a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-29"><code>MediaSourceHandle</code></a> object. </p> <section id="htmlmediaelement-extensions-seekable"><div class="header-wrapper"><h3 id="x10-1-htmlmediaelement-s-seekable"><bdi class="secno">10.1 </bdi> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> </h3><a class="self-link" href="#htmlmediaelement-extensions-seekable" aria-label="Permalink for Section 10.1"></a></div> <p> The <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable"><code>seekable</code></a> attribute returns a new static <a href="https://html.spec.whatwg.org/multipage/media.html#normalised-timeranges-object">normalized TimeRanges object</a> created based on the following steps: </p> <ol> <li>If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-104"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> that is terminated or is closing then return an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object and abort these steps. <div class="note" role="note" id="issue-container-generatedID-85"><div role="heading" class="note-title marker" id="h-note-85" aria-level="4"><span>Note</span></div><p class=""> This case is intended to handle implementations that may no longer maintain any previous information about buffered or seekable media in a MediaSource that was constructed in a DedicatedWorkerGlobalScope that has been terminated by <a data-link-type="idl" data-lt="terminate()" data-type="method" href="https://html.spec.whatwg.org/multipage/workers.html#dom-worker-terminate"><code>terminate</code></a><code>()</code> or user agent execution of <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/workers.html#terminate-a-worker">terminate a worker</a> for the MediaSource's DedicatedWorkerGlobalScope, for instance as the eventual result of <a data-link-type="idl" data-lt="close()" data-type="method" href="https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-close"><code>close</code></a><code>()</code> execution. </p></div> <div class="issue" id="issue-container-number-277"><div role="heading" class="issue-title marker" id="h-issue-2" aria-level="4"><a href="https://github.com/w3c/media-source/issues/277"><span class="issue-number">Issue 277</span></a><span class="issue-label">: MSE-in-Workers: Consider (eventually) transitioning attached element to error upon termination of MediaSource's worker/what should media element do?</span></div><div class=""> <p> Should there be some (eventual) media element error transition in the case of an attached worker MediaSource having its context destroyed? The experimental Chromium implementation of worker MSE just keeps the element readyState, networkState and error the same as prior to that context destruction, though the seekable and buffered attributes each report an empty TimeRange. </p> </div></div> </li> <li>Let <var data-type="unrestricted double">recent duration</var> and <var data-type="normalized TimeRanges">recent live seekable range</var> respectively be the recent values of <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-12"><code>duration</code></a> and <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-6"><code>[[live seekable range]]</code></a>, determined as follows: <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-105"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> </dt> <dd> Set <var data-type="unrestricted double">recent duration</var> to be <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-13"><code>duration</code></a> and set <var>recent live seekable range</var> to be <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-7"><code>[[live seekable range]]</code></a>. </dd> <dt> Otherwise: </dt> <dd> Set <var data-type="unrestricted double">recent duration</var> and <var data-type="normalized TimeRanges">recent live seekable range</var> respectively to be what the <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-14"><code>duration</code></a> and <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-8"><code>[[live seekable range]]</code></a> were recently, updated by handling implicit messages posted by the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-106"><code>MediaSource</code></a> to its <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-10"><code>[[port to main]]</code></a> on every change to <a data-link-type="idl" href="#dom-mediasource-duration" class="internalDFN" id="ref-for-dom-mediasource-duration-15"><code>duration</code></a> or <a data-link-type="attribute" data-lt="[[live seekable range]]" href="#dfn-live-seekable-range" class="internalDFN" id="ref-for-dfn-live-seekable-range-9"><code>[[live seekable range]]</code></a>. </dd> </dl> </li> <li> <dl class="switch"> <dt> If <var data-type="unrestricted double">recent duration</var> equals NaN: </dt> <dd> Return an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object. </dd> <dt> If <var data-type="unrestricted double">recent duration</var> equals positive Infinity: </dt> <dd> <ol> <li>If <var data-type="normalized TimeRanges">recent live seekable range</var> is not empty: <ol> <li>Let <var data-type="normalized TimeRanges">union ranges</var> be the union of <var>recent live seekable range</var> and the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute. </li> <li>Return a single range with a start time equal to the earliest start time in <var data-type="normalized TimeRanges">union ranges</var> and an end time equal to the highest end time in <var>union ranges</var> and abort these steps. </li> </ol> </li> <li>If the <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute returns an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object, then return an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></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 data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute. </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Return a single range with a start time of 0 and an end time equal to <var>recent duration</var>. </dd> </dl> </li> </ol> </section> <section id="htmlmediaelement-extensions-buffered"><div class="header-wrapper"><h3 id="x10-2-htmlmediaelement-s-buffered"><bdi class="secno">10.2 </bdi> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> </h3><a class="self-link" href="#htmlmediaelement-extensions-buffered" aria-label="Permalink for Section 10.2"></a></div> <p id="dom-htmlmediaelement.buffered"> The <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered"><code>buffered</code></a> attribute returns a static <a href="https://html.spec.whatwg.org/multipage/media.html#normalised-timeranges-object">normalized TimeRanges object</a> based on the following steps. </p> <ol> <li>If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-107"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> that is terminated or is closing then return an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object and abort these steps. <div class="note" role="note" id="issue-container-generatedID-86"><div role="heading" class="note-title marker" id="h-note-86" aria-level="4"><span>Note</span></div><p class=""> This case is intended to handle implementations that may no longer maintain any previous information about buffered or seekable media in a MediaSource that was constructed in a DedicatedWorkerGlobalScope that has been terminated by <a data-link-type="idl" data-lt="terminate()" data-type="method" href="https://html.spec.whatwg.org/multipage/workers.html#dom-worker-terminate"><code>terminate</code></a><code>()</code> or user agent execution of <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/workers.html#terminate-a-worker">terminate a worker</a> for the MediaSource's DedicatedWorkerGlobalScope, for instance as the eventual result of <a data-link-type="idl" data-lt="close()" data-type="method" href="https://html.spec.whatwg.org/multipage/workers.html#dom-dedicatedworkerglobalscope-close"><code>close</code></a><code>()</code> execution. </p></div> <div class="issue" id="issue-container-number-277-0"><div role="heading" class="issue-title marker" id="h-issue-3" aria-level="4"><a href="https://github.com/w3c/media-source/issues/277"><span class="issue-number">Issue 277</span></a><span class="issue-label">: MSE-in-Workers: Consider (eventually) transitioning attached element to error upon termination of MediaSource's worker/what should media element do?</span></div><div class=""> <p> Should there be some (eventual) media element error transition in the case of an attached worker MediaSource having its context destroyed? The experimental Chromium implementation of worker MSE just keeps the element readyState, networkState and error the same as prior to that context destruction, though the seekable and buffered attributes each report an empty TimeRange. </p> </div></div> </li> <li>Let <var data-type="normalized TimeRanges">recent intersection ranges</var> be determined as follows: <dl class="switch"> <dt> If the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-108"><code>MediaSource</code></a> was constructed in a <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> </dt> <dd> <ol> <li>Let <var data-type="normalized TimeRanges">recent intersection ranges</var> equal an empty <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object. </li> <li>If <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-32"><code>activeSourceBuffers</code></a>.length does not equal 0 then run the following steps: <ol> <li>Let <var data-type="sequence of normalized TimeRanges">active ranges</var> be the ranges returned by <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-8"><code>buffered</code></a> for each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-114"><code>SourceBuffer</code></a> object in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-33"><code>activeSourceBuffers</code></a>. </li> <li>Let <var data-type="unrestricted double">highest end time</var> be the largest range end time in the <var data-type="sequence of normalized TimeRanges">active ranges</var>. </li> <li>Let <var data-type="normalized TimeRanges">recent intersection ranges</var> equal a <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> object containing a single range from 0 to <var data-type="unrestricted double">highest end time</var>. </li> <li>For each <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-115"><code>SourceBuffer</code></a> object in <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-34"><code>activeSourceBuffers</code></a> run the following steps: <ol> <li>Let <var data-type="normalized TimeRanges">source ranges</var> equal the ranges returned by the <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-9"><code>buffered</code></a> attribute on the current <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-116"><code>SourceBuffer</code></a>. </li> <li>If <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-35"><code>readyState</code></a> is "<a data-link-type="idl" href="#dom-readystate-ended" class="internalDFN" id="ref-for-dom-readystate-ended-14"><code>ended</code></a>", then set the end time on the last range in <var data-type="normalized TimeRanges">source ranges</var> to <var data-type="unrestricted double">highest end time</var>. </li> <li>Let <var data-type="normalized TimeRanges">new intersection ranges</var> equal the intersection between the <var data-type="normalized TimeRanges">recent intersection ranges</var> and the <var>source ranges</var>. </li> <li>Replace the ranges in <var data-type="normalized TimeRanges">recent intersection ranges</var> with the <var>new intersection ranges</var>. </li> </ol> </li> </ol> </li> </ol> </dd> <dt> Otherwise: </dt> <dd> Let <var data-type="normalized TimeRanges">recent intersection ranges</var> be the <a data-link-type="idl" data-lt="TimeRanges" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#timeranges"><code>TimeRanges</code></a> resulting from the steps for the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> case, but run with the <a data-link-type="idl" data-lt="MediaSource" href="#dom-mediasource" class="internalDFN" id="ref-for-dom-mediasource-109"><code>MediaSource</code></a> and its <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-117"><code>SourceBuffer</code></a> objects in their <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> and communicated by using <a data-link-type="attribute" data-lt="[[port to main]]" href="#dfn-port-to-main" class="internalDFN" id="ref-for-dfn-port-to-main-11"><code>[[port to main]]</code></a> implicit messages on every update to the <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-35"><code>activeSourceBuffers</code></a>, <a data-link-type="idl" href="#dom-mediasource-readystate" class="internalDFN" id="ref-for-dom-mediasource-readystate-36"><code>readyState</code></a>, or any of the buffering state that would change any of the values of each of those <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-10"><code>buffered</code></a> attributes of the <a data-link-type="idl" href="#dom-mediasource-activesourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-activesourcebuffers-36"><code>activeSourceBuffers</code></a>. <div class="note" role="note" id="issue-container-generatedID-87"><div role="heading" class="note-title marker" id="h-note-87" aria-level="4"><span>Note</span></div><p class=""> The overhead of recalculating and communicating <var data-type="normalized TimeRanges">recent intersection ranges</var> so frequently is one reason for allowing implementation flexibility to query this information on-demand using other mechanisms such as shared memory and locks as mentioned in <a data-link-type="dfn|abstract-op" href="#dfn-cross-context-communication-model" class="internalDFN" id="ref-for-dfn-cross-context-communication-model-2">cross-context communication model</a>. </p></div> </dd> </dl> </li> <li>If the current value of this attribute has not been set by this algorithm or <var>recent intersection ranges</var> does not contain the exact same range information as the current value of this attribute, then update the current value of this attribute to <var>recent intersection ranges</var>. </li> <li>Return the current value of this attribute. </li> </ol> </section> <section id="htmlmediaelement-extensions-srcobject"><div class="header-wrapper"><h3 id="x10-3-htmlmediaelement-s-srcobject"><bdi class="secno">10.3 </bdi> <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> </h3><a class="self-link" href="#htmlmediaelement-extensions-srcobject" aria-label="Permalink for Section 10.3"></a></div> <p> If a <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> attribute is assigned a <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-30"><code>MediaSourceHandle</code></a>, then set <a data-link-type="attribute" data-lt="[[has ever been assigned as srcobject]]" href="#dfn-has-ever-been-assigned-as-srcobject" class="internalDFN" id="ref-for-dfn-has-ever-been-assigned-as-srcobject-2"><code>[[has ever been assigned as srcobject]]</code></a> for that <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-31"><code>MediaSourceHandle</code></a> to true as part of the synchronous steps of the extended <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s <a data-link-type="idl" data-type="attribute" href="https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject"><code>srcObject</code></a> setter that occur before invoking the element's load algorithm. </p> <div class="note" role="note" id="issue-container-generatedID-88"><div role="heading" class="note-title marker" id="h-note-88" aria-level="4"><span>Note</span></div><p class=""> This prevents transferring that <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-32"><code>MediaSourceHandle</code></a> object ever again, enabling clear synchronous exception if that is attempted. </p></div> <div class="issue" id="issue-container-generatedID-89"><div role="heading" class="issue-title marker" id="h-issue-4" aria-level="4"><span>Issue</span></div><p class=""> <a data-link-type="idl" data-lt="MediaSourceHandle" href="#dom-mediasourcehandle" class="internalDFN" id="ref-for-dom-mediasourcehandle-33"><code>MediaSourceHandle</code></a> needs to be added to <a data-link-type="idl" data-lt="HTMLMediaElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement"><code>HTMLMediaElement</code></a>'s MediaProvider IDL typedef and related text involving media provider objects. </p></div> </section> </section> <section id="audio-track-extensions"><div class="header-wrapper"><h2 id="x11-audiotrack-extensions"><bdi class="secno">11. </bdi> <code>AudioTrack</code> extensions </h2><a class="self-link" href="#audio-track-extensions" aria-label="Permalink for Section 11."></a></div> <p> This section specifies extensions to the [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> definition. </p> <div> <pre class="idl def" id="webidl-935490083"><span class="idlHeader"><a class="self-link" href="#webidl-935490083">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-audiotrack-partial-1" data-title="AudioTrack">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="AudioTrack" class="idlID" data-dfn-for="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack">AudioTrack</a> {<span data-idl="" class="idlAttribute" id="idl-def-audiotrack-sourcebuffer" data-title="sourceBuffer" data-dfn-for="AudioTrack"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-118"><code>SourceBuffer</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-audiotrack-sourcebuffer" id="ref-for-dom-audiotrack-sourcebuffer-2"><code>sourceBuffer</code></a>;</span> };</span></code></pre> <div class="issue" id="issue-container-number-280-0"><div role="heading" class="issue-title marker" id="h-issue-5" aria-level="3"><a href="https://github.com/w3c/media-source/issues/280"><span class="issue-number">Issue 280</span></a><span class="issue-label">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></div><div class=""> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a> needs Window+DedicatedWorker exposure. </div></div> <section> <div class="header-wrapper"><h3 id="attributes-4"> Attributes </h3><a class="self-link" href="#attributes-4" aria-label="Permalink for this Section"></a></div> <dl class="attributes" data-dfn-for="AudioTrack"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-audiotrack-sourcebuffer" data-idl="attribute" data-title="sourceBuffer" data-dfn-for="AudioTrack" data-type="SourceBuffer" data-lt="sourceBuffer" data-local-lt="AudioTrack.sourceBuffer" tabindex="0" aria-haspopup="dialog"><code>sourceBuffer</code></dfn> of type <span class="idlAttrType"><a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-119"><code>SourceBuffer</code></a></span>, readonly , nullable </dt> <dd> <p> On getting, run the following step: </p> <dl class="switch"> <dt> If this track was created by a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-120"><code>SourceBuffer</code></a> that was created on the same <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-global-object-realm">realm</a> as this track, and if that <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-121"><code>SourceBuffer</code></a> has not been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-34"><code>sourceBuffers</code></a> attribute of its <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-33">parent media source</a>: </dt> <dd> Return the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-122"><code>SourceBuffer</code></a> that created this track. </dd> <dt> Otherwise: </dt> <dd> Return null. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-90"><div role="heading" class="note-title marker" id="h-note-89" aria-level="4"><span>Note</span></div><div class=""> For example, if a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-123"><code>SourceBuffer</code></a> notified its internal <code>create track mirror</code> handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> to create this track, then the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> copy of the track would return null for this attribute. </div></div> </dd> </dl> </section> </div> </section> <section id="video-track-extensions"><div class="header-wrapper"><h2 id="x12-videotrack-extensions"><bdi class="secno">12. </bdi> <code>VideoTrack</code> extensions </h2><a class="self-link" href="#video-track-extensions" aria-label="Permalink for Section 12."></a></div> <p> This section specifies extensions to the [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> definition. </p> <div> <pre class="idl def" id="webidl-251527976"><span class="idlHeader"><a class="self-link" href="#webidl-251527976">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-videotrack-partial-1" data-title="VideoTrack">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="VideoTrack" class="idlID" data-dfn-for="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack">VideoTrack</a> {<span data-idl="" class="idlAttribute" id="idl-def-videotrack-sourcebuffer" data-title="sourceBuffer" data-dfn-for="VideoTrack"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-124"><code>SourceBuffer</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-videotrack-sourcebuffer" id="ref-for-dom-videotrack-sourcebuffer-2"><code>sourceBuffer</code></a>;</span> };</span></code></pre> <div class="issue" id="issue-container-number-280-1"><div role="heading" class="issue-title marker" id="h-issue-6" aria-level="3"><a href="https://github.com/w3c/media-source/issues/280"><span class="issue-number">Issue 280</span></a><span class="issue-label">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></div><div class=""> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a> needs Window+DedicatedWorker exposure. </div></div> <section> <div class="header-wrapper"><h3 id="attributes-5"> Attributes </h3><a class="self-link" href="#attributes-5" aria-label="Permalink for this Section"></a></div> <dl class="attributes" data-dfn-for="VideoTrack"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-videotrack-sourcebuffer" data-idl="attribute" data-title="sourceBuffer" data-dfn-for="VideoTrack" data-type="SourceBuffer" data-lt="sourceBuffer" data-local-lt="VideoTrack.sourceBuffer" tabindex="0" aria-haspopup="dialog"><code>sourceBuffer</code></dfn> of type <span class="idlAttrType"><a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-125"><code>SourceBuffer</code></a></span>, readonly , nullable </dt> <dd> <p> On getting, run the following step: </p> <dl class="switch"> <dt> If this track was created by a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-126"><code>SourceBuffer</code></a> that was created on the same <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-global-object-realm">realm</a> as this track, and if that <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-127"><code>SourceBuffer</code></a> has not been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-35"><code>sourceBuffers</code></a> attribute of its <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-34">parent media source</a>: </dt> <dd> Return the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-128"><code>SourceBuffer</code></a> that created this track. </dd> <dt> Otherwise: </dt> <dd> Return null. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-91"><div role="heading" class="note-title marker" id="h-note-90" aria-level="4"><span>Note</span></div><div class=""> For example, if a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-129"><code>SourceBuffer</code></a> notified its internal <code>create track mirror</code> handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> to create this track, then the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> copy of the track would return null for this attribute. </div></div> </dd> </dl> </section> </div> </section> <section id="text-track-extensions"><div class="header-wrapper"><h2 id="x13-texttrack-extensions"><bdi class="secno">13. </bdi> <code>TextTrack</code> extensions </h2><a class="self-link" href="#text-track-extensions" aria-label="Permalink for Section 13."></a></div> <p> This section specifies extensions to the [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> definition. </p> <div> <pre class="idl def" id="webidl-959897060"><span class="idlHeader"><a class="self-link" href="#webidl-959897060">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-texttrack-partial-1" data-title="TextTrack">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,DedicatedWorker)</span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="TextTrack" class="idlID" data-dfn-for="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack">TextTrack</a> {<span data-idl="" class="idlAttribute" id="idl-def-texttrack-sourcebuffer" data-title="sourceBuffer" data-dfn-for="TextTrack"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-130"><code>SourceBuffer</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-texttrack-sourcebuffer" id="ref-for-dom-texttrack-sourcebuffer-2"><code>sourceBuffer</code></a>;</span> };</span></code></pre> <div class="issue" id="issue-container-number-280-2"><div role="heading" class="issue-title marker" id="h-issue-7" aria-level="3"><a href="https://github.com/w3c/media-source/issues/280"><span class="issue-number">Issue 280</span></a><span class="issue-label">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></div><div class=""> [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>] <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> needs Window+DedicatedWorker exposure. </div></div> <section> <div class="header-wrapper"><h3 id="attributes-6"> Attributes </h3><a class="self-link" href="#attributes-6" aria-label="Permalink for this Section"></a></div> <dl class="attributes" data-dfn-for="TextTrack"> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-texttrack-sourcebuffer" data-idl="attribute" data-title="sourceBuffer" data-dfn-for="TextTrack" data-type="SourceBuffer" data-lt="sourceBuffer" data-local-lt="TextTrack.sourceBuffer" tabindex="0" aria-haspopup="dialog"><code>sourceBuffer</code></dfn> of type <span class="idlAttrType"><a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-131"><code>SourceBuffer</code></a></span>, readonly , nullable </dt> <dd> <p> On getting, run the following step: </p> <dl class="switch"> <dt> If this track was created by a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-132"><code>SourceBuffer</code></a> that was created on the same <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-global-object-realm">realm</a> as this track, and if that <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-133"><code>SourceBuffer</code></a> has not been removed from the <a data-link-type="idl" href="#dom-mediasource-sourcebuffers" class="internalDFN" id="ref-for-dom-mediasource-sourcebuffers-36"><code>sourceBuffers</code></a> attribute of its <a data-link-type="dfn|abstract-op" href="#parent-media-source" class="internalDFN" id="ref-for-parent-media-source-35">parent media source</a>: </dt> <dd> Return the <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-134"><code>SourceBuffer</code></a> that created this track. </dd> <dt> Otherwise: </dt> <dd> Return null. </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-92"><div role="heading" class="note-title marker" id="h-note-91" aria-level="4"><span>Note</span></div><div class=""> For example, if a <a data-link-type="idl" data-lt="DedicatedWorkerGlobalScope" data-type="interface" href="https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope"><code>DedicatedWorkerGlobalScope</code></a> <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-135"><code>SourceBuffer</code></a> notified its internal <code>create track mirror</code> handler in <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> to create this track, then the <a data-link-type="idl" data-lt="Window" data-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"><code>Window</code></a> copy of the track would return null for this attribute. </div></div> </dd> </dl> </section> </div> </section> <section id="byte-stream-formats"><div class="header-wrapper"><h2 id="x14-byte-stream-formats"><bdi class="secno">14. </bdi> <dfn data-export="" id="dfn-byte-stream-formats" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Byte Stream Formats</dfn> </h2><a class="self-link" href="#byte-stream-formats" aria-label="Permalink for Section 14."></a></div> <p> The bytes provided through <a data-link-type="idl" data-lt="appendBuffer()" href="#dom-sourcebuffer-appendbuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-appendbuffer-12"><code>appendBuffer</code></a><code>()</code> for a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-136"><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" data-plurals="byte stream format specification" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">byte stream format specifications</dfn>. The byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format Registry">MSE-REGISTRY</a></cite>] provides mappings between a MIME type that may be passed to <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-12"><code>addSourceBuffer</code></a><code>()</code>, <a data-link-type="idl" data-lt="isTypeSupported()" href="#dom-mediasource-istypesupported" class="internalDFN" id="ref-for-dom-mediasource-istypesupported-4"><code>isTypeSupported</code></a><code>()</code> or <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-17"><code>changeType</code></a><code>()</code> and the byte stream format expected by a <a data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-137"><code>SourceBuffer</code></a> using that MIME type for parsing newly appended data. Implementations are encouraged to register mappings for byte stream formats they support to facilitate interoperability. The byte stream format registry [<cite><a class="bibref" data-link-type="biblio" href="#bib-mse-registry" title="Media Source Extensions™ Byte Stream Format 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 data-link-type="idl" data-lt="SourceBuffer" href="#dom-sourcebuffer" class="internalDFN" id="ref-for-dom-sourcebuffer-138"><code>SourceBuffer</code></a> implementation <em class="rfc2119">MUST</em> conform to the <a data-link-type="dfn|abstract-op" href="#byte-stream-format-specs" class="internalDFN" id="ref-for-byte-stream-format-specs-7">byte stream format specification</a> listed in the registry entry. </p> <div class="note" role="note" id="issue-container-generatedID-93"><div role="heading" class="note-title marker" id="h-note-92" aria-level="3"><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" role="note" id="issue-container-generatedID-94"><div role="heading" class="note-title marker" id="h-note-93" aria-level="3"><span>Note</span></div><p class=""> Byte stream format parsing and validation is implemented in the <a data-link-type="dfn|abstract-op" href="#dfn-segment-parser-loop" class="internalDFN" id="ref-for-dfn-segment-parser-loop-5">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 <em class="rfc2119">MUST</em> define <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-33">initialization segments</a> and <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-15">media segments</a>. </li> <li>A byte stream format <em class="rfc2119">SHOULD</em> provide references for sourcing <a data-link-type="idl" data-lt="AudioTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#audiotrack"><code>AudioTrack</code></a>, <a data-link-type="idl" data-lt="VideoTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#videotrack"><code>VideoTrack</code></a>, and <a data-link-type="idl" data-lt="TextTrack" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#texttrack"><code>TextTrack</code></a> attribute values from data in <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-34">initialization segments</a>. <div class="note" role="note" id="issue-container-generatedID-95"><div role="heading" class="note-title marker" id="h-note-94" aria-level="3"><span>Note</span></div><p class=""> If the byte stream format covers a format similar to one covered in the in-band tracks spec [<cite><a class="bibref" data-link-type="biblio" href="#bib-inbandtracks" title="Sourcing In-band Media Resource Tracks from Media Containers into HTML">INBANDTRACKS</a></cite>], then it <em class="rfc2119">SHOULD</em> try to use the same attribute mappings so that Media Source Extensions playback and non-Media Source Extensions playback provide the same track information. </p></div> </li> <li>It <em class="rfc2119">MUST</em> be possible to identify segment boundaries and segment type (initialization or media) by examining the byte stream alone. </li> <li>The user agent <em class="rfc2119">MUST</em> run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-8">append error</a> algorithm when any of the following conditions are met: <ol> <li> <p> The number and type of tracks are not consistent. </p> <div class="note" role="note" id="issue-container-generatedID-96"><div role="heading" class="note-title marker" id="h-note-95" aria-level="3"><span>Note</span></div><p class=""> For example, if the first <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-35">initialization segment</a> has 2 audio tracks and 1 video track, then all <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-36">initialization segments</a> that follow it in the byte stream <em class="rfc2119">MUST</em> describe 2 audio tracks and 1 video track. </p></div> </li> <li><a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-9">Track IDs</a> are not the same across <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-37">initialization segments</a>, for segments describing multiple tracks of a single type (e.g., 2 audio tracks). </li> <li> <p> Unsupported codec changes occur across <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-38">initialization segments</a>. </p> <div class="note" role="note" id="issue-container-generatedID-97"><div role="heading" class="note-title marker" id="h-note-96" aria-level="3"><span>Note</span></div><p class=""> See the <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment-received" class="internalDFN" id="ref-for-dfn-initialization-segment-received-2">initialization segment received</a> algorithm, <a data-link-type="idl" data-lt="addSourceBuffer()" href="#dom-mediasource-addsourcebuffer" class="internalDFN" id="ref-for-dom-mediasource-addsourcebuffer-13"><code>addSourceBuffer</code></a><code>()</code> and <a data-link-type="idl" data-lt="changeType()" href="#dom-sourcebuffer-changetype" class="internalDFN" id="ref-for-dom-sourcebuffer-changetype-18"><code>changeType</code></a><code>()</code> for details and examples of codec changes. </p></div> </li> </ol> </li> <li>The user agent <em class="rfc2119">MUST</em> support the following: <ol> <li><a data-link-type="dfn|abstract-op" href="#dfn-track-id" class="internalDFN" id="ref-for-dfn-track-id-10">Track IDs</a> changing across <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-39">initialization segments</a> if the segments describe only one track of each type. </li> <li> <p> Video frame size changes. The user agent <em class="rfc2119">MUST</em> support seamless playback. </p> <div class="note" role="note" id="issue-container-generatedID-98"><div role="heading" class="note-title marker" id="h-note-97" aria-level="3"><span>Note</span></div><p class=""> This will cause the &lt;video&gt; 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 <em class="rfc2119">MAY</em> support this seamlessly and could trigger downmixing. </p> <div class="note" role="note" id="issue-container-generatedID-99"><div role="heading" class="note-title marker" id="h-note-98" aria-level="3"><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 data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-16">media segments</a> within a byte stream. A user agent <em class="rfc2119">MUST</em>: <ol> <li>Map all timestamps to the same <a href="https://html.spec.whatwg.org/multipage/media.html#media-timeline">media timeline</a>. </li> <li>Support seamless playback of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-17">media segments</a> having a timestamp gap smaller than the audio frame size. User agents <em class="rfc2119">MUST NOT</em> reflect these gaps in the <a data-link-type="idl" href="#dom-sourcebuffer-buffered" class="internalDFN" id="ref-for-dom-sourcebuffer-buffered-11"><code>buffered</code></a> attribute. <div class="note" role="note" id="issue-container-generatedID-100"><div role="heading" class="note-title marker" id="h-note-99" aria-level="3"><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 <em class="rfc2119">MUST</em> run the <a data-link-type="dfn|abstract-op" href="#dfn-append-error" class="internalDFN" id="ref-for-dfn-append-error-9">append error</a> algorithm when any combination of an <a data-link-type="dfn|abstract-op" href="#dfn-initialization-segment" class="internalDFN" id="ref-for-dfn-initialization-segment-40">initialization segment</a> and any contiguous sequence of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-18">media segments</a> satisfies the following conditions: <ol> <li>The number and type (audio, video, text, etc.) of all tracks in the <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-19">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 data-link-type="dfn|abstract-op" href="#random-access-point" class="internalDFN" id="ref-for-random-access-point-11">random access point</a> in the sequence of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-20">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="https://html.spec.whatwg.org/multipage/media.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 data-link-type="dfn|abstract-op" href="#presentation-timestamp" class="internalDFN" id="ref-for-presentation-timestamp-42">presentation timestamp</a> of every sample in the sequence of <a data-link-type="dfn|abstract-op" href="#dfn-media-segment" class="internalDFN" id="ref-for-dfn-media-segment-21">media segments</a> is not provided. </li> </ol> <p> For example, if I1 is associated with M1, M2, M3 then the above <em class="rfc2119">MUST</em> hold for all the combinations I1+M1, I1+M2, I1+M1+M2, I1+M2+M3, etc. </p> </li> </ul> <p> Byte stream specifications <em class="rfc2119">MUST</em> at a minimum define constraints which ensure that the above requirements hold. Additional constraints <em class="rfc2119">MAY</em> be defined, for example to simplify implementation. </p> </section> <section id="conformance"><div class="header-wrapper"><h2 id="x15-conformance"><bdi class="secno">15. </bdi>Conformance</h2><a class="self-link" href="#conformance" aria-label="Permalink for Section 15."></a></div><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p><p> The key words <em class="rfc2119">MAY</em>, <em class="rfc2119">MUST</em>, <em class="rfc2119">MUST NOT</em>, <em class="rfc2119">SHOULD</em>, and <em class="rfc2119">SHOULD NOT</em> in this document are to be interpreted as described in <a href="https://datatracker.ietf.org/doc/html/bcp14">BCP 14</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">RFC2119</a></cite>] [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8174" title="Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words">RFC8174</a></cite>] when, and only when, they appear in all capitals, as shown here. </p></section> <section id="examples"><div class="header-wrapper"><h2 id="x16-examples"><bdi class="secno">16. </bdi> Examples </h2><a class="self-link" href="#examples" aria-label="Permalink for Section 16."></a></div> <section id="using-media-source-extensions"><div class="header-wrapper"><h3 id="x16-1-using-media-source-extensions"><bdi class="secno">16.1 </bdi> Using Media Source Extensions </h3><a class="self-link" href="#using-media-source-extensions" aria-label="Permalink for Section 16.1"></a></div> <div class="example" id="example-1"> <div class="marker"> <a class="self-link" href="#example-1">Example<bdi> 1</bdi></a> </div> <pre aria-busy="false"><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">video</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"v"</span> <span class="hljs-attr">autoplay</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">video</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"> <span class="hljs-keyword">const</span> video = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"v"</span>); <span class="hljs-keyword">const</span> mediaSource = <span class="hljs-keyword">new</span> MediaSource(); mediaSource.addEventListener(<span class="hljs-string">"sourceopen"</span>, onSourceOpen); video.src = <span class="hljs-built_in">window</span>.URL.createObjectURL(mediaSource); <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">onSourceOpen</span>(<span class="hljs-params">e</span>) </span>{ <span class="hljs-keyword">const</span> mediaSource = e.target; <span class="hljs-keyword">if</span> (mediaSource.sourceBuffers.length &gt; <span class="hljs-number">0</span>) <span class="hljs-keyword">return</span>; <span class="hljs-keyword">const</span> sourceBuffer = mediaSource.addSourceBuffer( <span class="hljs-string">'video/webm; codecs="vorbis,vp8"'</span>, ); video.addEventListener(<span class="hljs-string">"seeking"</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> onSeeking(mediaSource, e.target)); video.addEventListener(<span class="hljs-string">"progress"</span>, <span class="hljs-function">() =&gt;</span> appendNextMediaSegment(mediaSource), ); <span class="hljs-keyword">try</span> { <span class="hljs-keyword">const</span> initSegment = <span class="hljs-keyword">await</span> getInitializationSegment(); <span class="hljs-keyword">if</span> (initSegment == <span class="hljs-literal">null</span>) { <span class="hljs-comment">// Error fetching the initialization segment. Signal end of stream with an error.</span> mediaSource.endOfStream(<span class="hljs-string">"network"</span>); <span class="hljs-keyword">return</span>; } <span class="hljs-comment">// Append the initialization segment.</span> sourceBuffer.addEventListener(<span class="hljs-string">"updateend"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">firstAppendHandler</span>(<span class="hljs-params"></span>) </span>{ sourceBuffer.removeEventListener(<span class="hljs-string">"updateend"</span>, firstAppendHandler); <span class="hljs-comment">// Append some initial media data.</span> appendNextMediaSegment(mediaSource); }); sourceBuffer.appendBuffer(initSegment); } <span class="hljs-keyword">catch</span> (error) { <span class="hljs-comment">// Handle errors that might occur during initialization segment fetching.</span> <span class="hljs-built_in">console</span>.error(<span class="hljs-string">"Error fetching initialization segment:"</span>, error); mediaSource.endOfStream(<span class="hljs-string">"network"</span>); } } <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">appendNextMediaSegment</span>(<span class="hljs-params">mediaSource</span>) </span>{ <span class="hljs-keyword">if</span> ( mediaSource.readyState === <span class="hljs-string">"closed"</span> || mediaSource.sourceBuffers[<span class="hljs-number">0</span>].updating ) <span class="hljs-keyword">return</span>; <span class="hljs-comment">// If we have run out of stream data, then signal end of stream.</span> <span class="hljs-keyword">if</span> (!haveMoreMediaSegments()) { mediaSource.endOfStream(); <span class="hljs-keyword">return</span>; } <span class="hljs-keyword">try</span> { <span class="hljs-keyword">const</span> mediaSegment = <span class="hljs-keyword">await</span> getNextMediaSegment(); <span class="hljs-comment">// <span class="hljs-doctag">NOTE:</span> If mediaSource.readyState == "ended", this appendBuffer() call will</span> <span class="hljs-comment">// cause mediaSource.readyState to transition to "open". The web application</span> <span class="hljs-comment">// should be prepared to handle multiple "sourceopen" events.</span> mediaSource.sourceBuffers[<span class="hljs-number">0</span>].appendBuffer(mediaSegment); } <span class="hljs-keyword">catch</span> (error) { <span class="hljs-comment">// Handle errors that might occur during media segment fetching.</span> <span class="hljs-built_in">console</span>.error(<span class="hljs-string">"Error fetching media segment:"</span>, error); mediaSource.endOfStream(<span class="hljs-string">"network"</span>); } } <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">onSeeking</span>(<span class="hljs-params">mediaSource, video</span>) </span>{ <span class="hljs-keyword">if</span> (mediaSource.readyState === <span class="hljs-string">"open"</span>) { <span class="hljs-comment">// Abort current segment append.</span> mediaSource.sourceBuffers[<span class="hljs-number">0</span>].abort(); } <span class="hljs-comment">// Notify the media segment loading code to start fetching data at the</span> <span class="hljs-comment">// new playback position.</span> seekToMediaSegmentAt(video.currentTime); <span class="hljs-comment">// Append a media segment from the new playback position.</span> appendNextMediaSegment(mediaSource); } <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">onProgress</span>(<span class="hljs-params">mediaSource, e</span>) </span>{ appendNextMediaSegment(mediaSource); } <span class="hljs-comment">// Example of async function for getting initialization segment</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInitializationSegment</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-comment">// Implement fetching of the initialization segment</span> <span class="hljs-comment">// This is just a placeholder function</span> } <span class="hljs-comment">// Example function for checking if there are more media segments</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">haveMoreMediaSegments</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-comment">// Implement logic to determine if there are more media segments</span> <span class="hljs-comment">// This is just a placeholder function</span> } <span class="hljs-comment">// Example function for getting the next media segment</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getNextMediaSegment</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-comment">// Implement fetching of the next media segment</span> <span class="hljs-comment">// This is just a placeholder function</span> } <span class="hljs-comment">// Example function for seeking to a specific media segment</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">seekToMediaSegmentAt</span>(<span class="hljs-params">currentTime</span>) </span>{ <span class="hljs-comment">// Implement seeking logic</span> <span class="hljs-comment">// This is just a placeholder function</span> } </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre> </div> </section><section id="using-a-managed-media-source"><div class="header-wrapper"><h3 id="x16-2-using-a-managed-media-source"><bdi class="secno">16.2 </bdi> Using a Managed Media Source </h3><a class="self-link" href="#using-a-managed-media-source" aria-label="Permalink for Section 16.2"></a></div> <div class="example" id="example-2"> <div class="marker"> <a class="self-link" href="#example-2">Example<bdi> 2</bdi></a> </div> <pre aria-busy="false"><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">setUpVideoStream</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-comment">// Specific video format and codec</span> <span class="hljs-keyword">const</span> mediaType = <span class="hljs-string">'video/mp4; codecs="mp4a.40.2,avc1.4d4015"'</span>; <span class="hljs-comment">// Check if the type of video format / codec is supported.</span> <span class="hljs-keyword">if</span> (!<span class="hljs-built_in">window</span>.ManagedMediaSource?.isTypeSupported(mediaType)) { <span class="hljs-keyword">return</span>; <span class="hljs-comment">// Not supported, do something else.</span> } <span class="hljs-comment">// Set up video and its managed source.</span> <span class="hljs-keyword">const</span> video = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">"video"</span>); <span class="hljs-keyword">const</span> source = <span class="hljs-keyword">new</span> ManagedMediaSource(); video.controls = <span class="hljs-literal">true</span>; <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> { video.src = URL.createObjectURL(source); source.addEventListener(<span class="hljs-string">"sourceopen"</span>, resolve, { <span class="hljs-attr">once</span>: <span class="hljs-literal">true</span> }); <span class="hljs-built_in">document</span>.body.appendChild(video); }); <span class="hljs-keyword">const</span> sourceBuffer = source.addSourceBuffer(mediaType); <span class="hljs-comment">// Set up the event handlers</span> sourceBuffer.onbufferedchange = <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> { <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"onbufferedchange event fired."</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Added Ranges: <span class="hljs-subst">${timeRangesToString(e.addedRanges)}</span>`</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Removed Ranges: <span class="hljs-subst">${timeRangesToString(e.removedRanges)}</span>`</span>); }; source.onstartstreaming = <span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">"./videos/bipbop.mp4"</span>); <span class="hljs-keyword">const</span> buffer = <span class="hljs-keyword">await</span> response.arrayBuffer(); <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> { sourceBuffer.addEventListener(<span class="hljs-string">"updateend"</span>, resolve, { <span class="hljs-attr">once</span>: <span class="hljs-literal">true</span> }); sourceBuffer.appendBuffer(buffer); }); }; source.onendstreaming = <span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-comment">// Stop fetching new segments here</span> }; } <span class="hljs-comment">// Helper function...</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">timeRangesToString</span>(<span class="hljs-params">timeRanges</span>) </span>{ <span class="hljs-keyword">const</span> ranges = []; <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; timeRanges.length; i++) { ranges.push([timeRanges.start(i), timeRanges.end(i)]); } <span class="hljs-keyword">return</span> <span class="hljs-string">"["</span> + ranges.map(<span class="hljs-function">(<span class="hljs-params">[start, end]</span>) =&gt;</span> <span class="hljs-string">`[<span class="hljs-subst">${start}</span>, <span class="hljs-subst">${end}</span>)`</span> ) + <span class="hljs-string">"]"</span>; } </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">body</span> <span class="hljs-attr">onload</span>=<span class="hljs-string">"setUpVideoStream()"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span></code></pre> </div> </section></section> <section id="acknowledgements"><div class="header-wrapper"><h2 id="x17-acknowledgments"><bdi class="secno">17. </bdi> Acknowledgments </h2><a class="self-link" href="#acknowledgements" aria-label="Permalink for Section 17."></a></div> <p> The editors would like to thank Alex Giladi, Bob Lund, Chris Needham, Chris Poole, Chris Wilson, Cyril Concolato, Dale Curtis, David Dorwin, David Singer, Duncan Rowden, François Daoust, Frank Galligan, Glenn Adams, Jer Noble, Joe Steele, John Simmons, Kagami Sascha Rosylight, Kevin Streeter, Marcos Cáceres, Mark Vickers, Matt Ward, Matthew Gregan, Michael(tm) Smith, Michael Thornburgh, Mounir Lamouri, Paul Adenot, Philip Jägenstedt, Philippe Le Hegaret, Pierre Lemieux, Ralph Giles, Steven Robertson, and Tatsuya Igarashi for their contributions to this specification. </p> </section> <section id="VideoPlaybackQuality" class="appendix informative"><div class="header-wrapper"><h2 id="a-videoplaybackquality"><bdi class="secno">A. </bdi> VideoPlaybackQuality </h2><a class="self-link" href="#VideoPlaybackQuality" aria-label="Permalink for Appendix A."></a></div><p><em>This section is non-normative.</em></p> <p> The video playback quality metrics described in previous revisions of this specification (e.g., sections 5 and 10 of the <a href="https://www.w3.org/TR/2016/CR-media-source-20160705/">Candidate Recommendation</a>) are now being developed as part of [<cite><a class="bibref" data-link-type="biblio" href="#bib-media-playback-quality" title="Media Playback Quality">MEDIA-PLAYBACK-QUALITY</a></cite>]. Some implementations may have implemented the earlier draft <code>VideoPlaybackQuality</code> object and the <a data-link-type="idl" data-lt="HTMLVideoElement" data-type="interface" href="https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement"><code>HTMLVideoElement</code></a> extension method <a data-link-type="idl" data-lt="getVideoPlaybackQuality()" data-type="method" href="https://w3c.github.io/media-playback-quality/#dom-htmlvideoelement-getvideoplaybackquality"><code>getVideoPlaybackQuality</code></a><code>()</code> described in those previous revisions. </p> </section> <section class="appendix" id="issue-summary"><div class="header-wrapper"><h2 id="b-issue-summary"><bdi class="secno">B. </bdi>Issue summary</h2><a class="self-link" href="#issue-summary" aria-label="Permalink for Appendix B."></a></div> <ul><li><a href="#issue-container-number-276">Issue 276</a><span style="text-transform: none">: MSE-in-Workers: Consider adding a "closing" readyState to explain new `InvalidStateError` exception when closing underway</span></li><li><a href="#issue-container-number-280">Issue 280</a><span style="text-transform: none">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></li><li><a href="#issue-container-number-289">Issue 289</a><span style="text-transform: none">: Editorial? Coded Frame eviction algorithm needs to note that "buffer full flag" may be updated immediately based on |new data|</span></li><li><a href="#issue-container-number-277">Issue 277</a><span style="text-transform: none">: MSE-in-Workers: Consider (eventually) transitioning attached element to error upon termination of MediaSource's worker/what should media element do?</span></li><li><a href="#issue-container-number-277-0">Issue 277</a><span style="text-transform: none">: MSE-in-Workers: Consider (eventually) transitioning attached element to error upon termination of MediaSource's worker/what should media element do?</span></li><li><a href="#issue-container-generatedID-89">Issue</a></li><li><a href="#issue-container-number-280-0">Issue 280</a><span style="text-transform: none">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></li><li><a href="#issue-container-number-280-1">Issue 280</a><span style="text-transform: none">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></li><li><a href="#issue-container-number-280-2">Issue 280</a><span style="text-transform: none">: MSE-in-Workers: {Audio,Video,Text}Track{,List} IDL in HTML need additional DedicatedWorker in Exposed</span></li></ul></section> <section id="references" class="appendix"><div class="header-wrapper"><h2 id="c-references"><bdi class="secno">C. </bdi>References</h2><a class="self-link" href="#references" aria-label="Permalink for Appendix C."></a></div><section id="normative-references"><div class="header-wrapper"><h3 id="c-1-normative-references"><bdi class="secno">C.1 </bdi>Normative references</h3><a class="self-link" href="#normative-references" aria-label="Permalink for Appendix C.1"></a></div> <dl class="bibliography"><dt id="bib-dom">[dom]</dt><dd> <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> </dd><dt id="bib-ecmascript">[ECMASCRIPT]</dt><dd> <a href="https://tc39.es/ecma262/multipage/"><cite>ECMAScript Language Specification</cite></a>. Ecma International. URL: <a href="https://tc39.es/ecma262/multipage/">https://tc39.es/ecma262/multipage/</a> </dd><dt id="bib-fileapi">[FILEAPI]</dt><dd> <a href="https://www.w3.org/TR/FileAPI/"><cite>File API</cite></a>. Marijn Kruisselbrink. W3C. 24 May 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/FileAPI/">https://www.w3.org/TR/FileAPI/</a> </dd><dt id="bib-html">[HTML]</dt><dd> <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> </dd><dt id="bib-infra">[infra]</dt><dd> <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> </dd><dt id="bib-mse-registry">[MSE-REGISTRY]</dt><dd> <a href="https://w3c.github.io/mse-byte-stream-format-registry/"><cite>Media Source Extensions™ Byte Stream Format Registry</cite></a>. Matthew Wolenetz; Jerry Smith; Aaron Colwell. W3C. URL: <a href="https://w3c.github.io/mse-byte-stream-format-registry/">https://w3c.github.io/mse-byte-stream-format-registry/</a> </dd><dt id="bib-rfc2119">[RFC2119]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. S. Bradner. IETF. March 1997. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc2119">https://www.rfc-editor.org/rfc/rfc2119</a> </dd><dt id="bib-rfc8174">[RFC8174]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8174"><cite>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</cite></a>. B. Leiba. IETF. May 2017. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc8174">https://www.rfc-editor.org/rfc/rfc8174</a> </dd><dt id="bib-webidl">[WEBIDL]</dt><dd> <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dd></dl> </section><section id="informative-references"><div class="header-wrapper"><h3 id="c-2-informative-references"><bdi class="secno">C.2 </bdi>Informative references</h3><a class="self-link" href="#informative-references" aria-label="Permalink for Appendix C.2"></a></div> <dl class="bibliography"><dt id="bib-inbandtracks">[INBANDTRACKS]</dt><dd> <a href="https://dev.w3.org/html5/html-sourcing-inband-tracks/"><cite>Sourcing In-band Media Resource Tracks from Media Containers into HTML</cite></a>. Silvia Pfeiffer; Bob Lund. W3C. 26 April 2015. Unofficial Draft. URL: <a href="https://dev.w3.org/html5/html-sourcing-inband-tracks/">https://dev.w3.org/html5/html-sourcing-inband-tracks/</a> </dd><dt id="bib-media-playback-quality">[MEDIA-PLAYBACK-QUALITY]</dt><dd> <a href="https://w3c.github.io/media-playback-quality/"><cite>Media Playback Quality</cite></a>. Mounir Lamouri. W3C. W3C Editor's Draft. URL: <a href="https://w3c.github.io/media-playback-quality/">https://w3c.github.io/media-playback-quality/</a> </dd><dt id="bib-url">[url]</dt><dd> <a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a> </dd></dl> </section></section><p role="navigation" id="back-to-top"> <a href="#title"><abbr title="Back to Top">↑</abbr></a> </p><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-active-track-buffers" aria-label="Links in this document to definition: Active Track Buffers"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-active-track-buffers" aria-label="Permalink for definition: Active Track Buffers. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-active-track-buffers-1" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-append-window" aria-label="Links in this document to definition: Append Window"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-append-window" aria-label="Permalink for definition: Append Window. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-append-window-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dfn-append-window-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame" aria-label="Links in this document to definition: Coded Frame"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame" aria-label="Permalink for definition: Coded Frame. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-coded-frame-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-3" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-4" title="Reference 4">(4)</a> <a href="#ref-for-dfn-coded-frame-5" title="Reference 5">(5)</a> <a href="#ref-for-dfn-coded-frame-6" title="Reference 6">(6)</a> <a href="#ref-for-dfn-coded-frame-7" title="Reference 7">(7)</a> <a href="#ref-for-dfn-coded-frame-8" title="Reference 8">(8)</a> <a href="#ref-for-dfn-coded-frame-9" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-dfn-coded-frame-10" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dfn-coded-frame-11" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-dfn-coded-frame-12" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dfn-coded-frame-13" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-dfn-coded-frame-14" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-15" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-16" title="Reference 4">(4)</a> <a href="#ref-for-dfn-coded-frame-17" title="Reference 5">(5)</a> <a href="#ref-for-dfn-coded-frame-18" title="Reference 6">(6)</a> <a href="#ref-for-dfn-coded-frame-19" title="Reference 7">(7)</a> <a href="#ref-for-dfn-coded-frame-20" title="Reference 8">(8)</a> <a href="#ref-for-dfn-coded-frame-21" title="Reference 9">(9)</a> <a href="#ref-for-dfn-coded-frame-22" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dfn-coded-frame-23" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-coded-frame-24" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-25" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-26" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> <a href="#ref-for-dfn-coded-frame-27" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-coded-frame-28" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-coded-frame-29" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-30" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-31" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dfn-coded-frame-32" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-33" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-34" title="Reference 4">(4)</a> <a href="#ref-for-dfn-coded-frame-35" title="Reference 5">(5)</a> <a href="#ref-for-dfn-coded-frame-36" title="Reference 6">(6)</a> <a href="#ref-for-dfn-coded-frame-37" title="Reference 7">(7)</a> <a href="#ref-for-dfn-coded-frame-38" title="Reference 8">(8)</a> <a href="#ref-for-dfn-coded-frame-39" title="Reference 9">(9)</a> <a href="#ref-for-dfn-coded-frame-40" title="Reference 10">(10)</a> <a href="#ref-for-dfn-coded-frame-41" title="Reference 11">(11)</a> <a href="#ref-for-dfn-coded-frame-42" title="Reference 12">(12)</a> <a href="#ref-for-dfn-coded-frame-43" title="Reference 13">(13)</a> <a href="#ref-for-dfn-coded-frame-44" title="Reference 14">(14)</a> <a href="#ref-for-dfn-coded-frame-45" title="Reference 15">(15)</a> <a href="#ref-for-dfn-coded-frame-46" title="Reference 16">(16)</a> <a href="#ref-for-dfn-coded-frame-47" title="Reference 17">(17)</a> </li><li> <a href="#ref-for-dfn-coded-frame-48" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-dfn-coded-frame-49" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-50" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-51" title="Reference 4">(4)</a> <a href="#ref-for-dfn-coded-frame-52" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-coded-frame-53" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> <a href="#ref-for-dfn-coded-frame-54" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-55" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-56" title="§ 5.5.12 Audio Splice Rendering">§ 5.5.12 Audio Splice Rendering</a> <a href="#ref-for-dfn-coded-frame-57" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-coded-frame-58" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> <a href="#ref-for-dfn-coded-frame-59" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-60" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-duration" aria-label="Links in this document to definition: Coded Frame Duration"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-duration" aria-label="Permalink for definition: Coded Frame Duration. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-duration-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-coded-frame-duration-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-duration-3" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-duration-4" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-coded-frame-duration-5" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-coded-frame-duration-6" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-dfn-coded-frame-duration-7" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> <a href="#ref-for-dfn-coded-frame-duration-8" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-duration-9" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-duration-10" title="§ 5.5.12 Audio Splice Rendering">§ 5.5.12 Audio Splice Rendering</a> </li><li> <a href="#ref-for-dfn-coded-frame-duration-11" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> <a href="#ref-for-dfn-coded-frame-duration-12" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-end-timestamp" aria-label="Links in this document to definition: Coded Frame End Timestamp"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-end-timestamp" aria-label="Permalink for definition: Coded Frame End Timestamp. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-end-timestamp-1" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-coded-frame-end-timestamp-2" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-coded-frame-end-timestamp-3" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-group" aria-label="Links in this document to definition: Coded Frame Group"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-group" aria-label="Permalink for definition: Coded Frame Group. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-group-1" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-dfn-coded-frame-group-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-group-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-group-4" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-coded-frame-group-5" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-decode-timestamp" aria-label="Links in this document to definition: Decode Timestamp"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-decode-timestamp" aria-label="Permalink for definition: Decode Timestamp. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-decode-timestamp-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-decode-timestamp-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-decode-timestamp-3" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li><li> <a href="#ref-for-dfn-decode-timestamp-4" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> <a href="#ref-for-dfn-decode-timestamp-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-decode-timestamp-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-decode-timestamp-7" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-initialization-segment" aria-label="Links in this document to definition: Initialization Segment"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-initialization-segment" aria-label="Permalink for definition: Initialization Segment. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-initialization-segment-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-initialization-segment-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-initialization-segment-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-initialization-segment-4" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dfn-initialization-segment-5" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-initialization-segment-6" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-initialization-segment-7" title="Reference 2">(2)</a> <a href="#ref-for-dfn-initialization-segment-8" title="Reference 3">(3)</a> <a href="#ref-for-dfn-initialization-segment-9" title="Reference 4">(4)</a> <a href="#ref-for-dfn-initialization-segment-10" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-initialization-segment-11" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-initialization-segment-12" title="Reference 2">(2)</a> <a href="#ref-for-dfn-initialization-segment-13" title="Reference 3">(3)</a> <a href="#ref-for-dfn-initialization-segment-14" title="Reference 4">(4)</a> <a href="#ref-for-dfn-initialization-segment-15" title="Reference 5">(5)</a> <a href="#ref-for-dfn-initialization-segment-16" title="Reference 6">(6)</a> <a href="#ref-for-dfn-initialization-segment-17" title="Reference 7">(7)</a> <a href="#ref-for-dfn-initialization-segment-18" title="Reference 8">(8)</a> <a href="#ref-for-dfn-initialization-segment-19" title="Reference 9">(9)</a> <a href="#ref-for-dfn-initialization-segment-20" title="Reference 10">(10)</a> <a href="#ref-for-dfn-initialization-segment-21" title="Reference 11">(11)</a> <a href="#ref-for-dfn-initialization-segment-22" title="Reference 12">(12)</a> <a href="#ref-for-dfn-initialization-segment-23" title="Reference 13">(13)</a> <a href="#ref-for-dfn-initialization-segment-24" title="Reference 14">(14)</a> <a href="#ref-for-dfn-initialization-segment-25" title="Reference 15">(15)</a> <a href="#ref-for-dfn-initialization-segment-26" title="Reference 16">(16)</a> <a href="#ref-for-dfn-initialization-segment-27" title="Reference 17">(17)</a> <a href="#ref-for-dfn-initialization-segment-28" title="Reference 18">(18)</a> <a href="#ref-for-dfn-initialization-segment-29" title="Reference 19">(19)</a> <a href="#ref-for-dfn-initialization-segment-30" title="Reference 20">(20)</a> <a href="#ref-for-dfn-initialization-segment-31" title="Reference 21">(21)</a> <a href="#ref-for-dfn-initialization-segment-32" title="Reference 22">(22)</a> </li><li> <a href="#ref-for-dfn-initialization-segment-33" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dfn-initialization-segment-34" title="Reference 2">(2)</a> <a href="#ref-for-dfn-initialization-segment-35" title="Reference 3">(3)</a> <a href="#ref-for-dfn-initialization-segment-36" title="Reference 4">(4)</a> <a href="#ref-for-dfn-initialization-segment-37" title="Reference 5">(5)</a> <a href="#ref-for-dfn-initialization-segment-38" title="Reference 6">(6)</a> <a href="#ref-for-dfn-initialization-segment-39" title="Reference 7">(7)</a> <a href="#ref-for-dfn-initialization-segment-40" title="Reference 8">(8)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-media-segment" aria-label="Links in this document to definition: Media Segment"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-media-segment" aria-label="Permalink for definition: Media Segment. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-media-segment-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-media-segment-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-media-segment-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-media-segment-4" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dfn-media-segment-5" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dfn-media-segment-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-media-segment-7" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-media-segment-8" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-media-segment-9" title="Reference 2">(2)</a> <a href="#ref-for-dfn-media-segment-10" title="Reference 3">(3)</a> <a href="#ref-for-dfn-media-segment-11" title="Reference 4">(4)</a> <a href="#ref-for-dfn-media-segment-12" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-media-segment-13" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dfn-media-segment-14" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-media-segment-15" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dfn-media-segment-16" title="Reference 2">(2)</a> <a href="#ref-for-dfn-media-segment-17" title="Reference 3">(3)</a> <a href="#ref-for-dfn-media-segment-18" title="Reference 4">(4)</a> <a href="#ref-for-dfn-media-segment-19" title="Reference 5">(5)</a> <a href="#ref-for-dfn-media-segment-20" title="Reference 6">(6)</a> <a href="#ref-for-dfn-media-segment-21" title="Reference 7">(7)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-mediasource-object-url" aria-label="Links in this document to definition: MediaSource object URL"> <span class="caret"></span> <div> <a class="self-link" href="#mediasource-object-url" aria-label="Permalink for definition: MediaSource object URL. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-mediasource-object-url-1" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-mediasource-object-url-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-mediasource-object-url-3" title="Reference 2">(2)</a> <a href="#ref-for-mediasource-object-url-4" title="Reference 3">(3)</a> <a href="#ref-for-mediasource-object-url-5" title="Reference 4">(4)</a> <a href="#ref-for-mediasource-object-url-6" title="Reference 5">(5)</a> <a href="#ref-for-mediasource-object-url-7" title="Reference 6">(6)</a> <a href="#ref-for-mediasource-object-url-8" title="Reference 7">(7)</a> <a href="#ref-for-mediasource-object-url-9" title="Reference 8">(8)</a> <a href="#ref-for-mediasource-object-url-10" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-mediasource-object-url-11" title="§ 4.1 Transfer">§ 4.1 Transfer</a> <a href="#ref-for-mediasource-object-url-12" title="Reference 2">(2)</a> <a href="#ref-for-mediasource-object-url-13" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-parent-media-source" aria-label="Links in this document to definition: Parent Media Source"> <span class="caret"></span> <div> <a class="self-link" href="#parent-media-source" aria-label="Permalink for definition: Parent Media Source. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-parent-media-source-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-parent-media-source-2" title="Reference 2">(2)</a> <a href="#ref-for-parent-media-source-3" title="Reference 3">(3)</a> <a href="#ref-for-parent-media-source-4" title="Reference 4">(4)</a> <a href="#ref-for-parent-media-source-5" title="Reference 5">(5)</a> <a href="#ref-for-parent-media-source-6" title="Reference 6">(6)</a> <a href="#ref-for-parent-media-source-7" title="Reference 7">(7)</a> <a href="#ref-for-parent-media-source-8" title="Reference 8">(8)</a> <a href="#ref-for-parent-media-source-9" title="Reference 9">(9)</a> <a href="#ref-for-parent-media-source-10" title="Reference 10">(10)</a> <a href="#ref-for-parent-media-source-11" title="Reference 11">(11)</a> </li><li> <a href="#ref-for-parent-media-source-12" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-parent-media-source-13" title="Reference 2">(2)</a> <a href="#ref-for-parent-media-source-14" title="Reference 3">(3)</a> <a href="#ref-for-parent-media-source-15" title="Reference 4">(4)</a> <a href="#ref-for-parent-media-source-16" title="Reference 5">(5)</a> <a href="#ref-for-parent-media-source-17" title="Reference 6">(6)</a> <a href="#ref-for-parent-media-source-18" title="Reference 7">(7)</a> <a href="#ref-for-parent-media-source-19" title="Reference 8">(8)</a> <a href="#ref-for-parent-media-source-20" title="Reference 9">(9)</a> <a href="#ref-for-parent-media-source-21" title="Reference 10">(10)</a> <a href="#ref-for-parent-media-source-22" title="Reference 11">(11)</a> </li><li> <a href="#ref-for-parent-media-source-23" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> <a href="#ref-for-parent-media-source-24" title="Reference 2">(2)</a> <a href="#ref-for-parent-media-source-25" title="Reference 3">(3)</a> <a href="#ref-for-parent-media-source-26" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-parent-media-source-27" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-parent-media-source-28" title="Reference 2">(2)</a> <a href="#ref-for-parent-media-source-29" title="Reference 3">(3)</a> <a href="#ref-for-parent-media-source-30" title="Reference 4">(4)</a> <a href="#ref-for-parent-media-source-31" title="Reference 5">(5)</a> <a href="#ref-for-parent-media-source-32" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-parent-media-source-33" title="§ Attributes">§ Attributes</a> <a href="#ref-for-parent-media-source-34" title="Reference 2">(2)</a> <a href="#ref-for-parent-media-source-35" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-presentation-start-time" aria-label="Links in this document to definition: Presentation Start Time"> <span class="caret"></span> <div> <a class="self-link" href="#presentation-start-time" aria-label="Permalink for definition: Presentation Start Time. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-presentation-start-time-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-presentation-start-time-2" title="Reference 2">(2)</a> <a href="#ref-for-presentation-start-time-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-presentation-start-time-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-presentation-start-time-5" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-presentation-start-time-6" title="Reference 2">(2)</a> <a href="#ref-for-presentation-start-time-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-presentation-start-time-8" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> <a href="#ref-for-presentation-start-time-9" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-presentation-interval" aria-label="Links in this document to definition: Presentation Interval"> <span class="caret"></span> <div> <a class="self-link" href="#presentation-interval" aria-label="Permalink for definition: Presentation Interval. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-presentation-interval-1" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-presentation-interval-2" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> </li><li> <a href="#ref-for-presentation-interval-3" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-presentation-order" aria-label="Links in this document to definition: Presentation Order"> <span class="caret"></span> <div> <a class="self-link" href="#presentation-order" aria-label="Permalink for definition: Presentation Order. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-presentation-order-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-presentation-order-2" title="Reference 2">(2)</a> <a href="#ref-for-presentation-order-3" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-presentation-timestamp" aria-label="Links in this document to definition: Presentation Timestamp"> <span class="caret"></span> <div> <a class="self-link" href="#presentation-timestamp" aria-label="Permalink for definition: Presentation Timestamp. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-presentation-timestamp-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-presentation-timestamp-2" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-3" title="Reference 3">(3)</a> <a href="#ref-for-presentation-timestamp-4" title="Reference 4">(4)</a> <a href="#ref-for-presentation-timestamp-5" title="Reference 5">(5)</a> <a href="#ref-for-presentation-timestamp-6" title="Reference 6">(6)</a> <a href="#ref-for-presentation-timestamp-7" title="Reference 7">(7)</a> <a href="#ref-for-presentation-timestamp-8" title="Reference 8">(8)</a> <a href="#ref-for-presentation-timestamp-9" title="Reference 9">(9)</a> <a href="#ref-for-presentation-timestamp-10" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-presentation-timestamp-11" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-presentation-timestamp-12" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-presentation-timestamp-13" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-presentation-timestamp-14" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-presentation-timestamp-15" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-presentation-timestamp-16" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> <a href="#ref-for-presentation-timestamp-17" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-presentation-timestamp-18" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-presentation-timestamp-19" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-20" title="Reference 3">(3)</a> <a href="#ref-for-presentation-timestamp-21" title="Reference 4">(4)</a> <a href="#ref-for-presentation-timestamp-22" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-presentation-timestamp-23" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-presentation-timestamp-24" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-25" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-presentation-timestamp-26" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> <a href="#ref-for-presentation-timestamp-27" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-28" title="Reference 3">(3)</a> <a href="#ref-for-presentation-timestamp-29" title="Reference 4">(4)</a> <a href="#ref-for-presentation-timestamp-30" title="Reference 5">(5)</a> <a href="#ref-for-presentation-timestamp-31" title="Reference 6">(6)</a> <a href="#ref-for-presentation-timestamp-32" title="Reference 7">(7)</a> <a href="#ref-for-presentation-timestamp-33" title="Reference 8">(8)</a> <a href="#ref-for-presentation-timestamp-34" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-presentation-timestamp-35" title="§ 5.5.12 Audio Splice Rendering">§ 5.5.12 Audio Splice Rendering</a> <a href="#ref-for-presentation-timestamp-36" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-37" title="Reference 3">(3)</a> <a href="#ref-for-presentation-timestamp-38" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-presentation-timestamp-39" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> <a href="#ref-for-presentation-timestamp-40" title="Reference 2">(2)</a> <a href="#ref-for-presentation-timestamp-41" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-presentation-timestamp-42" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-random-access-point" aria-label="Links in this document to definition: Random Access Point"> <span class="caret"></span> <div> <a class="self-link" href="#random-access-point" aria-label="Permalink for definition: Random Access Point. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-random-access-point-1" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-random-access-point-2" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-random-access-point-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-random-access-point-4" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-random-access-point-5" title="Reference 2">(2)</a> <a href="#ref-for-random-access-point-6" title="Reference 3">(3)</a> <a href="#ref-for-random-access-point-7" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-random-access-point-8" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-random-access-point-9" title="Reference 2">(2)</a> <a href="#ref-for-random-access-point-10" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-random-access-point-11" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourcebuffer-byte-stream-format-specification" aria-label="Links in this document to definition: SourceBuffer byte stream format specification"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourcebuffer-byte-stream-format-specification" aria-label="Permalink for definition: SourceBuffer byte stream format specification. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourcebuffer-byte-stream-format-specification-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourcebuffer-configuration" aria-label="Links in this document to definition: SourceBuffer configuration"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourcebuffer-configuration" aria-label="Permalink for definition: SourceBuffer configuration. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourcebuffer-configuration-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-track-description" aria-label="Links in this document to definition: Track Description"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-track-description" aria-label="Permalink for definition: Track Description. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-track-description-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dfn-track-description-2" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-track-description-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-track-description-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-track-description-5" title="Reference 3">(3)</a> <a href="#ref-for-dfn-track-description-6" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-track-id" aria-label="Links in this document to definition: Track ID"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-track-id" aria-label="Permalink for definition: Track ID. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-track-id-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-track-id-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-track-id-3" title="Reference 3">(3)</a> <a href="#ref-for-dfn-track-id-4" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-track-id-5" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-track-id-6" title="Reference 2">(2)</a> <a href="#ref-for-dfn-track-id-7" title="Reference 3">(3)</a> <a href="#ref-for-dfn-track-id-8" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-track-id-9" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dfn-track-id-10" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource" aria-label="Links in this document to definition: MediaSource"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource" aria-label="Permalink for definition: MediaSource. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-1" title="§ Status of This Document">§ Status of This Document</a> </li><li> <a href="#ref-for-dom-mediasource-2" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dom-mediasource-3" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-4" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-5" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-6" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-7" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-mediasource-8" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-9" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-10" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-11" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-12" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-13" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasource-14" title="Reference 7">(7)</a> <a href="#ref-for-dom-mediasource-15" title="Reference 8">(8)</a> <a href="#ref-for-dom-mediasource-16" title="Reference 9">(9)</a> <a href="#ref-for-dom-mediasource-17" title="Reference 10">(10)</a> <a href="#ref-for-dom-mediasource-18" title="Reference 11">(11)</a> </li><li> <a href="#ref-for-dom-mediasource-19" title="§ 3.1 handle attribute">§ 3.1 handle attribute</a> <a href="#ref-for-dom-mediasource-20" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-21" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-22" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-23" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-24" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-mediasource-25" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> <a href="#ref-for-dom-mediasource-26" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-27" title="§ 3.4 readyState attribute">§ 3.4 readyState attribute</a> <a href="#ref-for-dom-mediasource-28" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-29" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-mediasource-30" title="§ 3.6 canConstructInDedicatedWorker attribute">§ 3.6 canConstructInDedicatedWorker attribute</a> <a href="#ref-for-dom-mediasource-31" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-32" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dom-mediasource-33" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-34" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-35" title="§ 3.12 isTypeSupported() method">§ 3.12 isTypeSupported() method</a> <a href="#ref-for-dom-mediasource-36" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-37" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-38" title="§ 3.13 Event Summary">§ 3.13 Event Summary</a> <a href="#ref-for-dom-mediasource-39" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-40" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-41" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> <a href="#ref-for-dom-mediasource-42" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-43" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-44" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-45" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-46" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasource-47" title="Reference 7">(7)</a> <a href="#ref-for-dom-mediasource-48" title="Reference 8">(8)</a> <a href="#ref-for-dom-mediasource-49" title="Reference 9">(9)</a> <a href="#ref-for-dom-mediasource-50" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dom-mediasource-51" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dom-mediasource-52" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-53" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-54" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-55" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-56" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasource-57" title="Reference 7">(7)</a> <a href="#ref-for-dom-mediasource-58" title="Reference 8">(8)</a> <a href="#ref-for-dom-mediasource-59" title="Reference 9">(9)</a> <a href="#ref-for-dom-mediasource-60" title="Reference 10">(10)</a> <a href="#ref-for-dom-mediasource-61" title="Reference 11">(11)</a> <a href="#ref-for-dom-mediasource-62" title="Reference 12">(12)</a> <a href="#ref-for-dom-mediasource-63" title="Reference 13">(13)</a> <a href="#ref-for-dom-mediasource-64" title="Reference 14">(14)</a> <a href="#ref-for-dom-mediasource-65" title="Reference 15">(15)</a> <a href="#ref-for-dom-mediasource-66" title="Reference 16">(16)</a> <a href="#ref-for-dom-mediasource-67" title="Reference 17">(17)</a> <a href="#ref-for-dom-mediasource-68" title="Reference 18">(18)</a> <a href="#ref-for-dom-mediasource-69" title="Reference 19">(19)</a> <a href="#ref-for-dom-mediasource-70" title="Reference 20">(20)</a> <a href="#ref-for-dom-mediasource-71" title="Reference 21">(21)</a> <a href="#ref-for-dom-mediasource-72" title="Reference 22">(22)</a> <a href="#ref-for-dom-mediasource-73" title="Reference 23">(23)</a> <a href="#ref-for-dom-mediasource-74" title="Reference 24">(24)</a> <a href="#ref-for-dom-mediasource-75" title="Reference 25">(25)</a> <a href="#ref-for-dom-mediasource-76" title="Reference 26">(26)</a> <a href="#ref-for-dom-mediasource-77" title="Reference 27">(27)</a> <a href="#ref-for-dom-mediasource-78" title="Reference 28">(28)</a> </li><li> <a href="#ref-for-dom-mediasource-79" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dom-mediasource-80" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-81" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-82" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-83" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-84" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasource-85" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-dom-mediasource-86" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> </li><li> <a href="#ref-for-dom-mediasource-87" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-mediasource-88" title="§ 3.15.8 Mirror if necessary">§ 3.15.8 Mirror if necessary</a> <a href="#ref-for-dom-mediasource-89" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-90" title="§ 4. MediaSourceHandle interface">§ 4. MediaSourceHandle interface</a> <a href="#ref-for-dom-mediasource-91" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-92" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-93" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-94" title="§ 4.1 Transfer">§ 4.1 Transfer</a> <a href="#ref-for-dom-mediasource-95" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-96" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-97" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-98" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dom-mediasource-99" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> <a href="#ref-for-dom-mediasource-100" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-101" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-102" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> </li><li> <a href="#ref-for-dom-mediasource-103" title="§ 10. HTMLMediaElement Extensions">§ 10. HTMLMediaElement Extensions</a> </li><li> <a href="#ref-for-dom-mediasource-104" title="§ 10.1 HTMLMediaElement's seekable">§ 10.1 HTMLMediaElement's seekable</a> <a href="#ref-for-dom-mediasource-105" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-106" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-107" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> <a href="#ref-for-dom-mediasource-108" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-109" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-live-seekable-range" aria-label="Links in this document to definition: [[live seekable range]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-live-seekable-range" aria-label="Permalink for definition: [[live seekable range]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-live-seekable-range-1" title="§ 3.10 setLiveSeekableRange() method">§ 3.10 setLiveSeekableRange() method</a> <a href="#ref-for-dfn-live-seekable-range-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-live-seekable-range-3" title="§ 3.11 clearLiveSeekableRange() method">§ 3.11 clearLiveSeekableRange() method</a> <a href="#ref-for-dfn-live-seekable-range-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-live-seekable-range-5" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-live-seekable-range-6" title="§ 10.1 HTMLMediaElement's seekable">§ 10.1 HTMLMediaElement's seekable</a> <a href="#ref-for-dfn-live-seekable-range-7" title="Reference 2">(2)</a> <a href="#ref-for-dfn-live-seekable-range-8" title="Reference 3">(3)</a> <a href="#ref-for-dfn-live-seekable-range-9" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-has-ever-been-attached" aria-label="Links in this document to definition: [[has ever been attached]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-has-ever-been-attached" aria-label="Permalink for definition: [[has ever been attached]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-has-ever-been-attached-1" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dfn-has-ever-been-attached-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-readystate" aria-label="Links in this document to definition: ReadyState"> <span class="caret"></span> <div> <a class="self-link" href="#dom-readystate" aria-label="Permalink for definition: ReadyState. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-readystate-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-readystate-2" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> <a href="#ref-for-dom-readystate-3" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-4" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-5" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-readystate-6" title="§ 3.15.4 SourceBuffer Monitoring">§ 3.15.4 SourceBuffer Monitoring</a> <a href="#ref-for-dom-readystate-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-9" title="Reference 4">(4)</a> <a href="#ref-for-dom-readystate-10" title="Reference 5">(5)</a> <a href="#ref-for-dom-readystate-11" title="Reference 6">(6)</a> <a href="#ref-for-dom-readystate-12" title="Reference 7">(7)</a> <a href="#ref-for-dom-readystate-13" title="Reference 8">(8)</a> <a href="#ref-for-dom-readystate-14" title="Reference 9">(9)</a> <a href="#ref-for-dom-readystate-15" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dom-readystate-16" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> <a href="#ref-for-dom-readystate-17" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-18" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-19" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-readystate-20" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-readystate-21" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-22" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-23" title="Reference 4">(4)</a> <a href="#ref-for-dom-readystate-24" title="Reference 5">(5)</a> <a href="#ref-for-dom-readystate-25" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-readystate-26" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-readystate-27" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-28" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-29" title="Reference 4">(4)</a> <a href="#ref-for-dom-readystate-30" title="Reference 5">(5)</a> <a href="#ref-for-dom-readystate-31" title="Reference 6">(6)</a> <a href="#ref-for-dom-readystate-32" title="Reference 7">(7)</a> <a href="#ref-for-dom-readystate-33" title="Reference 8">(8)</a> <a href="#ref-for-dom-readystate-34" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-dom-readystate-35" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-dom-readystate-36" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-37" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-readystate-closed" aria-label="Links in this document to definition: closed"> <span class="caret"></span> <div> <a class="self-link" href="#dom-readystate-closed" aria-label="Permalink for definition: closed. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-26865842">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-readystate-closed-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-readystate-closed-2" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-readystate-closed-3" title="§ 3.4 readyState attribute">§ 3.4 readyState attribute</a> </li><li> <a href="#ref-for-dom-readystate-closed-4" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-readystate-closed-5" title="§ 3.13 Event Summary">§ 3.13 Event Summary</a> <a href="#ref-for-dom-readystate-closed-6" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-closed-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-readystate-closed-8" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> </li><li> <a href="#ref-for-dom-readystate-closed-9" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-readystate-open" aria-label="Links in this document to definition: open"> <span class="caret"></span> <div> <a class="self-link" href="#dom-readystate-open" aria-label="Permalink for definition: open. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-26865842">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-readystate-open-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-readystate-open-2" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-readystate-open-3" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-readystate-open-4" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-readystate-open-5" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dom-readystate-open-6" title="§ 3.10 setLiveSeekableRange() method">§ 3.10 setLiveSeekableRange() method</a> </li><li> <a href="#ref-for-dom-readystate-open-7" title="§ 3.11 clearLiveSeekableRange() method">§ 3.11 clearLiveSeekableRange() method</a> </li><li> <a href="#ref-for-dom-readystate-open-8" title="§ 3.13 Event Summary">§ 3.13 Event Summary</a> <a href="#ref-for-dom-readystate-open-9" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-open-10" title="Reference 3">(3)</a> <a href="#ref-for-dom-readystate-open-11" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-readystate-open-12" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dom-readystate-open-13" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-readystate-open-14" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-readystate-open-15" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-readystate-open-16" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-readystate-open-17" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-open-18" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-readystate-open-19" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-readystate-ended" aria-label="Links in this document to definition: ended"> <span class="caret"></span> <div> <a class="self-link" href="#dom-readystate-ended" aria-label="Permalink for definition: ended. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-26865842">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-readystate-ended-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-readystate-ended-2" title="§ 3.13 Event Summary">§ 3.13 Event Summary</a> <a href="#ref-for-dom-readystate-ended-3" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-ended-4" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-readystate-ended-5" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> <a href="#ref-for-dom-readystate-ended-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-readystate-ended-7" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-readystate-ended-8" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-readystate-ended-9" title="Reference 2">(2)</a> <a href="#ref-for-dom-readystate-ended-10" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-readystate-ended-11" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-readystate-ended-12" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-readystate-ended-13" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dom-readystate-ended-14" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-endofstreamerror" aria-label="Links in this document to definition: EndOfStreamError"> <span class="caret"></span> <div> <a class="self-link" href="#dom-endofstreamerror" aria-label="Permalink for definition: EndOfStreamError. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-endofstreamerror-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-endofstreamerror-network" aria-label="Links in this document to definition: network"> <span class="caret"></span> <div> <a class="self-link" href="#dom-endofstreamerror-network" aria-label="Permalink for definition: network. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1031259774">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-endofstreamerror-network-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-endofstreamerror-network-2" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-endofstreamerror-decode" aria-label="Links in this document to definition: decode"> <span class="caret"></span> <div> <a class="self-link" href="#dom-endofstreamerror-decode" aria-label="Permalink for definition: decode. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1031259774">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-endofstreamerror-decode-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-endofstreamerror-decode-2" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-endofstreamerror-decode-3" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-onsourceopen" aria-label="Links in this document to definition: onsourceopen"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-onsourceopen" aria-label="Permalink for definition: onsourceopen. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-onsourceended" aria-label="Links in this document to definition: onsourceended"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-onsourceended" aria-label="Permalink for definition: onsourceended. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-onsourceclose" aria-label="Links in this document to definition: onsourceclose"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-onsourceclose" aria-label="Permalink for definition: onsourceclose. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-handle" aria-label="Links in this document to definition: handle"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-handle" aria-label="Permalink for definition: handle. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-handle-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-handle-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dom-mediasource-handle-3" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-sourcebuffers" aria-label="Links in this document to definition: sourceBuffers"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-sourcebuffers" aria-label="Permalink for definition: sourceBuffers. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-sourcebuffers-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-sourcebuffers-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-4" title="§ 3.3 activeSourceBuffers attribute">§ 3.3 activeSourceBuffers attribute</a> <a href="#ref-for-dom-mediasource-sourcebuffers-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-6" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-7" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> <a href="#ref-for-dom-mediasource-sourcebuffers-8" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-9" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-10" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-11" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dom-mediasource-sourcebuffers-12" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-13" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-14" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-15" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-16" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dom-mediasource-sourcebuffers-17" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-18" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> <a href="#ref-for-dom-mediasource-sourcebuffers-19" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-20" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-21" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-mediasource-sourcebuffers-22" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-23" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-24" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-25" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-26" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-mediasource-sourcebuffers-27" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-28" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-29" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-30" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-31" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-32" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-33" title="§ 7.3.2 Memory Cleanup">§ 7.3.2 Memory Cleanup</a> </li><li> <a href="#ref-for-dom-mediasource-sourcebuffers-34" title="§ Attributes">§ Attributes</a> <a href="#ref-for-dom-mediasource-sourcebuffers-35" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-sourcebuffers-36" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-activesourcebuffers" aria-label="Links in this document to definition: activeSourceBuffers"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-activesourcebuffers" aria-label="Permalink for definition: activeSourceBuffers. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-activesourcebuffers-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-2" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-3" title="§ 3.3 activeSourceBuffers attribute">§ 3.3 activeSourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-4" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-5" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-6" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-7" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-9" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-10" title="§ 3.15.4 SourceBuffer Monitoring">§ 3.15.4 SourceBuffer Monitoring</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-11" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-12" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-13" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-14" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-15" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-16" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-17" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-18" title="Reference 7">(7)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-19" title="Reference 8">(8)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-20" title="Reference 9">(9)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-21" title="Reference 10">(10)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-22" title="Reference 11">(11)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-23" title="Reference 12">(12)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-24" title="Reference 13">(13)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-25" title="Reference 14">(14)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-26" title="Reference 15">(15)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-27" title="Reference 16">(16)</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-28" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-29" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-30" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-31" title="§ 9.3.2 Memory cleanup">§ 9.3.2 Memory cleanup</a> </li><li> <a href="#ref-for-dom-mediasource-activesourcebuffers-32" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-33" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-34" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-35" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-activesourcebuffers-36" title="Reference 5">(5)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-readystate" aria-label="Links in this document to definition: readyState"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-readystate" aria-label="Permalink for definition: readyState. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-readystate-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-readystate-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-readystate-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-4" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> <a href="#ref-for-dom-mediasource-readystate-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-6" title="§ 3.4 readyState attribute">§ 3.4 readyState attribute</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-7" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> <a href="#ref-for-dom-mediasource-readystate-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-9" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-10" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-11" title="§ 3.10 setLiveSeekableRange() method">§ 3.10 setLiveSeekableRange() method</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-12" title="§ 3.11 clearLiveSeekableRange() method">§ 3.11 clearLiveSeekableRange() method</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-13" title="§ 3.13 Event Summary">§ 3.13 Event Summary</a> <a href="#ref-for-dom-mediasource-readystate-14" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-readystate-15" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-16" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dom-mediasource-readystate-17" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-readystate-18" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-19" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-20" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> <a href="#ref-for-dom-mediasource-readystate-21" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-22" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-23" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-mediasource-readystate-24" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-readystate-25" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-readystate-26" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-readystate-27" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-28" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-mediasource-readystate-29" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-readystate-30" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-readystate-31" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-readystate-32" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-33" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> <a href="#ref-for-dom-mediasource-readystate-34" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-readystate-35" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> <a href="#ref-for-dom-mediasource-readystate-36" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-duration" aria-label="Links in this document to definition: duration"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-duration" aria-label="Permalink for definition: duration. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-duration-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-duration-2" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li><li> <a href="#ref-for-dom-mediasource-duration-3" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> <a href="#ref-for-dom-mediasource-duration-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-duration-5" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-duration-6" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-mediasource-duration-7" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-mediasource-duration-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-duration-9" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li><li> <a href="#ref-for-dom-mediasource-duration-10" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-dom-mediasource-duration-11" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li><li> <a href="#ref-for-dom-mediasource-duration-12" title="§ 10.1 HTMLMediaElement's seekable">§ 10.1 HTMLMediaElement's seekable</a> <a href="#ref-for-dom-mediasource-duration-13" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-duration-14" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-duration-15" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-canconstructindedicatedworker" aria-label="Links in this document to definition: canConstructInDedicatedWorker"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-canconstructindedicatedworker" aria-label="Permalink for definition: canConstructInDedicatedWorker. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-canconstructindedicatedworker-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-addsourcebuffer" aria-label="Links in this document to definition: addSourceBuffer()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-addsourcebuffer" aria-label="Permalink for definition: addSourceBuffer(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-addsourcebuffer-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-2" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-3" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-4" title="§ 3.12 isTypeSupported() method">§ 3.12 isTypeSupported() method</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-5" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-6" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-7" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-mediasource-addsourcebuffer-8" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasource-addsourcebuffer-9" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasource-addsourcebuffer-10" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasource-addsourcebuffer-11" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-mediasource-addsourcebuffer-12" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dom-mediasource-addsourcebuffer-13" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-removesourcebuffer" aria-label="Links in this document to definition: removeSourceBuffer()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-removesourcebuffer" aria-label="Permalink for definition: removeSourceBuffer(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-removesourcebuffer-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-endofstream" aria-label="Links in this document to definition: endOfStream()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-endofstream" aria-label="Permalink for definition: endOfStream(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-endofstream-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-endofstream-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-endofstream-3" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-mediasource-endofstream-4" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-mediasource-endofstream-5" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-setliveseekablerange" aria-label="Links in this document to definition: setLiveSeekableRange()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-setliveseekablerange" aria-label="Permalink for definition: setLiveSeekableRange(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-setliveseekablerange-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-setliveseekablerange-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-clearliveseekablerange" aria-label="Links in this document to definition: clearLiveSeekableRange()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-clearliveseekablerange" aria-label="Permalink for definition: clearLiveSeekableRange(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-clearliveseekablerange-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasource-clearliveseekablerange-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasource-istypesupported" aria-label="Links in this document to definition: isTypeSupported()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasource-istypesupported" aria-label="Permalink for definition: isTypeSupported(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1502719514">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasource-istypesupported-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dom-mediasource-istypesupported-2" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-mediasource-istypesupported-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasource-istypesupported-4" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourceopen" aria-label="Links in this document to definition: sourceopen"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourceopen" aria-label="Permalink for definition: sourceopen. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourceopen-1" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dfn-sourceopen-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-sourceopen-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dfn-sourceopen-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-sourceopen-5" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dfn-sourceopen-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-sourceopen-7" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourceended" aria-label="Links in this document to definition: sourceended"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourceended" aria-label="Permalink for definition: sourceended. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourceended-1" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourceclose" aria-label="Links in this document to definition: sourceclose"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourceclose" aria-label="Permalink for definition: sourceclose. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourceclose-1" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-cross-context-communication-model" aria-label="Links in this document to definition: Cross-context communication model"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-cross-context-communication-model" aria-label="Permalink for definition: Cross-context communication model. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-cross-context-communication-model-1" title="§ 4.1 Transfer">§ 4.1 Transfer</a> </li><li> <a href="#ref-for-dfn-cross-context-communication-model-2" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-port-to-main" aria-label="Links in this document to definition: [[port to main]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-port-to-main" aria-label="Permalink for definition: [[port to main]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-port-to-main-1" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-dfn-port-to-main-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dfn-port-to-main-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-port-to-main-4" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li><li> <a href="#ref-for-dfn-port-to-main-5" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> </li><li> <a href="#ref-for-dfn-port-to-main-6" title="§ 3.15.8 Mirror if necessary">§ 3.15.8 Mirror if necessary</a> </li><li> <a href="#ref-for-dfn-port-to-main-7" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-port-to-main-8" title="Reference 2">(2)</a> <a href="#ref-for-dfn-port-to-main-9" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-port-to-main-10" title="§ 10.1 HTMLMediaElement's seekable">§ 10.1 HTMLMediaElement's seekable</a> </li><li> <a href="#ref-for-dfn-port-to-main-11" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-port-to-worker" aria-label="Links in this document to definition: [[port to worker]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-port-to-worker" aria-label="Permalink for definition: [[port to worker]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-port-to-worker-1" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-dfn-port-to-worker-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dfn-port-to-worker-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-port-to-worker-4" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dfn-port-to-worker-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-port-to-worker-6" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> </li><li> <a href="#ref-for-dfn-port-to-worker-7" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-channel-with-worker" aria-label="Links in this document to definition: [[channel with worker]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-channel-with-worker" aria-label="Permalink for definition: [[channel with worker]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-channel-with-worker-1" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-dfn-channel-with-worker-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dfn-channel-with-worker-3" title="Reference 2">(2)</a> <a href="#ref-for-dfn-channel-with-worker-4" title="Reference 3">(3)</a> <a href="#ref-for-dfn-channel-with-worker-5" title="Reference 4">(4)</a> <a href="#ref-for-dfn-channel-with-worker-6" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-channel-with-worker-7" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-attaching-to-a-media-element" aria-label="Links in this document to definition: Attaching to a media element"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-attaching-to-a-media-element" aria-label="Permalink for definition: Attaching to a media element. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-attaching-to-a-media-element-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> </li><li> <a href="#ref-for-dfn-attaching-to-a-media-element-2" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-dfn-attaching-to-a-media-element-3" title="§ 4. MediaSourceHandle interface">§ 4. MediaSourceHandle interface</a> </li><li> <a href="#ref-for-dfn-attaching-to-a-media-element-4" title="§ 4.1 Transfer">§ 4.1 Transfer</a> <a href="#ref-for-dfn-attaching-to-a-media-element-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-attaching-to-a-media-element-6" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-detaching-from-a-media-element" aria-label="Links in this document to definition: Detaching from a media element"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-detaching-from-a-media-element" aria-label="Permalink for definition: Detaching from a media element. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-seeking" aria-label="Links in this document to definition: Seeking"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-seeking" aria-label="Permalink for definition: Seeking. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourcebuffer-monitoring" aria-label="Links in this document to definition: SourceBuffer Monitoring"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourcebuffer-monitoring" aria-label="Permalink for definition: SourceBuffer Monitoring. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-sourcebuffer-monitoring-1" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> <a href="#ref-for-dfn-sourcebuffer-monitoring-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-enough-data" aria-label="Links in this document to definition: enough data to ensure uninterrupted playback"> <span class="caret"></span> <div> <a class="self-link" href="#enough-data" aria-label="Permalink for definition: enough data to ensure uninterrupted playback. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-enough-data-1" title="§ 3.15.4 SourceBuffer Monitoring">§ 3.15.4 SourceBuffer Monitoring</a> <a href="#ref-for-enough-data-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-enough-data-3" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-changes-to-selected-enabled-track-state" aria-label="Links in this document to definition: Changes to selected/enabled track state"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-changes-to-selected-enabled-track-state" aria-label="Permalink for definition: Changes to selected/enabled track state. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-duration-change" aria-label="Links in this document to definition: Duration change"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-duration-change" aria-label="Permalink for definition: Duration change. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-duration-change-1" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> <a href="#ref-for-dfn-duration-change-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-duration-change-3" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dfn-duration-change-4" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-duration-change-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-duration-change-6" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-end-of-stream" aria-label="Links in this document to definition: End of stream"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-end-of-stream" aria-label="Permalink for definition: End of stream. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-end-of-stream-1" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dfn-end-of-stream-2" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-mirror-if-necessary" aria-label="Links in this document to definition: Mirror if necessary"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-mirror-if-necessary" aria-label="Permalink for definition: Mirror if necessary. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-mirror-if-necessary-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dfn-mirror-if-necessary-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-mirror-if-necessary-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-mirror-if-necessary-4" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-dfn-mirror-if-necessary-5" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> <a href="#ref-for-dfn-mirror-if-necessary-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-mirror-if-necessary-7" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-mirror-if-necessary-8" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-mediasourcehandle" aria-label="Links in this document to definition: MediaSourceHandle"> <span class="caret"></span> <div> <a class="self-link" href="#dom-mediasourcehandle" aria-label="Permalink for definition: MediaSourceHandle. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1737388085">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-mediasourcehandle-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-mediasourcehandle-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-3" title="§ 3.1 handle attribute">§ 3.1 handle attribute</a> <a href="#ref-for-dom-mediasourcehandle-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-5" title="§ 3.14 Cross-context communication model">§ 3.14 Cross-context communication model</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-6" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> <a href="#ref-for-dom-mediasourcehandle-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasourcehandle-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasourcehandle-9" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasourcehandle-10" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasourcehandle-11" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasourcehandle-12" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-13" title="§ 4. MediaSourceHandle interface">§ 4. MediaSourceHandle interface</a> <a href="#ref-for-dom-mediasourcehandle-14" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasourcehandle-15" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasourcehandle-16" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasourcehandle-17" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasourcehandle-18" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-19" title="§ 4.1 Transfer">§ 4.1 Transfer</a> <a href="#ref-for-dom-mediasourcehandle-20" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasourcehandle-21" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasourcehandle-22" title="Reference 4">(4)</a> <a href="#ref-for-dom-mediasourcehandle-23" title="Reference 5">(5)</a> <a href="#ref-for-dom-mediasourcehandle-24" title="Reference 6">(6)</a> <a href="#ref-for-dom-mediasourcehandle-25" title="Reference 7">(7)</a> <a href="#ref-for-dom-mediasourcehandle-26" title="Reference 8">(8)</a> <a href="#ref-for-dom-mediasourcehandle-27" title="Reference 9">(9)</a> <a href="#ref-for-dom-mediasourcehandle-28" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-29" title="§ 10. HTMLMediaElement Extensions">§ 10. HTMLMediaElement Extensions</a> </li><li> <a href="#ref-for-dom-mediasourcehandle-30" title="§ 10.3 HTMLMediaElement's srcObject">§ 10.3 HTMLMediaElement's srcObject</a> <a href="#ref-for-dom-mediasourcehandle-31" title="Reference 2">(2)</a> <a href="#ref-for-dom-mediasourcehandle-32" title="Reference 3">(3)</a> <a href="#ref-for-dom-mediasourcehandle-33" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-has-ever-been-assigned-as-srcobject" aria-label="Links in this document to definition: [[has ever been assigned as srcobject]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-has-ever-been-assigned-as-srcobject" aria-label="Permalink for definition: [[has ever been assigned as srcobject]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-has-ever-been-assigned-as-srcobject-1" title="§ 4.1 Transfer">§ 4.1 Transfer</a> </li><li> <a href="#ref-for-dfn-has-ever-been-assigned-as-srcobject-2" title="§ 10.3 HTMLMediaElement's srcObject">§ 10.3 HTMLMediaElement's srcObject</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-detached" aria-label="Links in this document to definition: [[Detached]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-detached" aria-label="Permalink for definition: [[Detached]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-detached-1" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer" aria-label="Links in this document to definition: SourceBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer" aria-label="Permalink for definition: SourceBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-1" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dom-sourcebuffer-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-4" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dom-sourcebuffer-5" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-6" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-7" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-8" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-9" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-10" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-sourcebuffer-11" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-12" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-13" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-14" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-15" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-16" title="§ 3.2 sourceBuffers attribute">§ 3.2 sourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-sourcebuffer-17" title="§ 3.3 activeSourceBuffers attribute">§ 3.3 activeSourceBuffers attribute</a> </li><li> <a href="#ref-for-dom-sourcebuffer-18" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-sourcebuffer-19" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> <a href="#ref-for-dom-sourcebuffer-20" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-21" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-22" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-23" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-24" title="§ 3.12 isTypeSupported() method">§ 3.12 isTypeSupported() method</a> <a href="#ref-for-dom-sourcebuffer-25" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-26" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-27" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dom-sourcebuffer-28" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-29" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dom-sourcebuffer-30" title="§ 3.15.4 SourceBuffer Monitoring">§ 3.15.4 SourceBuffer Monitoring</a> </li><li> <a href="#ref-for-dom-sourcebuffer-31" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> <a href="#ref-for-dom-sourcebuffer-32" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-33" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-34" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-35" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-36" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-37" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-38" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-39" title="Reference 9">(9)</a> <a href="#ref-for-dom-sourcebuffer-40" title="Reference 10">(10)</a> <a href="#ref-for-dom-sourcebuffer-41" title="Reference 11">(11)</a> <a href="#ref-for-dom-sourcebuffer-42" title="Reference 12">(12)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-43" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> <a href="#ref-for-dom-sourcebuffer-44" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-45" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-dom-sourcebuffer-46" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-47" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-sourcebuffer-48" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-49" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-50" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-51" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-sourcebuffer-52" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-53" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-54" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-55" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-56" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-57" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-58" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-59" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-60" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-dom-sourcebuffer-61" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-62" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-63" title="§ 5.4 Event Summary">§ 5.4 Event Summary</a> <a href="#ref-for-dom-sourcebuffer-64" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-65" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-66" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-67" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-68" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-69" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dom-sourcebuffer-70" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-71" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-72" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-73" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-74" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-75" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-76" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-77" title="Reference 9">(9)</a> <a href="#ref-for-dom-sourcebuffer-78" title="Reference 10">(10)</a> <a href="#ref-for-dom-sourcebuffer-79" title="Reference 11">(11)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-80" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> <a href="#ref-for-dom-sourcebuffer-81" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-82" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> <a href="#ref-for-dom-sourcebuffer-83" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-84" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> <a href="#ref-for-dom-sourcebuffer-85" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-86" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> <a href="#ref-for-dom-sourcebuffer-87" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-88" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-89" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-sourcebuffer-90" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-91" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-92" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-93" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-94" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-95" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-96" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-97" title="Reference 9">(9)</a> <a href="#ref-for-dom-sourcebuffer-98" title="Reference 10">(10)</a> <a href="#ref-for-dom-sourcebuffer-99" title="Reference 11">(11)</a> <a href="#ref-for-dom-sourcebuffer-100" title="Reference 12">(12)</a> <a href="#ref-for-dom-sourcebuffer-101" title="Reference 13">(13)</a> <a href="#ref-for-dom-sourcebuffer-102" title="Reference 14">(14)</a> <a href="#ref-for-dom-sourcebuffer-103" title="Reference 15">(15)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-104" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li><li> <a href="#ref-for-dom-sourcebuffer-105" title="§ 5.5.10 Coded Frame Eviction">§ 5.5.10 Coded Frame Eviction</a> <a href="#ref-for-dom-sourcebuffer-106" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-107" title="§ 6. SourceBufferList interface">§ 6. SourceBufferList interface</a> <a href="#ref-for-dom-sourcebuffer-108" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-109" title="§ 6.1 Attributes">§ 6.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-110" title="§ 6.2 Methods">§ 6.2 Methods</a> </li><li> <a href="#ref-for-dom-sourcebuffer-111" title="§ 6.3 Event Summary">§ 6.3 Event Summary</a> <a href="#ref-for-dom-sourcebuffer-112" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-113" title="§ 9. ManagedSourceBuffer interface">§ 9. ManagedSourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-114" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> <a href="#ref-for-dom-sourcebuffer-115" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-116" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-117" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-118" title="§ 11. AudioTrack extensions">§ 11. AudioTrack extensions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-119" title="§ Attributes">§ Attributes</a> <a href="#ref-for-dom-sourcebuffer-120" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-121" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-122" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-123" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-125" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-126" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-127" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-128" title="Reference 9">(9)</a> <a href="#ref-for-dom-sourcebuffer-129" title="Reference 10">(10)</a> <a href="#ref-for-dom-sourcebuffer-131" title="Reference 11">(11)</a> <a href="#ref-for-dom-sourcebuffer-132" title="Reference 12">(12)</a> <a href="#ref-for-dom-sourcebuffer-133" title="Reference 13">(13)</a> <a href="#ref-for-dom-sourcebuffer-134" title="Reference 14">(14)</a> <a href="#ref-for-dom-sourcebuffer-135" title="Reference 15">(15)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-124" title="§ 12. VideoTrack extensions">§ 12. VideoTrack extensions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-130" title="§ 13. TextTrack extensions">§ 13. TextTrack extensions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-136" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dom-sourcebuffer-137" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-138" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-appendmode" aria-label="Links in this document to definition: AppendMode"> <span class="caret"></span> <div> <a class="self-link" href="#dom-appendmode" aria-label="Permalink for definition: AppendMode. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-appendmode-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-appendmode-2" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-appendmode-segments" aria-label="Links in this document to definition: segments"> <span class="caret"></span> <div> <a class="self-link" href="#dom-appendmode-segments" aria-label="Permalink for definition: segments. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-955395090">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-appendmode-segments-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-appendmode-segments-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-appendmode-segments-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-appendmode-segments-4" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-dom-appendmode-segments-5" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-appendmode-sequence" aria-label="Links in this document to definition: sequence"> <span class="caret"></span> <div> <a class="self-link" href="#dom-appendmode-sequence" aria-label="Permalink for definition: sequence. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-955395090">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-appendmode-sequence-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> <a href="#ref-for-dom-appendmode-sequence-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-appendmode-sequence-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-6" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-7" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dom-appendmode-sequence-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-9" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-10" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-appendmode-sequence-11" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-appendmode-sequence-12" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-mode" aria-label="Links in this document to definition: mode"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-mode" aria-label="Permalink for definition: mode. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-mode-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> <a href="#ref-for-dom-sourcebuffer-mode-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-3" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-5" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-sourcebuffer-mode-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-7" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-8" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dom-sourcebuffer-mode-9" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-10" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-11" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-sourcebuffer-mode-12" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-mode-13" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-mode-14" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-dom-sourcebuffer-mode-15" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-updating" aria-label="Links in this document to definition: updating"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-updating" aria-label="Permalink for definition: updating. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-updating-1" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-2" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dom-sourcebuffer-updating-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-4" title="§ 3.9 endOfStream() method">§ 3.9 endOfStream() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-5" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-6" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dom-sourcebuffer-updating-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-updating-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-updating-9" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-10" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dom-sourcebuffer-updating-11" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-updating-12" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-updating-13" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-updating-14" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-15" title="§ 5.4 Event Summary">§ 5.4 Event Summary</a> <a href="#ref-for-dom-sourcebuffer-updating-16" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-updating-17" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-updating-18" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-19" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-20" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-21" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> </li><li> <a href="#ref-for-dom-sourcebuffer-updating-22" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> <a href="#ref-for-dom-sourcebuffer-updating-23" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-buffered" aria-label="Links in this document to definition: buffered"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-buffered" aria-label="Permalink for definition: buffered. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-buffered-1" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> <a href="#ref-for-dom-sourcebuffer-buffered-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-buffered-3" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-buffered-4" title="§ 5.5.10 Coded Frame Eviction">§ 5.5.10 Coded Frame Eviction</a> </li><li> <a href="#ref-for-dom-sourcebuffer-buffered-5" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> <a href="#ref-for-dom-sourcebuffer-buffered-6" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-buffered-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-buffered-8" title="§ 10.2 HTMLMediaElement's buffered">§ 10.2 HTMLMediaElement's buffered</a> <a href="#ref-for-dom-sourcebuffer-buffered-9" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-buffered-10" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-buffered-11" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-timestampoffset" aria-label="Links in this document to definition: timestampOffset"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-timestampoffset" aria-label="Permalink for definition: timestampOffset. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-timestampoffset-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-timestampoffset-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-timestampoffset-5" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dom-sourcebuffer-timestampoffset-6" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-9" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-timestampoffset-10" title="Reference 5">(5)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-audiotracks" aria-label="Links in this document to definition: audioTracks"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-audiotracks" aria-label="Permalink for definition: audioTracks. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-audiotracks-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-audiotracks-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-audiotracks-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-sourcebuffer-audiotracks-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-audiotracks-5" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-videotracks" aria-label="Links in this document to definition: videoTracks"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-videotracks" aria-label="Permalink for definition: videoTracks. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-videotracks-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-videotracks-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-videotracks-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-sourcebuffer-videotracks-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-videotracks-5" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-texttracks" aria-label="Links in this document to definition: textTracks"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-texttracks" aria-label="Permalink for definition: textTracks. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-texttracks-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-sourcebuffer-texttracks-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-texttracks-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-sourcebuffer-texttracks-4" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-appendwindowstart" aria-label="Links in this document to definition: appendWindowStart"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-appendwindowstart" aria-label="Permalink for definition: appendWindowStart. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-4" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-5" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-6" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-7" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-appendwindowstart-8" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-appendwindowend" aria-label="Links in this document to definition: appendWindowEnd"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-appendwindowend" aria-label="Permalink for definition: appendWindowEnd. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-appendwindowend-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowend-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowend-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowend-4" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendwindowend-5" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dom-sourcebuffer-appendwindowend-6" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-appendwindowend-7" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-onupdatestart" aria-label="Links in this document to definition: onupdatestart"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-onupdatestart" aria-label="Permalink for definition: onupdatestart. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-onupdatestart-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-onupdate" aria-label="Links in this document to definition: onupdate"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-onupdate" aria-label="Permalink for definition: onupdate. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-onupdate-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-onupdateend" aria-label="Links in this document to definition: onupdateend"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-onupdateend" aria-label="Permalink for definition: onupdateend. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-onupdateend-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-onerror" aria-label="Links in this document to definition: onerror"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-onerror" aria-label="Permalink for definition: onerror. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-onerror-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-onabort" aria-label="Links in this document to definition: onabort"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-onabort" aria-label="Permalink for definition: onabort. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-onabort-1" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-appendbuffer" aria-label="Links in this document to definition: appendBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-appendbuffer" aria-label="Permalink for definition: appendBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-1" title="§ 3.5 duration attribute">§ 3.5 duration attribute</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-2" title="§ 3.15.1 Attaching to a media element">§ 3.15.1 Attaching to a media element</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-3" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-4" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-5" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-6" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-7" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dom-sourcebuffer-appendbuffer-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-9" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-10" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-11" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li><li> <a href="#ref-for-dom-sourcebuffer-appendbuffer-12" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-abort" aria-label="Links in this document to definition: abort"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-abort" aria-label="Permalink for definition: abort. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-abort-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-abort-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-abort-3" title="§ 5.4 Event Summary">§ 5.4 Event Summary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-changetype" aria-label="Links in this document to definition: changeType"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-changetype" aria-label="Permalink for definition: changeType. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-changetype-1" title="§ Status of This Document">§ Status of This Document</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-2" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-3" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-5" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-6" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dom-sourcebuffer-changetype-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-sourcebuffer-changetype-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-sourcebuffer-changetype-9" title="Reference 4">(4)</a> <a href="#ref-for-dom-sourcebuffer-changetype-10" title="Reference 5">(5)</a> <a href="#ref-for-dom-sourcebuffer-changetype-11" title="Reference 6">(6)</a> <a href="#ref-for-dom-sourcebuffer-changetype-12" title="Reference 7">(7)</a> <a href="#ref-for-dom-sourcebuffer-changetype-13" title="Reference 8">(8)</a> <a href="#ref-for-dom-sourcebuffer-changetype-14" title="Reference 9">(9)</a> <a href="#ref-for-dom-sourcebuffer-changetype-15" title="Reference 10">(10)</a> <a href="#ref-for-dom-sourcebuffer-changetype-16" title="Reference 11">(11)</a> </li><li> <a href="#ref-for-dom-sourcebuffer-changetype-17" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dom-sourcebuffer-changetype-18" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebuffer-remove" aria-label="Links in this document to definition: remove"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebuffer-remove" aria-label="Permalink for definition: remove. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-544711679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebuffer-remove-1" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-dom-sourcebuffer-remove-2" title="§ 5. SourceBuffer interface">§ 5. SourceBuffer interface</a> </li><li> <a href="#ref-for-dom-sourcebuffer-remove-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dom-sourcebuffer-remove-4" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dom-sourcebuffer-remove-5" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li><li> <a href="#ref-for-dom-sourcebuffer-remove-6" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-track-buffer" aria-label="Links in this document to definition: track buffer"> <span class="caret"></span> <div> <a class="self-link" href="#track-buffer" aria-label="Permalink for definition: track buffer. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-track-buffer-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-track-buffer-2" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-track-buffer-3" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-track-buffer-4" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-track-buffer-5" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-6" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-7" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-track-buffer-8" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-track-buffer-9" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-10" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-11" title="Reference 4">(4)</a> <a href="#ref-for-track-buffer-12" title="Reference 5">(5)</a> <a href="#ref-for-track-buffer-13" title="Reference 6">(6)</a> <a href="#ref-for-track-buffer-14" title="Reference 7">(7)</a> <a href="#ref-for-track-buffer-15" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-track-buffer-16" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-track-buffer-17" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> <a href="#ref-for-track-buffer-18" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-19" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-20" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-track-buffer-21" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-track-buffer-22" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-23" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-24" title="Reference 4">(4)</a> <a href="#ref-for-track-buffer-25" title="Reference 5">(5)</a> <a href="#ref-for-track-buffer-26" title="Reference 6">(6)</a> <a href="#ref-for-track-buffer-27" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-track-buffer-28" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-track-buffer-29" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-30" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-31" title="Reference 4">(4)</a> <a href="#ref-for-track-buffer-32" title="Reference 5">(5)</a> <a href="#ref-for-track-buffer-33" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-track-buffer-34" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-track-buffer-35" title="Reference 2">(2)</a> <a href="#ref-for-track-buffer-36" title="Reference 3">(3)</a> <a href="#ref-for-track-buffer-37" title="Reference 4">(4)</a> <a href="#ref-for-track-buffer-38" title="Reference 5">(5)</a> <a href="#ref-for-track-buffer-39" title="Reference 6">(6)</a> <a href="#ref-for-track-buffer-40" title="Reference 7">(7)</a> <a href="#ref-for-track-buffer-41" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-track-buffer-42" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> </li><li> <a href="#ref-for-track-buffer-43" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-last-decode-timestamp" aria-label="Links in this document to definition: last decode timestamp"> <span class="caret"></span> <div> <a class="self-link" href="#last-decode-timestamp" aria-label="Permalink for definition: last decode timestamp. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-last-decode-timestamp-1" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-last-decode-timestamp-2" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-last-decode-timestamp-3" title="Reference 2">(2)</a> <a href="#ref-for-last-decode-timestamp-4" title="Reference 3">(3)</a> <a href="#ref-for-last-decode-timestamp-5" title="Reference 4">(4)</a> <a href="#ref-for-last-decode-timestamp-6" title="Reference 5">(5)</a> <a href="#ref-for-last-decode-timestamp-7" title="Reference 6">(6)</a> <a href="#ref-for-last-decode-timestamp-8" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-last-decode-timestamp-9" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-last-decode-timestamp-10" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-last-frame-duration" aria-label="Links in this document to definition: last frame duration"> <span class="caret"></span> <div> <a class="self-link" href="#last-frame-duration" aria-label="Permalink for definition: last frame duration. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-last-frame-duration-1" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-last-frame-duration-2" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-last-frame-duration-3" title="Reference 2">(2)</a> <a href="#ref-for-last-frame-duration-4" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-last-frame-duration-5" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-highest-end-timestamp" aria-label="Links in this document to definition: highest end timestamp"> <span class="caret"></span> <div> <a class="self-link" href="#highest-end-timestamp" aria-label="Permalink for definition: highest end timestamp. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-highest-end-timestamp-1" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-highest-end-timestamp-2" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-highest-end-timestamp-3" title="Reference 2">(2)</a> <a href="#ref-for-highest-end-timestamp-4" title="Reference 3">(3)</a> <a href="#ref-for-highest-end-timestamp-5" title="Reference 4">(4)</a> <a href="#ref-for-highest-end-timestamp-6" title="Reference 5">(5)</a> <a href="#ref-for-highest-end-timestamp-7" title="Reference 6">(6)</a> <a href="#ref-for-highest-end-timestamp-8" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-highest-end-timestamp-9" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-need-RAP-flag" aria-label="Links in this document to definition: need random access point flag"> <span class="caret"></span> <div> <a class="self-link" href="#need-RAP-flag" aria-label="Permalink for definition: need random access point flag. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-need-RAP-flag-1" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-need-RAP-flag-2" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li><li> <a href="#ref-for-need-RAP-flag-3" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-need-RAP-flag-4" title="Reference 2">(2)</a> <a href="#ref-for-need-RAP-flag-5" title="Reference 3">(3)</a> <a href="#ref-for-need-RAP-flag-6" title="Reference 4">(4)</a> <a href="#ref-for-need-RAP-flag-7" title="Reference 5">(5)</a> <a href="#ref-for-need-RAP-flag-8" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-need-RAP-flag-9" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-track-buffer-ranges" aria-label="Links in this document to definition: track buffer ranges"> <span class="caret"></span> <div> <a class="self-link" href="#track-buffer-ranges" aria-label="Permalink for definition: track buffer ranges. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-track-buffer-ranges-1" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-track-buffer-ranges-2" title="§ 3.15.7 End of stream">§ 3.15.7 End of stream</a> </li><li> <a href="#ref-for-track-buffer-ranges-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-track-buffer-ranges-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-track-buffer-ranges-5" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-track-buffer-ranges-6" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-updatestart" aria-label="Links in this document to definition: updatestart"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-updatestart" aria-label="Permalink for definition: updatestart. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-updatestart-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-updatestart-2" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dfn-updatestart-3" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> </li><li> <a href="#ref-for-dfn-updatestart-4" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-update" aria-label="Links in this document to definition: update"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-update" aria-label="Permalink for definition: update. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-update-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-update-2" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> </li><li> <a href="#ref-for-dfn-update-3" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-updateend" aria-label="Links in this document to definition: updateend"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-updateend" aria-label="Permalink for definition: updateend. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-updateend-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dfn-updateend-2" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-updateend-3" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dfn-updateend-4" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li><li> <a href="#ref-for-dfn-updateend-5" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> </li><li> <a href="#ref-for-dfn-updateend-6" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> </li><li> <a href="#ref-for-dfn-updateend-7" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-error" aria-label="Links in this document to definition: error"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-error" aria-label="Permalink for definition: error. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-error-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-error-2" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li><li> <a href="#ref-for-dfn-error-3" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> <a href="#ref-for-dfn-error-4" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-abort" aria-label="Links in this document to definition: abort"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-abort" aria-label="Permalink for definition: abort. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-abort-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dfn-abort-2" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-abort-3" title="§ 5.2 Methods">§ 5.2 Methods</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-segment-parser-loop" aria-label="Links in this document to definition: Segment Parser Loop"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-segment-parser-loop" aria-label="Permalink for definition: Segment Parser Loop. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-segment-parser-loop-1" title="§ 5.5.5 Buffer Append">§ 5.5.5 Buffer Append</a> <a href="#ref-for-dfn-segment-parser-loop-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-segment-parser-loop-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li><li> <a href="#ref-for-dfn-segment-parser-loop-4" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-dfn-segment-parser-loop-5" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-append-state" aria-label="Links in this document to definition: [[append state]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-append-state" aria-label="Permalink for definition: [[append state]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-append-state-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dfn-append-state-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-append-state-3" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-append-state-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-append-state-5" title="Reference 3">(3)</a> <a href="#ref-for-dfn-append-state-6" title="Reference 4">(4)</a> <a href="#ref-for-dfn-append-state-7" title="Reference 5">(5)</a> <a href="#ref-for-dfn-append-state-8" title="Reference 6">(6)</a> <a href="#ref-for-dfn-append-state-9" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-dfn-append-state-10" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> <a href="#ref-for-dfn-append-state-11" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-sourcebuffer-waiting-for-segment" aria-label="Links in this document to definition: WAITING_FOR_SEGMENT"> <span class="caret"></span> <div> <a class="self-link" href="#sourcebuffer-waiting-for-segment" aria-label="Permalink for definition: WAITING_FOR_SEGMENT. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-sourcebuffer-waiting-for-segment-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-sourcebuffer-waiting-for-segment-2" title="Reference 2">(2)</a> <a href="#ref-for-sourcebuffer-waiting-for-segment-3" title="Reference 3">(3)</a> <a href="#ref-for-sourcebuffer-waiting-for-segment-4" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-sourcebuffer-waiting-for-segment-5" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-sourcebuffer-parsing-init-segment" aria-label="Links in this document to definition: PARSING_INIT_SEGMENT"> <span class="caret"></span> <div> <a class="self-link" href="#sourcebuffer-parsing-init-segment" aria-label="Permalink for definition: PARSING_INIT_SEGMENT. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-sourcebuffer-parsing-init-segment-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-sourcebuffer-parsing-init-segment-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-sourcebuffer-parsing-media-segment" aria-label="Links in this document to definition: PARSING_MEDIA_SEGMENT"> <span class="caret"></span> <div> <a class="self-link" href="#sourcebuffer-parsing-media-segment" aria-label="Permalink for definition: PARSING_MEDIA_SEGMENT. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-sourcebuffer-parsing-media-segment-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-sourcebuffer-parsing-media-segment-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-sourcebuffer-parsing-media-segment-3" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-sourcebuffer-parsing-media-segment-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-sourcebuffer-parsing-media-segment-5" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-input-buffer" aria-label="Links in this document to definition: [[input buffer]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-input-buffer" aria-label="Permalink for definition: [[input buffer]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-input-buffer-1" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dfn-input-buffer-2" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-input-buffer-3" title="Reference 2">(2)</a> <a href="#ref-for-dfn-input-buffer-4" title="Reference 3">(3)</a> <a href="#ref-for-dfn-input-buffer-5" title="Reference 4">(4)</a> <a href="#ref-for-dfn-input-buffer-6" title="Reference 5">(5)</a> <a href="#ref-for-dfn-input-buffer-7" title="Reference 6">(6)</a> <a href="#ref-for-dfn-input-buffer-8" title="Reference 7">(7)</a> <a href="#ref-for-dfn-input-buffer-9" title="Reference 8">(8)</a> <a href="#ref-for-dfn-input-buffer-10" title="Reference 9">(9)</a> <a href="#ref-for-dfn-input-buffer-11" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dfn-input-buffer-12" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> <a href="#ref-for-dfn-input-buffer-13" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-input-buffer-14" title="§ 5.5.10 Coded Frame Eviction">§ 5.5.10 Coded Frame Eviction</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-buffer-full-flag" aria-label="Links in this document to definition: [[buffer full flag]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-buffer-full-flag" aria-label="Permalink for definition: [[buffer full flag]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-buffer-full-flag-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dfn-buffer-full-flag-2" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dfn-buffer-full-flag-3" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-dfn-buffer-full-flag-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-buffer-full-flag-5" title="§ 5.5.10 Coded Frame Eviction">§ 5.5.10 Coded Frame Eviction</a> <a href="#ref-for-dfn-buffer-full-flag-6" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-group-start-timestamp" aria-label="Links in this document to definition: [[group start timestamp]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-group-start-timestamp" aria-label="Permalink for definition: [[group start timestamp]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-group-start-timestamp-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> <a href="#ref-for-dfn-group-start-timestamp-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-group-start-timestamp-3" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-dfn-group-start-timestamp-4" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dfn-group-start-timestamp-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-group-start-timestamp-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-group-start-timestamp-7" title="Reference 4">(4)</a> <a href="#ref-for-dfn-group-start-timestamp-8" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-group-start-timestamp-9" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-group-end-timestamp" aria-label="Links in this document to definition: [[group end timestamp]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-group-end-timestamp" aria-label="Permalink for definition: [[group end timestamp]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-group-end-timestamp-1" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-group-end-timestamp-2" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dfn-group-end-timestamp-3" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-dfn-group-end-timestamp-4" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dfn-group-end-timestamp-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-group-end-timestamp-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-group-end-timestamp-7" title="Reference 4">(4)</a> <a href="#ref-for-dfn-group-end-timestamp-8" title="Reference 5">(5)</a> <a href="#ref-for-dfn-group-end-timestamp-9" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dfn-group-end-timestamp-10" title="§ 5.5.9 Coded Frame Removal">§ 5.5.9 Coded Frame Removal</a> <a href="#ref-for-dfn-group-end-timestamp-11" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-generate-timestamps-flag" aria-label="Links in this document to definition: [[generate timestamps flag]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-generate-timestamps-flag" aria-label="Permalink for definition: [[generate timestamps flag]]. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-generate-timestamps-flag-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> <a href="#ref-for-dfn-generate-timestamps-flag-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-generate-timestamps-flag-3" title="§ 5.1 Attributes">§ 5.1 Attributes</a> </li><li> <a href="#ref-for-dfn-generate-timestamps-flag-4" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dfn-generate-timestamps-flag-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-generate-timestamps-flag-6" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> <a href="#ref-for-dfn-generate-timestamps-flag-7" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-reset-parser-state" aria-label="Links in this document to definition: Reset Parser State"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-reset-parser-state" aria-label="Permalink for definition: Reset Parser State. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-reset-parser-state-1" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dfn-reset-parser-state-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-reset-parser-state-3" title="§ 5.5.3 Append Error">§ 5.5.3 Append Error</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-append-error" aria-label="Links in this document to definition: Append Error"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-append-error" aria-label="Permalink for definition: Append Error. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-append-error-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-dfn-append-error-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-append-error-3" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-append-error-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-append-error-5" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-append-error-6" title="Reference 2">(2)</a> <a href="#ref-for-dfn-append-error-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-append-error-8" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> <a href="#ref-for-dfn-append-error-9" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-prepare-append" aria-label="Links in this document to definition: Prepare Append"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-prepare-append" aria-label="Permalink for definition: Prepare Append. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-prepare-append-1" title="§ 5.2 Methods">§ 5.2 Methods</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-buffer-append" aria-label="Links in this document to definition: Buffer Append"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-buffer-append" aria-label="Permalink for definition: Buffer Append. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-buffer-append-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dfn-buffer-append-2" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dfn-buffer-append-3" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-range-removal" aria-label="Links in this document to definition: Range Removal"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-range-removal" aria-label="Permalink for definition: Range Removal. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-range-removal-1" title="§ 5.2 Methods">§ 5.2 Methods</a> <a href="#ref-for-dfn-range-removal-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-initialization-segment-received" aria-label="Links in this document to definition: Initialization Segment Received"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-initialization-segment-received" aria-label="Permalink for definition: Initialization Segment Received. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-initialization-segment-received-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dfn-initialization-segment-received-2" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-first-initialization-segment-received-flag" aria-label="Links in this document to definition: [[first initialization segment received flag]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-first-initialization-segment-received-flag" aria-label="Permalink for definition: [[first initialization segment received flag]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-first-initialization-segment-received-flag-1" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dfn-first-initialization-segment-received-flag-2" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> <a href="#ref-for-dfn-first-initialization-segment-received-flag-3" title="Reference 2">(2)</a> <a href="#ref-for-dfn-first-initialization-segment-received-flag-4" title="Reference 3">(3)</a> <a href="#ref-for-dfn-first-initialization-segment-received-flag-5" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-pending-initialization-segment-for-changetype-flag" aria-label="Links in this document to definition: [[pending initialization segment for changeType flag]]"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-pending-initialization-segment-for-changetype-flag" aria-label="Permalink for definition: [[pending initialization segment for changeType flag]]. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-pending-initialization-segment-for-changetype-flag-1" title="§ 5.2 Methods">§ 5.2 Methods</a> </li><li> <a href="#ref-for-dfn-pending-initialization-segment-for-changetype-flag-2" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-dfn-pending-initialization-segment-for-changetype-flag-3" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-processing" aria-label="Links in this document to definition: Coded Frame Processing"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-processing" aria-label="Permalink for definition: Coded Frame Processing. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-processing-1" title="§ 2. Definitions">§ 2. Definitions</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-2" title="§ 3.15.3 Seeking">§ 3.15.3 Seeking</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-3" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> <a href="#ref-for-dfn-coded-frame-processing-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-processing-5" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-6" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> <a href="#ref-for-dfn-coded-frame-processing-7" title="Reference 2">(2)</a> <a href="#ref-for-dfn-coded-frame-processing-8" title="Reference 3">(3)</a> <a href="#ref-for-dfn-coded-frame-processing-9" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-10" title="§ 5.5.2 Reset Parser State">§ 5.5.2 Reset Parser State</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-11" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-12" title="§ 5.5.13 Text Splice Frame">§ 5.5.13 Text Splice Frame</a> </li><li> <a href="#ref-for-dfn-coded-frame-processing-13" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-removal" aria-label="Links in this document to definition: Coded Frame Removal"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-removal" aria-label="Permalink for definition: Coded Frame Removal. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-removal-1" title="§ 3.15.6 Duration change">§ 3.15.6 Duration change</a> </li><li> <a href="#ref-for-dfn-coded-frame-removal-2" title="§ 5.3 Track Buffers">§ 5.3 Track Buffers</a> </li><li> <a href="#ref-for-dfn-coded-frame-removal-3" title="§ 5.5.6 Range Removal">§ 5.5.6 Range Removal</a> </li><li> <a href="#ref-for-dfn-coded-frame-removal-4" title="§ 5.5.10 Coded Frame Eviction">§ 5.5.10 Coded Frame Eviction</a> </li><li> <a href="#ref-for-dfn-coded-frame-removal-5" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li><li> <a href="#ref-for-dfn-coded-frame-removal-6" title="§ 9.3.2 Memory cleanup">§ 9.3.2 Memory cleanup</a> <a href="#ref-for-dfn-coded-frame-removal-7" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-coded-frame-eviction" aria-label="Links in this document to definition: Coded Frame Eviction"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-coded-frame-eviction" aria-label="Permalink for definition: Coded Frame Eviction. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-coded-frame-eviction-1" title="§ 5.5.4 Prepare Append">§ 5.5.4 Prepare Append</a> </li><li> <a href="#ref-for-dfn-coded-frame-eviction-2" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-audio-splice-frame" aria-label="Links in this document to definition: Audio Splice Frame"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-audio-splice-frame" aria-label="Permalink for definition: Audio Splice Frame. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-audio-splice-frame-1" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-dfn-audio-splice-frame-2" title="§ 5.5.12 Audio Splice Rendering">§ 5.5.12 Audio Splice Rendering</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-audio-splice-rendering" aria-label="Links in this document to definition: Audio Splice Rendering"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-audio-splice-rendering" aria-label="Permalink for definition: Audio Splice Rendering. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-audio-splice-rendering-1" title="§ 5.5.11 Audio Splice Frame">§ 5.5.11 Audio Splice Frame</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-text-splice-frame" aria-label="Links in this document to definition: Text Splice Frame"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-text-splice-frame" aria-label="Permalink for definition: Text Splice Frame. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-text-splice-frame-1" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebufferlist" aria-label="Links in this document to definition: SourceBufferList"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebufferlist" aria-label="Permalink for definition: SourceBufferList. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2108728413">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebufferlist-1" title="§ 3. MediaSource interface">§ 3. MediaSource interface</a> <a href="#ref-for-dom-sourcebufferlist-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebufferlist-3" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dom-sourcebufferlist-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-sourcebufferlist-5" title="§ 6. SourceBufferList interface">§ 6. SourceBufferList interface</a> <a href="#ref-for-dom-sourcebufferlist-6" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebufferlist-getter" aria-label="Links in this document to definition: getter"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebufferlist-getter" aria-label="Permalink for definition: getter. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebufferlist-length" aria-label="Links in this document to definition: length"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebufferlist-length" aria-label="Permalink for definition: length. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2108728413">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebufferlist-length-1" title="§ 6. SourceBufferList interface">§ 6. SourceBufferList interface</a> </li><li> <a href="#ref-for-dom-sourcebufferlist-length-2" title="§ 6.2 Methods">§ 6.2 Methods</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebufferlist-onaddsourcebuffer" aria-label="Links in this document to definition: onaddsourcebuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebufferlist-onaddsourcebuffer" aria-label="Permalink for definition: onaddsourcebuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2108728413">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebufferlist-onaddsourcebuffer-1" title="§ 6. SourceBufferList interface">§ 6. SourceBufferList interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-sourcebufferlist-onremovesourcebuffer" aria-label="Links in this document to definition: onremovesourcebuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-sourcebufferlist-onremovesourcebuffer" aria-label="Permalink for definition: onremovesourcebuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2108728413">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-sourcebufferlist-onremovesourcebuffer-1" title="§ 6. SourceBufferList interface">§ 6. SourceBufferList interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-sourcebufferlist-getter" aria-label="Links in this document to definition: getter"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-sourcebufferlist-getter" aria-label="Permalink for definition: getter. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-addsourcebuffer" aria-label="Links in this document to definition: addsourcebuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-addsourcebuffer" aria-label="Permalink for definition: addsourcebuffer. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-addsourcebuffer-1" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dfn-addsourcebuffer-2" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> <a href="#ref-for-dfn-addsourcebuffer-3" title="Reference 2">(2)</a> <a href="#ref-for-dfn-addsourcebuffer-4" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-addsourcebuffer-5" title="§ 5.5.7 Initialization Segment Received">§ 5.5.7 Initialization Segment Received</a> </li><li> <a href="#ref-for-dfn-addsourcebuffer-6" title="§ 6.1 Attributes">§ 6.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-removesourcebuffer" aria-label="Links in this document to definition: removesourcebuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-removesourcebuffer" aria-label="Permalink for definition: removesourcebuffer. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-removesourcebuffer-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> <a href="#ref-for-dfn-removesourcebuffer-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-removesourcebuffer-3" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> <a href="#ref-for-dfn-removesourcebuffer-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-removesourcebuffer-5" title="§ 3.15.5 Changes to selected/enabled track state">§ 3.15.5 Changes to selected/enabled track state</a> <a href="#ref-for-dfn-removesourcebuffer-6" title="Reference 2">(2)</a> <a href="#ref-for-dfn-removesourcebuffer-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-removesourcebuffer-8" title="§ 6.1 Attributes">§ 6.1 Attributes</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedmediasource" aria-label="Links in this document to definition: ManagedMediaSource"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedmediasource" aria-label="Permalink for definition: ManagedMediaSource. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1619111096">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-managedmediasource-1" title="§ Status of This Document">§ Status of This Document</a> </li><li> <a href="#ref-for-dom-managedmediasource-2" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-managedmediasource-3" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li><li> <a href="#ref-for-dom-managedmediasource-4" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> <a href="#ref-for-dom-managedmediasource-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-managedmediasource-6" title="§ 7.2 Event Summary">§ 7.2 Event Summary</a> <a href="#ref-for-dom-managedmediasource-7" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-managedmediasource-8" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> <a href="#ref-for-dom-managedmediasource-9" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-managedmediasource-10" title="§ 9.3.2 Memory cleanup">§ 9.3.2 Memory cleanup</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedmediasource-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedmediasource-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedmediasource-onstartstreaming" aria-label="Links in this document to definition: onstartstreaming"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedmediasource-onstartstreaming" aria-label="Permalink for definition: onstartstreaming. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedmediasource-onendstreaming" aria-label="Links in this document to definition: onendstreaming"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedmediasource-onendstreaming" aria-label="Permalink for definition: onendstreaming. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedmediasource-streaming" aria-label="Links in this document to definition: streaming"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedmediasource-streaming" aria-label="Permalink for definition: streaming. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1619111096">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-managedmediasource-streaming-1" title="§ 3.15.2 Detaching from a media element">§ 3.15.2 Detaching from a media element</a> </li><li> <a href="#ref-for-dom-managedmediasource-streaming-2" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> </li><li> <a href="#ref-for-dom-managedmediasource-streaming-3" title="§ 7.2 Event Summary">§ 7.2 Event Summary</a> <a href="#ref-for-dom-managedmediasource-streaming-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-managedmediasource-streaming-5" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> <a href="#ref-for-dom-managedmediasource-streaming-6" title="Reference 2">(2)</a> <a href="#ref-for-dom-managedmediasource-streaming-7" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-startstreaming" aria-label="Links in this document to definition: startstreaming"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-startstreaming" aria-label="Permalink for definition: startstreaming. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-startstreaming-1" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-endstreaming" aria-label="Links in this document to definition: endstreaming"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-endstreaming" aria-label="Permalink for definition: endstreaming. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-endstreaming-1" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-enough-managed-data-to-ensure-uninterrupted-playback" aria-label="Links in this document to definition: enough managed data to ensure uninterrupted playback"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-enough-managed-data-to-ensure-uninterrupted-playback" aria-label="Permalink for definition: enough managed data to ensure uninterrupted playback. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-enough-managed-data-to-ensure-uninterrupted-playback-1" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way" aria-label="Links in this document to definition: able to retrieve and buffer data in an efficient way"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way" aria-label="Permalink for definition: able to retrieve and buffer data in an efficient way. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-able-to-retrieve-and-buffer-data-in-an-efficient-way-1" title="§ 7.3.1 ManagedSourceBuffer Monitoring">§ 7.3.1 ManagedSourceBuffer Monitoring</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-memory-cleanup" aria-label="Links in this document to definition: Memory Cleanup"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-memory-cleanup" aria-label="Permalink for definition: Memory Cleanup. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-memory-cleanup-1" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeevent" aria-label="Links in this document to definition: BufferedChangeEvent"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeevent" aria-label="Permalink for definition: BufferedChangeEvent. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2057880103">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeevent-1" title="§ Status of This Document">§ Status of This Document</a> </li><li> <a href="#ref-for-dom-bufferedchangeevent-2" title="§ 8. BufferedChangeEvent interface">§ 8. BufferedChangeEvent interface</a> </li><li> <a href="#ref-for-dom-bufferedchangeevent-3" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li><li> <a href="#ref-for-dom-bufferedchangeevent-4" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeevent-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeevent-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeeventinit" aria-label="Links in this document to definition: BufferedChangeEventInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeeventinit" aria-label="Permalink for definition: BufferedChangeEventInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeeventinit-1" title="§ 8. BufferedChangeEvent interface">§ 8. BufferedChangeEvent interface</a> </li><li> <a href="#ref-for-dom-bufferedchangeeventinit-2" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeeventinit-addedranges" aria-label="Links in this document to definition: addedRanges"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeeventinit-addedranges" aria-label="Permalink for definition: addedRanges. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeeventinit-addedranges-1" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeeventinit-removedranges" aria-label="Links in this document to definition: removedRanges"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeeventinit-removedranges" aria-label="Permalink for definition: removedRanges. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeeventinit-removedranges-1" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeevent-addedranges" aria-label="Links in this document to definition: addedRanges"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeevent-addedranges" aria-label="Permalink for definition: addedRanges. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2057880103">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeevent-addedranges-1" title="§ 8. BufferedChangeEvent interface">§ 8. BufferedChangeEvent interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-bufferedchangeevent-removedranges" aria-label="Links in this document to definition: removedRanges"> <span class="caret"></span> <div> <a class="self-link" href="#dom-bufferedchangeevent-removedranges" aria-label="Permalink for definition: removedRanges. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2057880103">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-bufferedchangeevent-removedranges-1" title="§ 8. BufferedChangeEvent interface">§ 8. BufferedChangeEvent interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedsourcebuffer" aria-label="Links in this document to definition: ManagedSourceBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedsourcebuffer" aria-label="Permalink for definition: ManagedSourceBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1682162223">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-managedsourcebuffer-1" title="§ Status of This Document">§ Status of This Document</a> </li><li> <a href="#ref-for-dom-managedsourcebuffer-2" title="§ 3.7 addSourceBuffer() method">§ 3.7 addSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-managedsourcebuffer-3" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> </li><li> <a href="#ref-for-dom-managedsourcebuffer-4" title="§ 9. ManagedSourceBuffer interface">§ 9. ManagedSourceBuffer interface</a> </li><li> <a href="#ref-for-dom-managedsourcebuffer-5" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li><li> <a href="#ref-for-dom-managedsourcebuffer-6" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-managedsourcebuffer-onbufferedchange" aria-label="Links in this document to definition: onbufferedchange"> <span class="caret"></span> <div> <a class="self-link" href="#dom-managedsourcebuffer-onbufferedchange" aria-label="Permalink for definition: onbufferedchange. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1682162223">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-managedsourcebuffer-onbufferedchange-1" title="§ 9. ManagedSourceBuffer interface">§ 9. ManagedSourceBuffer interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-bufferedchange" aria-label="Links in this document to definition: bufferedchange"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-bufferedchange" aria-label="Permalink for definition: bufferedchange. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-bufferedchange-1" title="§ 7. ManagedMediaSource interface">§ 7. ManagedMediaSource interface</a> </li><li> <a href="#ref-for-dfn-bufferedchange-2" title="§ 9.1 Attributes">§ 9.1 Attributes</a> </li><li> <a href="#ref-for-dfn-bufferedchange-3" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li><li> <a href="#ref-for-dfn-bufferedchange-4" title="§ 9.3.2 Memory cleanup">§ 9.3.2 Memory cleanup</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-memory-cleanup-0" aria-label="Links in this document to definition: Memory cleanup"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-memory-cleanup-0" aria-label="Permalink for definition: Memory cleanup. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-memory-cleanup-0-1" title="§ 7.3.2 Memory Cleanup">§ 7.3.2 Memory Cleanup</a> </li><li> <a href="#ref-for-dfn-memory-cleanup-0-2" title="§ 8.1 Attributes">§ 8.1 Attributes</a> </li><li> <a href="#ref-for-dfn-memory-cleanup-0-3" title="§ 9.2 Event Summary">§ 9.2 Event Summary</a> </li><li> <a href="#ref-for-dfn-memory-cleanup-0-4" title="§ 9.3.1 Buffered Change">§ 9.3.1 Buffered Change</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-audiotrack-sourcebuffer" aria-label="Links in this document to definition: sourceBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-audiotrack-sourcebuffer" aria-label="Permalink for definition: sourceBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-935490083">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-audiotrack-sourcebuffer-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-audiotrack-sourcebuffer-2" title="§ 11. AudioTrack extensions">§ 11. AudioTrack extensions</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-videotrack-sourcebuffer" aria-label="Links in this document to definition: sourceBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-videotrack-sourcebuffer" aria-label="Permalink for definition: sourceBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-251527976">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-videotrack-sourcebuffer-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-videotrack-sourcebuffer-2" title="§ 12. VideoTrack extensions">§ 12. VideoTrack extensions</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-texttrack-sourcebuffer" aria-label="Links in this document to definition: sourceBuffer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-texttrack-sourcebuffer" aria-label="Permalink for definition: sourceBuffer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-959897060">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-texttrack-sourcebuffer-1" title="§ 3.8 removeSourceBuffer() method">§ 3.8 removeSourceBuffer() method</a> </li><li> <a href="#ref-for-dom-texttrack-sourcebuffer-2" title="§ 13. TextTrack extensions">§ 13. TextTrack extensions</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-byte-stream-formats" aria-label="Links in this document to definition: Byte Stream Formats"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-byte-stream-formats" aria-label="Permalink for definition: Byte Stream Formats. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-byte-stream-format-specs" aria-label="Links in this document to definition: byte stream format specifications"> <span class="caret"></span> <div> <a class="self-link" href="#byte-stream-format-specs" aria-label="Permalink for definition: byte stream format specifications. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-byte-stream-format-specs-1" title="§ 2. Definitions">§ 2. Definitions</a> <a href="#ref-for-byte-stream-format-specs-2" title="Reference 2">(2)</a> <a href="#ref-for-byte-stream-format-specs-3" title="Reference 3">(3)</a> <a href="#ref-for-byte-stream-format-specs-4" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-byte-stream-format-specs-5" title="§ 5.5.1 Segment Parser Loop">§ 5.5.1 Segment Parser Loop</a> </li><li> <a href="#ref-for-byte-stream-format-specs-6" title="§ 5.5.8 Coded Frame Processing">§ 5.5.8 Coded Frame Processing</a> </li><li> <a href="#ref-for-byte-stream-format-specs-7" title="§ 14. Byte Stream Formats">§ 14. Byte Stream Formats</a> </li> </ul> </div><script id="respec-dfn-panel">(() => { // @ts-check if (document.respec) { document.respec.ready.then(setupPanel); } else { setupPanel(); } function setupPanel() { const listener = panelListener(); document.body.addEventListener("keydown", listener); document.body.addEventListener("click", listener); } function panelListener() { /** @type {HTMLElement} */ let panel = null; return event => { const { target, type } = event; if (!(target instanceof HTMLElement)) return; // For keys, we only care about Enter key to activate the panel // otherwise it's activated via a click. if (type === "keydown" && event.key !== "Enter") return; const action = deriveAction(event); switch (action) { case "show": { hidePanel(panel); /** @type {HTMLElement} */ const dfn = target.closest("dfn, .index-term"); panel = document.getElementById(`dfn-panel-for-${dfn.id}`); const coords = deriveCoordinates(event); displayPanel(dfn, panel, coords); break; } case "dock": { panel.style.left = null; panel.style.top = null; panel.classList.add("docked"); break; } case "hide": { hidePanel(panel); panel = null; break; } } }; } /** * @param {MouseEvent|KeyboardEvent} event */ function deriveCoordinates(event) { const target = /** @type HTMLElement */ (event.target); // We prevent synthetic AT clicks from putting // the dialog in a weird place. The AT events sometimes // lack coordinates, so they have clientX/Y = 0 const rect = target.getBoundingClientRect(); if ( event instanceof MouseEvent && event.clientX >= rect.left && event.clientY >= rect.top ) { // The event probably happened inside the bounding rect... return { x: event.clientX, y: event.clientY }; } // Offset to the middle of the element const x = rect.x + rect.width / 2; // Placed at the bottom of the element const y = rect.y + rect.height; return { x, y }; } /** * @param {Event} event */ function deriveAction(event) { const target = /** @type {HTMLElement} */ (event.target); const hitALink = !!target.closest("a"); if (target.closest("dfn:not([data-cite]), .index-term")) { return hitALink ? "none" : "show"; } if (target.closest(".dfn-panel")) { if (hitALink) { return target.classList.contains("self-link") ? "hide" : "dock"; } const panel = target.closest(".dfn-panel"); return panel.classList.contains("docked") ? "hide" : "none"; } if (document.querySelector(".dfn-panel:not([hidden])")) { return "hide"; } return "none"; } /** * @param {HTMLElement} dfn * @param {HTMLElement} panel * @param {{ x: number, y: number }} clickPosition */ function displayPanel(dfn, panel, { x, y }) { panel.hidden = false; // distance (px) between edge of panel and the pointing triangle (caret) const MARGIN = 20; const dfnRects = dfn.getClientRects(); // Find the `top` offset when the `dfn` can be spread across multiple lines let closestTop = 0; let minDiff = Infinity; for (const rect of dfnRects) { const { top, bottom } = rect; const diffFromClickY = Math.abs((top + bottom) / 2 - y); if (diffFromClickY < minDiff) { minDiff = diffFromClickY; closestTop = top; } } const top = window.scrollY + closestTop + dfnRects[0].height; const left = x - MARGIN; panel.style.left = `${left}px`; panel.style.top = `${top}px`; // Find if the panel is flowing out of the window const panelRect = panel.getBoundingClientRect(); const SCREEN_WIDTH = Math.min(window.innerWidth, window.screen.width); if (panelRect.right > SCREEN_WIDTH) { const newLeft = Math.max(MARGIN, x + MARGIN - panelRect.width); const newCaretOffset = left - newLeft; panel.style.left = `${newLeft}px`; /** @type {HTMLElement} */ const caret = panel.querySelector(".caret"); caret.style.left = `${newCaretOffset}px`; } // As it's a dialog, we trap focus. // TODO: when <dialog> becomes a implemented, we should really // use that. trapFocus(panel, dfn); } /** * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function trapFocus(panel, dfn) { /** @type NodeListOf<HTMLAnchorElement> elements */ const anchors = panel.querySelectorAll("a[href]"); // No need to trap focus if (!anchors.length) return; // Move focus to first anchor element const first = anchors.item(0); first.focus(); const trapListener = createTrapListener(anchors, panel, dfn); panel.addEventListener("keydown", trapListener); // Hiding the panel releases the trap const mo = new MutationObserver(records => { const [record] = records; const target = /** @type HTMLElement */ (record.target); if (target.hidden) { panel.removeEventListener("keydown", trapListener); mo.disconnect(); } }); mo.observe(panel, { attributes: true, attributeFilter: ["hidden"] }); } /** * * @param {NodeListOf<HTMLAnchorElement>} anchors * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function createTrapListener(anchors, panel, dfn) { const lastIndex = anchors.length - 1; let currentIndex = 0; return event => { switch (event.key) { // Hitting "Tab" traps us in a nice loop around elements. case "Tab": { event.preventDefault(); currentIndex += event.shiftKey ? -1 : +1; if (currentIndex < 0) { currentIndex = lastIndex; } else if (currentIndex > lastIndex) { currentIndex = 0; } anchors.item(currentIndex).focus(); break; } // Hitting "Enter" on an anchor releases the trap. case "Enter": hidePanel(panel); break; // Hitting "Escape" returns focus to dfn. case "Escape": hidePanel(panel); dfn.focus(); return; } }; } /** @param {HTMLElement} panel */ function hidePanel(panel) { if (!panel) return; panel.hidden = true; panel.classList.remove("docked"); } })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10