JSFiddle - React, Tailwind, and code Playground
JavaScript
navigator.mediaDevices.getUserMedia({ audio : true }).then(s => {
const r = new MediaRecorder(s);
r.onstart = () => alert('start');
r.onstop = () => alert('stop');
r.start();
r.stop();
})