Code Monkey home page Code Monkey logo

cordova-media-upload's People

Contributors

d-marc1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cordova-media-upload's Issues

Initial Call Error: SyntaxError: Unexpected token u in JSON at position 0

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 ([email protected])
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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.