react-native-vlc-media-player
                                
                                 react-native-vlc-media-player copied to clipboard
                                
                                    react-native-vlc-media-player copied to clipboard
                            
                            
                            
                        Repeat is working only once when using player in flatlist
hi i am trying to repeat my current video multiple times currently I'm using repeat prop but its working only on one video i had 5 videos in my faltlist and played one at a time
expected behavior
- video should play continously after video finished
please help
@Kadir-prog Did you implemented?
I have the same problem repeat doesn't work
I have the same problem repeat doesn't work @bakirnewfire @Kadir-prog I have fixed it.
import React, { Component } from 'react'; import { View } from 'react-native'; import VLCPlayer from 'react-native-vlc-player';
class YourComponent extends Component { constructor(props) { super(props); this.state = { // Your existing state variables // ... key: 1, // Add a key to force remounting of the VLCPlayer component }; }
onEnded() { // Seek to the beginning this.playerRef.seek(0);
// Use setTimeout to ensure that seeking is complete before remounting the component
setTimeout(() => {
  // Increment the key to force remounting of the VLCPlayer component
  this.setState((prevState) => ({ key: prevState.key + 1 }));
}, 100);
}
render() { return ( <View> {/* Force remounting by changing the key */} <VLCPlayer key={this.state.key} style={{ width: this.state.width, height: this.state.Fullscreen ? this.state.orientation_change_height : '100%', }} autoplay={true} videoAspectRatio="16:9" resizeMode="fill" muted={this.state.muted} repeat={true} ref={(ref) => (this.playerRef = ref)} paused={this.state.paused} onProgress={this.progress} onEnd={this.onEnded.bind(this)} onBuffering={this.onBuffering.bind(this)} onError={this._onError} onStopped={this.onStopped.bind(this)} onPlaying={this.onPlaying.bind(this)} onPaused={this.onPaused.bind(this)} onLoad={this.load} source={{ uri: this.state.video_uri_path, initType: 2, initOptions: ['--rtsp-tcp', '--no-stats'], }} /> </View> ); } }
export default YourComponent;