-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(camera-preview): add camera-preview #301
Conversation
Hey there, Thanks for the PR.
Also two more functions are missing: @Cordova({
observable: true
})
static setOnPictureTakenHandler(): Observable<any> { return; } It can be used like this: CameraPreview.setOnPictureTakenHandler().subscribe((data) => console.log(data)); |
Hi, I create the PR based on the npm package already distributed (0.0.8) and not from the GitHub repository (0.0.9). That is why some functions are missing. I will add them.
|
If they're not implemented yet then there is no need to add wrappers for them. Thanks again @rbouleau |
Thanks for you answer @ihadeed I push a new commit related to your remarks. |
Perfect! Thank you @rbouleau |
Hi, I'm trying to use the Right now I'm on
but when I'm trying t use it inside my controller like this:
I'm getting: On debugging the Object.keys(this.cameraPreview) is I'm running 0.0.8 version of the plugin. Any ideas of how to fix? Thanks! |
|
To use CemraPreview.setOnPictureTakenHandler().subscribe((data) => {
// do something with data
}); That method returns back an observable that you have to subscribe to and provide the callback there. |
Thank you so much for your quick response! @Component({
templateUrl: 'build/pages/hello-ionic/hello-ionic.html',
providers: [CameraPreview]
})
export class HelloIonicPage {
constructor(public cameraPreview: CameraPreview) {
}
onCameraPreview(result: Array<any>) {
this.originalPicture = result[0];
this.previewPicture = result[0];
}
startCapturing(side) {
this.cameraPreview['setOnPictureTakenHandler']((result) => {
this.onCameraPreview(result);
});
}
} |
import {CordovaPreview} from 'ionic-native';
@Component({
templateUrl: 'build/pages/hello-ionic/hello-ionic.html'
})
export class HelloIonicPage {
constructor() { }
onCameraPreview(result: Array<any>) {
this.originalPicture = result[0];
this.previewPicture = result[0];
}
startCapturing(side) {
CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
this.onCameraPreview(result);
});
}
} |
Ionic Native wrappers aren't Injectable at the moment. They are just static classes (some are instance based). |
When I'm removing the |
Oh I see, I need to change the constructor and call CameraPreview without this . . . |
I'm getting: cordova_not_available. |
On device I'm getting: plugin_not_installed |
Yes you must be running on a device or an emulator to use any of the plugins. |
Yes, I'm using ionic-preview app and ionic upload. |
I haven't used Ionic View in awhile, but AFAIK it doesn't support plugins. You need to use |
This PR is not the right place to discuss these things. If you're still experiencing issues consider one of the following options depending on what you are having trouble with:
|
Oh, Let me setup the environments please. Actually I've already created a discussion at the Ionic Forums: Thank you so much for your help! |
Hello, i've installed the plugin with : and according to the type file camera-preview.d.ts this method is waiting an object as argument : |
I'm running CameraPreview.takePicture({maxWidth: window.innerWidth, maxHeight: window.innerHeight}); or this: CameraPreview.startCamera({x: 0, y: 0, width: 300, height:300, camera: "back", tapPhoto: true, previewDrag: true, toBack: false, alpha: 1}); FYI another issue: |
Add camera-preview-plugin to ionic-native