如何使用 youtube iframe 代码循环播放两个视频 [英] how to loop two videos using youtube iframe code
问题描述
我在我的网页中使用以下代码成功自动播放和循环播放一个视频.现在,我想添加另一个视频,基本上是循环播放两个视频.因此,在一个视频播放完毕后,第二个视频将开始播放,然后是第一个视频,依此类推,以此类推.应该如何修改代码才能做到这一点?
那是一行代码.我把它分成四行,这样更容易阅读.
要在 iframe 中添加多个视频,可以使用以下代码:
https://www.youtube.com/embed/?rel=0&version=3&playlist=、、&loop=1&自动播放=1
地点:
VIDEO_ID_1
:是第一个重现的videoId
.VIDEO_ID_2
、VIDEO_ID_3
、VIDEO_ID_N
等将成为videoId
你想包括.
通过这种方式,您最多可以在同一个 iframe1 中包含 196 或 200 个视频,一旦达到最终的 这是一个 小样本,上面有 4 个视频. 这是另一个 包含 93 个视频的示例. 如果您查看此播放列表,您会看到它有超过 1000 个视频 - (准确地说是 1653 个视频),但是,iframe 将阈值重置为大约 196 或 200 个视频. 1 我在尝试回答堆栈溢出中的这个问题时发现了这个阈值,并且如果你进入 Youtube 网站,你可以自己查看 - 这个播放列表 并检查它是否只显示前 200 个视频. 这可能是 YouTube 设置的阈值(并且未记录). I use the following code in my web page to successfully autoplay and loop one video. Now, I'd like to add another video, essentially looping two videos. So, after one video is finished playing, the second video will start to play, and then the first video, and so on, and so froth. How should the code be modified to do that? That is a one-line code. I break it into four lines so it's easier to read. For add more than one video in your iframe, you can use the following code: Where: In this way, you can include a max of 196 or 200 videos in the same iframe1 that will autoplay and loop once the final This is a small sample with 4 videos on it. This is another sample with 93 videos on it. If you check this playlist, you'll see that it has more than 1000 videos on it - (1653 videos to be exact), but, the iframe resets the threshold to 196 or 200 videos approximately. 1 I discover this threshold when I tried to answer this question in Stack Overflow and you can check it by yourself if you enter to the Youtube website - this playlist and check that it will show only the first 200 videos on it. This might be a threshold set (and undocumented) by YouTube. 这篇关于如何使用 youtube iframe 代码循环播放两个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!<iframe width="560" height="315" src=
"https://www.youtube.com/embed/51xS4yXbryc?
rel=0&version=3&playlist=51xS4yXbryc&loop=1
&autoplay=1" frameborder="0" allowfullscreen=""></iframe>
https://www.youtube.com/embed/<VIDEO_ID_1>?rel=0&version=3&playlist=<VIDEO_ID_2>,<VIDEO_ID_3>,<VIDEO_ID_N>&loop=1&autoplay=1
VIDEO_ID_1
: is the first videoId
to reproduce.VIDEO_ID_2
, VIDEO_ID_3
, VIDEO_ID_N
and so on will be the videoId
s you want include.videoId
is reached.