-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathindex.bs
1401 lines (1276 loc) · 52.6 KB
/
index.bs
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
<pre class='metadata'>
Title: Media Capabilities
Repository: w3c/media-capabilities
Status: ED
ED: https://w3c.github.io/media-capabilities/
TR: https://www.w3.org/TR/media-capabilities/
Shortname: media-capabilities
Level: None
Group: mediawg
Editor: Jean-Yves Avenard, w3cid 115886, Apple Inc. https://www.apple.com/
Editor: Mark Foltz, w3cid 68454, Google Inc. https://www.google.com/, https://github.com/markafoltz
Former Editor: Will Cassella, w3cid 139598, Google Inc. https://www.google.com/
Former Editor: Mounir Lamouri, w3cid 45389, Google Inc. https://www.google.com/
Former Editor: Chris Cunningham, w3cid 114832, Google Inc. https://www.google.com/
Former Editor: Vi Nguyen, w3cid 116349, Microsoft Corporation https://www.microsoft.com/
Abstract: This specification intends to provide APIs to allow websites to make
Abstract: an optimal decision when picking media content for the user. The APIs
Abstract: will expose information about the decoding and encoding capabilities
Abstract: for a given format but also output capabilities to find the best match
Abstract: based on the device's display.
!Participate: <a href='https://github.com/w3c/media-capabilities'>Git Repository.</a>
!Participate: <a href='https://github.com/w3c/media-capabilities/issues/new'>File an issue.</a>
!Version History: <a href='https://github.com/w3c/media-capabilities/commits'>https://github.com/w3c/media-capabilities/commits</a>
</pre>
<pre class='link-defaults'>
spec:html; type:dfn; for:realm; text:global object
</pre>
<pre class='anchors'>
spec: media-source; urlPrefix: https://www.w3.org/TR/media-source/
type: interface
for: MediaSource; text: MediaSource; url: #mediasource
type: method
for: MediaSource; text: isTypeSupported(); url: #dom-mediasource-istypesupported
spec: mediastream-recording; urlPrefix: https://www.w3.org/TR/mediastream-recording/#
type:interface
text: MediaRecorder; url: mediarecorder
spec: mimesniff; urlPrefix: https://mimesniff.spec.whatwg.org/#
type: dfn; text: valid mime type; url: valid-mime-type
</pre>
<pre class='biblio'>
{
"SMPTE-ST-2084": {
"href": "https://ieeexplore.ieee.org/document/7291452",
"title": "High Dynamic Range Electro-Optical Transfer Function of Mastering Reference Displays",
"publisher": "SMPTE",
"date": "2014",
"id": "SMPTE-ST-2084"
},
"SMPTE-ST-2086": {
"href": "https://ieeexplore.ieee.org/document/7291707",
"title": "Mastering Display Color Volume Metadata Supporting High Luminance and Wide Color Gamut Images",
"publisher": "SMPTE",
"date": "2014",
"id": "SMPTE-ST-2086"
},
"SMPTE-ST-2094": {
"href": "https://ieeexplore.ieee.org/document/7513361",
"title": "Dynamic Metadata for Color Volume Transform Core Components",
"publisher": "SMPTE",
"date": "2016",
"id": "SMPTE-ST-2094"
},
"ENCRYPTED-MEDIA-DRAFT": {
"href": "https://w3c.github.io/encrypted-media",
"title": "Encrypted Media Extensions",
"publisher": "W3C",
"date": "13 December 2019"
}
}
</pre>
<section class='non-normative'>
<h2 id='introduction'>Introduction</h2>
<em>This section is non-normative</em>
<p>
This specification defines an API to query the user agent with regards
to its audio and video decoding and encoding capabilities,
based on information such as the codecs, profile, resolution, bitrates,
etc., of the media. The API indicates if the configuration is supported
and whether the playback is expected to be smooth and/or power efficient.
</p>
<p>
This specification focuses on encoding and decoding capabilities.
It is expected to be used with other web APIs that provide information about
the display properties, such as supported color gamut or dynamic range capabilities,
which enable web applications to pick the right content for the display and to,
for example, avoid providing HDR content to an SDR display.
</p>
</section>
<section>
<h2 id='decoding-encoding-capabilities'>Decoding and Encoding Capabilities</h2>
<section>
<h3 id='media-configurations'>Media Configurations</h3>
<section>
<h4 id='mediaconfiguration'>MediaConfiguration</h4>
<xmp class='idl'>
dictionary MediaConfiguration {
VideoConfiguration video;
AudioConfiguration audio;
};
</xmp>
<xmp class='idl'>
dictionary MediaDecodingConfiguration : MediaConfiguration {
required MediaDecodingType type;
MediaCapabilitiesKeySystemConfiguration keySystemConfiguration;
};
</xmp>
<xmp class='idl'>
dictionary MediaEncodingConfiguration : MediaConfiguration {
required MediaEncodingType type;
};
</xmp>
<p>
The input to the decoding capabilities is represented by a
{{MediaDecodingConfiguration}} dictionary and the input to the encoding
capabilities by a {{MediaEncodingConfiguration}} dictionary.
</p>
<p>
For a {{MediaConfiguration}} to be a <dfn>valid
MediaConfiguration</dfn>, all of the following conditions MUST be true:
<ol>
<li>
<code>audio</code> and/or <code>video</code> MUST [=map/exist=].
</li>
<li>
<code>audio</code> MUST be a <a>valid audio configuration</a> if
it [=map/exists=].
</li>
<li>
<code>video</code> MUST be a <a>valid video configuration</a> if
it [=map/exists=].
</li>
</ol>
</p>
<p>
For a {{MediaDecodingConfiguration}} to be a <dfn>valid
MediaDecodingConfiguration</dfn>, all of the following conditions MUST
be true:
<ol>
<li>
It MUST be a <a>valid MediaConfiguration</a>.
</li>
<li>
If <code>keySystemConfiguration</code> [=map/exists=]:
<ol>
<li>
The <code>type</code> MUST be {{media-source}} or {{file}}.
</li>
<li>
If <code>keySystemConfiguration.audio</code> [=map/exists=],
<code>audio</code> MUST also [=map/exist=].
</li>
<li>
If <code>keySystemConfiguration.video</code> [=map/exists=],
<code>video</code> MUST also [=map/exist=].
</li>
</ol>
</li>
</ol>
</p>
<p>
For a {{MediaDecodingConfiguration}} to describe [[!ENCRYPTED-MEDIA]], a
{{keySystemConfiguration}} MUST [=map/exist=].
</p>
</section>
<section>
<h4 id='mediadecodingtype'>MediaDecodingType</h4>
<xmp class='idl'>
enum MediaDecodingType {
"file",
"media-source",
"webrtc"
};
</xmp>
<p>
A {{MediaDecodingConfiguration}} has three types:
<ul>
<li><dfn for='MediaDecodingType' enum-value>file</dfn> is used to
represent a configuration that is meant to be used for playback of
media sources other than {{MediaSource/MediaSource}} as defined in
[[media-source]] and {{RTCPeerConnection}} as defined in [[webrtc]]. </li>
<li><dfn for='MediaDecodingType' enum-value>media-source</dfn> is used
to represent a configuration that is meant to be used for playback of
a {{MediaSource/MediaSource}}. </li>
<li><dfn for='MediaDecodingType' enum-value>webrtc</dfn> is used to
represent a configuration that is meant to be received using
{{RTCPeerConnection}}.</li>
</ul>
</p>
</section>
<section>
<h4 id='mediaencodingtype'>MediaEncodingType</h4>
<xmp class='idl'>
enum MediaEncodingType {
"record",
"webrtc"
};
</xmp>
<p>
A {{MediaEncodingConfiguration}} can have one of two types:
<ul>
<li><dfn for='MediaEncodingType' enum-value>record</dfn> is used to
represent a configuration for recording of media,
<span class="informative">e.g., using {{MediaRecorder}} as defined in
[[mediastream-recording]]</span>.</li>
<li><dfn for='MediaEncodingType' enum-value>webrtc</dfn> is used to
represent a configuration that is meant to be transmitted using
{{RTCPeerConnection}} as defined in [[webrtc]]</span>).</li>
</ul>
</p>
</section>
<section>
<h4 id='mime-type'>MIME types</h4>
<p>
In the context of this specification, a MIME type is also called content
type. A <dfn>valid media MIME type</dfn> is a string that is a <a>valid
MIME type</a> per [[mimesniff]].
</p>
<p>
Please note that the definition of MIME subtypes and parameters is
context dependent. For {{file}}, {{media-source}}, and {{record}}, the
MIME types are specified as defined for [[#http|HTTP]], whereas for
{{MediaDecodingType/webrtc}} the MIME types are specified as
defined for [[#rtp|RTP]].
</p>
<p>
A <dfn>valid audio MIME type</dfn> is a string that is a <a>valid media
MIME type</a> and for which the <code>type</code> per [[RFC9110]] is
either <code>audio</code> or <code>application</code>.
</p>
<p>
A <dfn>valid video MIME type</dfn> is a string that is a <a>valid media
MIME type</a> and for which the <code>type</code> per [[RFC9110]] is
either <code>video</code> or <code>application</code>.
</p>
<section>
<h5 id='http'>HTTP</h5>
<p>
If the MIME type does not imply a codec, the string MUST also have one
and only one parameter that is named <code>codecs</code> with a value
describing a single media codec. Otherwise, it MUST contain no
parameters.
</p>
</section>
<section>
<h5 id='rtp'>RTP</h5>
<p>
The MIME types used with RTP are defined in the specifications of the
corresponding RTP payload formats [[RFC4855]] [[RFC6838]]. The codec
name is typically specified as subtype and zero or more parameters
may be present depending on the codec.
</p>
</section>
</section>
<section>
<h4 id='videoconfiguration'>VideoConfiguration</h4>
<xmp class='idl'>
dictionary VideoConfiguration {
required DOMString contentType;
required unsigned long width;
required unsigned long height;
required unsigned long long bitrate;
required double framerate;
boolean hasAlphaChannel;
HdrMetadataType hdrMetadataType;
ColorGamut colorGamut;
TransferFunction transferFunction;
DOMString scalabilityMode;
boolean spatialScalability;
};
</xmp>
<p>
The <dfn for='VideoConfiguration' dict-member>contentType</dfn> member
represents the MIME type of the video track.
</p>
<p>
To check if a {{VideoConfiguration}} <var>configuration</var> is a
<dfn>valid video configuration</dfn>, the following steps MUST be run:
<ol>
<li>
If <var>configuration</var>'s {{VideoConfiguration/contentType}} is
not a <a>valid video MIME type</a>, return <code>false</code> and
abort these steps.
</li>
<li>
If {{VideoConfiguration/framerate}} is not finite or is not greater
than 0, return <code>false</code> and abort these steps.
</li>
<li>
If an optional member is specified for a {{MediaDecodingType}} or
{{MediaEncodingType}} to which it's not applicable, return
<code>false</code> and abort these steps. See applicability rules
in the member definitions below.
<li>
Return <code>true</code>.
</li>
</ol>
</p>
<p>
The <dfn for='VideoConfiguration' dict-member>width</dfn> and
<dfn for='VideoConfiguration' dict-member>height</dfn> members represent
respectively the visible horizontal and vertical encoded pixels in the
encoded video frames.
</p>
<p>
The <dfn for='VideoConfiguration' dict-member>bitrate</dfn> member
represents the average bitrate of the video track given in units of bits
per second. In the case of a video stream encoded at a constant bit rate
(CBR) this value should be accurate over a short term window. For the
case of variable bit rate (VBR) encoding, this value should be usable to
allocate any necessary buffering and throughput capability to
provide for the un-interrupted decoding of the video stream over the
long-term based on the indicated {{VideoConfiguration/contentType}}.
</p>
<p>
The <dfn for='VideoConfiguration' dict-member>framerate</dfn> member
represents the framerate of the video track. The framerate is the number
of frames used in one second (frames per second). It is represented as a
double.
</p>
<p>
The <dfn for='VideoConfiguration' dict-member>hasAlphaChannel</dfn> member
represents whether the video track contains alpha channel information. If
true, the encoded video stream can produce per-pixel alpha channel information
when decoded. If false, the video stream cannot produce per-pixel alpha channel
information when decoded. If undefined, the UA should determine whether the
video stream encodes alpha channel information based on the indicated
{{VideoConfiguration/contentType}}, if possible. Otherwise, the UA should
presume that the video stream cannot produce alpha channel information.
</p>
<p>
If present, the <dfn for='VideoConfiguration' dict-member>hdrMetadataType</dfn>
member represents that the video track includes the specified HDR
metadata type, which the UA needs to be capable of interpreting for tone
mapping the HDR content to a color volume and luminance of the output
device. Valid inputs are defined by {{HdrMetadataType}}. hdrMetadataType is
only applicable to {{MediaDecodingConfiguration}} for types {{media-source}}
and {{file}}.
</p>
<p>
If present, the <dfn for='VideoConfiguration' dict-member>colorGamut</dfn>
member represents that the video track is delivered in the specified
color gamut, which describes a set of colors in which the content is
intended to be displayed. If the attached output device also supports
the specified color, the UA needs to be able to cause the output device
to render the appropriate color, or something close enough. If the
attached output device does not support the specified color, the UA
needs to be capable of mapping the specified color to a color supported
by the output device. Valid inputs are defined by {{ColorGamut}}. colorGamut
is only applicable to {{MediaDecodingConfiguration}} for types
{{media-source}} and {{file}}.
</p>
<p>
If present, the <dfn for='VideoConfiguration' dict-member>transferFunction</dfn>
member represents that the video track requires the specified transfer
function to be understood by the UA. Transfer function describes the
electro-optical algorithm supported by the rendering capabilities of a
user agent, independent of the display, to map the source colors in the
decoded media into the colors to be displayed. Valid inputs are defined
by {{TransferFunction}}. transferFunction is only applicable to
{{MediaDecodingConfiguration}} for types {{media-source}} and {{file}}.
</p>
<p>
If present, the <dfn for='VideoConfiguration' dict-member>scalabilityMode</dfn>
member represents the scalability mode as defined in [[webrtc-svc]]. If
absent, the implementer defined default mode for this
{{VideoConfiguration/contentType}} is assumed (i.e., the mode you get if
you don't specify one via {{RTCRtpSender/setParameters()}}).
scalabilityMode is only applicable to {{MediaEncodingConfiguration}} for
type {{MediaEncodingType/webrtc}}.
</p>
<p>
If present, the <dfn for='VideoConfiguration' dict-member>spatialScalability</dfn>
member represents the ability to do spatial prediction, that is,
using frames of a resolution different than the current resolution as
dependencies. If absent, spatialScalability will default to
<code>false</code>. spatialScalability is closely coupled to
{{VideoConfiguration/scalabilityMode}} in the sense that streams encoded
with modes using spatial scalability (e.g. "L2T1") can only be decoded
if spatialScalability is supported. spatialScalability is only
applicable to {{MediaDecodingConfiguration}} for types {{media-source}},
{{file}}, and {{MediaDecodingType/webrtc}}.
</p>
</section>
<section>
<h4 id='hdrmetadatatype'>HdrMetadataType</h4>
<p>
<xmp class='idl'>
enum HdrMetadataType {
"smpteSt2086",
"smpteSt2094-10",
"smpteSt2094-40"
};
</xmp>
<p>
If present, {{HdrMetadataType}} describes the capability to interpret HDR metadata
of the specified type.
</p>
<p>
The {{VideoConfiguration}} may contain one of the following types:
<ul>
<li>
<dfn for='HdrMetadataType' enum-value>smpteSt2086</dfn>,
representing the static metadata type defined by
[[!SMPTE-ST-2086]].
</li>
<li>
<dfn for='HdrMetadataType' enum-value>smpteSt2094-10</dfn>,
representing the dynamic metadata type defined by
[[!SMPTE-ST-2094]].
</li>
<li>
<dfn for='HdrMetadataType' enum-value>smpteSt2094-40</dfn>,
representing the dynamic metadata type defined by
[[!SMPTE-ST-2094]].
</li>
</ul>
</p>
</p>
</section>
<section>
<h4 id='colorgamut'>ColorGamut</h4>
<p>
<xmp class='idl'>
enum ColorGamut {
"srgb",
"p3",
"rec2020"
};
</xmp>
<p>
The {{VideoConfiguration}} may contain one of the following types:
<ul>
<li>
<dfn for='ColorGamut' enum-value>srgb</dfn>, representing the
[[!sRGB]] color gamut.
</li>
<li>
<dfn for='ColorGamut' enum-value>p3</dfn>, representing the DCI
P3 Color Space color gamut. This color gamut includes the
{{ColorGamut/srgb}} gamut.
</li>
<li>
<dfn for='ColorGamut' enum-value>rec2020</dfn>, representing
the ITU-R Recommendation BT.2020 color gamut. This color gamut
includes the {{ColorGamut/p3}} gamut.
</li>
</ul>
</p>
</p>
</section>
<section>
<h4 id='transferfunction'>TransferFunction</h4>
<p>
<xmp class='idl'>
enum TransferFunction {
"srgb",
"pq",
"hlg"
};
</xmp>
<p>
The {{VideoConfiguration}} may contain one of the following types:
<ul>
<li>
<dfn for='TransferFunction' enum-value>srgb</dfn>, representing
the transfer function defined by [[!sRGB]].
</li>
<li>
<dfn for='TransferFunction' enum-value>pq</dfn>, representing the
"Perceptual Quantizer" transfer function defined by
[[!SMPTE-ST-2084]].
</li>
<li>
<dfn for='TransferFunction' enum-value>hlg</dfn>, representing the
"Hybrid Log Gamma" transfer function defined by BT.2100.
</li>
</ul>
</p>
</p>
</section>
<section>
<h4 id='audioconfiguration'>AudioConfiguration</h4>
<xmp class='idl'>
dictionary AudioConfiguration {
required DOMString contentType;
DOMString channels;
unsigned long long bitrate;
unsigned long samplerate;
boolean spatialRendering;
};
</xmp>
<p>
The <dfn for='AudioConfiguration' dict-member>contentType</dfn> member
represents the MIME type of the audio track.
</p>
<p>
To check if a {{AudioConfiguration}} <var>configuration</var> is a
<dfn>valid audio configuration</dfn>, the following steps MUST be run:
<ol>
<li>
If <var>configuration</var>'s {{AudioConfiguration/contentType}} is
not a <a>valid audio MIME type</a>, return <code>false</code> and
abort these steps.
</li>
<li>
Return <code>true</code>.
</li>
</ol>
</p>
<p>
The <dfn for='AudioConfiguration' dict-member>channels</dfn> member
represents the audio channels used by the audio track. channels is only
applicable to the decoding types {{media-source}}, {{file}}, and
{{MediaDecodingType/webrtc}} and the encoding type
{{MediaEncodingType/webrtc}}.
</p>
<p class='issue'>
The {{AudioConfiguration/channels}} needs to be defined as a
<code>double</code> (2.1, 4.1, 5.1, ...), an <code>unsigned short</code>
(number of channels) or as an <code>enum</code> value. The current
definition is a placeholder.
</p>
<p>
The <dfn for='AudioConfiguration' dict-member>bitrate</dfn> member
represents the average bitrate of the audio track. The bitrate
is the number of bits used to encode a second of the audio track.
</p>
<p>
The <dfn for='AudioConfiguration' dict-member>samplerate</dfn>
member represents the sample rate of the audio track. The sample rate
is the number of samples of audio carried per second. samplerate is only
applicable to the decoding types {{media-source}}, {{file}}, and
{{MediaDecodingType/webrtc}} and the encoding type
{{MediaEncodingType/webrtc}}.
</p>
<p class='note'>
The {{AudioConfiguration/samplerate}} is expressed in <code>Hz</code>
(ie. number of samples of audio per second). Sometimes the samplerates
value are expressed in <code>kHz</code> which represents the number of
thousands of samples of audio per second.<br>
44100 <code>Hz</code> is equivalent to 44.1 <code>kHz</code>.
</p>
<p>
The <dfn for='AudioConfiguration' dict-member>spatialRendering</dfn>
member indicates that the audio SHOULD be rendered spatially. The
details of spatial rendering SHOULD be inferred from the
{{AudioConfiguration/contentType}}. If it does not [=map/exist=], the UA
MUST presume spatial rendering is not required. When <code>true</code>,
the user agent SHOULD only report this configuration as
{{MediaCapabilitiesInfo/supported}} if it can support spatial
rendering for the current audio output device without failing back to a
non-spatial mix of the stream. {{spatialRendering}} is only applicable to
{{MediaDecodingConfiguration}} for types {{media-source}} and {{file}}.
</p>
</section>
</section>
<section>
<h4 id='mediacapabilitieskeysystemconfiguration'>
MediaCapabilitiesKeySystemConfiguration
</h4>
<xmp class='idl'>
dictionary MediaCapabilitiesKeySystemConfiguration {
required DOMString keySystem;
DOMString initDataType = "";
MediaKeysRequirement distinctiveIdentifier = "optional";
MediaKeysRequirement persistentState = "optional";
sequence<DOMString> sessionTypes;
KeySystemTrackConfiguration audio;
KeySystemTrackConfiguration video;
};
</xmp>
<p class='note'>
This dictionary refers to a number of types defined by
[[ENCRYPTED-MEDIA]] (EME). Sequences of EME types are
flattened to a single value whenever the intent of the sequence was to
have {{Navigator/requestMediaKeySystemAccess()}} choose a subset it supports.
With MediaCapabilities, callers provide the sequence across multiple
calls, ultimately letting the caller choose which configuration to use.
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>keySystem</dfn>
member represents a {{MediaKeySystemAccess/keySystem}} name as described in
[[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>initDataType</dfn>
member represents a single value from the {{MediaKeySystemConfiguration/initDataTypes}} sequence
described in [[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>distinctiveIdentifier</dfn>
member represents a {{MediaKeySystemConfiguration/distinctiveIdentifier}} requirement as
described in [[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>persistentState</dfn>
member represents a {{MediaKeySystemConfiguration/persistentState}} requirement as described in
[[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>sessionTypes</dfn>
member represents a sequence of required {{MediaKeySystemConfiguration/sessionTypes}} as
described in [[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>audio</dfn> member
represents a {{KeySystemTrackConfiguration}} associated with the {{AudioConfiguration}}.
</p>
<p>
The <dfn for='MediaCapabilitiesKeySystemConfiguration' dict-member>video</dfn> member
represents a {{KeySystemTrackConfiguration}} associated with the {{VideoConfiguration}}.
</p>
</section>
<section>
<h4 id='keysystemtrackconfiguration'>
KeySystemTrackConfiguration
</h4>
<xmp class='idl'>
dictionary KeySystemTrackConfiguration {
DOMString robustness = "";
DOMString? encryptionScheme = null;
};
</xmp>
<p>
The <dfn for='KeySystemTrackConfiguration' dict-member>robustness</dfn>
member represents a {{MediaKeySystemMediaCapability/robustness}} level
as described in [[!ENCRYPTED-MEDIA]].
</p>
<p>
The <dfn for='KeySystemTrackConfiguration' dict-member>encryptionScheme</dfn>
member represents an {{MediaKeySystemMediaCapability/encryptionScheme}}
as described in [[!ENCRYPTED-MEDIA-DRAFT]].
</p>
</section>
<section>
<h3 id='media-capabilities-info'>Media Capabilities Information</h3>
<xmp class='idl'>
dictionary MediaCapabilitiesInfo {
required boolean supported;
required boolean smooth;
required boolean powerEfficient;
};
</xmp>
<xmp class='idl'>
dictionary MediaCapabilitiesDecodingInfo : MediaCapabilitiesInfo {
required MediaKeySystemAccess keySystemAccess;
MediaDecodingConfiguration configuration;
};
</xmp>
<xmp class='idl'>
dictionary MediaCapabilitiesEncodingInfo : MediaCapabilitiesInfo {
MediaEncodingConfiguration configuration;
};
</xmp>
<p>
A {{MediaCapabilitiesInfo}} has associated <dfn dict-member
for='MediaCapabilitiesInfo'>supported</dfn>, <dfn dict-member
for='MediaCapabilitiesInfo'>smooth</dfn>, <dfn dict-member
for='MediaCapabilitiesInfo'>powerEfficient</dfn> fields which are
booleans.
</p>
<p>
Encoding or decoding is considered <dfn>power efficient</dfn> when the
power draw is optimal. The definition of optimal power draw for encoding
or decoding is left to the user agent. However, a common implementation
strategy is to consider hardware usage as indicative of optimal power
draw. User agents SHOULD NOT mark hardware encoding or decoding as power
efficient by default, as non-hardware-accelerated codecs can be just as
efficient, particularly with low-resolution video. User agents SHOULD
NOT take the device's power source into consideration when determining
encoding power efficiency unless the device's power source has side
effects such as enabling different encoding or decoding modules.
</p>
<p>
A {{MediaCapabilitiesDecodingInfo}} has associated
<dfn dict-member for=MediaCapabilitiesDecodingInfo>keySystemAccess</dfn>
which is a {{MediaKeySystemAccess}} or <code>null</code> as
appropriate.
</p>
<p class='note'>
If the encrypted decoding configuration is supported, the
resulting {{MediaCapabilitiesInfo}} will include a
{{MediaKeySystemAccess}}. Authors may use this to create
{{MediaKeys}} and setup encrypted playback.
</p>
<p>
A {{MediaCapabilitiesDecodingInfo}} has an associated <dfn
dict-member for='MediaCapabilitiesDecodingInfo'>configuration</dfn> which
is the decoding configuration properties used to generate the
{{MediaCapabilitiesDecodingInfo}}.
</p>
<p>
A {{MediaCapabilitiesEncodingInfo}} has an associated <dfn dict-member
for='MediaCapabilitiesEncodingInfo'>configuration</dfn> which
is the encoding configuration properties used to generate the
{{MediaCapabilitiesEncodingInfo}}.
</p>
<section>
<h3 id='info-algorithms'>Algorithms</h3>
<section>
<h4 id='create-media-capabilities-encoding-info'>
<dfn>Create a MediaCapabilitiesEncodingInfo</dfn>
</h4>
<p>
Given a {{MediaEncodingConfiguration}} <var>configuration</var>, this
algorithm returns a {{MediaCapabilitiesEncodingInfo}}. The following
steps are run:
<ol>
<li>
Let <var>info</var> be a new {{MediaCapabilitiesEncodingInfo}}
instance. Unless stated otherwise, reading and writing apply to
<var>info</var> for the next steps.
</li>
<li>
Set {{MediaCapabilitiesEncodingInfo/configuration}} to be a
new {{MediaEncodingConfiguration}}. For every property in <var>
configuration</var> create a new property with the same name and
value in {{MediaCapabilitiesEncodingInfo/configuration}}.
</li>
<li>
If the user agent is able to encode the media represented by
<var>configuration</var>, set {{MediaCapabilitiesInfo/supported}}
to <code>true</code>. Otherwise set it to <code>false</code>.
</li>
<li>
If the user agent is able to encode the media represented by
<var>configuration</var> at the indicated framerate, set
{{MediaCapabilitiesInfo/smooth}} to <code>true</code>. Otherwise
set it to <code>false</code>.
</li>
<li>
If the user agent is able to encode the media represented by
<var>configuration</var> in a [=power efficient=] manner, set
{{MediaCapabilitiesInfo/powerEfficient}} to <code>true</code>.
Otherwise set it to <code>false</code>.
</li>
<li>
Return <var>info</var>.
</li>
</ol>
</p>
</section>
<section>
<h4 id='create-media-capabilities-decoding-info'>
<dfn>Create a MediaCapabilitiesDecodingInfo</dfn>
</h4>
<p>
Given a {{MediaDecodingConfiguration}} <var>configuration</var>, this
algorithm returns a {{MediaCapabilitiesDecodingInfo}}. The following
steps are run:
<ol>
<li>
Let <var>info</var> be a new {{MediaCapabilitiesDecodingInfo}}
instance. Unless stated otherwise, reading and writing apply to
<var>info</var> for the next steps.
</li>
<li>
Set {{MediaCapabilitiesDecodingInfo/configuration}} to be a new
{{MediaDecodingConfiguration}}. For every property in <var>
configuration</var> create a new property with the same name and
value in {{MediaCapabilitiesDecodingInfo/configuration}}.
</li>
<li>
If <code>configuration.keySystemConfiguration</code> [=map/exists=]:
<ol>
<li>
Set {{MediaCapabilitiesDecodingInfo/keySystemAccess}}
to the result of running the <a>Check Encrypted Decoding
Support</a> algorithm with <var>configuration</var>.
</li>
<li>
If {{MediaCapabilitiesDecodingInfo/keySystemAccess}}
is not <code>null</code> set
{{MediaCapabilitiesInfo/supported}} to
<code>true</code>. Otherwise set it to <code>false</code>.
</li>
</ol>
</li>
<li>
Otherwise, run the following steps:
<ol>
<li>
Set {{MediaCapabilitiesDecodingInfo/keySystemAccess}}
to <code>null</code>.
</li>
<li>
If the user agent is able to decode the media represented
by <var>configuration</var>, set
{{MediaCapabilitiesInfo/supported}} to <code>true</code>.
</li>
<li>Otherwise, set it to <code>false</code>.</li>
</ol>
</li>
<li>
If the user agent is able to decode the media represented by
<var>configuration</var> at the indicated framerate
without dropping frames, set {{MediaCapabilitiesInfo/smooth}}
to <code>true</code>. Otherwise set it to <code>false</code>.
</li>
<li>
If the user agent is able to decode the media represented by
<var>configuration</var> in a [=power efficient=]
manner, set {{MediaCapabilitiesInfo/powerEfficient}} to
<code>true</code>. Otherwise set it to <code>false</code>.
</li>
<li>
Return <var>info</var>.
</li>
</ol>
</p>
</section>
<section>
<h4 id='is-encrypted-decode-supported'>
<dfn>Check Encrypted Decoding Support</dfn>
</h4>
<p>
Given a {{MediaDecodingConfiguration}} <var>config</var> where
{{keySystemConfiguration}} [=map/exists=], this algorithm returns a
{{MediaKeySystemAccess}} or <code>null</code> as appropriate. The
following steps are run:
<ol>
<li>
If the {{keySystem}} member of
<code>config.keySystemConfiguration</code> is not one of the
[=Key Systems=] supported by the user agent, return
<code>null</code>. String comparison is case-sensitive.
</li>
<li>
Let <var>origin</var> be the [=/origin=] of the calling context's
<a>Document</a>.
</li>
<li>
Let <var>implementation</var> be the implementation of <code>config.keySystemConfiguration.keySystem</code>.
</li>
<li>
Let <var>emeConfiguration</var> be a new
{{MediaKeySystemConfiguration}}, and initialize it as follows:
</li>
<ol>
<li>
Set the {{MediaKeySystemConfiguration/initDataTypes}} attribute to a sequence containing
<code>config.keySystemConfiguration.initDataType</code>.
</li>
<li>
Set the {{MediaKeySystemConfiguration/distinctiveIdentifier}} attribute to
<code>config.keySystemConfiguration.distinctiveIdentifier</code>.
</li>
<li>
Set the {{MediaKeySystemConfiguration/persistentState}} attribute to
<code>config.keySystemConfiguration.peristentState</code>.
</li>
<li>
Set the {{MediaKeySystemConfiguration/sessionTypes}} attribute to
<code>config.keySystemConfiguration.sessionTypes</code>.
</li>
<li>
If {{MediaConfiguration/audio}} [=map/exists=] in <var>config</var>, set the
{{MediaKeySystemConfiguration/audioCapabilities}} attribute to a sequence containing a
single {{MediaKeySystemMediaCapability}}, initialized as
follows:
<ol>
<li>
Set the {{MediaKeySystemMediaCapability/contentType}} attribute to
<code>config.audio.contentType</code>.
</li>
<li>
If <code>config.keySystemConfiguration.audio</code>
[=map/exists=]:
<ol>
<li>
Set the {{MediaKeySystemMediaCapability/robustness}} attribute to <code>
config.keySystemConfiguration.audio.robustness</code>.
</li>
<li>
Set the {{MediaKeySystemMediaCapability/encryptionScheme}} attribute to <code>
config.keySystemConfiguration.audio.encryptionScheme</code>.
</li>
</ol>
</li>
</ol>
</li>
<li>
If {{MediaConfiguration/video}} [=map/exists=] in <var>config</var>, set the
videoCapabilities attribute to a sequence containing a single
{{MediaKeySystemMediaCapability}}, initialized as follows:
<ol>
<li>
Set the {{MediaKeySystemMediaCapability/contentType}} attribute to
<code>config.video.contentType</code>.
</li>
<li>
If <code>config.keySystemConfiguration.video</code> [=map/exists=]:
<ol>
<li>
Set the {{MediaKeySystemMediaCapability/robustness}} attribute to <code>
config.keySystemConfiguration.video.robustness</code>.
</li>
<li>
Set the {{MediaKeySystemMediaCapability/encryptionScheme}} attribute to <code>
config.keySystemConfiguration.video.encryptionScheme</code>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
<li>
Let <var>supported configuration</var> be the result of
executing the [=Get Supported Configuration=]
algorithm on <var>implementation</var>,
<var>emeConfiguration</var>, and <var>origin</var>.
</li>