Page 4 of 5

Audio Recorder

Posted: Mon Aug 04, 2014 3:30 am
by Lim Samantha

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...


Audio Recorder

Posted: Mon Aug 04, 2014 10:22 pm
by Alena Prykhodko

Samantha,

Did you follow all steps from instruction Evgene had provided?

What exact errors do you get?


Audio Recorder

Posted: Tue Aug 05, 2014 3:27 am
by Lim Samantha

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


Audio Recorder

Posted: Tue Aug 05, 2014 9:13 am
by Maryna Brodina

Hello!

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


Audio Recorder

Posted: Tue Aug 05, 2014 9:43 am
by Lim Samantha

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


Audio Recorder

Posted: Tue Aug 05, 2014 12:22 pm
by Maryna Brodina

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


Audio Recorder

Posted: Wed Aug 06, 2014 12:48 am
by Lim Samantha

Hi this is the error as shown

Image


Audio Recorder

Posted: Wed Aug 06, 2014 9:16 am
by Maryna Brodina

Hello!

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


Audio Recorder

Posted: Fri Aug 08, 2014 7:59 am
by Lim Samantha

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


Audio Recorder

Posted: Fri Aug 08, 2014 8:41 pm
by Evgene Karachevtsev

Hello Lim,

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