Last active
August 24, 2017 01:33
-
-
Save pavei/f30c1f9a46e069e2373f420131bcabed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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