title: call a function from navigator.mediaDevices.getUserMedia
body: <p>I am trying to call a function from within <code>navigator.mediaDevices.GetUserMedia</code> and it ain't working.</p>
  <p>This is what I have</p>
  <pre><code>navigator.mediaDevices.getUserMedia({audio: true}, startUserMedia, function(e) {
     __log('No live audio input: ' + e);
  });
  </code></pre>
  <p>This is my function</p>
  <pre><code>function startUserMedia(stream) {
      var input = audio_context.createMediaStreamSource(stream);
      __log('Media stream created.' );
      __log(&quot;input sample rate &quot; +input.context.sampleRate);
      __log('Input connected to audio context destination.');
  
      recorder = new Recorder(input, {
                    numChannels: 1
                  });
      __log('Recorder initialised.');
    }
  </code></pre>
  <p>I'm trying to update this call, since before it was:</p>
  <pre><code>navigator.getUserMedia({audio: true}, startUserMedia, function(e) {
       __log('No live audio input: ' + e);
  });
  </code></pre>
  <p>and guess what, that works. But this new &quot;mediaDevices&quot;, I can't make it work somehow. It says:</p>
  <pre><code>Uncaught TypeError: recorder is undefined
  </code></pre>
  <p>It is not making the call to the &quot;startUserMedia&quot; function. If I add a &quot;alert(&quot;hello&quot;)&quot; inside the function, it doesn't executes.</p>
  <p>This works though:</p>
  <pre><code> navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
        startUserMedia();
  }).catch(function(err) {});
  
  </code></pre>
  <p>but it doesn't recognizes my recorder</p>
  <p><code>recorder = new Recorder(input, { numChannels: 1 });</code></p>
  <p>Anyone can lend a hand?</p>