--- title: MediaRecorder.start() slug: Web/API/MediaRecorder/start translation_of: Web/API/MediaRecorder/start ---
Метод MediaRecorder.start() (часть MediaRecorder API) используется для начала захвата медиа {{domxref("Blob")}}.
When the start() method is invoked, the UA queues a task that runs the following steps:
InvalidState error and terminate these steps. if the {{domxref("MediaRecorder.state")}} is "inactive", continue on to the next step.stream passed into {{domxref("Navigator.getUserMedia")}}.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 {{domxref("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 {{domxref("MediaRecorder.state")}} to "inactive" and stop gathering data.Note: If the browser is unable to start recording or continue recording, it will raise a {{domxref("DOMError")}} event, followed by a {{domxref("MediaRecorder.dataavailable")}} event containing the Blob it has gathered, followed by the {{domxref("MediaRecorder.stop")}} event.
MediaRecorder.start(timeslice)
timeslice {{optional_inline}}An InvalidState error is raised if the start() method is called while the MediaRecorder object’s {{domxref("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("рекордер запущен");
}
...
| Specification | Status | Comment |
|---|---|---|
| {{SpecName("MediaStream Recording", "#widl-MediaRecorder-start-void-long-timeslice", "MediaRecorder.start()")}} | {{Spec2("MediaStream Recording")}} | Initial definition |
{{Compat}}