JimJim2000 JimJim2000 - 3 months ago 12x
Javascript Question

HTML5: play on speakers stream from microphone on Ubuntu

I am learning html5 and want to try to play on speakers what I say on microphone. So I wrote the following js code:

navigator.getUserMedia = navigator.getUserMedia ||navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

var aCtx;
var analyser;
var microphone;
if (navigator.getUserMedia) {
{audio: true},
function(stream) {
aCtx = new AudioContext();
analyser = aCtx.createAnalyser();
microphone = aCtx.createMediaStreamSource(stream);
var destination=aCtx.destination;
function(){ console.log("Error 003.")}

I test it on firefox 47 and ubuntu 14. I see the panel to share my microphone, I select share and nothing I hear nothing. How to fix it?

However, it works on firefox 47 in windows7. But in ubuntu I have all drivers installed and I use skype, youtube etc everything works except this js script.


It works for me on both firefox and chrome (I'm on a Macbook Pro OSX 10.11)


Note it doesn't run on stackoverflow because using the mic requires HTTPS (at least on Chrome, didn't check firefox). If the page is not HTTPS then I get

getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https<colon slash slash>goo.gl/rStTGz for more details.

stupid stackoverflow won't let me post the actual message from chrome because stackoverflow bans goo.gl