Exports a handy useMediaDevices
hook that utilizes the MediaDevice API to detect available media devices.
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>
);
};