Question

Is there some lib/plugin to record an audio stream coming from webRTC stream and save it locally on device/pc ?

I'm using Angular js + Node.js + JS + Phonegap (NO JQUERY)

I'm building up a webapp that will run on mobile devices thanks to phonegap, but i really would like to not reinvent the wheel.

So it could be great to have some lib/plugin/ dunno that runs both on mobile and desktop apps

N.B: if is out there something that helps more than Phonegap it's appriciated, cause actually i use Phonegap only to build the mobile app nothing more (as a webview only)

Was it helpful?

Solution

Good news for you then, there is actually a library doing exactly what you want. Only sad part is: The relevant API's are (as far as I know) not available on mobile devices. In other words, you would need to build an abstraction layer where on mobile devices you use the Cordova capture API and on desktop devices you will use either RecordRTC which is quite a broad library or more explictedly Recorder.js which takes a bit more work to implement. Lastly you can use this library also called Recorder.js which is older and less maintained, but should fall back to flash if WebRTC is not supported.

To give an example of how RecordRTC should work:

navigator.getUserMedia({audio: true, video:false}, function(mediaStream) {
   window.recordRTC = RecordRTC(MediaStream);
   recordRTC.startRecording();
});

btnStopRecording.onclick = function() {
   recordRTC.stopRecording(function(audioURL) {
      window.open(audioURL);
      //or
      recordRTC.save();
   });
};

Still though, despite such an abstraction layer taking some work, it's far from reinventing the wheel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top