Kasem Mohamed
Committed by GitHub

Fix NoSuchMethodError when calling CameraXHelper.createCameraProvider without useCases (#546)

* Fix NoSuchMethodError No virtual method createCameraProvider caused by method kotlin optional argument

* Fix typo in readme

* Use JvmOverloads
@@ -55,14 +55,14 @@ We provide a convenience `ScaleZoomHelper` class that can handle pinch-to-zoom f @@ -55,14 +55,14 @@ We provide a convenience `ScaleZoomHelper` class that can handle pinch-to-zoom f
55 55
56 ### Taking a high quality picture 56 ### Taking a high quality picture
57 57
58 -This allows you to take a high picture without interrupting the video stream. 58 +This allows you to take a picture without interrupting the video stream.
59 59
60 ``` 60 ```
61 // Pass in the imageCapture use case when creating the camera provider 61 // Pass in the imageCapture use case when creating the camera provider
62 val imageCapture = ImageCapture.Builder() 62 val imageCapture = ImageCapture.Builder()
63 .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY) 63 .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
64 .build() 64 .build()
65 -CameraXHelper.createCameraProvider(lifecycleOwner, arrayOf(imageCapture).let { 65 +CameraXHelper.createCameraProvider(lifecycleOwner, arrayOf(imageCapture)).let {
66 if (it.isSupported(application)) { 66 if (it.isSupported(application)) {
67 CameraCapturerUtils.registerCameraProvider(it) 67 CameraCapturerUtils.registerCameraProvider(it)
68 68
@@ -29,7 +29,6 @@ import io.livekit.android.room.track.video.CameraEventsDispatchHandler @@ -29,7 +29,6 @@ import io.livekit.android.room.track.video.CameraEventsDispatchHandler
29 29
30 class CameraXHelper { 30 class CameraXHelper {
31 companion object { 31 companion object {
32 -  
33 /** 32 /**
34 * Creates a CameraProvider that uses CameraX for its sessions. 33 * Creates a CameraProvider that uses CameraX for its sessions.
35 * 34 *
@@ -40,6 +39,7 @@ class CameraXHelper { @@ -40,6 +39,7 @@ class CameraXHelper {
40 * @param lifecycleOwner The lifecycleOwner which controls the lifecycle transitions of the use cases. 39 * @param lifecycleOwner The lifecycleOwner which controls the lifecycle transitions of the use cases.
41 * @param useCases The use cases to bind to a lifecycle. 40 * @param useCases The use cases to bind to a lifecycle.
42 */ 41 */
  42 + @JvmOverloads
43 @ExperimentalCamera2Interop 43 @ExperimentalCamera2Interop
44 fun createCameraProvider( 44 fun createCameraProvider(
45 lifecycleOwner: LifecycleOwner, 45 lifecycleOwner: LifecycleOwner,