从onLoad移出时,总会有大约2秒黑屏,这会停止我的加载微调组件,并在下面的代码中开始视频播放。我正在使用ExoPlayer。
知道我做错了什么,或者如何改善代码以摆脱黑屏?!

render() {
let loading = null;
let waitingVideo = null;
if (!this.state.waitingVideoURL) {
  loading = (
    <View>
      <Text style={styles.loading}>Loading...</Text>
      <ActivityIndicator size="large" color="#2C3942" />
    </View>
  );
} else {
  waitingVideo = (
    <Video
      source={{
        uri: this.state.waitingVideoURL,
      }}
      resizeMode="cover"
      style={styles.backgroundVideo}
      repeat
      onLoad={this.stopLoading}
    />
  );
}

return (
  <View style={styles.container}>
    <StatusBar hidden />
    {waitingVideo}
    {loading}
  </View>
);
}
}

最佳答案

您尝试投放的视频可能还在缓冲中?
尝试注册onBuffer事件,然后查看视频是否仍在缓冲。

08-18 04:21
查看更多