javascript - Youtube API pause when i press play in some mobile browser -
i have been working youtubes javascript api webpage , has been working great. today noticed problem has not been present before. on mobile browsers instance firefox on android youtube players works ones. if press play(on video) start playing , if press pause stops. if press play again play couple of frames , pause again. think new problem have done lot of testing last couple of weeks. here code creating players.
//start youtube api var tag = document.createelement('script'); tag.src = "http://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var youtubeready = false; //variable dynamically created youtube players var players= new array(); var isplaying = false; function onyoutubeiframeapiready(){ youtubeready = true; //the id of iframe , same videoid jquery(".video").each(function(i, obj) { players[obj.id] = new yt.player(obj.id, { videoid: obj.id, playervars: { controls: 0, showinfo: 0 , modestbranding: 1, wmode: "transparent", html5: 1 }, events: { 'onstatechange': onplayerstatechange } }); }); }
ok found cause of problems. experinced problem in firefox android , standard browser on samsung galaxy s3. setting youtube player had control=0 play , pause interaction done pressing iframe/video image
in firefox problem if played video, paused , played again play couple of frames pause no reason. cause of problem line:
tag.src = "http://www.youtube.com/iframe_api";
if change http https works. same problem occur when using regular embeds if not link video https.
however means user has activate plugin before video visible , furthermore seems more laggy player appears... when reading in forums seems lot of people have problem youtube embeds firefox android.
for samsung s3 browser problem kind of opposite. when playing video , pausing rewind couple frames , play again no reason. found problem "control=0" parameter. if change "control=2" works, if want support browser need rethink design. not seems work...
Comments
Post a Comment