YouTube player stops after few seconds on mobile

北城余情 提交于 2019-12-22 14:58:17

问题


I have a YouTube video embedded in my mobile webpage. On desktop, it plays properly. However, on mobile phone (emulated on Android), it stops after some time throwing an error.

When I debugged in console, following errors are generated:

Failed to load resource: net::ERR_FAILED

XMLHttpRequest cannot load http://r13---sn-nx57yn7s.googlevideo.com/videoplayback?source=youtube&ipbit…s_redirect=yes&mm=30&ms=nxu&mt=1410325650&mv=u&range=0-65535&keepalive=yes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.youtube.com' is therefore not allowed access.

The HTML I am using for the video is like this

<iframe id="video1" width="100%" height="100%" src="http://www.youtube.com/embed/PLOUfmig96M?&amp;enablejsapi=1&amp;hl=es_ES&amp;rel=0&amp;color1=0x2b405b&amp;color2=0x6b8ab6
&amp;fs=1&amp;border=1&amp;autoplay=1"></iframe>

Error Image

来源:https://stackoverflow.com/questions/25757846/youtube-player-stops-after-few-seconds-on-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!