LiveKit docs › Hooks › useMediaDeviceSelect

---

# useMediaDeviceSelect

The `useMediaDeviceSelect` hook is used to implement the `MediaDeviceSelect` component and returns o.a. the list of devices of a given kind (audioinput or videoinput), the currently active device and a function to set the the active device.

## Import

```typescript
import { useMediaDeviceSelect } from "@livekit/components-react";

```

## Usage

```tsx
const { devices, activeDeviceId, setActiveMediaDevice } = useMediaDeviceSelect({
  kind: "audioinput"
});

```

## Properties

- **`{ kind, room, track, requestPermissions, onError, }.kind`** _(MediaDeviceKind)_: 

- **`{ kind, room, track, requestPermissions, onError, }.onError`** _((e: Error) => void)_ (optional): this callback gets called if an error is thrown when failing to select a device and also if a user denied permissions, eventhough the `requestPermissions` option is set to `true`. Most commonly this will emit a MediaDeviceError

- **`{ kind, room, track, requestPermissions, onError, }.requestPermissions`** _(boolean)_ (optional): this will call getUserMedia if the permissions are not yet given to enumerate the devices with device labels. in some browsers multiple calls to getUserMedia result in multiple permission prompts. It's generally advised only flip this to true, once a (preview) track has been acquired successfully with the appropriate permissions.

- **`{ kind, room, track, requestPermissions, onError, }.room`** _(Room)_ (optional): 

- **`{ kind, room, track, requestPermissions, onError, }.track`** _(LocalAudioTrack | LocalVideoTrack)_ (optional): 

## Returns

```typescript
{
    devices: MediaDeviceInfo[];
    className: string;
    activeDeviceId: string;
    setActiveMediaDevice: (id: string, options?: import('@livekit/components-core').SetMediaDeviceOptions) => Promise<void>;
}

```

---

This document was rendered at 2026-06-07T11:33:37.917Z.
For the latest version of this document, see [https://docs.livekit.io/reference/components/react/hook/usemediadeviceselect.md](https://docs.livekit.io/reference/components/react/hook/usemediadeviceselect.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).