import { Component, OnInit } from '@angular/core'; import { Platform } from '@ionic/angular'; import { RouterService } from 'src/app/services/router.service'; import { StorageService } from 'src/app/services/storage.service'; // import { VideoPlayer, VideoOptions } from '@ionic-native/video-player/ngx'; //import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media/ngx'; import {DomSanitizer} from '@angular/platform-browser'; import { VideoPlayer } from '@ionic-native/video-player/ngx'; @Component({ selector: 'app-splash', templateUrl: './splash.page.html', styleUrls: ['./splash.page.scss'], }) export class SplashPage implements OnInit { // videoOptions: VideoOptions; constructor( private platform:Platform, private router:RouterService, private storage:StorageService, public sanitizer:DomSanitizer, private videoPlayer: VideoPlayer ) { } ionViewWillEnter(){ this.playVideo(); this.platform.ready().then(() => { this.platform.backButton.subscribeWithPriority(9999999,()=>{ this.router.goBack(); }); // this.splashScreen.hide(); this.storage.get("IsFirstLogin").then( data=>{ if(data==undefined || data==null) { this.router.navByUrl("dashboard"); }else{ this.storage.get("IsFirstLogin").then( lang=>{if(lang==undefined || lang==null){ setTimeout(() => { this.router.navByUrl("dashboard"); }, 2000); }else{ console.log('here'); setTimeout(() => { // let options: StreamingVideoOptions = { // successCallback: () => { console.log('Video played') }, // errorCallback: (e) => { console.log('Error streaming') }, // orientation: 'portrait', // shouldAutoClose: true, // controls: true // }; // console.log(options); // this.streamingMedia.playVideo('https://kanisati.info/uploads/splash.mp4', options); this.router.navByUrl("layout/main"); }, 2000); } }, error=>{ console.log(error); }); } }, error=>{ console.log(error,"error"); } ); });} playVideo(){ this.videoPlayer.play('https://kanisati.info/uploads/splash_tqRX5bOf_TgmL.mp4').then(() => { console.log('video completed'); }).catch(err => { console.log(err); }); } ngOnInit() { //this.playVideo(); } }