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

ofAll模式下,怎么在相机里使用“点击拍照,长按摄像”功能 #2903

Open
gaowch opened this issue Jun 17, 2024 · 0 comments

Comments

@gaowch
Copy link

gaowch commented Jun 17, 2024

当前使用的版本是多少?

v3.11.2

####我目前是用的这个方法绕过去的

在启动时传递ofImage(),在自定义界面setCameraMode=0

PictureSelector.create(this)
    .openCamera(SelectMimeType.ofImage())
    .setOutputCameraDir("") //不要自定义路径
    .setCameraInterceptListener(MeOnCameraInterceptListener(both)) //自定义相机
    .forResult(listener)
private inner class MeOnCameraInterceptListener() : OnCameraInterceptListener {
    /**
     * @param cameraMode [com.luck.lib.camerax.CustomCameraConfig]
     */
    override fun openCamera(fragment: Fragment, cameraMode: Int, requestCode: Int) {
        val camera = SimpleCameraX.of()
        camera.isAutoRotation(true)
        camera.setCameraMode(0)
        camera.setVideoFrameRate(30)
        camera.setVideoBitRate(3 * 1024 * 1024)
        camera.isDisplayRecordChangeTime(true)
        camera.isManualFocusCameraPreview(false)
        camera.isZoomCameraPreview(true)
        camera.setOutputPathDir("") //不要自定义路径:保存到相册
        camera.setRecordVideoMaxSecond(MAX_VIDEO_SECOND)
        camera.setRecordVideoMinSecond(MIN_VIDEO_SECOND)
        camera.setCaptureLoadingColor(resources.getColor(R.color.theme))
        camera.setImageEngine { context, url, imageView -> Glide.with(context).load(url).into(imageView) }
        camera.start(fragment.requireActivity(), fragment, requestCode)
    }
}
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

1 participant