This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The stop() method of the MediaRecorder interface is used to stop media capture.
When the stop() method is invoked, the UA queues a task that runs the following steps:
MediaRecorder.state is "inactive", raise a DOM InvalidState error and terminate these steps. If the MediaRecorder.state is not "inactive", continue on to the next step.MediaRecorder.state to "inactive" and stop capturing media.dataavailable event containing the Blob of data that has been gathered.stop event.stop()
None.
None (undefined).
InvalidStateError DOMException
Thrown if the MediaRecorder is currently "inactive"; you cannot stop the recording if the MediaRecorder is not active.
stop.onclick = () => {
mediaRecorder.stop();
console.log("recorder stopped, data available");
};
| Specification |
|---|
| MediaStream Recording> # dom-mediarecorder-stop> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
stop |
49 | 79 | 25 | 36 | 14.1 | 49 | 25 | 36 | 14 | 5.0 | 49 | 14 |
Navigator.getUserMedia
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/stop