Advertisement
dMe1337

Untitled

Feb 28th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { App, NavController, NavParams, MenuController } from 'ionic-angular';
  3. import { MediaCapture, MediaFile, CaptureError, CaptureVideoOptions } from 'ionic-native';
  4. import { ResultPage } from '../result/result';
  5.  
  6. /*
  7. Generated class for the Start page.
  8.  
  9. See http://ionicframework.com/docs/v2/components/#navigation for more info on
  10. Ionic pages and navigation.
  11. */
  12. @Component({
  13. selector: 'page-start',
  14. templateUrl: 'start.html'
  15. })
  16. export class StartPage {
  17.  
  18.  
  19. constructor(public app: App, public navCtrl: NavController, public navParams: NavParams, public menu: MenuController) {menu.enable(true);}
  20.  
  21. ionViewDidLoad() {
  22. console.log('ionViewDidLoad StartPage');
  23. }
  24.  
  25.  
  26. /*
  27. Starting video recorder using MediaCapture plugin, native to Ionic framework.
  28. Setting the limit of videos to 1.
  29. */
  30.  
  31. startVideoCapture(){
  32.  
  33. let options: CaptureVideoOptions = { limit: 1};
  34. MediaCapture.captureVideo(options)
  35. .then(
  36. (data: MediaFile[]) => {console.log(data}; this.navCtrl.push(ResultPage); this.navCtrl.setRoot(ResultPage)},
  37. (err: CaptureError) => {console.log(err}; this.navCtrl.push(StartPage); this.navCtrl.setRoot(StartPage)}
  38. ).catch((err: CaptureError) => {console.log(err}; this.navCtrl.push(StartPage); this.navCtrl.setRoot(StartPage););
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement