# 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);
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/sdk/events/mediadevicechanged.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
