Fix Kotlin compilation in UsbCameraView.kt by invoking isCameraOpened() as a function and using CameraRequest.Builder()
This commit is contained in:
@@ -20,8 +20,14 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
textureView = AspectRatioTextureView(context)
|
textureView = AspectRatioTextureView(context)
|
||||||
addView(textureView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
addView(textureView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
||||||
|
|
||||||
|
val cameraRequest = CameraRequest.Builder()
|
||||||
|
.setPreviewWidth(1280)
|
||||||
|
.setPreviewHeight(720)
|
||||||
|
.create()
|
||||||
|
|
||||||
cameraClient = CameraClient.newBuilder(context)
|
cameraClient = CameraClient.newBuilder(context)
|
||||||
.setCameraStrategy(CameraUvcStrategy(context))
|
.setCameraStrategy(CameraUvcStrategy(context))
|
||||||
|
.setCameraRequest(cameraRequest)
|
||||||
.setEnableGLES(true)
|
.setEnableGLES(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@@ -32,11 +38,7 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
|
|
||||||
private fun startPreview() {
|
private fun startPreview() {
|
||||||
try {
|
try {
|
||||||
val cameraRequest = CameraRequest.CameraRequestBuilder()
|
cameraClient?.openCamera(textureView)
|
||||||
.setPreviewWidth(1280)
|
|
||||||
.setPreviewHeight(720)
|
|
||||||
.create()
|
|
||||||
cameraClient?.openCamera(textureView, cameraRequest)
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
@@ -73,7 +75,7 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isCameraConnected(): Boolean {
|
fun isCameraConnected(): Boolean {
|
||||||
return cameraClient?.isCameraOpened ?: false
|
return cameraClient?.isCameraOpened() ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onDestroy() {
|
fun onDestroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user