4

I am trying to open a 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 appropriate libs in the .pro and these line to 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 the emulator, i got in the console : view finder failed. If anybody has an idea of why the view finder doesn't start, it will be helpful.

EDIT : It seems that it was the emulator. I download the Beta 10.2.1 and it works.

brexis
  • 41
  • 3

1 Answers1

1

Camera will not open in emulator. Run it in the Device.