我想在用户播放视频时禁用硬件后退按钮 . 我用了ionic-native/video-player . 我使用下面的代码来禁用后退按钮 . 它's working fine when we are not playing video. But when video is loaded, it'不起作用 .

或者在播放视频时按下后退按钮时我可以获得任何事件,或者如果我可以获得标记视频停止或完全播放 .

谁能帮我吗?

public unregisterBackButtonAction: any;

ionViewDidEnter() {
    this.initializeBackButtonCustomHandler();
}

ionViewWillLeave() {
    // Unregister the custom back button action for this page
    this.unregisterBackButtonAction && this.unregisterBackButtonAction();
}

public initializeBackButtonCustomHandler(): void {
    this.unregisterBackButtonAction = this.platform.registerBackButtonAction(() => {
        this.customHandleBackButton();
    }, 10);
}

private customHandleBackButton(): void {
    // do what you need to do here ...
}