html - 如何从 FileList 中的视频中获取预览图像?HTML 反应
问题描述
我正在处理这种情况
{currentFile.type.includes('video') ? (
<video
width='auto'
height='400'
src={URL.createObjectURL(currentFile)}
controls={'controls'}
>
Your browser does not support the video tag.
</video>
) : (
<img
src={URL.createObjectURL(currentFile)}
/>
)}
所以这是可行的,因为如果我上传视频,我可以像观看图像一样观看它,但我想以图像的形式显示视频预览。像whatsapp这样的东西!
看看当您将视频放到 Whatsapp Web 上时,您可以看到它,然后您可以看到像预览一样的图像!,您知道如何达到这种行为吗?谢谢!
解决方案
推荐阅读
- php - 多文件上传 slim 框架只运行一次
- arrays - 列表到 numpy 数组
- ruby-on-rails - 您如何通过父 ID 查询模型并在日期创建
- vue.js - 如何在赛普拉斯中为单个测试切换浏览器语言?
- javascript - 图表 js 分组条的总和
- python - 如何使用 Python 库 GitPython 提交和推送文件
- hyperledger-fabric - 如何在没有 configtx 的情况下在服务上找到策略超级账本结构?
- javascript - ReferenceError:索引未在侦听器渲染中定义。Extjs6
- c++ - 如何在两个单词之间添加空格
- javascript - 单击子菜单未打开页面,它在 HTML 中隐藏子菜单