Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Apps_A_
Beginner
78 Views

How To Fix - YouTube Keeps Playing Even After Power Button Is Pressed

I compiled an app, using Cordova 6.4.0 and Intel XDK 3759. The app, among other contents, also has a few YouTube playlists.

I have used the YouTube data api in the app and i have also mentioned this in the config.additions.xml:

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

The app was rejected by Google Playstore stating  'it violates its terms of service; by enabling background play of YouTube videos'. I checked the app, and noticed that the YT videos keep playing even after pressing the power button. This is not allowed by Google PlayStore.

Has anyone found a solution to this?

PS: Slso, I notice that someone has given a solution, but this is to non-Intel XDK app:

http://stackoverflow.com/questions/30244808/how-do-i-fix-this-app-enables-background-playing-of-yout...

How to include that solution in Intel XDK projects? Can someone help me on how to solve this?

 

 

Tags (2)
0 Kudos
3 Replies
Alex_Hang
New Contributor II
78 Views

As far as I can see that post from Stack Overflow is related to a PhoneGap app, which uses the same technologies such as Intel XDk ( HTML5, CSS, Java Script and Cordova Plug-ins) so if it worked on PhoneGap it should work on Intel XDk as well. Try that solution and see if it works.

0 Kudos
Apps_A_
Beginner
78 Views

Thanks for the reply.

If you see the post at StackOverFlow, it says 

Make the changes in the below activity 

public class MainActivity extends CordovaActivity

But, in IntelXDK, these files are hidden. In which file, do I have to add these codes?

This seems to be a IntelXDK webview issue.  Can someone pls have a look and tell me how to resolve this?

0 Kudos
PaulF_IntelCorp
Employee
78 Views

The first answer in that SO post is relevant and can be applied, using the "pause" event. This is a standard Android event that is passed through by the Cordova framework, so it is available with the XDK (since you are building a standard Cordova, aka PhoneGap, app).

There is no special XDK webview, the webview you are using when you build your app with the XDK is the same one you get when you build it with PhoneGap or Cordova CLI. When you choose "optimize with Crosswalk" you Android app uses an alternate Crosswalk webview (which you can also build against using Cordova CLI or PhoneGap). The Crosswalk behavior will vary, but the "pause" event is still available and, with that event, you can stop whatever is playing in your app. Likewise, there is a "resume" event.

If your target is Android 4.4 or higher you don't really need to use the "optimize with Crosswalk" option, unless you are dependent on some Crosswalk extended APIs (which most people are not).

0 Kudos