我试过这个小提琴:http://jsfiddle.net/77PJB/3/
<div ID="player"></div>var tag = document.createElement('script');tag.src = "https://www.youtube.com/iframe_API";var firstScriptTag = document.getElementsByTagname('script')[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);var player;function onYouTubeiframeAPIReady() {player = new YT.Player('player',{ height: '250',wIDth: '444',vIDeoID: 'M7lc1UVf-VE',events: { 'onReady': onPlayerReady}});}function onPlayerReady(event) {event.target.playVIDeo();}
与iPad,iPhone和三星galaxy nexus.视频没有播放..有什么变化吗?
谢谢
解决方法Mobile ConsIDerations Autoplay and Scripted Playback总结The HTML5 element,in certain mobile browsers (such as Chrome and Safari),only allows playback to take place if it’s initiated by a user interaction (such as tapPing on the player). Here’s an excerpt from Apple’s documentation:
“Warning: To prevent unsolicited downloads over cellular networks at the user’s expense,embedded media cannot be played automatically in Safari on iOS — the user always initiates playback.”
由于此限制,自动播放,playVIDeo(),loadVIDeoByID()等功能和参数将无法在所有移动环境中使用.来自:https://developers.google.com/youtube/iframe_api_reference#Mobile_considerations
一个简单的解决方法,具有“播放”按钮的自定义外观:
有一个覆盖元素与
pointer-events: none;
.指针事件适用于所有现代mobile browsers或只是视频容器覆盖按钮不透明度:0.
以上是内存溢出为你收集整理的Youtube iframe API无法用于移动设备?全部内容,希望文章能够帮你解决Youtube iframe API无法用于移动设备?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)