I am trying to open the camera in 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)
}
}
}
I also add the corresponding libs to .pro and this line in my bar-descriptor.xml
<permission system="true">run_native</permission>
<permission>use_camera</permission>
<permission>access_shared</permission>
But when I run this code on an emulator, I hit the console: view finder failed. If someone has an idea of why the viewer does not start, this will be helpful.
EDIT : It seems like it was an emulator. I download Beta 10.2.1 and it works.
source
share