Flowr-es / node-microphone

MIT License
27 stars 9 forks source link

Live streaming to a client #7

Closed naveennamani closed 6 years ago

naveennamani commented 6 years ago

Is it possible to provide a live streaming to the user through this? I've tried the following code

var Mic = require('node-microphone');
var mic = new Mic();

app.get('/testmic',function(req,res) {
    var micStream = mic.startRecording();
    micStream.pipe(res);
});

when I directly pointed to this address (localhost:4000/testmic) the stream is getting downloaded as some file. But I want it such that when I assign this url to a audio src attribute in HTML5 audio element, I should be able to listen to the stream.

Is it possible? If yes, where have I done the mistake?

Flowr-es commented 6 years ago

Hi @naveennamani, sorry I was pretty inactive. Yes this is possible, but your browser interprets the stream as a download. You will need some Client (HTML/Javascript) Parts to realize that. However this would be out of scope for this module, so I will close this issue.