How to disable youtube background playing in phone

2020-03-25 05:32发布

问题:

My app gets rejected by playstore "modify your app to make sure it doesn't enable background play of YouTube videos", I am using phonegap for android and it seems that the youtube videos are still playing even if my app is in background mode.

I have tried to set:

<preference name="KeepRunning" value="false"/>

But still never worked, I even tried to add "pause" listeners for that issue, the listener is never triggered even though the "deviceready" listener is triggered.

Please I need some help here.

回答1:

Update the plugin to latest version (1.5.0) and use shouldPauseOnSuspend option set to yes

cordova.InAppBrowser.open('http://youtube.com', '_blank', 'shouldPauseOnSuspend=yes');


回答2:

I finally figured it out, adding to jcesarmobile approach, we need also to add this flag in the preference "ShouldPauseInAppBrowser" and set it to true.

Thanks all