> For the complete documentation index, see [llms.txt](https://docs.digitalsamba.com/reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalsamba.com/reference/sdk/events/mediadevicechanged.md).

# mediaDeviceChanged

Emitted when the user selects a different camera, microphone or speakers device.

The **kind** property can be:

* videoinput - for camera
* audioinput - for microphone
* audiooutput - for speakers

#### Sample payloads

```json
{
    "type": "mediaDeviceChanged",
    "data": {
      "kind": "videoinput OR audioinput OR audiooutput",
      "label": "HD Pro Webcam C920 (046d:082d)",
      "previousDeviceLabel": "Logi Capture",
      "availableDevices": [
        An array of all available devices of all types, following these specs:
        https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
      ]
    }
}
```

#### Sample subscription code

```javascript
sambaFrame.on('mediaDeviceChanged', (event) => {
  const data = event.data;
  console.log('New device id:', data.deviceId);
});
```
