Screen orientation issue before minimize app


Me and my team wrote an angular application which is wrapped with ionic capacitor. We are using the screen orientation plugin to detect the tilting of the phone and display a video in fullscreen.

We are using ionic because we have 2 apps one for Android and one for iOS. On iOS the screen orientation behaves exactly as expected but on Android there is an issue: when keeping the phone in landscape mode pressing the home button to put the application in background fires a screen orientation event to portait. This determines our app to change the video to portait mode (not fullscreen). We have tried to use the platform specific pause event to detect when the application is put into background, but this is fired after the screen orientation event. Also, we unsubscribe from the screen orientation event handler on ionViewWillLeave. Do you know how we can resolve this issue? so that when the home button is pressed that event will not be fired or maybe not be used at all?