abdullah celik
abdullah celik

Reputation: 551

CameraX - VideoCaptureConfig.Builder is showing an error

I have the following line in my CameraXFragment and Android Studio is showing me an error:

videoCapture = VideoCaptureConfig.Builder()     // <--- Builder is in red
            .setTargetRotation(binding.previewView.display.rotation)
            .setCameraSelector(cameraSelector)
            .setTargetAspectRatio(screenAspectRatio)
            .build()

Android Studio does not recognize Builder after updating the camerax version from '1.0.0-beta04' to '1.0.0-beta12'.

Does somebody know how to create a VideoCaptureConfig in the latest version ?

Upvotes: 1

Views: 1601

Answers (2)

Grigor Abgaryan
Grigor Abgaryan

Reputation: 1

You could use this in order to utilize the library's restricted api. That doesn't mean it's gonna work, though.

@SuppressLint("RestrictedApi")

Upvotes: -2

Saurabh Thorat
Saurabh Thorat

Reputation: 20634

Use VideoCapture.Builder():

videoCapture = VideoCapture.Builder()
            .setTargetRotation(binding.previewView.display.rotation)
            .setCameraSelector(cameraSelector)
            .setTargetAspectRatio(screenAspectRatio)
            .build()

Upvotes: 3

Related Questions