The MediaRecorder.onstart
event handler (part of the MediaRecorder API) handles the start
event, allowing you to run code in response to media recording being started by a MediaRecorder
.
The start
event is thrown as a result of the MediaRecorder.start()
method being invoked. At this point, the data starts being gathered into a Blob
.
Syntax
MediaRecorder.onstart = function(event) { ... } MediaRecorder.addEventListener('start', function(event) { ... })
Example
...
record.onclick = function() {
mediaRecorder.start();
console.log("recorder started");
}
mediaRecorder.onstart = function() {
// do something in response to
// recording being started
}
...
Properties
None.
Specifications
Specification | Status | Comment |
MediaStream RecordingThe definition of 'MediaRecorder.onstart' 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
onstart
|
Chrome
Full support 49 |
Edge
Full support 79 |
Firefox
Full support 25 |
IE
No support No |
Opera
Full support 36 |
Safari
No support No |
WebView Android
Full support 49 |
Chrome Android
Full support 49 |
Firefox Android
Full support 25 |
Opera Android
Full support 36 |
Safari iOS
No support No |
Samsung Internet Android
Full support 5.0 |
Legend
- Full support
- Full support
- No support
- No support
See also
- Using the MediaRecorder API
- [[../../../../../../../mdn.github.io/web-dictaphone/index|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
MediaRecorder.onstart by Mozilla Contributors is licensed under CC-BY-SA 2.5.