首页 > 解决方案 > 如何存储和检索从 Firebase 到应用程序的 URL

问题描述

这是 RTMP 播放器的 URL 链接,但它会定期更改,因此我决定将其存储在 firebase 中并从那里检索它。这是我的代码。我在 firebase 中创建了一个实时数据库。我怎么能在我的应用程序中使用它?

constructor(props) {
  super(props);

  this.state = {
    paused: true
  };
}

render() {
  return (
    <View style={styles.container}>
      <ImageBackground
        source={require('./backgroundvideo.jpg')}
        style={styles.backgroundImage}>
        <Video
          source={{
            uri: "rtmp://187.150.178.26:1245/ntv/live/live1"
          }} // Can be a URL or a local file.
          ref={ref => {
            this.player = ref;
          }} // Store reference
          controls={true}
          volume={1.0}
          muted={false}
          paused={this.state.paused} // Pauses playback entirely.
          resizeMode="cover" // Fill the whole screen at aspect ratio.*
          repeat={true} // Repeat forever.
          playInBackground={false} // Audio continues to play when app entering background.
          progressUpdateInterval={250.0}
          style={{ height: height * .35, width: width * 1, backgroundColor: 'black', }}
        />
        <Text>Video streaming....</Text>
      </ImageBackground>
    </View>
  );
}

标签: javascriptreact-native

解决方案


推荐阅读