I want to use camera in Android with Qml interface and QtMultimedia 5.0 Until now I haven't succeeded in it.
I'm using Qt 5.1 with qtquick 2.1 and Android 4.2.2 API 17
Here is my code:
main.qml :
import QtQuick 2.1
import QtMultimedia 5.0
Rectangle {
width: 800
height: 1280
color:'green'
Camera {
id: camera
imageCapture {
onImageCaptured: {
// Show the preview in an Image
photoPreview.source = preview
}
onImageSaved: {
text.text = qsTr("Last Captured Image (%1):").arg(camera.imageCapture.capturedImagePath)
}
}
}
Column {
Text {
height: 15
text: qsTr("Preview (Click to capture):")
}
VideoOutput {
source: camera
focus: visible // To receive focus and capture key events when visible
width: 320; height: 240
MouseArea {
anchors.fill: parent
onClicked: camera.imageCapture.capture()
}
}
Text {
id: text
height: 15
text: qsTr("Last Captured Image (none)")
}
Image {
id: photoPreview
width: 320; height: 240
}
}
}
and in AndroidManifest.xml file I added:
<uses-feature android:name="android.hardware.camera" />
What I got is white screen
Thanks in Advance