- This topic has 2 replies, 2 voices, and was last updated 11 years, 1 month ago by MrBean.
-
AuthorPosts
-
MrBeanMemberHi
I am developing an app that captures audio, video and images.
Capture video and Images works just fine.
However, I am not able to get captureAudio to work. Is it supported by your implementation?I do a simple call by
var options = { duration: 10 };
navigator.device.capture.captureAudio(captureSuccess, captureError, options);The screen then goes black and after 10 s, CaptureError is called with code 3.
It is somewhat interacting with the audio, since if I do a background playback of an internet radio, the sound is stopped when doing this.
The phonegap documentation states ” iOS Quirks, iOS does not have a default audio recording application, so a simple user interface is provided.”Do you have any suggestion here to get it working?
I am using MobiOne 2.5, Cordova 2.9 and iOS 7.03 on IPhone 5
Btw, I think MobiOne is an execellent tool, I developed pretty advanced imaging applications without the need of xcode.
Thanks,
fbod383Memberyou have to use a separate custom js for iOS
var myAudioFile; var myFileRecord = "myrecording.wav"; var myMime = "audio/x-wav"; // Wait for PhoneGap to load // //document.addEventListener("deviceready", onDeviceReady, false); // Record audio // function recordAudio() { src = recordingPath; mediaRec = new Media(src, onSuccess, onError); // Record audio mediaRec.startRecord(); // Stop recording after 611 sec var recTime = 0; var recInterval = setInterval(function() { recTime = recTime + 1; setAudioPosition(recTime + " sec"); if (recTime >= 600) { clearInterval(recInterval); mediaRec.stopRecord(); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); } }, 1000); }
MrBeanMember@fbod383 wrote:
you have to use a separate custom js for iOS
var myAudioFile; var myFileRecord = "myrecording.wav"; var myMime = "audio/x-wav"; // Wait for PhoneGap to load // //document.addEventListener("deviceready", onDeviceReady, false); // Record audio // function recordAudio() { src = recordingPath; mediaRec = new Media(src, onSuccess, onError); // Record audio mediaRec.startRecord(); // Stop recording after 611 sec var recTime = 0; var recInterval = setInterval(function() { recTime = recTime + 1; setAudioPosition(recTime + " sec"); if (recTime >= 600) { clearInterval(recInterval); mediaRec.stopRecord(); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); } }, 1000); }
Thanks, I will try that interface instead.
My snippet above was placed in a custom.js, and calls to captureImage and CaptureVideo works, not audio. -
AuthorPosts