5

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 apps with the following reasons.

  1. Your submission has been rejected for enabling background playing of YouTube videos in violation of the YouTube API Terms of Service. If this submission was an update to an existing app....

  2. After a regular review, we have determined that your app enables background playing of YouTube videos, which is a violation of the YouTube API Terms of Service...

I am not sure what's wrong with them. Could anyone please help me out

Thanks in advance.

5 Answers5

2

Google just told me that the problem is when you hit the power button when playing your video. The screen will turn off but you also must stop your video playing. The mediaplayer handles Powerbutton off differently to changing to a different app (where it turnes off automatically). Since you are still having a valid screen (although dark), it keeps playing. That behavior is wanted when you for example have a mp3 player and you want to continue listening to your music whlie the screen is off. But Youtube doesn't like that with their videos.

schmiddy
  • 21
  • 5
2

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 !

JoxieMedina
  • 843
  • 1
  • 13
  • 20
  • i tried this answer but it is not working. video still playing when i lock the screen. – Roxx Aug 20 '17 at 04:23
  • It seems that this works (pause events is fired) when the home button is pressed but does not work when the lock button pressed. – SuprMan Feb 26 '19 at 06:34
0

Check out the answer to my similiar post here Stop android app audio playing when device locked

This solution works for my problem, and it may for yours as well.

Community
  • 1
  • 1
Guy Lowe
  • 2,115
  • 1
  • 27
  • 37
0

I had the same problem for many days, and this solve my issue.

Just put a permission on manifest file

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Community
  • 1
  • 1
Daniel Beltrami
  • 756
  • 9
  • 22
-2

I fixed this issue with my app (not using Cordova). I was using a WebView which opened Youtube links, which was the problem.

Add an if statement to open youtube.com and youtu.be links using the code from this post, so they open in the app instead.

Community
  • 1
  • 1
tm-null
  • 69
  • 1
  • 1
  • 3