当我们最初将播放器开始时间寻找到 00:00:00 以外的任何其他秒时,播放器在 00:00:00 秒开始,在播放到 00:00:01 秒或更短时间后,它会寻找我们提供的适当秒数开始播放视频。它发生在 safari 浏览器中。我们为此使用了video-react包。
播放器代码
<Player
ref="player"
playsInline
startTime={videoStartTime}
src={subject && subject.clipUrl}
onLoadStart={() => {
this.setState({
isLoading: false,
})
}}
onLoadedData={() => {
this.setState({
isLoading: true,
})
}}
>
</player>
当点击播放按钮 startIntro() 以下函数调用时,
startIntro = () => {
introStart = 500;
this.setState({
videoStartTime: introStart,
})
this.refs.player.seek(introStart);
this.refs.player.play();
}