我正在使用YouTube嵌入代码来显示视频。但是循环选项不起作用。
我该如何工作?
这是我正在使用的代码
<iframe frameborder="0" height="100%" width="100%"
src="https://www.youtube.com/embed/ejoIgFsmqxA?autoplay=1&controls=0&showinfo=0&autohide=1&loop=1"> </iframe>
最佳答案
如果检查Youtube docs,您将看到loop参数有一些限制:
Note: This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL [...]
因此,如果您像这样在iframe src的末尾添加
&playlist=ejoIgFsmqxA
,则似乎可以正常工作(未经测试):<iframe frameborder="0" height="100%" width="100%"
src="https://www.youtube.com/embed/ejoIgFsmqxA?autoplay=1&controls=0&showinfo=0&autohide=1&loop=1&playlist=ejoIgFsmqxA"></iframe>
关于loops - YouTube视频未循环播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27108286/