最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

videos - How do I add "live thumbnails" or slideshow like thumbnails?

programmeradmin2浏览0评论

I noticed on Tube sites like YouTube and some cheap adult sites built on WordPress, you can mouse over a video file (post) and the image will play a video in some cases, and a slideshow preview of the video in others.

How is this possible? Every single Google Search result for Live Thumbnails gives me nothing related on how to create, or better yet, AUTO generate a moving thumbnail for my site.

Any suggestions would help, thanks.

I noticed on Tube sites like YouTube and some cheap adult sites built on WordPress, you can mouse over a video file (post) and the image will play a video in some cases, and a slideshow preview of the video in others.

How is this possible? Every single Google Search result for Live Thumbnails gives me nothing related on how to create, or better yet, AUTO generate a moving thumbnail for my site.

Any suggestions would help, thanks.

Share Improve this question edited Nov 21, 2019 at 14:27 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Nov 21, 2019 at 11:28 SidedTechSidedTech 101
Add a comment  | 

1 Answer 1

Reset to default 0

I know what tack I would take.

I would clip for a specific amount of time and scale it to the size of my desired thumbnail. The video can be auto clipped or they can be clipped manually to ensure the most interesting pieces are captured.

HTML

<div class="video">
    <video class="thevideo" loop preload="none">
        <source src="PATH/TO/FILE.mp4" type="video/mp4">
        <source src="PATH/TO/FILE.webm" type="video/webm">
        Your browser does not support the video tag.
    </video>
</div>

Javascript

 var figure = $(".video").hover( hoverVideo, hideVideo );

 function hoverVideo(e) { $('video', this).get(0).play();  }
 function hideVideo(e)  { $('video', this).get(0).pause(); }

CSS

.video {
    background-image: url('PATH/TO/FILE.jpg');
    height: HEIGHTpx;
    width: WIDTHpx;
    margin-bottom: MARGINpx;
}


video::-webkit-media-controls {
    display:none !important;  /* Hide Play button/controls on iOS */
}

Hope this helps.

发布评论

评论列表(0)

  1. 暂无评论