在项目中,我需要在视频播放 1 分钟时显示按钮,任何人都可以帮助我,使用react-player
这是我的代码,谢谢
const Page = () => {
const [play, setPlay] = useState(false)
const [showButton, setShowButton] = useState(false)
function playVideo() {
setPlay(true);
}
return(
<div>
<div className="relative">
<div className="embed-responsive aspect-ratio-16/9">
<ReactPlayer
className="embed-responsive-item"
url="https://vimeo.com/126060304"
width="100%"
height="100%"
onProgress={(played=1.00) => setShowButton(true)}
controls={true}
playing={play}
></ReactPlayer>
<div className={`cursor-pointer absolute inset-0 ${play === true ? 'hidden' : ''}`} onClick={playVideo} onKeyDown={playVideo} aria-hidden="true">
<StaticImage src="../../images/play-overlay.png" alt="overlay" />
</div>
</div>
</div>
{showButton && (
<button>next</button>
)}
</div>
)
}
export default Page