Skip to content

Instantly share code, notes, and snippets.

@pavei
Last active August 24, 2017 01:33
Show Gist options
  • Save pavei/f30c1f9a46e069e2373f420131bcabed to your computer and use it in GitHub Desktop.
Save pavei/f30c1f9a46e069e2373f420131bcabed to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import {NavController, NavParams, Platform} from 'ionic-angular';
import {CameraPreview} from "@ionic-native/camera-preview";
@Component({
selector: 'page-story-photo',
templateUrl: 'story-photo.html',
})
export class StoryPhotoPage {
constructor(public navCtrl: NavController,
public navParams: NavParams,
private cameraPreview : CameraPreview,
private platform : Platform) {
this.startCamera();
}
startCamera(){
try{
this.cameraPreview.stopCamera().then(() =>{
console.log("camera started")
}).catch(e =>{
console.log("camera error")
});
}catch(e) {
}
// start camera
this.cameraPreview.startCamera({x: 0, y: 0, width:this.platform.width(), height: this.platform.height(), toBack: true, previewDrag: false, tapPhoto: true});
}
ionViewDidLoad() {
console.log('ionViewDidLoad StoryPhotoPage');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment