MediaRecorder: start event
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("MediaStream Recording")}}
The **start** event of the {{domxref("MediaRecorder")}} interface is fired when {{domxref("MediaRecorder.start()")}} is called. At this point, the data starts being gathered into a {{domxref("Blob")}}.
Syntax
Use the event name in {{domxref("EventTarget/addEventListener", "addEventListener()")}}:
js-nolint
addEventListener("start", (event) => { })Alternatively, assign to the event handler property of the interface:
js-nolint
onstart = (event) => { }Event type
A generic {{domxref("Event")}}.
Example
js
record.onclick = () => {
mediaRecorder.start();
console.log("recorder started");
};
mediaRecorder.onstart = () => {
// do something in response to
// recording being started
};Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Using the MediaStream Recording API
- Web Dictaphone: MediaRecorder +
getUserMedia + Web Audio API visualization demo, by Chris Mills (source on GitHub.)
- simpl.info MediaStream Recording demo, by Sam Dutton.
- {{domxref("Navigator.getUserMedia")}}