You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The camera supported resolutions are 400x200px and 1200x600px.
If I choose the lower resolution 400x200px, the preview will not fill the entire screen
If I choose the higher resolution 1200x600px, the preview will be larger than the screen
Is there a positibility to choose the higher res 1200x600px but then scale the View-Container of the preview box, so that the entire screen is filled? It is ok if there is a little overlap top/bottom or left/right that is not visible due to aspect ratio.
The text was updated successfully, but these errors were encountered:
Instead of scaling, this can be achieved with the x, y, width, height params of startCamera in combination with setPreviewSize.
For future reference:
startCamera with x = 0, y = 0, width = window.innerWidth, height = window.innerHeight results in a view container that fits the entire screen. x, y, width and height can be any user defined pixel value.
setPreviewSize of e.g. 400x200px sets the camera to that resolution. It is than stretched into the dimensions above (low camera resolution but fullscreen). Aspect ratio may be distorted however. Width and height can only be a dimsension that is supported by the camera. Currently there only is the option to get the supported pictures sizes, but not all of them are working. A new method to get the supported preview sizes is therefore needed Feature request: getSupportedPreviewSizes #664
in order to keep the correct aspect ratio of the screen, the x, y, width and height params of setPreviewSize need to be calculated and adjusted (e.g. leave space for black bars on top and bottom OR move into negative pixel area and cut off some image content of the preview)
Edit: on iOS the implementation seems to work differently. Using window.innerWidth and window.innerHeight for startCamera without the use of setPreviewSize however seems to work for all iPhone/iPads.
Is it possible to scale the preview box?
For example the device screen is 800x400px.
The camera supported resolutions are 400x200px and 1200x600px.
If I choose the lower resolution 400x200px, the preview will not fill the entire screen
If I choose the higher resolution 1200x600px, the preview will be larger than the screen
Is there a positibility to choose the higher res 1200x600px but then scale the View-Container of the preview box, so that the entire screen is filled? It is ok if there is a little overlap top/bottom or left/right that is not visible due to aspect ratio.
The text was updated successfully, but these errors were encountered: