I'm encountering a minor problem with a simple demo Android app built in Ionic 2.
Whenever a Youtube video is playing on the Homepage, if the power button is pressed or the phone goes into sleep/lock mode, the Youtube video continues to play. This issue results in Google rejecting the app from being listed in the Play Store because it violates their policy regarding Youtube embeds.
To resolve this issue, I need to implement some code that will pause the video when the state changes and then resume playback when the device wakes up again.
The functionality I believe needs to be added is onPause and onResume, but I'm uncertain about where and how to incorporate the necessary code to make this feature work with the customized Youtube code.
Below are links to the files in a repository and the APK (which is only 3mb). The issue can be observed on a blank Ionic 2 installation by visiting the provided link to the homepage.