When used with MediaDevices.getUserMedia() , it provides an easy way to record media from the user’s input devices and instantly use the result in web apps. Basic app setupTo grab the media stream we want to capture, we use getUserMedia() . Next, we call getUserMedia() and inside it define:The constraints : Only audio is to be captured for our dictaphone. Capturing the media streamOnce getUserMedia has created a media stream successfully, you create a new Media Recorder instance with the MediaRecorder() constructor and pass it the stream directly. stop.onclick = function() { mediaRecorder.stop(); console.log(mediaRecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; }Note that the recording may also stop naturally if the media stream ends (e.g.