如何显示本地视频的缩略图

发布于 2025-01-19 16:16:16 字数 100 浏览 4 评论 0 原文

您知道显示本地视频缩略图的库/方法吗? 我使用react-native-image-picker从我的设备中选择一个视频,并且我想在有多个选择的情况下在视图或平面列表中显示该视频的缩略图

Do you know a lib / a way to display a thumbnail of a local video ?
I select a video from my device with react-native-image-picker and i would like to display a thumbnail of this video in a View or flatlist in case of several selections

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

旧人 2025-01-26 16:16:16

如果您正在使用 Expo 并且没有部署到网络,则此软件包将为您完成这项工作: https://docs.expo.dev/versions/latest/sdk/video-thumbnails/

If you are using Expo and you are not deploying to web, this package will do the job for you: https://docs.expo.dev/versions/latest/sdk/video-thumbnails/

亣腦蒛氧 2025-01-26 16:16:16

您可以使用下面的插件从本地路径获取缩略图

https://github.com/phuochau /react-native-thumbnail#readme

import RNThumbnail from 'react-native-thumbnail';
let getFilePath = ''
RNThumbnail.get(filepath).then((result) => {
 console.log(result.path); // thumbnail path
 getFilePath = result.path;
})

获取显示路径后,您可以使用react-native-video进行播放和显示

react-native-video 并使用下面的代码

<Video source={{ uri: getFilePath }} pause={true} />

希望这对您有用。

You can use below plugin for get thubmnail form local path

https://github.com/phuochau/react-native-thumbnail#readme

import RNThumbnail from 'react-native-thumbnail';
let getFilePath = ''
RNThumbnail.get(filepath).then((result) => {
 console.log(result.path); // thumbnail path
 getFilePath = result.path;
})

After getting path for display purpose you can use react-native-video for play and display

react-native-video and use below code

<Video source={{ uri: getFilePath }} pause={true} />

Hope this will work for you.

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