如果您更改视频的当前时间并运行 play() ,视频的开头将短暂出现,然后从指定时间开始播放。 如何防止视频的开头瞬间出现?
const ref = createRef<HTMLVideoElement>();
const clickBtn = () => {
if (!ref.current) return;
ref.current.currentTime = 5;
ref.current.play();
}
return (
<video ref={ref} src="video.mp4" playsInline muted></video>
<button onClick={clickBtn}>Click</button>
);