The MediaRecorder.onpause
event handler (part of the MediaRecorder API) handles the pause
event, allowing you to run code in response to the media recording being paused.
The pause
event is thrown as a result of the MediaRecorder.pause()
method being invoked.
Syntax
MediaRecorder.onpause = function(event) { ... } MediaRecorder.addEventListener('pause', function(event) { ... })
Example
... pause.onclick = function() { if(mediaRecorder.state === "recording") { mediaRecorder.pause(); // recording paused } else if(mediaRecorder.state === "paused") { mediaRecorder.resume(); // resume recording } } mediaRecorder.onpause = function() { // do something in response to // recording being paused } mediaRecorder.onresume = function() { // do something in response to // recording being resumed } ...
Properties
None.
Specifications
Specification | Status | Comment |
---|---|---|
MediaStream Recording The definition of 'MediaRecorder.onpause' 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
onpause | Chrome Full support 49 | Edge No support No | Firefox Full support 65 | IE ? | Opera Full support 36 | Safari ? | WebView Android Full support 49 | Chrome Android Full support 49 | Firefox Android Full support 65 | Opera Android Full support 36 | Safari iOS ? | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
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