Page 1 of 6

Phonegap Capture Audio

Posted: Wed May 29, 2013 4:27 pm
by pafowkes

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});


Phonegap Capture Audio

Posted: Wed May 29, 2013 5:09 pm
by Maryna Brodina

Hello! We're working on it.


Phonegap Capture Audio

Posted: Wed May 29, 2013 5:53 pm
by Maryna Brodina

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?


Phonegap Capture Audio

Posted: Wed May 29, 2013 5:56 pm
by pafowkes

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


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:01 pm
by pafowkes

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?


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:16 pm
by Maryna Brodina

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?


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:19 pm
by pafowkes

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?


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:27 pm
by pafowkes

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.


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:28 pm
by Maryna Brodina

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


Phonegap Capture Audio

Posted: Wed May 29, 2013 6:33 pm
by pafowkes

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