我想在带有 Qml 界面和 QtMultimedia 5.0 的 Android 中使用摄像头 直到现在我还没有成功。
我将 Qt 5.1 与 qtquick 2.1 和 Android 4.2.2 API 17 一起使用
这是我的代码:
主.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
}
}
}
并且在我添加的 AndroidManifest.xml 文件中:
<uses-feature android:name="android.hardware.camera" />
我得到的是白屏
提前致谢
最佳答案
如果您有 HTC 设备,这个错误可能是您没有视频输出的原因:QTBUG-43487 .
关于android - Qt 5.1 : QMultimedia 5. 0 in android for Camera,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18853593/