cordova-plugin-camera-preview
cordova-plugin-camera-preview copied to clipboard
setting the x and y position after camera start
Is there any method to set the x and y position of the preview after the cam has already started? I need to deal with device orientation.
I have a similar need, since I want the preview to follow where the user scrolls the page view in my app.
I might have an idea on how this could be fixed for iOS:
In CameraPreview.m, startCamera sets the x and y position (Link to source)
self.cameraRenderController.view.frame = CGRectMake(x, y, width, height);
In CameraPreview.m, setPreviewSize, the x and y position are set to 0,0. But we could easily give x,y parameters here (Link to source)
self.cameraRenderController.view.frame = CGRectMake(0, 0, width, height);
@westonganger Do you have ideas on the best way to make this change in the API?
- create a new method, setPreviewPosition, which would pass the appropriate x,y positions?
- create a new method, setPreviewRect, which x,y,width,height could all be set in one call?
I might be willing to submit a PR for this functionality
@youralien setPreviewPosition() would be ideal
because when user scrolls, you only need to set x & y axis when window resize only then you'll call the resize function
There seems to a be related issue but I don't understand https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues/145