React Native 为视频 url 生成缩略图 [英] React Native generate thumbnail for video url
问题描述
我想在用户点击视频以获取完整视频之前以缩略图的形式显示这些视频.他们不是本地的,我只有网址.是否有 RN 组件来执行此操作?RN Image 组件不以视频 url 作为来源.
I have videos that I'd like to present as thumbnails before a user clicks on them for the full video. They are not local, I only have the url. Is there a RN component to do this? The RN Image component does not take videos urls as sources.
推荐答案
不可能.无法从视频 URL 自动生成视频缩略图.它应该与后端数据库中的视频一起创建和存储,当 RN 应用程序收到视频 URL 时,它也应该收到缩略图 URL.然后您可以使用 Image
和 TouchableOpacity
组件在缩略图上添加按压行为.
Not possible. Video thumbnail cannot be auto-generated from video URL. It should be created and stored along with the video in backend database and when RN app receives video URL, it should receive thumbnail URL too. Then you can use Image
and TouchableOpacity
components to add pressing behavior on the thumbnail.
但是,如果您只使用 Youtube 视频,那么 react-native-thumbnail-video 可能是您问题的快速解决方案.
However, if you use Youtube videos only, then react-native-thumbnail-video might be a quick solution to your problem.
这篇关于React Native 为视频 url 生成缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!