ios - React Native 播放 iOS 慢动作视频
问题描述
我正在使用 react-native-image-crop-picker (v0.34.1) 从 iPhone 中选择慢动作视频。
选择视频后,我正在使用 react-native-video (v5.0.2) 播放视频。
视频的慢动作效果不会反映在视频的播放中。我找不到有关如何实现这一目标的任何信息。谁能指出我正确的方向?
谢谢
解决方案
就像我说的,你必须使用它来达到你想要的效果。
试试看:
const [rate,setRate] = useState(1);
const durationRef = useRef();
const checkCurrentTime = useCallback(({currentTime}) => {
const percentagePlayed = currentTime/durationRef.current;
setRate(percentagePlayed < 0.1 || percentagePlayed > 0.9 ? 1 : 0.2)
},[durationRef]);
return (
<Video
...
rate={rate}
onLoad(({duration}) => durationRef.current = duration)
onProgress={checkCurrentTime}
/>
)
推荐阅读
- python - 使用 Matplotlib 在 Python 中绘制数据框 - 水平条形图
- python - 在python中连接服务器和客户端时出现超时错误
- python - 以特定格式对字符串或整数数组进行排序
- django - 第一次通过for循环后,django模板中的上下文变量不可用
- c# - 可能导致此错误的原因:“csc.exe”以代码-2146232576 退出
- macos - 如何在容器内使用与在主机上访问相同的 url 访问服务
- xslt - 有没有办法制作整页表?
- vue.js - 添加拖放到 vuetify 的选择
- linux - Oracle Developer Studio 12.6 Fortran 编译器:ieee_arithmetic_semantics:断言“0”失败
- css - 框框内的标题 - CSS,前端开发 - UX