Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera not working for web (ionic serve) with Capacitor 4 #247

Closed
gregoiregentil opened this issue Aug 21, 2022 · 2 comments
Closed

Camera not working for web (ionic serve) with Capacitor 4 #247

gregoiregentil opened this issue Aug 21, 2022 · 2 comments

Comments

@gregoiregentil
Copy link

gregoiregentil commented Aug 21, 2022

Hello,

Thank you for your hard work. I think that the plugin is not working with Capacitor 4 for "ionic serve". I have:
"@capacitor-community/camera-preview": "^4.0.0-0",
"@capacitor/core": "4.1.0",
as I have installed @capacitor-community/camera-preview@next

Please let me know if I have done anything wrong or if it's an issue because of the recent Capacitor 4. My ts code is working in Android and I'm "just" doing:

const { CameraPreview } = Plugins;
CameraPreview.start(cameraPreviewOptions);

The error in the browser says:

ERROR TypeError: Cannot read properties of undefined (reading 'start')

cameraPreview doesn't seem to exist.

@pbowyer
Copy link
Collaborator

pbowyer commented Sep 20, 2022

Hi @gregoiregentil, sorry to hear about these problems. It's going to be something to do with Capacitor 4. I don't use the plugin on the web so I'm hoping someone who does can jump in with a fix. Best of luck!

@jcesarmobile
Copy link
Contributor

Don't use it like this:

const { CameraPreview } = Plugins;
CameraPreview.start(cameraPreviewOptions);

Use it like this:

import { CameraPreview } from '@capacitor-community/camera-preview';
CameraPreview.start(cameraPreviewOptions);

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants