I’m new with ionic. trying build a simple app. App needs to download a video than play it. Here is my codes. What is wrong with it?
async indirOynat(){
this.file.checkFile(this.file.dataDirectory, 'vidyo.mp4').then(_ => this.sadeceoynat()).catch(err => this.indir());
}
indir()
{
let alert = this.alertCtrl.create({
title: 'UYARI',
subTitle: "1 mb'lık bir video telefonunuza indirilecektir.",
buttons: ['TAMAM']
});
alert.present();
const url = 'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4';
const fileTransfer: TransferObject = this.transfer.create();
fileTransfer.download(url, this.file.dataDirectory + 'vidyo.mp4').then((entry) => {
this.videoOption ={
volume : 0.7
}
this.vp.play(this.file.dataDirectory + 'vidyo.mp4',this.videoOption);
}, (error) => {
// handle error
});
}
sadeceoynat()
{
let alert = this.alertCtrl.create({
title: 'UYARI',
subTitle: "bu dosya telefonunuzda mevcut, indirmeden oynatılacaktır.",
buttons: ['TAMAM']
});
alert.present();
this.videoOption ={
volume : 0.7
}
this.vp.play(this.file.dataDirectory + 'vidyo.mp4',this.videoOption);
}
and also it works too slow.