React-Native <Video> 如何在 Android 上播放一次后重新开始视频?

Dan*_*dek 3 react-native react-native-android react-native-video

我正在使用这样的视频组件:

<Video style={[videoPlayerStyle, this.props.containerStyle, {height: videoHeight, width: videoWidth}] }
      source={{uri: this.props.videoURL}}
      ref={(ref) => {
        this.player = ref
    }} 
      paused={this.state.paused}
      controls={nativeControls}
      playInBackground={false}
      repeat={false} 
      key="something123"
      muted={this.state.mute}

      onBuffer={this.onBuffer}
      onEnd={this.onEnd}
      onError={this.onError}
      onLoad={this.onLoad}
      onLoadStart={this.onLoadStart}
      onProgress={this.onProgress}
    />
Run Code Online (Sandbox Code Playgroud)

视频结束后,我会显示一个按钮,允许用户再次播放。我尝试使用:

restartPlayingVideo = (dict) => {
  this.player.seek(0) // I tried with and without this
  this.setState({paused: false})
}
Run Code Online (Sandbox Code Playgroud)

但该视频不会在 Android 上再次开始(在 iOS 上运行良好)。

我错过了什么吗?

小智 5

我用了

<Video repeat={true} paused={this.state.paused} onEnd={this.setState({paused: true})}> 
</Video>
Run Code Online (Sandbox Code Playgroud)

为我工作。