Recieve a Memory warning iOS after using camera with Cordova -
Recieve a Memory warning iOS after using camera with Cordova -
when take photo, begin receive memory warnings continuously. i'm using cordova 3.5 , photographic camera plugin these settings.
var _config; var picturesource; var destinationtype; // sets format of returned value. var encodingtype; // enconding type 0=jpg 1=png /** * initialize photographic camera plugin. * @param {object} config - settings. */ function initialize(config) { alert("camera comming!!"); // wait cordova connect device document.addeventlistener('deviceready', ondeviceready, false); } /** * cordova ready used! * @param {object} config - settings. */ function ondeviceready() { console.log("camera ready!!"); picturesource=navigator.camera.picturesourcetype; destinationtype=navigator.camera.destinationtype; encodingtype = navigator.camera.encodingtype; capturephoto(); } /** * set photographic camera plugin settings. * @param {object} config - settings. */ function setconfig(config) { _config = config; } /** * take image using device photographic camera , retrieve image base64-encoded string. */ function capturephoto() { setconfig({ quality: 20, destinationtype: destinationtype.data_url, encodingtype: 0}); navigator.camera.getpicture(onphotodatasuccess, onfail, _config); } /** * photo retrieved. * @callback getpicture~onphotodatasuccess * @param {string} imagedata - base64-encoded image. */ function onphotodatasuccess(imagedata) { //edit photo }
i create sure quality low, gets slower until crashes.
thanks help!
finally, solved problem fixing photo size:
/** * take image , image base64-encoded string. */ function capturephoto() { setconfig({ quality: 20, targetwidth: 600, targetheight: 600, correctorientation: true, destinationtype: destinationtype.data_url, encodingtype: 0}); navigator.camera.getpicture(onphotodatasuccess, onfail, _config); }
ios cordova camera
Comments
Post a Comment