如何解决React-native-Video是否会从Firebase存储中渲染视频?
我正在尝试从Firebase存储中渲染一些视频。使用此代码块,我可以从Firebase存储中渲染图像,但不能从那里渲染任何视频。我在下面有Firebase视频的命令日志。
state = {
image: []
}
componentDidMount = () => {
this.download()
};
download = async () => {
let array = []
await storage().ref().child('videos').listAll().then(result => {
result.items.forEach(pics => {
storage().ref().child(pics.fullPath).getDownloadURL().then(url => {
array.push(url);
this.setState({ image: array });
console.log(array)
})
});
})
}
render() {
return (
<SafeAreaView style={styles.container}>
<FlatList
data={this.state.image}
renderItem={({ item }) => {
return (
<Video source={{ uri: item }}
ref={(ref) => {
this.player = ref
}}
style={styles.backgroundVideo} />
)
}
}
keyExtractor={(item,index) => index.toString()}
/>
</SafeAreaView>
);
}
}
[Tue Sep 08 2020 16:40:06.572] LOG ["https://firebasestorage.googleapis.com/v0/b/d-tekvideo.appspot.com/o/videos%2FSampleVideo_1280x720_1mb.mp4?alt=media&token=d6e1438e-01c2-40db-869c-a8287654b215"]
[Tue Sep 08 2020 16:40:06.616] LOG ["https://firebasestorage.googleapis.com/v0/b/d-tekvideo.appspot.com/o/videos%2FSampleVideo_1280x720_1mb.mp4?alt=media&token=d6e1438e-01c2-40db-869c-a8287654b215","https://firebasestorage.googleapis.com/v0/b/d-tekvideo.appspot.com/o/videos%2FSampleVideo_1280x720_2mb.mp4?alt=media&token=79cb63bf-6e79-4941-8f26-9c9236cb5ccc"]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。