Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13743

Adding this plugin breaks all instances of FileReader's already existing within an ionic project when deployed on Android (work on web)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Ionic
    • None
    • Android 6.0.0

    Description

      By adding the following to an ionic project:

      In the package.json
      + "@ionic-native/media-capture": "^4.5.2",
      In the config.xml
      + <plugin name="cordova-plugin-media-capture" spec="^3.0.1" />

      After this a code sample like this:

      var result = null;
       var reader = new FileReader();
      
            reader.onloadend = function (encodedFile: any) {
             result = encodedFile.target.result;
            };
              reader.onerror = function() {
                console.error("some error with reader")
              };
            reader.readAsDataURL(file);
      

      or another example:

      var result = null;
        var reader  = new FileReader();
              reader.onload = function() {
                result=reader.result; 
              };
              reader.onerror = function() {
                console.error("some error with reader")
              };
              //reader.readAsDataURL(file); 
              //reader.readAsBinaryString(file);
              reader.readAsArrayBuffer(file)
      

      In all cases result is not defined. No errors are emitted.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jk89home Jonathan Kelsey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: