How to pause or stop ionic youtube app playing in the background

Hi all,

I’ve followed this tutorial http://bit.ly/2dXWVAL and created and ionic youtube app. Then, I’ve submitted it to Google Play.

Ta taa! App rejected.

I’m using this snippet

$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
document.addEventListener("pause", onPause, false);
function onPause() {
player.stopVideo();
}
});

But it didn’t work. I want to stop playing in the background when I press home and screen lock buttons on my phone.
Also, I put an alert on onPause() function to control it’s fired or not. I’m seeing alert popup when I press my screen lock button. But video not pause/stop when I press home button or screen lock button.

Any help would be appreciated.

Thanks,

Hey,

Is this issue resolved for you? Even my app is rejected for the same reason. I have youtube url embed in the app.

Thanks in advance

-Vivek

Any luck with this? My app was also rejected because of the same issue

I am having the same issue myself. Has anyone solved this?