Reputation: 525
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?
Upvotes: 3
Views: 7166
Reputation: 141
I used
<Video repeat={true} paused={this.state.paused} onEnd={this.setState({paused: true})}>
</Video>
Works for me.
Upvotes: 11