Your Search Results


    The MediaRecorder.onstop event handler (part of the MediaRecorder API) handles the stop event, allowing you to run code in response to media recording via a MediaRecorder being stopped.

    The stop event is thrown either as a result of the MediaRecorder.stop() method being invoked, or when the media stream being captured ends. In each case, the stop event is preceded by a dataavailable event, making the Blob captured up to that point available for you to use in your application.


    attribute EventHandler       onstop;


    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,