0

I feel like maybe something has changed in Chrome as there are demos of this functionality out there that don't seem to work anymore. I haven't found anything saying so though. Here is my code:

navigator.getUserMedia = ( navigator.getUserMedia    || navigator.webkitGetUserMedia ||
                           navigator.mozGetUserMedia ||navigator.msGetUserMedia);

var aCtx;
var analyser;
var microphone;
if (navigator.getUserMedia) {
    navigator.getUserMedia({audio: true}, function(stream) {
        aCtx = new webkitAudioContext();
        analyser = aCtx.createAnalyser();
        microphone = aCtx.createMediaStreamSource(stream);
        microphone.connect(analyser);
        analyser.connect(aCtx.destination);
    });
};

I can't get the audio to play through the speakers. I'm hoping that my code is just incorrect and that this is still possible. I can get it to work if I use an audio tag and send it straight there but I want to be able to add filters to it.

Jeffery Mills
  • 189
  • 12

2 Answers2

0

You have made a typographical error. Your first line should be

navigator.getUserMedia = ( navigator.getUserMedia    || navigator.webkitGetUserMedia ||
                           navigator.mozGetUserMedia ||navigator.msGetUserMedia);
rmcclellan
  • 445
  • 5
  • 9
  • Thanks, I actually noticed that after I posted but haven't updated. Although this doesn't make it work. – Jeffery Mills Jun 21 '13 at 17:39
  • Your code works for me in chrome 27 for mac. When you call getUserMedia, chrome will put up a banner beneath the search bar asking the user for permission to use the microphone. – rmcclellan Jun 21 '13 at 19:23
  • rmcclellan and you can hear it in your speakers? – Jeffery Mills Jun 21 '13 at 20:03
  • I sure can. Does the permission banner come up for you? – rmcclellan Jun 21 '13 at 20:15
  • Yes it asks for permission and acts like it's working but no sound coming through my speakers, but at least I know it's not a code issue. I've been able to get sound using the audio tag but I can't use any filters on it that way. I'm on a mac running OS X 10.8.4 and running Chrome 28.0.1500.52 beta. – Jeffery Mills Jun 21 '13 at 20:34
-1

It looks like I needed to change my microphone to default. It was set on display audio.enter image description here

Jeffery Mills
  • 189
  • 12