自动启动+循环视频 YouTube 视频 [英] Autostart+loop videos YouTube videos

查看:31
本文介绍了自动启动+循环视频 YouTube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube 最近丢弃了旧的嵌入"代码,取而代之的是 iframe 代码.

在新的 iframe 代码中,由于 )

<iframe width="100%" height="100%" src="http://www.youtube.com/embed?listType=播放列表&list=PLAYLIST_ID&版本=3&循环=1&自动播放=1&rel=0&显示信息=0&控制=0&自动隐藏=1" frameborder="0" allowfullscreen></iframe>

YouTube recently discarded the old "embed" code and replaced it with iframe code.

In the new iframe code I found the way to loop+autostart videos on my website, thanks to this article. It says:

It's important to note that the "loop" parameter needs to work together with the "playlist" parameter. This means that we are looping a playlist that has only one video. So the embed code will look like this:

<iframe width="560″ height="315″ src="http://www.youtube.com/embed/V3oJR5IAMxM?rel=0&autoplay=1&loop=1&playlist=V3oJR5IAMxM" frameborder="0″ allowfullscreen></iframe>

But in my new code, why does each plalist have the two same videos?

When I apply the code the playlist, it has the same two videos in it. See for example:

How can I have only one video per playlist? I never created any playlists. YouTube shows by default that I have the same 2 videos in a playlist.

解决方案

This is the correct way to loop the videos of a playlist (as Google explains here)

<iframe width="100%" height="100%" src="http://www.youtube.com/embed?
    listType=playlist&
    list=PLAYLIST_ID&
    version=3&
    loop=1&
    autoplay=1&
    rel=0&
    showinfo=0&
    controls=0&
    autohide=1
" frameborder="0" allowfullscreen></iframe>

这篇关于自动启动+循环视频 YouTube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆