[SOLVED] Cordova cordova-plugin-camera and cordova-plugin-media-capture Can't find variable


I just update my app to 1.3 and everything is working except cordova-plugin-camera and cordova-plugin-media-capture.

Before the update i was using METEOR@1.3-cordova-beta.2 and everything was working, after the update every time i click(tap) the event to open the camera or the camera roll Uncaught Error: ReferenceError: Can’t find variable: videoCaptureSuccess.

I’m also using cordova-plugin-video-editor.

Here is the error that i receive from xCode.

And here are my file.

My cordova plugins:

Thanks in advance

I’m pretty sure what you are dealing with here is a block scoping issue. Changing the way you declare you functions should fix it.

rather than like this which I believe will be handled like declaring with let:

function videoCaptureSuccess() { /*....*/ }

declare the function like this with var to avoid block scope:

var videoCaptureSuccess = function() { /*....*/ }

you could also declare using let or const at the top of the file and then assign later.

let videoCaptureSuccess;

   videoCaptureSuccess = function() {}

Thanks for the help it fix the issue.

1 Like