mozilla
Your Search Results

    MediaRecorder.onstart

    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.

    Syntax

    attribute EventHandler       onstart;

    Example

    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() {
                   mediaRecorder.start();
                   console.log("recorder started");
               }
    
               stop.onclick = function() {
                   mediaRecorder.stop();
                   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
               }
    
               ...

    Properties

    None.

    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.

    Specifications

    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,