fun bindPreview(cameraProvider: ProcessCameraProvider) {
Log.e("XN2", "bindPreview")
Log.e("XN2", NMSingleton.view!!.previewView.width.toString())
Log.e("XN2", NMSingleton.view!!.previewView.height.toString())
var preview: Preview = Preview.Builder()
.setTargetResolution(
Size(NMSingleton.view!!.width, NMSingleton.view!!.height))
.build()
var cameraSelector: CameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
/**
* FOR FUTURE VERSIONS SUPPORTING MULTI-CAMERA PHONES:
* var cameraSelector: CameraSelector = CameraSelector.Builder()
* .requireLensFacing(NMSingleton.desiredLens)
* .build()
*/// ImageAnalysis is being reimplemented. Not binding it during meantime.
// var imageAnalysis: ImageAnalysis = ImageAnalysis.Builder()
// .setTargetResolution(
// Size(NMSingleton.view!!.width, NMSingleton.view!!.height))
// .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
// .build()
//
// imageAnalysis.setAnalyzer(executor, NMImageAnalyzer())
var imageCapture: ImageCapture = ImageCapture.Builder()
.build()
// var camera = cameraProvider.bindToLifecycle(this as LifecycleOwner, cameraSelector, imageAnalysis, preview, imageCapture)
var camera = cameraProvider.bindToLifecycle(this as LifecycleOwner, cameraSelector, preview, imageCapture)
preview.setSurfaceProvider(NMSingleton.view!!.previewView.createSurfaceProvider(camera.cameraInfo))
}
--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/84eab40e-61de-4a72-bd58-3a3514a32256%40android.com.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.
TextureView is always more compatible than SurfaceView
(2)if you still meet the problem, try to initiate a TextureView directly and see if it can get
TextureView.SurfaceTextureListene$onSurfaceTextureAvailable being called (you need to set the lister by
mTextureView.setSurfaceTextureListener)
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/84eab40e-61de-4a72-bd58-3a3514a32256%40android.com.
--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/f29f7d28-f05d-4a8d-94a6-9a92a12df774%40android.com.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/84eab40e-61de-4a72-bd58-3a3514a32256%40android.com.
--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.
init { viewFinder = PreviewView(context) viewFinder!!.layoutParams = LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ) addView(viewFinder, 0)
viewFinder!!.post { startCamera() } installHierarchyFitter(viewFinder!!) // this was the fix}