JSFiddle - React, Tailwind, and code Playground
HTML
<button id="check">check</button>
<button id="req">request approval</button>
JavaScript
function checkIsApproved(){
return navigator.mediaDevices.enumerateDevices()
.then(infos =>{
console.log([...infos].map(i=>i.label));
return [...infos].some(info=>info.label!=="")
});
}
check.onclick = e => {
checkIsApproved().then(res=>alert('approved: ' + res));
};
req.onclick = e => {
navigator.mediaDevices.getUserMedia({video:true}).then(s=>{});
}