My code throws this error Failed to load resource: unsupported url on the following line:
self.$el.find('.capturedImage').attr('src', imageData);
This is the value of imageData:
assets-library://asset/asset.JPG?id=106E99A1-4F6A-45A2-B320-B0AD4A8E8473&ext=JPG
This is happening when running a cordova app on the iPhone simulator using the plugin cordova-plugin-camera 2.4.1 "Camera" Deployment Target in Xcode is set to 9.0
render: function (context, template) {
var self = this;
View.__super__.render.apply(this, [context, template]);
setTimeout(function() {
var imageData = app.selectedYoungPerson.imageData;
if (app.selectedYoungPerson.fromCamera) {
if (imageData.indexOf('data:image/jpeg;base64,') != 0 && imageData.indexOf('data:;base64,') != 0) {
self.$el.find('.capturedImage').attr('src', "data:image/jpeg;base64," + imageData);
}
}else{
self.$el.find('.capturedImage').attr('src', imageData);
}
self.startCrop.apply(self,[]);
}, 1000);
getBrowseImage: function(data) {
var self = this;
var destinationType = (navigator.userAgent.match(/iemobile/i)) ? navigator.camera.DestinationType.DATA_URL : navigator.camera.DestinationType.NATIVE_URI;
navigator.camera.getPicture(function(imgData) {
var fileName = 'img_'+(new Date()).valueOf()+'.jpg';
if(data.callback) {
data.imgData = imgData;
data.fileName = fileName;
data.fromCamera = false;
data.callback.apply(data.ref, [data]);
//self.uploadImage(data);
}
}, function(err) {
alert('Image cpature failed : '+err);
}, {
quality: 100,
allowEdit: true,
correctOrientation: true,
destinationType: destinationType,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);
},
This is my list of plugins:
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-file 4.3.2 "File"
cordova-plugin-file-transfer 1.6.2 "File Transfer"
cordova-plugin-whitelist 1.3.2 "Whitelist"
org.apache.cordova.console 0.2.11 "Console"
assets-libraryis a hosted application or just a folder? - T J://inassets-library://..? - T Junsupported urlso you should know whether you have a valid url or not... - T J