Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add use cases to cameraX createCameraProvider #536

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

KasemJaffer
Copy link
Contributor

This allows you to take a high quality picture without interrupting the video stream.

val imageCapture = ImageCapture.Builder()
      .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
      .build()

init {
  // Pass in imageCapture use case when creating the camera provider
  CameraXHelper.createCameraProvider(lifecycleOwner, arrayOf(imageCapture).let {
      if (it.isSupported(application)) {
          CameraCapturerUtils.registerCameraProvider(it)
  
          // Save cameraProvider for unregistration later.
          cameraProvider = it
      }
  }
}

fun takeHighQualityPicture() {
    val outputOptions = ImageCapture.OutputFileOptions.Builder(
        File(getApplication<Application>().filesDir, "high_quality_picture.jpg")
    ).build()

    imageCapture.takePicture(
        outputOptions,
        ContextCompat.getMainExecutor(getApplication()),
        object : ImageCapture.OnImageSavedCallback {
            override fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults) {
                Log.d(TAG, "Image saved successfully: ${outputFileResults.savedUri}")
            }

            override fun onError(exception: ImageCaptureException) {
                Log.e(TAG, "Error capturing image", exception)
            }
        }
    )
}

Copy link

changeset-bot bot commented Nov 11, 2024

🦋 Changeset detected

Latest commit: 4ddcc6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
client-sdk-android Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Nov 11, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@davidliu davidliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the PR!

livekit-android-camerax/README.md Outdated Show resolved Hide resolved
@davidliu
Copy link
Contributor

davidliu commented Nov 12, 2024

Please run ./gradlew spotlessApply from the project root to fix any style errors. Also, will need you to sign the CLA in order to merge this into the repo.

@KasemJaffer
Copy link
Contributor Author

Please run ./gradlew spotlessApply from the project root to fix any style errors. Also, will need you to sign the CLA in order to merge this into the repo.

Thanks, I signed the CLA but the problem is that my commits are saying unverified. I'm working to fix it and push shortly.

@KasemJaffer KasemJaffer requested a review from davidliu November 12, 2024 21:15
@davidliu
Copy link
Contributor

davidliu commented Nov 13, 2024

Hey @KasemJaffer, I think the issue is that the emails for your older commits are still in the wrong format, for example

commit ba37382db1c9fe0189d9b6f388ace2f490c13759
Author: kasem <“xxx.xxxx@email.com”>
Date:   Tue Nov 12 12:13:00 2024 -0800

    Update readme

The quotes within the <> are probably what's messing up the detection (should be just <xxx.xxxx@email.com> without the quotes).

There's a quick guide on how to amend the author field here, under the interactive rebase section. I highly suggest creating a separate branch to save a copy of the work before doing an interactive rebase, especially if you're not familiar with it since it can drop commits entirely. You can also just do it in another branch and open up a separate PR with the fixed commits.

@KasemJaffer
Copy link
Contributor Author

Hey @KasemJaffer, I think the issue is that the emails for your older commits are still in the wrong format, for example

commit ba37382db1c9fe0189d9b6f388ace2f490c13759
Author: kasem <“xxx.xxxx@email.com”>
Date:   Tue Nov 12 12:13:00 2024 -0800

    Update readme

The quotes within the <> are probably what's messing up the detection (should be just <xxx.xxxx@email.com> without the quotes).

There's a quick guide on how to amend the author field here, under the interactive rebase section. I highly suggest creating a separate branch to save a copy of the work before doing an interactive rebase, especially if you're not familiar with it since it can drop commits entirely. You can also just do it in another branch and open up a separate PR with the fixed commits.

You were right! thanks for the tip. All fixed up now.

@davidliu davidliu merged commit db34adb into livekit:main Nov 14, 2024
2 checks passed
@davidliu davidliu mentioned this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants