App enables background playing of videos, cordova issues, google play rejecting apps

前端 未结 5 727
孤城傲影
孤城傲影 2021-01-19 02:12

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

相关标签:
5条回答
  • 2021-01-19 02:32

    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 !

    0 讨论(0)
  • 2021-01-19 02:33

    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"/>
    
    0 讨论(0)
  • 2021-01-19 02:36

    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.

    0 讨论(0)
  • 2021-01-19 02:49

    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.

    0 讨论(0)
  • 2021-01-19 02:58

    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.

    0 讨论(0)
提交回复
热议问题