BernhardS
BernhardS

Reputation: 1088

ionic cordova-plugin-camerapreview "no preview"

i always get following error when i'm trying to start the ionic camera-preview:

ERROR Error: Uncaught (in promise): No preview

I updated all dependencies, added the provider etc. but i don't get it running, hope anyone can help me =)

enter image description here

enter image description here

The CameraPreviewOptions are copied from the example in the docs.

this.cameraPreview.startCamera(this.cameraPreviewOpts).then(
    (res) => {
      console.log(res)
    },
    (err) => {
      console.log(err)
    });

Upvotes: 1

Views: 2411

Answers (1)

Nicolas
Nicolas

Reputation: 2744

I had the same issue like you,

The following instructions did the trick for me:

start and then show the camera-preview in the ionViewCanEnter() lifecycle function.

You have also to be carefull of hiding the camera-preview in the ionViewWillLeave() lifecycle function. And also showing it again in the ionViewWillEnter() lifecycle function. To be clean.

Hope it helps :)

Upvotes: 2

Related Questions