forked from w3c/media-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
3246 lines (2873 loc) · 385 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" dir="ltr" typeof="bibo:Document " prefix="bibo: http://purl.org/ontology/bibo/ w3p: http://www.w3.org/2001/02pd/rec54#">
<head><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta lang="" property="dc:language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Source Extensions</title>
<!-- script to register bugs -->
<!-- Disabled unless/until it supports GitHub issues.
<script src="https://w3c.github.io/webcomponents/assets/scripts/bug-assist.js"></script>
<meta name="bug.short_desc" content="[MSE] ">
<meta name="bug.product" content="HTML WG">
<meta name="bug.component" content="Media Source Extensions">
-->
<style>/* --- ISSUES/NOTES --- */
div.issue-title, div.note-title , div.ednote-title, div.warning-title {
padding-right: 1em;
min-width: 7.5em;
color: #b9ab2d;
}
div.issue-title { color: #e05252; }
div.note-title, div.ednote-title { color: #2b2; }
div.warning-title { color: #f22; }
div.issue-title span, div.note-title span, div.ednote-title span, div.warning-title span {
text-transform: uppercase;
}
div.note, div.issue, div.ednote, div.warning {
margin-top: 1em;
margin-bottom: 1em;
}
.note > p:first-child, .ednote > p:first-child, .issue > p:first-child, .warning > p:first-child { margin-top: 0 }
.issue, .note, .ednote, .warning {
padding: .5em;
border-left-width: .5em;
border-left-style: solid;
}
div.issue, div.note , div.ednote, div.warning {
padding: 1em 1.2em 0.5em;
margin: 1em 0;
position: relative;
clear: both;
}
span.note, span.ednote, span.issue, span.warning { padding: .1em .5em .15em; }
.issue {
border-color: #e05252;
background: #fbe9e9;
}
.note, .ednote {
border-color: #52e052;
background: #e9fbe9;
}
.warning {
border-color: #f11;
border-right-width: .2em;
border-top-width: .2em;
border-bottom-width: .2em;
border-style: solid;
background: #fbe9e9;
}
.warning-title:before{
content: "⚠"; /*U+26A0 WARNING SIGN*/
font-size: 3em;
float: left;
height: 100%;
padding-right: .3em;
vertical-align: top;
margin-top: -0.5em;
}
li.task-list-item {
list-style: none;
}
input.task-list-item-checkbox {
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
}
</style><style>/* --- WEB IDL --- */
pre.idl {
border-top: 1px solid #90b8de;
border-bottom: 1px solid #90b8de;
padding: 1em;
line-height: 120%;
}
@media print {
pre.idl {
white-space: pre-wrap;
}
}
pre.idl::before {
content: "WebIDL";
display: block;
width: 150px;
background: #90b8de;
color: #fff;
font-family: sans-serif;
padding: 3px;
font-weight: bold;
margin: -1em 0 1em -1em;
}
.idlType {
color: #ff4500;
font-weight: bold;
text-decoration: none;
}
/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
font-weight: bold;
color: #005a9c;
}
a.idlEnumItem {
color: #000;
border-bottom: 1px dotted #ccc;
text-decoration: none;
}
.idlSuperclass {
font-style: italic;
color: #005a9c;
}
/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
color: #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
color: #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlMethod*/
.idlMethType, .idlCallbackType {
color: #005a9c;
}
.idlMethName {
color: #ff4500;
}
.idlMethName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlCtor*/
.idlCtorName {
color: #ff4500;
}
.idlCtorName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlParam*/
.idlParamType {
color: #005a9c;
}
.idlParamName, .idlDefaultValue {
font-style: italic;
}
.extAttr {
color: #666;
}
/*.idlSectionComment*/
.idlSectionComment {
color: gray;
}
/*.idlIterable*/
.idlIterableKeyType, .idlIterableValueType {
color: #005a9c;
}
/*.idlMaplike*/
.idlMaplikeKeyType, .idlMaplikeValueType {
color: #005a9c;
}
/*.idlConst*/
.idlConstType {
color: #005a9c;
}
.idlConstName {
color: #ff4500;
}
.idlConstName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlException*/
.idlExceptionID {
font-weight: bold;
color: #c00;
}
.idlTypedefID, .idlTypedefType {
color: #005a9c;
}
.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
color: #c00;
font-weight: normal;
}
.excName a {
font-family: monospace;
}
.idlRaises a.idlType, .excName a.idlType {
border-bottom: 1px dotted #c00;
}
.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
width: 45px;
text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
.idlImplements a {
font-weight: bold;
}
dl.attributes, dl.methods, dl.constants, dl.constructors, dl.fields, dl.dictionary-members {
margin-left: 2em;
}
.attributes dt, .methods dt, .constants dt, .constructors dt, .fields dt, .dictionary-members dt {
font-weight: normal;
}
.attributes dt code, .methods dt code, .constants dt code, .constructors dt code, .fields dt code, .dictionary-members dt code {
font-weight: bold;
color: #000;
font-family: monospace;
}
.attributes dt code, .fields dt code, .dictionary-members dt code {
background: #ffffd2;
}
.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
color: #005a9c;
background: transparent;
font-family: inherit;
font-weight: normal;
font-style: italic;
}
.methods dt code {
background: #d9e6f8;
}
.constants dt code {
background: #ddffd2;
}
.constructors dt code {
background: #cfc;
}
.attributes dd, .methods dd, .constants dd, .constructors dd, .fields dd, .dictionary-members dd {
margin-bottom: 1em;
}
table.parameters, table.exceptions {
border-spacing: 0;
border-collapse: collapse;
margin: 0.5em 0;
width: 100%;
}
table.parameters { border-bottom: 1px solid #90b8de; }
table.exceptions { border-bottom: 1px solid #deb890; }
.parameters th, .exceptions th {
color: #fff;
padding: 3px 5px;
text-align: left;
font-weight: normal;
text-shadow: #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }
.parameters td, .exceptions td {
padding: 3px 10px;
border-top: 1px solid #ddd;
vertical-align: top;
}
.parameters tr:first-child td, .exceptions tr:first-child td {
border-top: none;
}
.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
width: 100px;
}
.parameters td.prmType {
width: 120px;
}
table.exceptions table {
border-spacing: 0;
border-collapse: collapse;
width: 100%;
}
</style><link rel="stylesheet" href="mse.css">
<style>/*****************************************************************
* ReSpec 3 CSS
* Robin Berjon - http://berjon.com/
*****************************************************************/
/* --- INLINES --- */
em.rfc2119 {
text-transform: lowercase;
font-variant: small-caps;
font-style: normal;
color: #900;
}
h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
border: none;
}
dfn {
font-weight: bold;
}
a.internalDFN {
color: inherit;
border-bottom: 1px solid #99c;
text-decoration: none;
}
a.externalDFN {
color: inherit;
border-bottom: 1px dotted #ccc;
text-decoration: none;
}
a.bibref {
text-decoration: none;
}
cite .bibref {
font-style: normal;
}
code {
color: #C83500;
}
/* --- TOC --- */
.toc a, .tof a {
text-decoration: none;
}
a .secno, a .figno {
color: #000;
}
ul.tof, ol.tof {
list-style: none outside none;
}
.caption {
margin-top: 0.5em;
font-style: italic;
}
/* --- TABLE --- */
table.simple {
border-spacing: 0;
border-collapse: collapse;
border-bottom: 3px solid #005a9c;
}
.simple th {
background: #005a9c;
color: #fff;
padding: 3px 5px;
text-align: left;
}
.simple th[scope="row"] {
background: inherit;
color: inherit;
border-top: 1px solid #ddd;
}
.simple td {
padding: 3px 10px;
border-top: 1px solid #ddd;
}
.simple tr:nth-child(even) {
background: #f0f6ff;
}
/* --- DL --- */
.section dd > p:first-child {
margin-top: 0;
}
.section dd > p:last-child {
margin-bottom: 0;
}
.section dd {
margin-bottom: 1em;
}
.section dl.attrs dd, .section dl.eldef dd {
margin-bottom: 0;
}
@media print {
.removeOnSave {
display: none;
}
}
</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2016/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
<body class="h-entry" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
<p>
<a class="logo" href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a>
</p>
<h1 class="title p-name" id="title" property="dcterms:title">Media Source Extensions</h1>
<h2 id="w3c-editor-s-draft-01-august-2016"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time property="dcterms:issued" class="dt-published" datetime="2016-08-01">01 August 2016</time></h2>
<dl>
<dt>This version:</dt>
<dd><a class="u-url" href="http://w3c.github.io/media-source/">http://w3c.github.io/media-source/</a></dd>
<dt>Latest published version:</dt>
<dd><a href="http://www.w3.org/TR/media-source/">http://www.w3.org/TR/media-source/</a></dd>
<dt>Latest editor's draft:</dt>
<dd><a href="http://w3c.github.io/media-source/">http://w3c.github.io/media-source/</a></dd>
<dt>Editors:</dt>
<dd class="p-author h-card vcard" property="bibo:editor" resource="_:editor0"><span property="rdf:first" typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Matthew Wolenetz</span>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
<span property="rdf:rest" resource="_:editor1"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor1"><span property="rdf:first" typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Jerry Smith</span>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.microsoft.com/">Microsoft Corporation</a></span>
<span property="rdf:rest" resource="_:editor2"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor2"><span property="rdf:first" typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mark Watson</span>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.netflix.com/">Netflix Inc.</a></span>
<span property="rdf:rest" resource="_:editor3"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor3"><span property="rdf:first" typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Aaron Colwell (until April 2015)</span>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.google.com/">Google Inc.</a></span>
<span property="rdf:rest" resource="_:editor4"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor4"><span property="rdf:first" typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Adrian Bateman (until April 2015)</span>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.microsoft.com/">Microsoft Corporation</a></span>
<span property="rdf:rest" resource="rdf:nil"></span>
</dd>
<dt>Repository:</dt>
<dd>
<a href="https://github.com/w3c/media-source/">
We are on GitHub
</a>
</dd>
<dd>
<a href="https://github.com/w3c/media-source/issues">
File a bug
</a>
</dd>
<dd>
<a href="https://github.com/w3c/media-source/commits/gh-pages/media-source-respec.html">
Commit history
</a>
</dd>
<dt>Mailing list:</dt>
<dd>
<a href="https://lists.w3.org/Archives/Public/public-html-media/">
</a>
</dd>
<dt>Implementation:</dt>
<dd>
<a href="http://caniuse.com/#feat=mediasource">
Can I use Media Source Extensions?
</a>
</dd>
<dd>
<a href="http://w3c-test.org/media-source/">
Test Suite
</a>
</dd>
<dd>
<a href="https://github.com/w3c/web-platform-tests/tree/master/media-source">
Test Suite repository
</a>
</dd>
</dl>
<p class="copyright">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
2016
<a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
<a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>).
<abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
<a rel="license" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
rules apply.
</p>
<hr title="Separator for header">
</div>
<section id="abstract" class="introductory" property="dc:abstract"><h2 id="h-abstract" resource="#h-abstract"><span property="xhv:role" resource="xhv:heading">Abstract</span></h2>
This specification extends <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#htmlmediaelement-htmlmediaelement">HTMLMediaElement</a></code> [<cite><a class="bibref" href="#bib-HTML51">HTML51</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.
<p>If you wish to make comments or file bugs regarding this document in a manner that is tracked by the editors, please submit them via
<a href="https://github.com/w3c/media-source/issues/new">our public bug database</a>.
</p>
</section><section id="sotd" class="introductory"><h2 id="h-sotd" resource="#h-sotd"><span property="xhv:role" resource="xhv:heading">Status of This Document</span></h2>
<p>
<em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at http://www.w3.org/TR/.</em>
</p>
<p>The working 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>; there may also be open bugs in the <a href="http://w3.org/brief/Mjcw">previous bug tracker</a>. This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid.</p>
<p>Implementors should be aware that this specification is not stable. <strong>Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways.</strong> Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the mailing list mentioned below and take part in the discussions.</p>
<p>The following features are <strong>at risk</strong> and may be removed:</p>
<ul>
<li><p>The <code><a href="#widl-SourceBuffer-appendStream-void-ReadableStream-stream-unsigned-long-long-maxSize">appendStream</a></code> method on the <a href="#sourcebuffer">sourceBuffer</a> object and algorithm steps that are used only by it.</p></li>
<li><p>The <a href="#videoplaybackquality">VideoPlaybackQuality</a> object and the <a href="#htmlvideoelement-extensions">HTMLVideoElement Extensions</a> that use it.</p></li>
<li><p>The <code><a href="#widl-VideoPlaybackQuality-totalFrameDelay">totalFrameDelay</a></code> attribute on the <a href="#videoplaybackquality">VideoPlaybackQuality</a> object.</p></li>
<li><p>The <a href="#idl-def-TrackDefault">TrackDefault</a> object and its related objects, attributes, methods and algorithms, including: <a href="#idl-def-TrackDefaultList">TrackDefaultList</a>, <a href="#widl-SourceBuffer-trackDefaults">SourceBuffer.trackDefaults</a>, <a href="#sourcebuffer-default-track-language">Default track language</a>, <a href="#sourcebuffer-default-track-label">Default track label</a>, and <a href="#sourcebuffer-default-track-kinds">Default track kinds</a>. Implementations still <em class="rfc2119" title="MUST">MUST</em> at least include trivial versions of these default track language/label/kinds algorithms that are used by the <a href="#sourcebuffer-init-segment-received">initialization segment received algorithm</a>. These trivial versions would behave as follows: Trivial default track language and Trivial default track label algorithms <em class="rfc2119" title="MUST">MUST</em> return an empty string, and Trivial default kinds algorithm <em class="rfc2119" title="MUST">MUST</em> return a sequence with a single empty string element in it.</p></li>
</ul>
<p>
For this specification to exit the Candidate Recommendation stage,
two independent implementations as detailed in the <a href="http://dev.w3.org/html5/decision-policy/public-permissive-exit-criteria.html">CR Exit Criteria (Public Permissive version 3)</a> document
will be required to pass each test in the MSE test suite to be
developed by the HTML Media Extensions WG.
</p>
<p>
This document was published by the <a href="http://www.w3.org/html/wg/">HTML Media Extensions Working Group</a> as an Editor's Draft.
If you wish to make comments regarding this document, please send them to
<a href="mailto:[email protected]">[email protected]</a>
(<a href="mailto:[email protected]?subject=subscribe">subscribe</a>,
<a href="http://lists.w3.org/Archives/Public/public-html-media/">archives</a>).
All comments are welcome.
</p>
<p>
Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
Membership. This is a draft document and may be updated, replaced or obsoleted by other
documents at any time. It is inappropriate to cite this document as other than work in
progress.
</p>
<p>
This document was produced by
a group
operating under the
<a id="sotd_patent" property="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
Policy</a>.
<abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/40318/status" rel="disclosure">public list of any patent
disclosures</a>
made in connection with the deliverables of
the group; that page also includes
instructions for disclosing a patent. An individual who has actual knowledge of a patent
which the individual believes contains
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
</p>
<p>This document is governed by the <a id="w3c_process_revision" href="http://www.w3.org/2015/Process-20150901/">1 September 2015 <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><ul class="toc" role="directory"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">2. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">2.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">2.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">2.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">2.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">2.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">2.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">2.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">2.4.6 </span>Duration change</a></li><li class="tocline"><a href="#end-of-stream-algorithm" class="tocxref"><span class="secno">2.4.7 </span>End of stream algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">3. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">3.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">3.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">3.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">3.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">3.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">3.5.3 </span>Append Error Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-prepare-append" class="tocxref"><span class="secno">3.5.4 </span>Prepare Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-buffer-append" class="tocxref"><span class="secno">3.5.5 </span>Buffer Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">3.5.6 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-range-removal" class="tocxref"><span class="secno">3.5.7 </span>Range Removal</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">3.5.8 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-default-track-language" class="tocxref"><span class="secno">3.5.9 </span>Default track language</a></li><li class="tocline"><a href="#sourcebuffer-default-track-label" class="tocxref"><span class="secno">3.5.10 </span>Default track label</a></li><li class="tocline"><a href="#sourcebuffer-default-track-kinds" class="tocxref"><span class="secno">3.5.11 </span>Default track kinds</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">3.5.12 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-removal" class="tocxref"><span class="secno">3.5.13 </span>Coded Frame Removal Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-eviction" class="tocxref"><span class="secno">3.5.14 </span>Coded Frame Eviction Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.15 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">3.5.16 </span>Audio Splice Rendering Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-text-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.17 </span>Text Splice Frame Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">4. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">4.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#videoplaybackquality" class="tocxref"><span class="secno">5. </span>VideoPlaybackQuality Object</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#trackdefault" class="tocxref"><span class="secno">6. </span>TrackDefault Object</a><ul class="toc"><li class="tocline"><a href="#constructors" class="tocxref"><span class="secno">6.1 </span>Constructors</a></li><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">6.2 </span>Attributes</a></li><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">6.3 </span>Methods</a></li></ul></li><li class="tocline"><a href="#trackdefaultlist" class="tocxref"><span class="secno">7. </span>TrackDefaultList Object</a><ul class="toc"><li class="tocline"><a href="#constructors-1" class="tocxref"><span class="secno">7.1 </span>Constructors</a></li><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">7.2 </span>Attributes</a></li><li class="tocline"><a href="#methods-4" class="tocxref"><span class="secno">7.3 </span>Methods</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">8. </span>URL Object Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-5" class="tocxref"><span class="secno">8.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-extensions" class="tocxref"><span class="secno">9. </span>HTMLMediaElement Extensions</a></li><li class="tocline"><a href="#htmlvideoelement-extensions" class="tocxref"><span class="secno">10. </span>HTMLVideoElement Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-6" class="tocxref"><span class="secno">10.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">11. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-6" class="tocxref"><span class="secno">11.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">12. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-7" class="tocxref"><span class="secno">12.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">13. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-8" class="tocxref"><span class="secno">13.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">14. </span>Byte Stream Formats</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">15. </span>Conformance</a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">16. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">17. </span>Acknowledgments</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></nav>
<section id="introduction" typeof="bibo:Chapter" resource="#introduction" property="bibo:hasPart">
<!--OddPage--><h2 id="h-introduction" resource="#h-introduction"><span property="xhv:role" resource="xhv:heading"><span class="secno">1. </span>Introduction</span></h2>
<p>This specification allows JavaScript to dynamically construct media streams for <audio> and <video>.
It defines objects that allow JavaScript to pass media segments to an <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#htmlmediaelement-htmlmediaelement">HTMLMediaElement</a></code> [<cite><a class="bibref" href="#bib-HTML51">HTML51</a></cite>].
A buffering model is also included to describe how the user agent acts when different media segments are
appended at different times. Byte stream specifications used with these extensions are available in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>].</p>
<img src="pipeline_model.svg" alt="Media Source Pipeline Model Diagram" longdesc="pipeline_model_description.html#pipelinedesc">
<section id="goals" typeof="bibo:Chapter" resource="#goals" property="bibo:hasPart">
<h3 id="h-goals" resource="#h-goals"><span property="xhv:role" resource="xhv:heading"><span class="secno">1.1 </span>Goals</span></h3>
<p>This specification was designed with the following goals in mind:</p>
<ul>
<li>Allow JavaScript to construct media streams independent of how the media is fetched.</li>
<li>Define a splicing and buffering model that facilitates use cases like adaptive streaming, ad-insertion, time-shifting, and video editing.</li>
<li>Minimize the need for media parsing in JavaScript.</li>
<li>Leverage the browser cache as much as possible.</li>
<li>Provide requirements for byte stream format specifications.</li>
<li>Not require support for any particular media format or codec.</li>
</ul>
<p>This specification defines:</p>
<ul>
<li>Normative behavior for user agents to enable interoperability between user agents and web applications when processing media data.</li>
<li>Normative requirements to enable other specifications to define media formats to be used within this specification.</li>
</ul>
</section>
<section id="definitions" typeof="bibo:Chapter" resource="#definitions" property="bibo:hasPart">
<h3 id="h-definitions" resource="#h-definitions"><span property="xhv:role" resource="xhv:heading"><span class="secno">1.2 </span>Definitions</span></h3>
<dl>
<dt id="active-track-buffers">Active Track Buffers</dt>
<dd><p>The <a href="#track-buffer">track buffers</a> that provide <a href="#coded-frame">coded frames</a> for the <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-audiotrack-enabled">enabled</a></code>
<code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-audiotracks">audioTracks</a></code>, the <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-videotrack-selected">selected</a></code> <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-videotracks">videoTracks</a></code>, and the
<code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-texttrackmode-showing">"showing"</a></code> or <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-texttrackmode-hidden">"hidden"</a></code> <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-texttracks">textTracks</a></code>. All these tracks are associated with
<a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in the <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> list.</p>
</dd>
<dt id="append-window">Append Window</dt>
<dd><p>A <a href="#presentation-timestamp">presentation timestamp</a> range used to filter out <a href="#coded-frame">coded frames</a> while appending. The append window represents a single
continuous time range with a single start time and end time. Coded frames with <a href="#presentation-timestamp">presentation timestamp</a> within this range are allowed to be appended
to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> while coded frames outside this range are filtered out. The append window start and end times are controlled by
the <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> and <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> attributes respectively.</p></dd>
<dt id="coded-frame">Coded Frame</dt>
<dd><p>A unit of media data that has a <a href="#presentation-timestamp">presentation timestamp</a>, a <a href="#decode-timestamp">decode timestamp</a>, and a <a href="#coded-frame-duration">coded frame duration</a>.</p></dd>
<dt id="coded-frame-duration">Coded Frame Duration</dt>
<dd>
<p>The duration of a <a href="#coded-frame">coded frame</a>. For video and text, the duration indicates how long the video frame or text <em class="rfc2119" title="SHOULD">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 id="coded-frame-end-timestamp">Coded Frame End Timestamp</dt>
<dd>
<p>The sum of a <a href="#coded-frame">coded frame</a> <a href="#presentation-timestamp">presentation timestamp</a> and its
<a href="#coded-frame-duration">coded frame duration</a>. It represents the <a href="#presentation-timestamp">presentation timestamp</a> that immediately follows the coded frame.</p>
</dd>
<dt id="coded-frame-group">Coded Frame Group</dt>
<dd><p>A group of <a href="#coded-frame">coded frames</a> that are adjacent and have monotonically increasing <a href="#decode-timestamp">decode timestamps</a> without any gaps. Discontinuities detected by the
<a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> and <code><a href="#widl-SourceBuffer-abort-void">abort()</a></code> calls trigger the start of a new coded frame group.</p>
</dd>
<dt id="decode-timestamp">Decode Timestamp</dt>
<dd>
<p> The decode timestamp indicates the latest time at which the frame needs to be decoded assuming instantaneous decoding and rendering of this and any dependant frames (this is equal to the <a href="#presentation-timestamp">presentation timestamp</a> of the earliest frame, in <a href="#presentation-order">presentation order</a>, that is dependant on this frame). If frames can be decoded out of <a href="#presentation-order">presentation order</a>, then the decode timestamp <em class="rfc2119" title="MUST">MUST</em> be present in or derivable from the byte stream. The user agent <em class="rfc2119" title="MUST">MUST</em> run the <a href="#sourcebuffer-append-error">append error algorithm</a> with the <var>decode error</var> parameter set to true if this is not the case. If frames cannot be decoded out of <a href="#presentation-order">presentation order</a> and a decode timestamp is not present in the byte stream, then the decode timestamp is equal to the <a href="#presentation-timestamp">presentation timestamp</a>.</p>
</dd>
<dt id="displayed-frame-delay">Displayed Frame Delay</dt>
<dd>
<p>The delay between a frame's presentation time and the actual time it was displayed, in a double-precision value in seconds and rounded to the nearest display refresh interval. This
delay is always greater than or equal to zero since frames <em class="rfc2119" title="MUST">MUST</em> never be displayed before their presentation time. Non-zero delays are a sign of playback jitter
and possible loss of A/V sync.</p>
</dd>
<dt id="init-segment">Initialization Segment</dt>
<dd>
<p>A sequence of bytes that contain all of the initialization information required to decode a sequence of <a href="#media-segment">media segments</a>. This includes codec initialization data, <a href="#track-id">Track ID</a> mappings for multiplexed segments, and timestamp offsets (e.g., edit lists).</p>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note1"><span>Note</span></div><p class="">The <a href="#byte-stream-format-specs">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] contain format specific examples.</p></div>
</dd><dt id="media-segment">Media Segment</dt>
<dd>
<p>A sequence of bytes that contain packetized & timestamped media data for a portion of the <a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#media-timeline">media timeline</a>. Media segments are always associated with the most recently appended <a href="#init-segment">initialization segment</a>.</p>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note2"><span>Note</span></div><p class="">The <a href="#byte-stream-format-specs">byte stream format specifications</a> in the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] contain format specific examples.</p></div>
</dd>
<dt id="mediasource-object-url">MediaSource object URL</dt>
<dd>
<p>A MediaSource object URL is a unique <a href="https://www.w3.org/TR/FileAPI/#url">Blob URI</a> [<cite><a class="bibref" href="#bib-FILE-API">FILE-API</a></cite>] created by <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>. It is used to attach a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object to an HTMLMediaElement.</p>
<p>These URLs are the same as a <a href="https://www.w3.org/TR/FileAPI/#url">Blob URI</a>, except that anything in the definition of that feature that refers to <a href="https://www.w3.org/TR/FileAPI/#dfn-file">File</a> and <a href="https://www.w3.org/TR/FileAPI/#dfn-Blob">Blob</a> objects is hereby extended to also apply to <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> objects.</p>
<p>The <a href="https://www.w3.org/TR/html51/browsers.html#origin">origin</a> of the MediaSource object URL is the <a href="https://www.w3.org/TR/html51/webappapis.html#relevant-settings-object">relevant settings object</a> of <code>this</code> during the call to <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>.</p>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note3"><span>Note</span></div><p class="">For example, the <a href="https://www.w3.org/TR/html51/browsers.html#origin">origin</a> of the MediaSource object URL affects the way that the media element is <a href="https://www.w3.org/TR/html51/semantics-scripting.html#security-with-canvas-elements">consumed by canvas</a>.</p></div>
</dd>
<dt id="parent-media-source">Parent Media Source</dt>
<dd><p>The parent media source of a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object is the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object that created it.</p></dd>
<dt id="presentation-start-time">Presentation Start Time</dt>
<dd><p>The presentation start time is the earliest time point in the presentation and specifies the <a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#initial-playback-position">initial playback position</a> and <a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#earliest-possible-position">earliest possible position</a>. All presentations created using this specification have a presentation start time of 0.</p></dd>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note4"><span>Note</span></div><p class="">For the purposes of determining if <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-buffered">HTMLMediaElement.buffered</a></code> contains a <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRange</a></code> that includes the current playback position, implementations <em class="rfc2119" title="MAY">MAY</em> choose to allow a current playback position at or after <a href="#presentation-start-time">presentation start time</a> and before the first <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRange</a></code> to play the first <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRange</a></code> if that <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRange</a></code> starts within a reasonably short time, like 1 second, after <a href="#presentation-start-time">presentation start time</a>. This allowance accommodates the reality that muxed streams commonly do not begin all tracks precisely at <a href="#presentation-start-time">presentation start time</a>. Implementations <em class="rfc2119" title="MUST">MUST</em> report the actual buffered range, regardless of this allowance.</p></div>
<dt id="presentation-interval">Presentation Interval</dt>
<dd>
<p>The presentation interval of a <a href="#coded-frame">coded frame</a> is the time interval from its <a href="#presentation-timestamp">presentation timestamp</a> to the <a href="#presentation-timestamp">presentation timestamp</a> plus the <a href="#coded-frame-duration">coded frame's duration</a>. For example, if a coded frame has a presentation timestamp of 10 seconds and a <a href="#coded-frame-duration">coded frame duration</a> of 100 milliseconds, then the presentation interval would be [10-10.1). Note that the start of the range is inclusive, but the end of the range is exclusive.</p>
</dd>
<dt id="presentation-order">Presentation Order</dt>
<dd>
<p>The order that <a href="#coded-frame">coded frames</a> are rendered in the presentation. The presentation order is achieved by ordering <a href="#coded-frame">coded frames</a> in monotonically increasing order by their <a href="#presentation-timestamp">presentation timestamps</a>.</p>
</dd>
<dt id="presentation-timestamp">Presentation Timestamp</dt>
<dd>
<p>A reference to a specific time in the presentation. The presentation timestamp in a <a href="#coded-frame">coded frame</a> indicates when the frame <em class="rfc2119" title="SHOULD">SHOULD</em> be rendered.</p>
</dd>
<dt id="random-access-point">Random Access Point</dt>
<dd><p>A position in a <a href="#media-segment">media segment</a> where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.</p></dd>
<dt id="sourcebuffer-byte-stream-format-spec">SourceBuffer byte stream format specification</dt>
<dd><p>The specific <a href="#byte-stream-format-specs">byte stream format specification</a> that describes the format of the byte stream accepted by a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> instance. The
<a href="#byte-stream-format-specs">byte stream format specification</a>, for a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object, is selected based on the <var>type</var> passed to the
<code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code> call that created the object.</p></dd>
<dt id="sourcebuffer-configuration">SourceBuffer configuration</dt>
<dd><p>A specific set of tracks distributed across one or more <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>
objects owned by a single <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> instance.</p>
<p>Implementations <em class="rfc2119" title="MUST">MUST</em> support at least 1 <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object with the following
configurations:</p>
<ul>
<li>A single SourceBuffer with 1 audio track and/or 1 video track.</li>
<li>Two SourceBuffers with one handling a single audio track and the other handling a single video track.</li>
</ul>
<p>MediaSource objects <em class="rfc2119" title="MUST">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 id="track-description">Track Description</dt>
<dd><p>A byte stream format specific structure that provides the <a href="#track-id">Track ID</a>, codec configuration, and other metadata for a single track. Each track description inside a single <a href="#init-segment">initialization segment</a> has a unique <a href="#track-id">Track ID</a>. The user agent <em class="rfc2119" title="MUST">MUST</em> run the <a href="#sourcebuffer-append-error">append error algorithm</a> with the <var>decode error</var> parameter set to true if the <a href="#track-id">Track ID</a> is not unique within the <a href="#init-segment">initialization segment</a>.</p></dd>
<dt id="track-id">Track ID</dt>
<dd><p>A Track ID is a byte stream format specific identifier that marks sections of the byte stream as being part of a specific track. The Track ID in a <a href="#track-description">track description</a> identifies which sections of a <a href="#media-segment">media segment</a> belong to that track.</p></dd>
</dl>
</section>
</section>
<section id="mediasource" typeof="bibo:Chapter" resource="#mediasource" property="bibo:hasPart">
<!--OddPage--><h2 id="h-mediasource" resource="#h-mediasource"><span property="xhv:role" resource="xhv:heading"><span class="secno">2. </span>MediaSource Object</span></h2>
<p>The MediaSource object represents a source of media data for an HTMLMediaElement. It keeps track of the <code><a href="#widl-MediaSource-readyState">readyState</a></code> for this source as well as a list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects that can be used to add media data to the presentation. MediaSource objects are created by the web application and then attached to an HTMLMediaElement. The application uses the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> to add media data to this source. The HTMLMediaElement fetches this media data from the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object when it is needed during playback.</p>
<p>Each <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object has a <dfn id="live-seekable-range" data-dfn-for="" data-dfn-type="dfn">live seekable range</dfn> variable that stores a <a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#normalized-timeranges-object">normalized TimeRanges object</a>. This variable is initialized to an empty <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRanges</a></code> object when the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object is created, is maintained by <code><a href="#widl-MediaSource-setLiveSeekableRange-void-double-start-double-end">setLiveSeekableRange()</a></code> and <code><a href="#widl-MediaSource-clearLiveSeekableRange-void">clearLiveSeekableRange()</a></code>, and is used in <a href="#htmlmediaelement-extensions">HTMLMediaElement Extensions</a> to modify <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-seekable">HTMLMediaElement.seekable</a></code> behavior.</p>
<pre class="idl"><span class="idlEnum" id="idl-def-ReadyState">enum <span class="idlEnumID">ReadyState</span> {
"<a href="#idl-def-ReadyState.closed" class="idlEnumItem">closed</a>",
"<a href="#idl-def-ReadyState.open" class="idlEnumItem">open</a>",
"<a href="#idl-def-ReadyState.ended" class="idlEnumItem">ended</a>"
};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-ReadyState.closed">closed</code></td><td>
Indicates the source is not currently attached to a media element.
</td></tr><tr><td><code id="idl-def-ReadyState.open">open</code></td><td>
The source has been opened by a media element and is ready for data to be appended to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.
</td></tr><tr><td><code id="idl-def-ReadyState.ended">ended</code></td><td>
The source is still attached to a media element, but <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> has been called.
</td></tr></tbody></table>
<pre class="idl"><span class="idlEnum" id="idl-def-EndOfStreamError">enum <span class="idlEnumID">EndOfStreamError</span> {
"<a href="#idl-def-EndOfStreamError.network" class="idlEnumItem">network</a>",
"<a href="#idl-def-EndOfStreamError.decode" class="idlEnumItem">decode</a>"
};</span></pre><table class="simple"><tbody><tr><th colspan="2">Enumeration description</th></tr><tr><td><code id="idl-def-EndOfStreamError.network">network</code></td><td>
<p>Terminates playback and signals that a network error has occured.</p>
<div class="note"><div class="note-title marker" aria-level="3" role="heading" id="h-note5"><span>Note</span></div><p class="">JavaScript applications <em class="rfc2119" title="SHOULD">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>
</td></tr><tr><td><code id="idl-def-EndOfStreamError.decode">decode</code></td><td>
<p>Terminates playback and signals that a decoding error has occured.</p>
<div class="note"><div class="note-title marker" aria-level="3" role="heading" id="h-note6"><span>Note</span></div><p class="">JavaScript applications <em class="rfc2119" title="SHOULD">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>
</td></tr></tbody></table>
<pre class="idl"><span class="idlInterface" id="idl-def-MediaSource">[<span class="extAttr">Constructor</span>]
interface <span class="idlInterfaceID">MediaSource</span> : <span class="idlSuperclass"><code><a href="https://dom.spec.whatwg.org/#eventtarget" class="idlType">EventTarget</a></code></span> {
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-ReadyState" class="idlType"><code>ReadyState</code></a></span> <span class="idlAttrName"><a href="#widl-MediaSource-readyState">readyState</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-unrestricted-double" class="idlType">unrestricted double</a></code></span> <span class="idlAttrName"><a href="#widl-MediaSource-duration">duration</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span> <span class="idlAttrName"><a href="#widl-MediaSource-onsourceopen">onsourceopen</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span> <span class="idlAttrName"><a href="#widl-MediaSource-onsourceended">onsourceended</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span> <span class="idlAttrName"><a href="#widl-MediaSource-onsourceclose">onsourceclose</a></span>;</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span> <span class="idlMethName"><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-DOMString" class="idlType">DOMString</a></code></span> <span class="idlParamName">type</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></span> <span class="idlMethName"><a href="#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer">removeSourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span> <span class="idlParamName">sourceBuffer</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></span> <span class="idlMethName"><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream</a></span> (<span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></span> <span class="idlParamName">error</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></span> <span class="idlMethName"><a href="#widl-MediaSource-setLiveSeekableRange-void-double-start-double-end">setLiveSeekableRange</a></span> (<span class="idlParam"><span class="idlParamType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-double" class="idlType">double</a></code></span> <span class="idlParamName">start</span></span>, <span class="idlParam"><span class="idlParamType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-double" class="idlType">double</a></code></span> <span class="idlParamName">end</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></span> <span class="idlMethName"><a href="#widl-MediaSource-clearLiveSeekableRange-void">clearLiveSeekableRange</a></span> ();</span>
<span class="idlMethod"> static <span class="idlMethType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-boolean" class="idlType">boolean</a></code></span> <span class="idlMethName"><a href="#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported</a></span> (<span class="idlParam"><span class="idlParamType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-DOMString" class="idlType">DOMString</a></code></span> <span class="idlParamName">type</span></span>);</span>
};</span></pre><section id="attributes" typeof="bibo:Chapter" resource="#attributes" property="bibo:hasPart"><h3 id="h-attributes" resource="#h-attributes"><span property="xhv:role" resource="xhv:heading"><span class="secno">2.1 </span>Attributes</span></h3><dl class="attributes"><dt id="widl-MediaSource-activeSourceBuffers"><code>activeSourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly </dt><dd>
<p>Contains the subset of <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> that are providing the
<a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-videotrack-selected">selected video track</a>, the
<a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-audiotrack-enabled">enabled audio track(s)</a>, and the
<code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-texttrackmode-showing">"showing"</a></code> or <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-texttrackmode-hidden">"hidden"</a></code> text track(s).
</p>
<p><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in this list <em class="rfc2119" title="MUST">MUST</em> appear in the same order as they appear in
the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute; e.g., if only sourceBuffers[0] and
sourceBuffers[3] are in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then activeSourceBuffers[0] <em class="rfc2119" title="MUST">MUST</em>
equal sourceBuffers[0] and activeSourceBuffers[1] <em class="rfc2119" title="MUST">MUST</em> equal sourceBuffers[3].
</p>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note7"><span>Note</span></div><p class="">The <a href="#active-source-buffer-changes">Changes to selected/enabled track state</a> section describes how this attribute gets
updated.</p></div>
</dd><dt id="widl-MediaSource-duration"><code>duration</code> of type <span class="idlAttrType"><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-unrestricted-double" class="idlType">unrestricted double</a></code></span></dt><dd>
<p>Allows the web application to set the presentation duration. The duration is initially set to NaN when the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object is created.</p>
<p>On getting, run the following steps:</p>
<ol>
<li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> then return NaN and abort these steps.</li>
<li>Return the current value of the attribute.</li>
</ol>
<p>On setting, run the following steps:</p>
<ol>
<li>If the value being set is negative or NaN then throw a <code>TypeError</code> exception and abort these steps.</li>
<li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not <code><a href="#idl-def-ReadyState.open">"open"</a></code> then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the value being assigned to this attribute.
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note8"><span>Note</span></div><p class=""><code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code>, <code><a href="#widl-SourceBuffer-appendStream-void-ReadableStream-stream-unsigned-long-long-maxSize">appendStream()</a></code> and <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> can update the duration under certain circumstances.</p></div>
</li>
</ol>
</dd><dt id="widl-MediaSource-onsourceclose"><code>onsourceclose</code> of type <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span></dt><dd>
<p>The event handler for the <code><a href="#dom-evt-sourceclose">sourceclose</a></code> event.</p>
</dd><dt id="widl-MediaSource-onsourceended"><code>onsourceended</code> of type <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span></dt><dd>
<p>The event handler for the <code><a href="#dom-evt-sourceended">sourceended</a></code> event.</p>
</dd><dt id="widl-MediaSource-onsourceopen"><code>onsourceopen</code> of type <span class="idlAttrType"><code><a href="https://www.w3.org/TR/html51/webappapis.html#typedefdef-eventhandlernonnull-eventhandler" class="idlType">EventHandler</a></code></span></dt><dd>
<p>The event handler for the <code><a href="#dom-evt-sourceopen">sourceopen</a></code> event.</p>
</dd><dt id="widl-MediaSource-readyState"><code>readyState</code> of type <span class="idlAttrType"><a href="#idl-def-ReadyState" class="idlType"><code>ReadyState</code></a></span>, readonly </dt><dd>
<p>Indicates the current state of the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object. When the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is created <code><a href="#widl-MediaSource-readyState">readyState</a></code> <em class="rfc2119" title="MUST">MUST</em> be set to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code>.
</p></dd><dt id="widl-MediaSource-sourceBuffers"><code>sourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly </dt><dd>
Contains the list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects associated with this <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>. When <code><a href="#widl-MediaSource-readyState">readyState</a></code> equals <code><a href="#idl-def-ReadyState.closed">"closed"</a></code> this list will be empty. Once <code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions to <code><a href="#idl-def-ReadyState.open">"open"</a></code> SourceBuffer objects can be added to this list by using <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.
</dd></dl></section><section id="methods" typeof="bibo:Chapter" resource="#methods" property="bibo:hasPart"><h3 id="h-methods" resource="#h-methods"><span property="xhv:role" resource="xhv:heading"><span class="secno">2.2 </span>Methods</span></h3><dl class="methods"><dt id="widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type"><code>addSourceBuffer</code></dt><dd>
<p>Adds a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> to <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</p>
<table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">type</td><td class="prmType"><code><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-DOMString" class="idlType">DOMString</a></code></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptFalse"><span role="img" aria-label="False">✘</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
<li>If <var>type</var> is an empty string then throw a <code>TypeError</code> exception and abort these steps.</li>
<li>If <var>type</var> contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified for the other <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw a <code><a href="https://www.w3.org/TR/WebIDL-1/#notsupportederror">NotSupportedError</a></code> exception and abort these steps.</li>
<li>If the user agent can't handle any more SourceBuffer objects or if creating a SourceBuffer
based on <var>type</var> would result in an unsupported <a href="#sourcebuffer-configuration">SourceBuffer configuration</a>,
then throw a <code><a href="https://www.w3.org/TR/WebIDL-1/#quotaexceedederror">QuotaExceededError</a></code> exception and abort these steps.
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note9"><span>Note</span></div><p class="">For example, a user agent <em class="rfc2119" title="MAY">MAY</em> throw a <code><a href="https://www.w3.org/TR/WebIDL-1/#quotaexceedederror">QuotaExceededError</a></code> exception if the media element has reached the
<code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-have_metadata">HAVE_METADATA</a></code> readyState. This can occur if the user agent's media engine does not support adding more tracks during
playback.
</p></div>
</li>
<li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not in the <code><a href="#idl-def-ReadyState.open">"open"</a></code> state then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>Create a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object and associated resources.</li>
<li>Set the <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> on the new object to the value in the
"Generate Timestamps Flag" column of the byte stream format registry [<cite><a class="bibref" href="#bib-MSE-REGISTRY">MSE-REGISTRY</a></cite>] entry
that is associated with <var>type</var>.
</li><li>
<dl class="switch">
<dt>If the <var><a href="#sourcebuffer-generate-timestamps-flag">generate timestamps flag</a></var> equals true:</dt>
<dd>
Set the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute on the new object to
<code><a href="#idl-def-AppendMode.sequence">"sequence"</a></code>.
</dd>
<dt>Otherwise:</dt>
<dd>
Set the <code><a href="#widl-SourceBuffer-mode">mode</a></code> attribute on the new object to
<code><a href="#idl-def-AppendMode.segments">"segments"</a></code>.
</dd>
</dl>
</li>
<li>Add the new object to <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> and <a href="https://www.w3.org/TR/html51/webappapis.html#queuing">queue a task</a> to <a href="https://www.w3.org/TR/html51/infrastructure.html#fire">fire a simple event</a> named <code><a href="#dom-evt-addsourcebuffer">addsourcebuffer</a></code> at <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
<li>Return the new object.</li>
</ol></dd><dt id="widl-MediaSource-clearLiveSeekableRange-void"><code>clearLiveSeekableRange</code></dt><dd>
<p>Updates the <var><a href="#live-seekable-range">live seekable range</a></var> variable used in <a href="#htmlmediaelement-extensions">HTMLMediaElement Extensions</a> to modify <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-seekable">HTMLMediaElement.seekable</a></code> behavior.</p>
<div><em>No parameters.</em></div><div><em>Return type: </em><code><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
<li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not <code><a href="#idl-def-ReadyState.open">"open"</a></code> then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>If <var><a href="#live-seekable-range">live seekable range</a></var> contains a range, then set <var><a href="#live-seekable-range">live seekable range</a></var> to be a new empty <code><a href="https://www.w3.org/TR/html51/semantics-embedded-content.html#timeranges-timeranges">TimeRanges</a></code> object.
</li></ol></dd><dt id="widl-MediaSource-endOfStream-void-EndOfStreamError-error"><code>endOfStream</code></dt><dd>
<p>Signals the end of the stream.</p>
<table class="parameters"><tbody><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">error</td><td class="prmType"><code><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></code></td><td class="prmNullFalse"><span role="img" aria-label="False">✘</span></td><td class="prmOptTrue"><span role="img" aria-label="True">✔</span></td><td class="prmDesc"></td></tr></tbody></table><div><em>Return type: </em><code><code><a href="https://www.w3.org/TR/WebIDL-1/#idl-void" class="idlType">void</a></code></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
<li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not in the <code><a href="#idl-def-ReadyState.open">"open"</a></code> state then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="https://www.w3.org/TR/WebIDL-1/#invalidstateerror">InvalidStateError</a></code> exception and abort these steps.</li>
<li>Run the <a href="#end-of-stream-algorithm">end of stream algorithm</a> with the <var>error</var> parameter set to <var>error</var>.</li>
</ol></dd><dt id="widl-MediaSource-isTypeSupported-boolean-DOMString-type"><code>isTypeSupported</code>, static</dt><dd>
<p>Check to see whether the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is capable of creating <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects for the specified MIME type.</p>
<div class="note"><div class="note-title marker" aria-level="4" role="heading" id="h-note10"><span>Note</span></div><p class="">