-
Notifications
You must be signed in to change notification settings - Fork 3
Initial Call Error: SyntaxError: Unexpected token u in JSON at position 0 #2
Copy link
Copy link
Open
Description
Error-Message:
file:///android_asset/www/js/cordova-media-upload.js: Line 39 : Uncaught (in promise) SyntaxError: Unexpected token u in JSON at position 0
chromium: [INFO:CONSOLE(39)] "Uncaught (in promise) SyntaxError: Unexpected token u in JSON at position 0", source: file:///android_asset/www/js/cordova-media-upload.js (39)
Specs:
Device: Android Cordova App on Datalogic Memor 10 with Android 8.1.0
Cordova: 8.1.2 (cordova-lib@8.1.1)
Build on: Ubuntu 20.04
Code:
const cmu = new CordovaMediaUpload({
"imageWidth": 640,
"imageHeight": 480,
"imageQuality": 50,
"videoWidth": 640,
"videoHeight": 480,
"videoBitRate": 1000000
});
function getMedia(callback){
cmu.getVideo()
.then(data => {
showUserAlert(data);
callback();
})
.catch(error => {
if(error) {
navigator.notification.alert(_('album.failure'));
showUserAlert(error); // shows message box on page
throw error;
}
})
}Already tried with
const cmu = new CordovaMediaUpload({
imageWidth: 640,
imageHeight": 480,
imageQuality: 50,
videoWidth: 640,
videoHeight: 480,
videoBitRate: 1000000
});
[…]The error throws by calling getMedia. In getMedia the Error gets caught.
The error message is probably caused by the fact that in line 39 of your cordova-media-upload.js this.optionsObj is "undefined". Therefore, also "Unexpected token u in JSON at position 0". I can not say why it would be "undefined"…
But I could also be wrong, I haven't quite figured out your code yet.
I can't get past the error.
Please help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels