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

camerakit #7

Open
jinman opened this issue Feb 20, 2019 · 4 comments
Open

camerakit #7

jinman opened this issue Feb 20, 2019 · 4 comments

Comments

@jinman
Copy link

jinman commented Feb 20, 2019

I upgraded it from wonderklin package to new camerakit version and using AndroidX. but this code in BarCodeReaderActivity

    override fun onClick(v: View) {
        fabProgressCircle.show()
        cameraKitView.captureImage { cameraKitImage ->
            // Get the Bitmap from the captured shot
            getQRCodeDetails(cameraKitImage.bitmap)
            runOnUiThread {
                showPreview()
                imagePreview.setImageBitmap(cameraKitImage.bitmap)
            }
        }
    }

Is not compiling. Not sure what is wrong? Any suggestions

@harshithdwivedi
Copy link

Hi, what's the issue that you're facing @jinman?

@Uplink03
Copy link

Uplink03 commented Apr 24, 2019

CameraKit 1.0 breaks API compatibility with CameraKit 0.13

The example code uses com.wonderkiln.camerakit.CameraView from CameraKit 0.13 which has a captureImage that works like that, but in CameraKit 1.0 with com.camerakit.CameraKitView captureImage and friends only accept callbacks with this signature: (com.camerakit.CameraKitView cameraKitView, byte[] bytes).

I tried to figure out how to get a bitmap out of those bytes right now as there's no object that has a bitmap property, but I gave up and moved back to 0.13, for which at least the docs and examples match.

@Uplink03
Copy link

Good news: I figured out how to get a bitmap out of the byte array and fix your function:

    override fun onClick(v: View) {
        fabProgressCircle.show()
        cameraKitView.captureImage { cameraKitView, jpeg ->
            val bitmap = BitmapFactory.decodeByteArray(jpeg, 0, jpeg.size)
            // Get the Bitmap from the captured shot
            getQRCodeDetails(bitmap)
            runOnUiThread {
                showPreview()
                imagePreview.setImageBitmap(bitmap)
            }
        }
    }

Bad news: It doesn't capture anything... as described in this CameraKit's issue: CameraKit/camerakit-android#533

@pravingaikwad07
Copy link

Check this out. Degrade the version. CameraKit/camerakit-android#533 (comment)

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

No branches or pull requests

4 participants