title: Chrome won't play WebAudio getUserMedia via WebRTC/Peer.js
body: <p>I want to make a simple audio only stream over WebRTC, using <a href="http://peerjs.com/" rel="nofollow">Peer.js</a>. I'm running the simple PeerServer locally.</p>
  
  <p>The following works perfectly fine in Firefox 30, but I can't get it to work in <strong>Chrome 35</strong>. I would expect there was something wrong with the PeerJS setup, but Chrome -> Firefox works perfectly fine, while Chrome -> Chrome seems to send the stream, but won't play over speakers.</p>
  
  <p><strong>Setting up getUserMedia</strong> <em>Note: uncommenting those lines below will let me hear the loopback in Chrome and Firefox.</em></p>
  
  <pre><code>navigator.getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
  window.AudioContext = window.AudioContext || window.webkitAudioContext;
  
  if(navigator.getUserMedia) {
      navigator.getUserMedia({video: false, audio: true}, getMediaSuccess, getMediaError);
  } else {
      alert('getUserMedia not supported.');
  }
  
  var localMediaStream;
  //var audioContext = new AudioContext();
  
  function getMediaSuccess(mediaStream) {
      //var microphone = audioContext.createMediaStreamSource(mediaStream);
      //microphone.connect(audioContext.destination);
      localMediaStream = mediaStream;
  }
  
  function getMediaError(err) {
      alert('getUserMedia error. See console.');
      console.error(err);
  }
  </code></pre>
  
  <p><strong>Making the connection</strong></p>
  
  <pre><code>var peer = new Peer({host: '192.168.1.129', port: 9000});
  
  peer.on('open', function(id) {
      console.log('My ID:', id);
  });
  
  peer.on('call', function(call) {
      console.log('answering call with', localMediaStream);
      call.answer(localMediaStream);
      //THIS WORKS IN CHROME, localMediaStream exists
  
      call.on('stream', function(stream) {
          console.log('streamRecieved', stream);
          //THIS WORKS IN CHROME, the stream has come through
  
          var audioContext = new AudioContext();
          var audioStream = audioContext.createMediaStreamSource(stream);
          audioStream.connect(audioContext.destination);
          //I HEAR AUDIO IN FIREFOX, BUT NOT CHROME
  
      });
  
      call.on('error', function(err) {
          console.log(err);
          //LOGS NO ERRORS
      });
  });
  
  function connect(id) {
      var voiceStream = peer.call(id, localMediaStream);
  }
  </code></pre>