[英]How to record audio within a application on a mobile device, by not using the built in microphone
Im developing an application (with phonegap) where I want the user to be able to record his/her voice, when pushing/holding a button. 我正在开发一个应用程序(带有phonegap),希望用户在按下/按住按钮时能够记录他/她的声音。 So far, I have only figured out one way to do this, by using phongap's capture audio method.
到目前为止,我只是想出一种方法,可以使用phongap的捕获音频方法。 When I click on the button, the device's audio recording application is launched.
当我单击按钮时,将启动设备的音频录制应用程序。
So my question, is it possible to record an audio within the application by simply holding down a button, without launching the device's recording application? 所以我的问题是,是否可以通过简单地按住一个按钮来在应用程序中录制音频,而无需启动设备的录制应用程序?
<button id="record" d class="btn btn-xlarge"> Record </button>
$("#record").mousedown(function(){
// Start the recording, maximum 10 seconds save the audio file
});
$("#record").mouseup(function(){
// stop the recording and save the audio file
});
Instead of using the Catpure object, you may use the Media object: http://docs.phonegap.com/en/3.2.0/cordova_media_media.md.html#Media 除了使用Catpure对象外,还可以使用Media对象: http ://docs.phonegap.com/en/3.2.0/cordova_media_media.md.html#Media
This object makes it possible to interface the mic directly, without launching the device's audio recording application. 该对象使直接连接麦克风成为可能,而无需启动设备的音频录制应用程序。
Some examples are found here: http://docs.phonegap.com/en/3.2.0/cordova_media_media.md.html#media.startRecord_quick_example 在此处找到一些示例: http : //docs.phonegap.com/en/3.2.0/cordova_media_media.md.html#media.startRecord_quick_example
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.