Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1132573 of devicechange

  • Revision slug: Web/Events/devicechange
  • Revision title: devicechange
  • Revision id: 1132573
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment Updated with more details and compat info for Firefox

Revision Content

A devicechange event is sent to a {{domxref("MediaDevices")}} instance whenever a media device such as a camera, microphone, or speaker is connected to or removed from the system. It's a generic {{domxref("Event")}} with no added properties.

General info

Specification
{{SpecName('Media Capture')}}
Interface
Event
Bubbles
No
Cancelable
No
Target
{{domxref('MediaDevices')}}
Default Action
None

Properties

{{OpenEventProperties()}}{{CloseEventProperties()}}

None.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Microsoft Edge Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(52.0)}} {{CompatGeckoDesktop(51)}}[1] {{CompatUnknown}} {{CompatUnknown}} 39 {{CompatUnknown}}
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} 39 {{CompatUnknown}} {{CompatNo}}

[1] While support for the devicechange event and for {{domxref("MediaDevices.ondevicechange")}} landed in Firefox 51, but only for Mac, and disabled by default. It can be enabled by setting the preference media.ondevicechange.enabled to true. Support for this event was added for Linux and Windows—and it was enabled by default—starting in Firefox 52.

Revision Source

<p>A <code>devicechange</code> event is sent to a {{domxref("MediaDevices")}} instance whenever a&nbsp;media device such as a camera, microphone, or speaker is connected to or removed from the system. It's a generic {{domxref("Event")}} with no added properties.</p>

<h2 id="General_info">General info</h2>

<dl>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Specification</dt>
 <dd style="margin: 0 0 0 120px;">{{SpecName('Media Capture')}}</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Interface</dt>
 <dd style="margin: 0 0 0 120px;">Event</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Bubbles</dt>
 <dd style="margin: 0 0 0 120px;">No</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Cancelable</dt>
 <dd style="margin: 0 0 0 120px;">No</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Target</dt>
 <dd style="margin: 0 0 0 120px;">{{domxref('MediaDevices')}}</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Default Action</dt>
 <dd style="margin: 0 0 0 120px;">None</dd>
</dl>

<h2 id="Properties">Properties</h2>

<p>{{OpenEventProperties()}}{{CloseEventProperties()}}</p>

<h2 id="Related_Events">Related events</h2>

<p>None.</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Microsoft Edge</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(52.0)}}</td>
   <td>{{CompatGeckoDesktop(51)}}<sup>[1]</sup></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>39</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>39</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] While support for the <code>devicechange</code> event and for {{domxref("MediaDevices.ondevicechange")}} landed in Firefox 51, but <em>only for Mac</em>, and disabled by default. It can be enabled by setting the preference <code>media.ondevicechange.enabled</code> to true. Support for this event was added for Linux and Windows—and it was enabled by default—starting in Firefox 52.</p>
Revert to this revision