简体   繁体   English

从浏览器中的mp4链接获取缩略图

[英]get thumbnail from mp4 link within browser

Is it possible with just javascript? 仅使用JavaScript可能吗?

Or will we have to process the video on the backend before everything else? 还是我们必须先在后端处理视频?

I saw this library http://bgrins.github.io/videoconverter.js/demo/ as a possibility, but wanted to explore if other solutions were available 我看到了这个库http://bgrins.github.io/videoconverter.js/demo/的可能性,但是我想探究是否有其他解决方案可用

So long as the video is not DRM protected, you can use a frame grab technique to do this. 只要视频不受DRM保护,就可以使用抓帧技术来执行此操作。

You add a player to your page, auto play the video, grab a frame at certain point and display the frame at whatever size you want. 您可以在页面上添加播放器,自动播放视频,在特定位置抓取帧并以所需大小显示帧。

There is an excellent example of frame grab here: https://stackoverflow.com/a/29806483/334402 这里有一个很好的抓帧示例: https : //stackoverflow.com/a/29806483/334402

You can use CSS to hide the video. 您可以使用CSS隐藏视频。

Caveats are that it won't work for videos which are DRM protected and autoplay does not generally work on mobile devices. 注意,它不适用于受DRM保护的视频,并且自动播放通常不适用于移动设备。

Having said all this, most video services will do the thumbnail generation at the backend. 综上所述,大多数视频服务将在后端生成缩略图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM