仅加载视频的第一帧
我有一个可以从Mediafire中检索视频的应用程序。显示了视频的第一帧,并单击图像将带您进入播放特定视频的视频页面。
<a href <%=@video_page_link%>>
<video>
<source src = <%=video_link%>>
</video>
</a>
问题是,该页面上大约有20-30个视频,并且加载每个视频需要很多时间。结果,应用程序非常慢。我尝试使用流IO FFMPEG GEM从每个视频中提取图像,然后在链接中显示图像,但它更慢。
如果我只能快速抓住视频的第一帧然后展示它,有办法吗?还是只是加载视频的第一帧而不是加载整个视频?我真的不需要加载整个视频,我只需要一个可以单击的视频海报才能转到视频页面。
我可以将视频的图像用作超链接,但这需要我在上传之前对每个视频进行屏幕截图,然后将其存储在我不想要的地方。
谢谢
I have an application that retrieve videos from mediafire. The first frame of the video is shown and clicking on the image takes you to a video page that plays that specific vide.
<a href <%=@video_page_link%>>
<video>
<source src = <%=video_link%>>
</video>
</a>
The problem is, there are around 20-30 videos on the page and it takes a lot of time to load each video. As a result, the application is very slow. I tried using stream io FFMPEG gem to extract an image from each video and then show the image instead in the link but it is even more slow.
Is there a way if I can quickly grab only the first frame of the video and then show it? or just load the video s first frame instead of loading the whole video? I don't really need to load the whole video I just need a video poster that can be clicked to go to the video page.
I can use the image of the video as a hyperlink but that would require me to take a screenshot of each video before uploading it and then store it somewhere which I don't want.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用Video_Tag助手在视图中渲染视频。 Video_tag助手将根据浏览器的功能自动选择正确的视频。 &lt;%= video_tag“ video.mp4”%&gt;您还可以指定控制视频呈现方式的其他选项。例如,您可以在加载视频时自动开始播放该视频,&lt;%= video_tag“ video.mp4”,自动播放true%&gt;您也可以使用Video_Tag助手将视频嵌入基于HTML5的电子邮件中。为此,将电子邮件选项设置为true&lt;%= video_tag“ video.mp4”,请发送电子邮件至true%&gt;
You can use the video_tag helper to render a video in your view. The video_tag helper will automatically pick the right video based on the browser's capabilities. <%= video_tag "video.mp4" %> You can also specify additional options that control how the video is rendered. For example, you can automatically start playing the video when it's loaded <%= video_tag "video.mp4", autoplay true %> You can also use the video_tag helper to embed a video in an HTML5-based email. To do this, set the email option to true <%= video_tag "video.mp4", email true %>