I have created a few android apps using Cordova, These are having videos in it. I am trying to upload the Apps on Google play store but every-time they are rejecting all app
for those who have rejected them from the Play Store for "YouTube background play when the screen is off." or because the player still playing in background I solved with the following:
I used this library: https://github.com/brandly/angular-youtube-embed,
When the player is ready I assign the player to a root scope variable:
$scope.$on('youtube.player.ready', function ($event, player) {
$rootScope.YTPlayer = player;
});
and then i just listening the onPause of the android life cycle and stop or pause the video:
document.addEventListener("pause", function() {
if ($rootScope.YTPlayer) {
$rootScope.YTPlayer.stopVideo();
//or maybe $rootScope.YTPlayer.pauseVideo();
}
}, false);
For ionic 2 check out this repo: https://github.com/JoxieMedina/yt-channel
Greetings !