我想嵌入一个不是我的 YouTube 视频(所以我不能在 YouTube 上更改它)。视频有一个不代表视频的缩略图(我指的是嵌入视频时显示的初始静止图像,在用户播放之前显示)。
有没有办法设置静止时间,例如我尝试传递 ?s=XXX
但这不起作用。还是 YouTube 自带的另一种方式?
最佳答案
在 sitepoint forums 中有一个很好的解决方法:
<div onclick="this.nextElementSibling.style.display='block'; this.style.display='none'">
<img src="my_thumbnail.png" style="cursor:pointer" />
</div>
<div style="display:none">
<!-- Embed code here -->
</div>
注意:为避免必须点击两次才能播放视频,请在视频嵌入代码中使用 autoplay=1
。当显示第二个 div 时,它将开始播放。
关于video - YouTube 嵌入视频 : set different thumbnail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7199624/