仅加载视频的第一帧

发布于 2025-02-07 12:11:42 字数 500 浏览 1 评论 0原文

我有一个可以从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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落日海湾 2025-02-14 12:11:42

您可以使用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 %>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文