-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
Using CameraPlus v. 4.1.0
There's still a bug in iOS that creates an error when sending a photo taken with the camera back to the calling function. Goal is to save the image in the file-system (not to the camera-roll)
this._owner.get().sendEvent(CameraPlus.photoCapturedEvent, asset);
this.resetPreview();
Sends back an asset that the calling script can't process
I had to change it like this:
this._owner.get().sendEvent(CameraPlus.photoCapturedEvent, this._photoToSave);
this.resetPreview();
Here's the callback in the calling script:
cam.on(CameraPlus.photoCapturedEvent, async (event) => {
console.log('CameraPlus.photoCapturedEvent', event.data);
try {
// let image = event.data;
if (isIOS) {
const imageFolder = knownFolders.documents();
console.log('event-data', event.data);
const iosImage = UIImageJPEGRepresentation(event.data, 0.7);
const result1 = NSFileManager.defaultManager.createFileAtPathContentsAttributes(imageFolder.path + "/cam_capture.jpg", iosImage, null);
const asset = new ImageAsset(imageFolder.path + "/cam_capture.jpg");
console.log('asset', asset);
currentAsset = asset;
viewModel.previewImage = asset;
viewModel.didTakePicture = true;
viewModel.canTakePicture = false;
console.log('ios-image', asset);
}
} catch (error) {
console.error('error', error);
}
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels