-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathusermedia-chrome-mvp.html
More file actions
281 lines (262 loc) · 12.4 KB
/
Copy pathusermedia-chrome-mvp.html
File metadata and controls
281 lines (262 loc) · 12.4 KB
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
<!doctype html>
<html lang="en-us">
<head>
<title>Note on Chrome <usermedia> MVP</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove"></script>
<script class='remove'>
"use strict";
// See https://github.com/w3c/respec/wiki/ for how to configure ReSpec
var respecConfig = {
xref: ["mediacapture-extensions", "mediacapture-streams",
"geolocation-element", "html", "dom", "pointerevents4"],
editors: [{name: "Daniel Vogelheim", company: "Google LLC"}],
specStatus: "unofficial",
noRecTrack: true,
latestVersion: null,
shortName: "chrome-mvp-usermedia-html-elements",
localBiblio: {
"mediacapture-extensions": {
title: "Media Capture and Streams Extensions",
href: "https://w3c.github.io/mediacapture-extensions/",
},
"permission-element": {
title: "The HTML <permission> Element",
href: "https://wicg.github.io/PEPC/permission-element.html",
},
"usermedia-migration-guide": {
title: "Migration from <permission> to the MVP <usermedia> Capability Element",
href: "https://chromium.googlesource.com/chromium/src/+/HEAD/docs/permissions/pepc_usermedia_migration.md",
},
"usermedia-mvp": {
title: "Capability Element <usermedia> MVP",
href: "https://chromestatus.com/feature/4926233538330624",
},
"origin-trials": {
title: "Origin Trials",
href: "https://developer.chrome.com/docs/web-platform/origin-trials",
},
"usermedia-legacy": {
title: "Proposed usermedia, camera, and microphone media capture HTML elements",
href: "https://wicg.github.io/PEPC/usermedia-element-delta.html",
},
"pepc": {
title: "Page Embedded Permission Control",
href: "https://github.com/WICG/PEPC",
},
},
};
</script>
</head>
<body>
<section id=abstract>
<p>This documents the difference between Chrome's [[[usermedia-mvp]]] and
[[mediacapture-extensions]]'s [[[mediacapture-extensions#media-capture-html-elements]]].
</section>
<section id=sotd>
<p>
This is a purely informational note about a particular implementation and
how it relates to its relevant specification.
</p>
</section>
<section>
<h1>Introduction</h1>
<p>
Chrome introduced the <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>
element as en experimental [[origin-trials|Origin Trial]] in
<a href=https://chromestatus.com/feature/4926233538330624>Chrome M144</a>.
Later standardization in [[mediacapture-extensions]] modified the API and
behavior of <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>.
Chrome will adapt its implementation to follow
[[mediacapture-extensions]]. Web page authors should adapt their
usage accordingly. A migration guide can be found in
[[usermedia-migration-guide]].
</p>
<p>
This note documents the differences between <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>
elements as shipped by Chrome in origin trials and intermediate versions
and the final API specified in
[[[mediacapture-extensions#media-capture-html-elements]]].
This is note is only informational.
</p>
</section>
<section>
<h1>Differences between Chrome's [[[usermedia-mvp]]] and
[[[mediacapture-extensions#media-capture-html-elements]]]</h1>
<p>
The <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a> element support in Chrome is developed
in several phases.
</p>
<p>
With the initial public release we will support the MVP API ([[[#mvp]]]).
The older API shape ([[[#original-pepc]]]) will be supported behind an
origin trial, to allow origin trial participants to transition on their
own timeline.
</p>
<dl>
<dt>soon — Standardized API</dt>
<dd>
The API as described in
[[[mediacapture-extensions#the-usermedia-html-element]]], including
<usermedia>, <camera>, and <microphone>.
</dd>
<dt>M151 & later — <usermedia> element MVP</dt>
<dd>
The first publicly available version. It is based on the
[[mediacapture-extensions]], but only implements a subset of the
specification.
This API is described in [[[#mvp]]].
</dd>
<dt>M144 - M150 — <usermedia> element [[[origin-trials|origin trial]]]</dt>
<dd>
The original implementation, based on the original
[[[pepc#page-embedded-permission-control-pepc]]] design, described
in [[[#original-pepc]]].
This API was available originally behind an origin trial.
For a limited time, it will continue to be available behind the
origin trial, concurrently with the MVP, as a
[[[origin-trials#deprecation_trials|reverse origin trial]]].
</dd>
<dt>pre M144 — <permission> element [[[origin-trials|origin trial]]]</dt>
<dd>
[[[pepc]]]'s <permission> element is the ancestor of
<usermedia>. It is no longer supported.
</dd>
</dl>
</section>
<section id="mvp">
<h1>MVP API</h1>
<p>
The [[usermedia-mvp|MVP]]'s
<a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a> element uses the following
[=element interface=]. Note that it is a strict subset of the interface
speciefied in [[[mediacapture-extensions#the-usermedia-html-element]]].
</p>
<pre>
[Exposed=Window]
interface HTMLUserMediaElement : HTMLElement {
[HTMLConstructor] constructor();
readonly attribute DOMException? error;
attribute EventHandler onstream;
attribute EventHandler oncancel;
attribute EventHandler onerror;
};
</pre>
<p>
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-stream>stream</a>,
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-error>error</a>,
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-onstream>onstream</a>,
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-oncancel>oncancel</a>, and
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-onerror>onerror</a>
attributes work as in [[mediacapture-extensions]]'s
<a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a> element.
</p>
<p>
The [=EventTarget/activation behavior=] is as follows:
</p>
<ul>
<li>
Activation of <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>
will call directly into the [[permissions|Permissions API]], rather than
letting {{MediaDevices/getUserMedia()}} handle it. This should be
functionally identical, but may show a different prompt text.
</li>
<li>
"Second" activation — activation while a stream is active —
of <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>
will have no special effect, other than firing the [[DOM]]
<a data-dfn-type=event>click</a>
event. [[mediacapture-extensions]] presently leaves this aspect
unspecified.
</li>
</ul>
<p>
The <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-camera>camera</a> and
<a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-microphone>microphone</a>
elements are expected to follow shortly.
</p>
</section>
<section id="original-pepc">
<h1>Legacy PEPC API</h1>
<p>
This is the original implemenation of
<a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>, behind the <a href=https://developer.chrome.com/origintrials/#/view_trial/3736298840857247745>Trial for UserMediaElement</a>
[[origin-trials|origin trial]]. This trial will temporarily in place, as a
[[[origin-trials#deprecation_trials|reverse origin trial]]], to give the
original users more time for a smooth transition.
</p>
<p>
The legacy API is largely that described by [[[usermedia-legacy]]].
The differences to the [[mediacapture-extensions]] version are as
follows:
</p>
<pre>
[Exposed=Window]
interface HTMLUserMediaElement : HTMLElement {
[HTMLConstructor] constructor();
readonly attribute MediaStream? stream;
undefined setConstraints(MediaStreamConstraints constraints);
readonly attribute DOMException? error;
[Reflect] attribute DOMString type;
boolean isTypeSupported(DOMString type);
};
HTMLUserMediaElement includes ActivationBlockersMixin;
HTMLUserMediaElement includes PowerfulFeatureObserver;
</pre>
<p>
The
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-stream>stream</a> attribute,
<a data-link-type=attribute href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-error>error</a> attribute, and
<a data-link-type=method href=https://w3c.github.io/mediacapture-extensions/#dom-htmlusermediaelement-setconstraints>setConstraints()</a> method
work as in [[mediacapture-extensions]]'s <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a> element.
</p>
<p>
The <dfn data-dfn-for=HTMLUserMediaElement>type</dfn> IDL attribute
reflects the `type` content attribute.
Depending on {{HTMLUserMediaElement/type}}, the
<a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a>
element changes behaviour:
</p>
<dl>
<dt>`"microphone camera"`</dt>
<dt>`"camera microphone"`</dt>
<dd>— behaves like a regular <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-usermedia>usermedia</a> element.</dd>
<dt>`"microphone"`</dt>
<dd>— behaves like a <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-microphone>microphone</a> element.</dd>
<dt>`"camera"`</dt>
<dd>— behaves like a <a data-link-type=element href=https://w3c.github.io/mediacapture-extensions/#dfn-camera>camera</a> element.</dd>
<dt>all other values</dt>
<dd>— behaves like an {{HTMLUnknownElement}}.</dd>
</dl>
<p>
The
<dfn data-dfn-for=HTMLUserMediaElement data-dfn-type=method>isTypeSupported()</dfn>
method can be used to query whether a given type is supported by this
element.
It will return true if the input string is one of `"microphone camera"`,
`"camera microphone"`, `"microphone"`, or `"camera"`,
and false in all other cases.
</p>
<p>
The {{ActivationBlockersMixin}} formalizes several "click-jacking"
protections, and exposes their state in
{{ActivationBlockersMixin/isValid}},
{{ActivationBlockersMixin/invalidReason}}, and
{{ActivationBlockersMixin/onvalidationstatuschange}} attributes.
[[mediacapture-extensions]]
[[[mediacapture-extensions#dfn-trusted|encourages]]] similar
"click-jacking" protections, it does specify them in details,
and does not expose their inner state to developers or users.
</p>
<p>
The {{PowerfulFeatureObserver}} formalizes access into the [[permissions]]
API using the "camera microphone" permission descriptor (or the suitable
substrings, as appropriate). [[mediacapture-extensions]] eschews direct
calls to [[permissions]] APIs and instead relies on
{{MediaDevices/getUserMedia()}} to handle permission requests internally,
and consequently relies on [[mediacapture-streams]] to describe the
suitable interactions with [[permissions]].
</p>
</section>
</body>
</html>