cordova - How do I fix this: app enables background playing of YouTube videos -


i made phonegap app plays youtube videos. google has pulled play store because "app enables background playing of youtube videos."

i have no idea means.

can me fix videos don't play in background?

thanks.

i think google means u have pause youtube video when app in background mode (e.g. touching device home button)

the way solve register 'pause' event (called when app goes background)

document.addeventlistener("pause", pause, false); function pause (argument) {   if (typeof document.app.player != "undefined") {     document.app.player.pausevideo();   }  } 

when youtube played keep reference of player:

        patt=/\/www\.youtube\.com\/watch\?v=(.*)/;         m = patt.exec(url);         if (m.length == 2) {             url = "http://www.youtube.com/embed/"+ m[1] //+ "?autoplay=1"             console.log("url = "+url)          }          ytid = 'yt_'+m[1];          $("#mediappsvideo").html(             "<div id='"+ytid+"' width=\"100%\"></div>"         ).after(function() {             document.app.player = new yt.player(ytid, {               height: $(window).height()/2,               width: $(window).width()*0.95,               videoid: m[1],               events: {                 'onready': onplayerready,               }             });         }) 

this ugly working


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -