Your Search Results


    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.


    attribute EventHandler       onstart;


    if (navigator.getUserMedia) {
       console.log('getUserMedia supported.');
       navigator.getUserMedia (
          // constraints - only audio needed for this app
             audio: true
          // Success callback
          function(stream) {
               var mediaRecorder = new MediaRecorder(stream);
               record.onclick = function() {
                   console.log("recorder started");
               stop.onclick = function() {
                   console.log("recorder stopped");
               mediaRecorder.onstart = function() {
                 // do something in response to
                 // recording being started
               mediaRecorder.onstop = function() {
                 // do something in response to
                 // recording being stopped



    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Basic support

    Not supported

    25.0 (25.0) [1] Not supported Not supported Not supported
    Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
    Basic support Not supported 25.0 (25.0) [1] 1.3 Not supported Not supported Not supported

    [1] The current Gecko implementation currently only supports audio recording.


    Specification Status Comment
    MediaStream Recording Editor's Draft  

    See also

    Document Tags and Contributors

    Contributors to this page: kscarfone, teoli, chrisdavidmills
    Last updated by: teoli,