我正在尝试在Blackberry Cascades 10.2中打开相机
import bb.cascades.multimedia 1.0
import bb.multimedia 1.0
import bb.cascades 1.2
import bb.system 1.2
Page {
titleBar: TitleBar {
title: "QML Camera Sample App"
}
content : Camera {
id: qmlCameraObj
property bool photoBeingTaken
onTouch: {
if (photoBeingTaken == false) {
photoBeingTaken = true;
qmlCameraObj.capturePhoto();
}
}
onCameraOpened: {
qmlCameraObj.startViewfinder();
}
onCameraOpenFailed: {
console.log("camera open failed")
}
onViewfinderStarted: {
photoBeingTaken = false;
}
onViewfinderStartFailed: {
console.log("view finder failed")
}
onPhotoCaptureFailed: {
console.log("Photo capture failed")
photoBeingTaken = false;
}
onPhotoSaveFailed: {
console.log("Photo save failed")
photoBeingTaken = false;
}
onPhotoSaved: {
photoBeingTaken = false;
}
onCreationCompleted: {
qmlCameraObj.open(CameraUnit.Front)
}
}
}
我还将.pro和这些行中的相应库添加到我的bar-descriptor.xml
<permission system="true">run_native</permission>
<permission>use_camera</permission>
<permission>access_shared</permission>
但是当我在模拟器上运行此代码时,我进入了控制台:查找程序失败。 如果有人知道为什么取景器没有启动,那将会有所帮助。
编辑:似乎是模拟器。我下载了Beta 10.2.1,它可以运行。
答案 0 :(得分:1)
相机无法在模拟器中打开。在设备中运行它。