AdapterJS
AdapterJS copied to clipboard
Audio streaming to node.js server
Hy, I have implemented audio streaming to node.js server from the browser. What I exactly did was this. var startTimer = new Date().getTime();
At client side
var self = this;
navigator.getUserMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
navigator.getUserMedia({audio: true, video: false}, function (stream) {
var audioContext = window.AudioContext;
var context = new audioContext();
window.audioInput = context.createMediaStreamSource(stream);
var bufferSize = 2048;
var recorder = context.createScriptProcessor(bufferSize, 1, 1);
recorder.onaudioprocess = self.onAudioProcess.bind(self);
audioInput.connect(recorder);
recorder.connect(context.destination);
}, this.onAudioError);
I am sending the audio buffer using the socket.io and at server I use lame encoder to encode it to mp3. Then I realized this doesn't work in IE and safari. So on a bit of research I was redirected here. Also I have seen in other issues that I cannot record streams using this plugin. I am actually not recording it, instead streaming it to nodejs server. Will this actually work?
I'm afraid it's not going to work out. The Temasys plugin does not implement AudioContext. It's simply not available on IE, and the implementation in Safari is not compatible with the plugin's.
If you're looking to record what's being captured by getUserMedia, I suggest you look at the recording capabilities in webrtc. It's not fully supported everywhere, and is not supported by the plugin at the moment, but it is in our backlog and will -eventually- be implemented.