How to trigger stop method for react-player to stop and end video? Here is my code:
<ReactPlayer
className="react-player mw-100 w-100 "
id="myPlayer"
ref={(player) => {
this.player = player;
}}
url={VIMEO_URL}
onStart={() => {
this.player.seekTo(this.getProgress());
}}
onPlay={() => this.play(this)}
onPause={() => this.pause()}
onDuration={this.handleDuration}
onProgress={this._recordProgress}
onReady={() => this.player.seekTo(this.getProgress())}
/>;
Try using the playing proerty:
const [isPlaying, setIsPlaying] = useState(true);
<ReactPlayer
playing={isPlaying}
className="react-player mw-100 w-100 "
id="myPlayer"
ref={(player) => {
this.player = player;
}}
url={VIMEO_URL}
onStart={() => {
this.player.seekTo(this.getProgress());
}}
onPlay={() => this.play(this)}
onPause={() => this.pause()}
onDuration={this.handleDuration}
onProgress={this._recordProgress}
onReady={() => this.player.seekTo(this.getProgress())}
/>;