如何触发react-player停止和结束视频的stop方法?下面是我的代码:
<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())}
/>;发布于 2021-11-24 15:23:56
尝试使用播放属性:
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())}
/>;https://stackoverflow.com/questions/70096664
复制相似问题