Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DeviceChangeEvent interface. #996

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 69 additions & 6 deletions getusermedia.html
Original file line number Diff line number Diff line change
Expand Up @@ -2649,11 +2649,10 @@ <h2>Event summary</h2>
<tr>
<th scope=row><dfn id=
"event-mediadevices-devicechange" data-dfn-type=event>devicechange</dfn></td>
<td>{{Event}}</td>
<td>{{DeviceChangeEvent}}</td>
<td>The set of media devices, available to the [=User Agent=], has
changed. The current list devices can be retrieved with the
{{MediaDevices/enumerateDevices()}}
method.</td>
changed. The current list of devices is available in the
{{DeviceChangeEvent/devices}} attribute.</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -2834,8 +2833,9 @@ <h3>{{MediaDevices}}</h3>
<var>deviceList</var>.</p>
</li>
<li>
<p>Queue a task that fires a simple event named <a data-link-type=event>devicechange</a> at
<var>mediaDevices</var>.</p>
<p>Queue a task that [= fire an event | fires an event=] named {{devicechange}},
using the {{DeviceChangeEvent}} constructor with {{DeviceChangeEventInit/devices}}
initialized to <var>newExposedDevices</var>, at <var>mediaDevices</var>.</p>
<p>The [=User Agent=] MAY combine firing multiple events into firing one
event when several events are due or when multiple devices are added
or removed at the same time, e.g. a camera with a microphone.</p>
Expand Down Expand Up @@ -3424,6 +3424,69 @@ <h2>Methods</h2>
</section>
</div>
</section>
<section>
<h3>{{DeviceChangeEvent}}</h3>
<p>The {{devicechange}} event uses the {{DeviceChangeEvent}} interface.</p>
<div>
<pre class="idl"
>[Exposed=Window]
interface DeviceChangeEvent : Event {
constructor(DOMString type, DeviceChangeEventInit eventInitDict);
[SameObject] readonly attribute FrozenArray&lt;MediaDeviceInfo&gt; devices;
};</pre>
<section>
<h2>Constructors</h2>
<dl data-link-for="DeviceChangeEvent" data-dfn-for=
"DeviceChangeEvent" class="constructors">
<dt><dfn>constructor()</dfn></dt>
<dd>
<p>Initialize [=this=].{{DeviceChangeEvent/devices}} to the
result of [=creating a frozen array=] from
<var>eventInitDict</var>.{{DeviceChangeEventInit/devices}}.</p>
</dd>
</dl>
</section>
<section>
<h2>Attributes</h2>
<dl data-link-for="DeviceChangeEvent" data-dfn-for=
"DeviceChangeEvent" class="attributes">
<dt>
<dfn data-idl="">devices</dfn> of type <span class=
"idlAttrType">FrozenArray&lt;{{MediaDeviceInfo}}&gt;</span>,
readonly
</dt>
<dd>
<p>The {{devices}} attribute returns an array of {{MediaDeviceInfo}}
objects representing the list of available devices at this time.
</p>
</dd>
</dl>
</section>
</div>
<div>
<pre class="idl"
>dictionary DeviceChangeEventInit : EventInit {
sequence&lt;MediaStream&gt; streams = [];
};</pre>
<section>
<h2>Dictionary <dfn>DeviceChangeEventInit</dfn> Members</h2>
<dl data-link-for="DeviceChangeEventInit" data-dfn-for=
"DeviceChangeEventInit" class="dictionary-members">
<dt>
<dfn data-idl="">devices</dfn> of type <span class=
"idlMemberType">sequence&lt;{{MediaDeviceInfo}}&gt;</span>,
defaulting to <code>[]</code>
</dt>
<dd>
<p>
The {{devices}} member is an array of {{MediaDeviceInfo}} objects
representing the available devices.
</p>
</dd>
</dl>
</section>
</div>
</section>
</section>
<section id="local-content">
<h2>Obtaining local multimedia content</h2>
Expand Down