Cordova Camera Plugin returns green pictures Windows Phone 8.1

痞子三分冷 提交于 2019-12-21 21:55:07

问题


Very strange behaviour: after takinf a 2nd or third picture using cordova camera plugin returned picture is green and about 200kb while normally about 2 mb. When taking more 'green' pictures application crashes and default camera screen becomes green untill phone is restarted.

Tryed different parameters like getting url instead of base64, different picture sizes - no luck.

This is reproduced on Nokia Lumia 520, but Microsoft Lumia 535 allowes to take about 6 pictures. While android works fine.

Code looks like:

navigator.camera.getPicture(onSuccess, onFail, {
    quality: 50,
    destinationType: Camera.DestinationType.DATA_URL,
    encodingType: Camera.EncodingType.JPEG,
    sourceType : Camera.PictureSourceType.CAMERA
});

Tryed to use capture plugin result is the same.


回答1:


You may try this:

camera: {
    pictureSource: "UNDEFINED",
    destinationType: "UNDEFINED",
    cameraInitialize: function () {
        pictureSource = navigator.camera.PictureSourceType;
        destinationType = navigator.camera.DestinationType;
        cameraOptions = { quality: 50, allowEdit: true, destinationType: destinationType.DATA_URL, correctOrientation: true }
        galleryOptions = { quality: 50, destinationType: destinationType.DATA_URL, sourceType: pictureSource.PHOTOLIBRARY }
    },
    getPicture: function (cameraSuccess, cameraError, cameraOptions) {
        navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);
    }
},



回答2:


For me the only solution so far (per microsoft support) is to hard reset your phone. I have an ancient Lumia running windows phone 8.1 and it is having the same issue in my app.

I actually think that the device is overheating.

Also things you should do to help avoid camera issues in your WP app:

  • Assuming you use cordova, check if the video object has the maximum z-index and check if it isn't stacking under your application.
  • If you also use angular, some button types fire ng-click twice on IE and so the camera opens twice.
  • Implement cordova-camera-plugin 2.0.0 which fixes things like double-tapping in the camera and making it crash

I hope this helps you in your painful quest.



来源:https://stackoverflow.com/questions/30416719/cordova-camera-plugin-returns-green-pictures-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!