The MediaRecorder.start() method (part of the MediaRecorder API) is used to start capturing media into a Blob.
When the start() method is invoked, the UA queues a task that runs the following steps:
MediaRecorder.state is not "inactive", raise a DOM InvalidState error and terminate these steps. if the MediaRecorder.state is "inactive", continue on to the next step.MediaRecorder.state to "recording" and wait until media becomes available from the stream passed into Navigator.getUserMedia.MediaRecorder.start event and start gathering the data into a Blob (see FILE-API).timeSlice argument has been provided, once that many milliseconds of data have been collected — or a minimum time slice imposed by the UA, whichever is greater — raise a MediaRecorder.dataavailable event containing the Blob of collected data, and start gathering a new Blob of data. If timeSlice has not been provided, continue gathering data into the original Blob.stream is ended, set MediaRecorder.state to "inactive" and stop gathering data.MediaRecorder.dataavailable event containing the Blob of data.MediaRecorder.stop event.Note: If the browser is unable to start recording or continue recording, it will raise a DOMError event, followed by a MediaRecorder.dataavailable event containing the Blob it has gathered, followed by the MediaRecorder.stop event.
MediaRecorder.start(timeslice)
timeslice Optional
MediaRecorder.requestData.An InvalidState error is raised if the start() method is called while the MediaRecorder object’s MediaRecorder.state is not "inactive" — it makes no sense to start media capture if it is already happening.
...
record.onclick = function() {
mediaRecorder.start();
console.log("recorder started");
}
... | Specification | Status | Comment |
|---|---|---|
| MediaStream Recording The definition of 'MediaRecorder.start()' in that specification. | Working Draft | Initial definition |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | 47 | 25.0 (25.0) | No support | No support | No support |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | No support | 47 | 25.0 (25.0) | 1.3[1] | No support | No support | No support | 47 |
[1] The intial Firefox OS implementation only supported audio recording.
Navigator.getUserMedia
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/start