MediaDevices: devicechange event

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.

Bubbles No
Cancelable No
Interface Event
Event handler ondevicechange


You can use the devicechange event in an addEventListener method:

navigator.mediaDevices.addEventListener('devicechange', function(event) {

Or use the ondevicechange event handler property:

navigator.mediaDevices.ondevicechange = function(event) {


Specification Status
Media Capture and Streams
The definition of 'devicechange' in that specification.
Candidate Recommendation

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
devicechange eventChrome Full support 57Edge Full support 12Firefox Full support 52IE No support NoOpera Full support 34Safari No support NoWebView Android No support NoChrome Android No support NoFirefox Android ? Opera Android Full support 43Safari iOS No support NoSamsung Internet Android No support No


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also