You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/21 04:01:04 UTC

[GitHub] [cordova-plugin-camera] glister commented on issue #678: App crashing randomly while taking images by camera in iOS14

glister commented on issue #678:
URL: https://github.com/apache/cordova-plugin-camera/issues/678#issuecomment-923602070


   @capc0 
   
   I took the same approach as @ita33 and it works well, run `cordova plugin add cordova-plugin-camera-preview`.
   
   Then do something along the lines of the following, where element is the dom element you want to contain the photo preview.
   
   ```javascript
   var targetPosition = element.getBoundingClientRect();
   
   CameraPreview.startCamera({
       x: targetPosition.left,
       y: targetPosition.top,
       width: targetPosition.width,
       height: targetPosition.height,
       //...other options
   });
   ```
   
   Then wire up your buttons to take a photo etc. Also don't forget to listen to orientation change event so your camera repositions with your dom element
   ```javascript
   window.removeEventListener('orientationchange', repositionCamera);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org