Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Audio Recorder

Hi after deleting the function and added the code 'captureimage command();' , errors appear

please help me solve and check my application as i have to complete it by this wednesday 06-august-2014

thank you Image

http://appery.io/app/project/8ede79da...

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Audio Recorder

Samantha,

Did you follow all steps from instruction Evgene had provided?

What exact errors do you get?

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Audio Recorder

errors are shown in the screenshot above.
yes i followed the steps. this is my codes as shown in the screenshot:

function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
function win(r) {
alert("Code = " + r.responseCode);
alert("Response = " + r.response);
alert("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);
}
var fileURI = data.imageURI;
var headers = {
'X-Appery-Database-Id': 'XXXXXXXXXXXXXXXX',
'X-Appery-Session-Token': localStorage.getItem("userSessionToken")
};
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
options.mimeType = 'image/jpeg';
options.headers = headers;
var uri = encodeURI("https://api.appery.io/rest/1/db/files/" + options.fileName);
var ft = new FileTransfer();
ft.upload(fileURI, uri, win, fail, options);
}
}

Code: Select all

 // Called if something bad happens. 
 // 
 function captureError(error) { 
     var msg = 'An error occurred during capture: ' + error.code; 
     navigator.notification.alert(msg, null, 'Uh oh!'); 
 } 

 // A button will call this function 
 // 
 function captureImage() { 
     // Launch device camera application, 
     // allowing user to capture up to 2 images 
     navigator.device.capture.captureImage(captureSuccess, captureError, {limit: 2}); 
 } 

 // Upload files to server 
 function uploadFile(mediaFile) { 
     var ft = new FileTransfer(), 
         path = mediaFile.fullPath, 
         name = mediaFile.name; 

     ft.upload(path, 
         "[url=http://my.domain.com/upload.php]http://my.domain.com/upload.php[/url]", 
         function(result) { 
             console.log('Upload success: ' + result.responseCode); 
             console.log(result.bytesSent + ' bytes sent'); 
         }, 
         function(error) { 
             console.log('Error uploading file ' + path + ': ' + error.code); 
         }, 
         { fileName: name }); 
 } 

captureimage command();

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

Audio Recorder

Hello!

Sorry, there is a typo in Evgene's reply. Instead precaptureimage command();/pre use precaptureImage();/pre

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Audio Recorder

hi, the codes have no error now
however when i try to debug it, the console tab shows error.

how do i know if it is recorded since it is not saved into my database as i have not done any mapping

Image

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

Audio Recorder

Click on the link in console to find out where is the error.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Audio Recorder

Hi this is the error as shown

Image

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

Audio Recorder

Hello!

It needs to be tested in installed on device app. It won't work in browser.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Audio Recorder

hi. i have tested it on an ipad
however, it allows me to take picture instead and not record the voice.
please assist thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Audio Recorder

Hello Lim,

Could you please show what did you do for recording audio (code, events)?

Return to “Issues”