I am using sample code of Camera2API and there is one bug in both the samples of ImageCapture and VideoCapture code by google. The bug is that when i open camera it does not take the complete width of AutofitTextureView. It crops some of its part from the right side.
The temporary fix which i found is to comment these 4 lines in both the samples:
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
textureView.setAspectRatio(previewSize.width, previewSize.height)
} else {
textureView.setAspectRatio(previewSize.height, previewSize.width)
}
But I am not sure whether doing this wrong or right. So please help me in fixing this code.