Solved QML Camera Flash not working properly (Android, iOS)
-
trying to use QML Camera in Android / iOS App
run into a problem with the FlashFlash Modes Auto, On, Off, FlashVideoLight are supported by my devices
Setting FlashAuto or FlashOn I can see that the Flash indeed was used from Android or iOS Camera
but captured Image is dark. seems not to be in sync with Flash and captured too earlyanyone else run into this ?
as a workaround I can use FlashVideoLight and set it immediately before Image capture:// on clicked Capture Button: camera.flash.mode = Camera.FlashVideoLight flashTimer.start() .... Timer { id: flashTimer repeat: false interval: 200 onTriggered: { camera.searchAndLock() camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation()) } } .... Camera { imageCapture { onImageCaptured: { camera.unlock() camera.flash.mode = Camera.FlashAuto photoPreview.source = preview // Show the preview in an Image } onImageSaved: { console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath) } } }
works but is an ugly workaround
any ideas or should I open a Bug report ? -
@SGaist Qt 5.10.1, tried with iOS 11, Android 6, Android 7 on different devices
now found a Bug explaining why this happens: https://bugreports.qt.io/browse/QTBUG-37990so the solution to fix this is:
// Capture Button: camera.searchAndLock() camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation()) // Camera { id: camera captureMode: Camera.CaptureStillImage flash.mode: Camera.FlashAuto imageCapture { onImageCaptured: { camera.unlock() // Show the preview in an Image photoPreview.source = preview } onImageSaved: { console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath) // Hint: you should set the Image with the saved Image, // because if using a Flash the first preview will be too dark // see https://bugreports.qt.io/browse/QTBUG-37990 photoPreview.source = "file://"+ camera.imageCapture.capturedImagePath } } } // camera
-
Hi,
Looks like a bug.
What version of Qt are you using ?
Could you try that on different Android/iOS versions ? -
@SGaist Qt 5.10.1, tried with iOS 11, Android 6, Android 7 on different devices
now found a Bug explaining why this happens: https://bugreports.qt.io/browse/QTBUG-37990so the solution to fix this is:
// Capture Button: camera.searchAndLock() camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation()) // Camera { id: camera captureMode: Camera.CaptureStillImage flash.mode: Camera.FlashAuto imageCapture { onImageCaptured: { camera.unlock() // Show the preview in an Image photoPreview.source = preview } onImageSaved: { console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath) // Hint: you should set the Image with the saved Image, // because if using a Flash the first preview will be too dark // see https://bugreports.qt.io/browse/QTBUG-37990 photoPreview.source = "file://"+ camera.imageCapture.capturedImagePath } } } // camera
-
This post is deleted!