本文介绍了在iPad上播放playVideo()命令后,YouTube iFrame API会挂起缓冲状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPad上的iFrame API有问题(iOS 7,Safari浏览器)。当我尝试使用'player.playVideo()'命令启动视频时,当我调用'player.getPlayerState()'命令(说它正在缓冲)时,播放器变为黑色并返回'3'状态。

I have a problem with the iFrame API on the iPad (iOS 7, Safari browser). When I try to start the video with the 'player.playVideo()' command, the player goes to black and returns a '3'-state when I call 'player.getPlayerState()' command (says it's buffering).

点击大红色YouTube按钮有效,但使用'playVideo()'命令却没有。这可以在Google自己的YouTube API演示页面上重现:

Hitting the big red YouTube button works, but using the 'playVideo()' command does not. This can be reproduced on Google's own YouTube API demo page: https://developers.google.com/youtube/youtube_player_demo

确保显示iFrame,然后点击播放器下方的蓝色播放按钮。在桌面浏览器上,这可以正常工作,但在iOS7 iPad上失败。

Make sure you display an iFrame, and hit the blue 'Play' button below the player. On desktop browsers, this works fine, but fails on an iOS7 iPad.

我需要'playVideo()'命令来控制无边框播放器(无控件)。任何想法?

I need the 'playVideo()' command to control a chromeless player (no controls). Any ideas?

推荐答案

尝试自动播放功能,如果按下大红色按钮不是强制性的,我通过添加 event.target.playVideo(); 到嵌入式HTML正文中的onReady函数。我的播放器显示大红色按钮并立即启动。我在GitHub 上使用了最新的ios helper availble 。谷歌开发者网站上也提到了

Try the autoplay feature if hitting the big red button is not a compulsion, i have done so by adding "event.target.playVideo();" to the onReady function in the embeded HTML body. My player shows the big red button and starts itself immediately. I have used the latest ios helper availble on GitHub youtube-ios-player-helper. It is also mentioned on the google developers site Using the YouTube Helper Library to embed YouTube videos in your iOS application

这篇关于在iPad上播放playVideo()命令后,YouTube iFrame API会挂起缓冲状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 03:03