问题描述
我尝试使用expo-camera捕获视频,一旦录制了视频,因为我们得到了一个视频uri,我用这个uri来显示预览,显示预览时我使用了expo的视频组件-av, 但是视频组件显示空白屏幕。有人可以提出修复建议吗?
const takeVideo = async ()=>{
if(cameraRef)
{
setIsRecording(true);
let res = await cameraRef.recordAsync();
console.log(res);
setVideoUri(res.uri);
setVideoModalVisible(true);
setIsRecording(false);
}
}
const VideoPreview = (props)=>{
return (
<Modal visible={videoModalVisible}>
<View style={{ flex: 1,margin: 50,paddingTop: 20,flexDirection: "column",justifyContent: "flex-start",alignItems: "center",backgroundColor: "white" }}>
<Video
source={{ uri: videoUri }}
rate={1.0}
volume={1.0}
isMuted={false}
resizeMode="cover"
shouldplay = {false}
isLooping = {false}
useNativeControls
style={{width:width*0.75,height:height*0.5}}
/>
<View style={{ flexDirection: "column" }}>
<Button mode="contained" style={{ margin: 5 }} onPress={() => { sendFile(videoUri,"video"); }}>Send</Button>
<Button mode="contained" style={{ margin: 5 }} onPress={() => { setVideoModalVisible(false) }}>Close</Button>
</View>
</View>
</Modal>
);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)