Hi guys,
I try to set a specific currentTime position for a video, my code below works on ionic serve but once I push my code on my android phone, the currentTime update method doesn’t work
import { Component, ViewChild } from '@angular/core';
import { NavController, AlertController, Platform } from 'ionic-angular';
import { HomePage } from '../home/home';
@Component({
selector: 'page-workout',
templateUrl: 'workout.html'
})
export class WorkoutPage {
@ViewChild('videoPlayer') mVideoPlayer: any;
@ViewChild('audioPlayer') maudioPlayer: any;
audioMuted : boolean = false;
constructor(public navCtrl: NavController, public alertCtrl : AlertController, public platform: Platform) {
}
ionViewWillLeave(){
this.mVideoPlayer.nativeElement.ontimeupdate = null;
this.maudioPlayer.nativeElement.pause();
this.maudioPlayer.nativeElement = null;
this.mVideoPlayer.nativeElement.pause();
this.mVideoPlayer.nativeElement = null;
this.tabBarElement.style.display = 'flex';
}
reload(){
this.mVideoPlayer.nativeElement.currentTime = this.mVideoPlayer.nativeElement.currentTime - 10; //back to 10 sec
}
muted(){
this.audioMuted = !this.audioMuted;
this.maudioPlayer.nativeElement.muted = !this.maudioPlayer.nativeElement.muted;
}
}
What’s the solution of this issue ?
Thanks