Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import { App, NavController, NavParams, MenuController } from 'ionic-angular';
- import { MediaCapture, MediaFile, CaptureError, CaptureVideoOptions } from 'ionic-native';
- import { ResultPage } from '../result/result';
- /*
- Generated class for the Start page.
- See http://ionicframework.com/docs/v2/components/#navigation for more info on
- Ionic pages and navigation.
- */
- @Component({
- selector: 'page-start',
- templateUrl: 'start.html'
- })
- export class StartPage {
- constructor(public app: App, public navCtrl: NavController, public navParams: NavParams, public menu: MenuController) {menu.enable(true);}
- ionViewDidLoad() {
- console.log('ionViewDidLoad StartPage');
- }
- /*
- Starting video recorder using MediaCapture plugin, native to Ionic framework.
- Setting the limit of videos to 1.
- */
- startVideoCapture(){
- let options: CaptureVideoOptions = { limit: 1};
- MediaCapture.captureVideo(options)
- .then(
- (data: MediaFile[]) => {console.log(data}; this.navCtrl.push(ResultPage); this.navCtrl.setRoot(ResultPage)},
- (err: CaptureError) => {console.log(err}; this.navCtrl.push(StartPage); this.navCtrl.setRoot(StartPage)}
- ).catch((err: CaptureError) => {console.log(err}; this.navCtrl.push(StartPage); this.navCtrl.setRoot(StartPage););
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement