youtube 使用播放列表嵌入单个视频循环显示两次相同的视频 [英] youtube embed single video loop with playlist shows twice the same video
问题描述
我正在尝试使用循环模式嵌入 YouTube 视频,为此我必须设置播放列表参数,否则将无法工作:
问题是当我这样做时,我得到一个包含 2 个视频的播放列表,同一个视频出现了两次,这会产生非常糟糕的视觉效果,因为我希望一个视频无休止地循环播放.
关于如何做到这一点的任何建议?谢谢
这是我的代码:
我不认为以下信息实际上记录在某处,但我想分享我通过在 URL 中进行一些测试来尝试解决您的问题".
<小时>说到这里,你就可以解决你的问题"——(即:显示相同的视频两次
)——通过如下修改网址:
https://www.youtube.com/embed/VIDEO_ID_1/?playlist=VIDEO_ID_2&autoplay=1&loop=1&rel=0&showinfo=0&color=white
说明:
VIDEO_ID_1
:对应于旨在连续播放的videoId
- (循环中).VIDEO_ID_2
:对应于VIDEO_ID_1
中使用的videoId
,但是最后一个字母变了.这个想法是设置一个不存在的videoId
.
所以,有了前面的解释,你可以用下面的视频作为例子:
<块引用>视频:堆栈溢出 10!
videoId:QwS1r1mc888
修改后的网址显示如下:
https://www.youtube.com/embed/QwS1r1mc888?enablejsapi=1&loop=1&playlist=QwS1r1mc880&autoplay=1&rel=0&showinfo=0&color=white
<块引用>
注意 videoId QwS1r1mc880
不存在 (yet) - 您也可以将这个值替换为 15874598752
- 这永远不会是YouTube videoId
(据我所知).
<小时>
旁注:我真的希望这个发现不会被删除.
I am trying to embed a YouTube video with loop mode on, and to do so I have to set the playlist parameter otherwise it won't work:
The problem is when I do so i get a playlist with 2 videos on it, the same video appearing twice, which produces a very bad visual effect since i want one video to loop endlessly.
Any suggestions on how to do so? Thanks
Here's my code:
<iframe width="600" height="338"
src="https://www.youtube.com/embed/VIDEO_ID/?playlist=VIDEO_ID&autoplay=1&loop=1&rel=0&showinfo=0&color=white"
frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
I don't think the following information is actually documented somewhere, but I want share the discovery I made by making some tests in the URL for trying solve your "problem".
Saying this, you can remove your "problem" - (which is: displaying the same video twice
) - by modifying the URL as follows:
https://www.youtube.com/embed/VIDEO_ID_1/?playlist=VIDEO_ID_2&autoplay=1&loop=1&rel=0&showinfo=0&color=white
Explanation:
VIDEO_ID_1
: Corresponds to thevideoId
intended to play continuously - (in loop).VIDEO_ID_2
: Corresponds to thevideoId
usted in theVIDEO_ID_1
, BUT with the last letter changed. The idea is set avideoId
that does not exist.
So, with the previous explanation, you can use the following video as an example:
Video: Stack Overflow is 10!
videoId:
QwS1r1mc888
The modified URL shows the following:
https://www.youtube.com/embed/QwS1r1mc888?enablejsapi=1&loop=1&playlist=QwS1r1mc880&autoplay=1&rel=0&showinfo=0&color=white
N.B that the videoId
QwS1r1mc880
does not exist (yet) - you could also replace this value for15874598752
- which will never be a YouTubevideoId
(as far as I know).
Side note: I really hope this discovery won't be removed.
这篇关于youtube 使用播放列表嵌入单个视频循环显示两次相同的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!