简体   繁体   English

Javascript / HTML5 - 用于Web桌面/移动应用的音频流录制

[英]Javascript / HTML5 - Audio stream recording for web desktop/mobile app

Is there some lib/plugin to record an audio stream coming from webRTC stream and save it locally on device/pc ? 是否有一些lib /插件来记录来自webRTC流的音频流并将其本地保存在设备/ PC上?

I'm using Angular js + Node.js + JS + Phonegap (NO JQUERY) 我正在使用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. 我正在构建一个可以在移动设备上运行的webapp,这要归功于phonegap,但我真的不想重新发明轮子。

So it could be great to have some lib/plugin/ dunno that runs both on mobile and desktop apps 因此,在移动和桌面应用程序上运行一些lib / plugin / dunno可能会很棒

NB: 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) 注意:如果有一些东西比Phonegap更有帮助,那么实际上我只使用Phonegap来构建移动应用程序(仅限webview)

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. 唯一可悲的是:相关的API(据我所知)在移动设备上不可用。 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. 换句话说,您需要构建一个抽象层,在移动设备上使用Cordova捕获API,在桌面设备上,您将使用RecordRTC ,这是一个相当广泛的库或更明确的Recorder.js ,它需要更多的工作实行。 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. 最后,您可以使用此库也称为Recorder.js ,它较旧且维护较少,但如果不支持WebRTC,则应该回退到闪存。

To give an example of how RecordRTC should work: 举一个RecordRTC应该如何工作的例子:

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. 尽管如此,尽管这样的抽象层需要一些工作,但它还远没有重新发明轮子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM