Hello,
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.
Error xCode
2016-03-31 15:55:11.727 AppName[9536:1368591] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/D0289CE2-79B5-45D6-8B37-4B9D8ABA5D06/Library/Cookies/Cookies.binarycookies
2016-03-31 15:55:11.843 AppName[9536:1368591] Apache Cordova native platform version 4.1.0 is starting.
2016-03-31 15:55:11.844 AppName[9536:1368591] Multi-tasking -> Device: YES, App: YES
2016-03-31 15:55:11.878 AppName[9536:1368591]
Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
This file has been truncated. show original
And here are my file.
init.js
if (Meteor.isCordova) {
Meteor.startup(function () {
pictureSource = navigator.camera.PictureSourceType;
destinationType = navigator.camera.DestinationType;
mediaType = navigator.camera.MediaType;
});
}
video-capture.js
var uploader = new Slingshot.Upload('myFileUploads');
// counter starts at 0
Session.setDefault('uploadProgress', 0);
Template.templateVideoCapture.helpers({
progress: function () {
return Math.round(uploader.progress() * 100);
}
});
This file has been truncated. show original
My cordova plugins:
cordova-plugin-camera@2.1.1
cordova-plugin-device@1.1.1
cordova-plugin-media-capture@1.2.0
cordova-plugin-video-editor@1.0.8
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;
if(Meteor.isCordova){
videoCaptureSuccess = function() {}
}
Thanks for the help it fix the issue.
1 Like