pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

This isn't specifically an Appery issue but I wonder if anybody has experience in capturing audio that can help?

I have used the following sample code from the cordova site and am currently testing on Android, the voice recorder starts OK and I am able to record voice clips but when I select the back button to return to the app I get an error code 3 on my Samsung Galaxy device and on a friends Razr we just get a grey screen.

If anybody has any ideas or experience please let me know.

// capture callback
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
path = mediaFiles.fullPath;
// do something interesting with the file
}
};

// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};

// start audio capture
navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2});

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Phonegap Capture Audio

Hello! We're working on it.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Phonegap Capture Audio

We tested on Android 2.3.5 - your code works. How do you call this code? What event you use? Did you set permissions RECORD_AUDIO, WRITE_EXTERNAL_STORAGE in App Setings?

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

I just had this in a button click event, I will check the permissions though as maybe that is the issue.

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

Just checked, I have the record_audio and, write_external_storage enabled.
So just to verify, when you use the back button it returns to the appery app (from the anrodi recorder) without any errors? Perhaps you could let me know what device you are testing on, maybe it is device specific?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Phonegap Capture Audio

If you made at least one record and returned with back button to app - there won't be any error. If you didn't record any audio and return to app with back button - you'll get an error with code 3 (which means you didn't record anything). This is how it works. I don't think it's a device specific. How do you test?

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

When I call the code I am able to make a recording (or more than one) and it shows up in the recorder. Maybe I can share the app with you to see if it is something specific in my test app?

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

Hi Marina,

I have shared the app, code executed from the "Record Audio" button. If you get a chance to test it at your end that would be great, thx Paul.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Phonegap Capture Audio

After you click to start recording, then click Stop - what option you select? You need to select "User record" option.

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Phonegap Capture Audio

I don't see a "User record" option.

Return to “Issues”