YouTube embedded video: set different thumbnail
I want to embed a video from YouTube that is not mine (so I can not change it at YouTube). The video has a thumbnail that is not representative for the video (I refer to the initial still that is shown when you embed a video, shown before the user plays it).
Is there a way to set the time of the still, for instance I tried passing ?s=XXX
but this does not work. Or another way that comes natively with YouTube?
No. Most YouTube videos only have one pre-generated "poster" thumbnail (480x360). They usually have several other lower resolution thumbnails (120x90). So even if there were an embedding parameter to use an alternate poster image (which there isn't), it's result wouldn't be acceptable.
You can theoretically use the Player API to seek the video to whatever location you want, but this would be a major hack for a minor result.
There's a nice workaround for this in the 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>
Note: To prevent having to click twice to make the video play, use autoplay=1
in the video embed code. It will start playing when the second div is displayed.
The answers did not work for me. Maybe they were outdated.
Anyway, found this website, which does all the job for you, and even prevent you from needing to read the unclear-as-usual google documentation: http://www.classynemesis.com/projects/ytembed/
链接地址: http://www.djcxy.com/p/28908.html上一篇: 流式传输Youtube视频
下一篇: YouTube嵌入视频:设置不同的缩略图