У меня есть HomePage и в ionViewWillEnter () я добавил код камеры. Так что, когда HomePage получает триггер, он сначала открывает камеру
Я хочу настроить поведение кнопки «Назад», чтобы при нажатии кнопки «Назад» после открытия камеры она переходила на SecondPage, по умолчанию - на HomePage.
ionViewWillEnter() {
this.captureVideo();
}
captureVideo() {
platform.registerBackButtonAction(() => {
this.navCtrl.push(SecondPage)
});
let options: CaptureVideoOptions = { limit: 1 };
this.mediaCapture.captureVideo(options)
.then((videodata: MediaFile[]) => {
var i, path, len;
for (i = 0, len = videodata.length; i < len; i += 1) {
path = videodata[i].fullPath;
}
this.flag_play = false;
this.flag_upload = false;
this.file.resolveLocalFilesystemUrl(path).then((newUrl) => {
alert(JSON.stringify(newUrl))
let dirPath = newUrl.nativeURL;
let dirPathSegments = dirPath.split('/')
dirPathSegments.pop()
dirPath = dirPathSegments.join('/')
this.file.readAsArrayBuffer(dirPath, newUrl.name).then(async (buffer)
=> {
await this.upload(buffer, newUrl.name);
})
})
})
.then(() => {
var videoFileName = 'video-name-here';
this.videoEditor.createThumbnail(
{
fileUri:'abc',// this.videoId,
outputFileName: videoFileName,
atTime: 2,
width: 320,
height: 480,
quality: 100
}
).then(result => {
this.result = result;
this.base64.encodeFile(result).then((base64File) => {
this.base64Thumbnail = base64File.replace("*;charset=utf-8", "jpg")
}, err => {
alert("Unable to create thumbnail")
})
})
})
}