The Media.pause() method (part of the MediaRecorder API) is used to pause recording of media streams.
When a MediaRecorder object’s pause()method is called, the browser queues a task that runs the below steps:
- If
MediaRecorder.stateis "inactive", raise a DOMInvalidStateerror and terminate these steps. If not, continue to the next step. - Set
MediaRecorder.stateto "paused". - Stop gathering data into the current
Blob, but keep it available so that recording can be resumed later on. - Raise a
pauseevent.
Syntax
MediaRecorder.pause()
Return value
undefined.
Exceptions
InvalidStateError- The
MediaRecorderis currently"inactive"; you can't pause recording if it's not active. If you callpause()while already paused, it silently does nothing.
Example
...
pause.onclick = function() {
mediaRecorder.pause();
console.log("recording paused");
}
...
Specifications
| Specification | Status | Comment |
|---|---|---|
| MediaStream Recording The definition of 'MediaRecorder.pause()' in that specification. |
Working Draft | Initial definition |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome
Full support
47
| Edge ? | Firefox Full support 25 | IE ? | Opera Full support 36 | Safari ? | WebView Android Full support 49 | Chrome Android Full support 49 | Edge Mobile ? | Firefox Android Full support 25 | Opera Android Full support 36 | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.
See also
- Using the MediaRecorder API
- Web Dictaphone: MediaRecorder + getUserMedia + Web Audio API visualization demo, by Chris Mills (source on Github.)
- simpl.info MediaStream Recording demo, by Sam Dutton.
Navigator.getUserMedia
Document Tags and Contributors
Tags:
Contributors to this page:
lucian95,
Sheppy,
jpmedley,
Sebastianz,
chrisdavidmills,
teoli,
kscarfone
Last updated by:
lucian95,