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 (将#修改为@)