-
Notifications
You must be signed in to change notification settings - Fork 490
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
Switch camera during scanning #110
Comments
I also encountered the same problem,waiting for the suggestion. |
My solution,insert code at "QRCodeReaderView.java": `
and you just need use this code to switch Camera during scanning : |
thank you so much for your help
Envoyé à partir d’Outlook<http://aka.ms/weboutlook>
…________________________________
De : 清梅 <notifications@github.com>
Envoyé : jeudi 4 mai 2017 04:36
À : dlazaro66/QRCodeReaderView
Cc : Subscribed
Objet : Re: [dlazaro66/QRCodeReaderView] Switch camera during scanning (#110)
My solution,insert code at "QRCodeReaderView.java":
`
public void switchCameraFace() {
releaseCamera();
//"face" means your scanning camera face
face = face == Camera.CameraInfo.CAMERA_FACING_FRONT ? Camera.CameraInfo.CAMERA_FACING_BACK : Camera.CameraInfo.CAMERA_FACING_FRONT;
openCamera(face);
}
private void openCamera(int cameraFace) {
try {
mCameraManager.setPreviewCameraId(cameraFace);
mCameraManager.openDriver(getHolder(), this.getWidth(), this.getHeight());
mCameraManager.setDisplayOrientation(getCameraDisplayOrientation());
mCameraManager.startPreview();
mCameraManager.setPreviewCallback(this);
} catch (Exception e) {
e.printStackTrace();
}
}
private void releaseCamera() {
mCameraManager.setPreviewCallback(null);
mCameraManager.stopPreview();
mCameraManager.closeDriver();
}`
and you just need use this code to switch Camera during scanning :
mScannerView.switchCameraFace();
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#110 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ASw38Gr1Heft7AxvSxewKpVprXRmBLvYks5r2UeygaJpZM4Mg_Cw>.
|
When I set my camera to either front or back before starting it the first time like this
I can set it to either one of them. But when I have the preview running and want to switch the camera with:
it still uses the old camera direction and the points seem to be flipped (QR code at the bottom -> found dots at the top).
How can I switch cameras during preview?
The text was updated successfully, but these errors were encountered: