capacitor-community / camera-preview

Capacitor plugin that allows camera interaction from HTML code
MIT License
189 stars 166 forks source link

Can't apply styles to camera view on Android #338

Open festinalente opened 5 months ago

festinalente commented 5 months ago

Describe the bug When loaded on Android, the video element will not adopt any styles. It can be resized passing a height and width option via the CameraPreview.start(cameraPreviewOptions); but then won't (for example) centre via CSS and seems to have different dimensions to those provided to it.

On a desktop in the browser, it works as expected.

To Reproduce Steps to reproduce the behavior: 1.) I load the element as such

` async function startup () { await platformInfo(); const cameraPreviewOptions = { parent: 'cameraControl', enableZoom: true, position: 'front', toBack: true, disableAudio: true, width: vars.width, height: vars.height };

await CameraPreview.start(cameraPreviewOptions); // other things to start up }`

Then the usual npm run build (with vite), npx cap sync, npx cap run android

Expected behavior To be able to style, position the camera output

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

I am using this plugin to get around PTZ limitations in the webview. Using a normal video element or canvas works, this seems to exist separate to the webview.