3

I'm using a Video component like this:

<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}
    />

After video ends I show a button that allows user to play it again. I tried using:

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

But the video doesn't start again on Android (it works fine on iOS).

Am I missing something?

Daniel Dudek
  • 515
  • 7
  • 17
  • It could be related to your video asset, some video encoding could cause this. Are you using an mp4 video with breakpoints? – Ady Levy Oct 29 '18 at 19:13
  • Thanks for feedback. I just tried two others, and it didn't change anything. Other two videos I checked: http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 http://techslides.com/demos/sample-videos/small.mp4 – Daniel Dudek Oct 30 '18 at 08:20

1 Answers1

9

I used

<Video repeat={true} paused={this.state.paused} onEnd={this.setState({paused: true})}> 
</Video>

Works for me.

barbsan
  • 3,418
  • 11
  • 21
  • 28
Andriy Khlopyk
  • 121
  • 1
  • 8