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

devicechange

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

A devicechange event is sent to a 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 Event with no added properties.

General info

Specification
Media Capture and Streams
Interface
Event
Bubbles
No
Cancelable
No
Target
MediaDevices
Default Action
None

Properties

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not
cancelable Read only Boolean Whether the event is cancellable or not?

None.

Example

See "Example" in MediaDevices.ondevicechange for an example that uses devicechange events to update lists of devices onscreen.

Specifications

Specification Status Comment
Media Capture and Streams
The definition of 'devicechange' in that specification.
Editor's Draft Initial specification.

Browser compatibility

Feature Chrome Firefox (Gecko) Microsoft Edge Internet Explorer Opera Safari (WebKit)
Basic support 52.0 51 (51)[1] ? ? 39 ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support ? ? ? 39 ? No support

[1] Support for the devicechange event and for 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.

See also

文档标签和贡献者

 此页面的贡献者: Sheppy, jpmedley
 最后编辑者: Sheppy,