nativescript-camera-plus icon indicating copy to clipboard operation
nativescript-camera-plus copied to clipboard

How to set Static Properties such as defaultCamera on Angular apps?

Open leocaseiro opened this issue 6 years ago • 7 comments

Hi guys from nstudio. I'm trying to set the defaultCamera to 'front', but it doesn't work for me.

I've tried setting on the html, like so and nothing changes:

Attempt 1:

<CameraPlus defaultCamera="front"></CameraPlus>

Attempt 2:

class CaptureComponent {
    defaultCamera: string = 'front';
	// ...
}
<CameraPlus [defaultCamera]="defaultCamera"></CameraPlus>

Is there another way of doing that? Should I set while registering the Element, how to do so?

PS: For the time being, I've edited the source file, but I would like to set properly avoiding bugs while updating from npm.

node_modules/@nstudio/nativescript-camera-plus/camera-plus.common.js:63

Thanks

leocaseiro avatar May 10 '18 05:05 leocaseiro

Your second approach should work, it's possible there is some timing work that can be improved/fixed here. Can you send over a zip of project to test with?

bradmartin avatar Jun 10 '18 04:06 bradmartin

Have you been able to solve this?

marcelofb avatar Nov 16 '18 16:11 marcelofb

Simple, use this method:

getCurrentCamera()

AklsKiu avatar Mar 27 '19 00:03 AklsKiu

Attempt 1 should work as well, no? (Both 1 & 2 are not working for me as well)

wimva avatar Jul 10 '19 14:07 wimva

using this.cam.toggleCamera() on camloaded()

myst-al avatar Jul 18 '19 09:07 myst-al

Attempt 1 should work as well, no? (Both 1 & 2 are not working for me as well)

Late to the party but for me it had to be done quite early in my code, it's for VueJS but still, I set the value for that static field before attempting to using the component

let CamPlusFront = require('@nstudio/nativescript-camera-plus').CameraPlus; CamPlusFront.defaultCamera = "front"; Vue.registerElement('CameraPlus', () => CamPlusFront);

fumpierrez avatar May 25 '20 12:05 fumpierrez

this.cam.toggleCamera() just works fine temporarily but as I minimize app and come back its gone to rear OR default camera.

`import { CameraPlus } from '@nstudio/nativescript-camera-plus';

CameraPlus.defaultCamera = 'front'`

Do this while import and it would work..!!

adityadi98 avatar Mar 12 '21 08:03 adityadi98