react-media-devices
v1.1.5
Published
A custom hook to enumerate user media devices, using the MediaDevices API
Downloads
2,677
Maintainers
Readme
Exports a handy useMediaDevices
hook that utilizes the MediaDevice API to detect available media devices.
Usage
import React from "react";
import { useMediaDevices } from "react-media-devices";
const App = () => {
const { devices } = useMediaDevices();
return (
<div>
<h1>Devices</h1>
<ul>
{devices?.map((device) => (
<li key={device.id}>{device.label}</li>
))}
</ul>
</div>
);
};