title: MediaStreamRecorder and TypeScript Uncaught TypeError
body: <p>I am currently developing an audio recorder that uses the users PC microphone, which works fine. However, when I want to record the audio I get this type error:</p>
  
  <blockquote>
    <p>audioHandler.ts:45 Uncaught TypeError: MediaStreamRecorder is not a function</p>
  </blockquote>
  
  <p>This is the code:</p>
  
  <pre><code>/// &lt;reference path="../references.d.ts" /&gt;
  //This component handles all things audio related
  
  export = Scaut.AudioHandler;
  
  module Scaut.AudioHandler {
  
      var n = &lt;any&gt;navigator;
      var stream = &lt;any&gt;"";
      var stopRecording = &lt;any&gt;"";
      var mediaRecorder = &lt;any&gt;"";
      //var MediaStreamRecorder = &lt;any&gt;""; 
  
      //Check if microphone is ok
      export function hasGetUserMedia() {
          n.getUserMedia = n.getUserMedia ||
          n.webkitGetUserMedia ||
          n.mozGetUserMedia;
  
          if (n.getUserMedia) {
              n.getUserMedia({ audio: true},
                  function (stream) {
                      var audio = &lt;any&gt;"";
                      audio = document.getElementById('audioRecord');
                      audio.src = window.URL.createObjectURL(stream);
                      audio.onloadedmetadata = function (e) {
                          audio.play();
                      };
                  },
                  function (err) {
                      alert("The following error occured: " + err.name);
                  }
              );
          } else {
              alert("getUserMedia not supported");
          }
  
          recordAudio(stream);
      }
  
      //Record audio
      export function recordAudio(stream) {
          mediaRecorder = new MediaStreamRecorder(stream);
          console.log("Stream: "+stream)
          mediaRecorder.mimeType = 'audio/ogg';
          mediaRecorder.audioChannels = 1;
          mediaRecorder.ondataavailable = function (blob) {
              // POST/PUT "Blob" using FormData/XHR2
              var blobURL = URL.createObjectURL(blob);
              //document.write('&lt;a href="' + blobURL + '"&gt;' + blobURL + '&lt;/a&gt;');
              console.log("Blob: "+blob)
              console.log("BlobUrl: "+blobURL)
          };
          mediaRecorder.start(3000);
      }
  </code></pre>
  
  <p>Can anyone point me in the right direction?</p>