Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
cómo hacer que una ventana emergente se abra automáticamente mientras mira un video

Tengo un reproductor de video en React, necesito abrir una ventana emergente / modal para verificar que el usuario no sea un robot en un segundo aleatorio de visualización de video.

Algoritmo: el usuario abre el sitio web -> mira el video -> en una segunda ventana emergente aleatoria / aparece modal -> el usuario confirma el captcha (no soy un robot) -> desaparece la ventana modal / emergente -> el video continúa reproduciéndose.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Sería útil un poco más de información, como un fragmento de código y los paquetes que está utilizando. Pero si está usando react-player, puede hacer algo como esto:

 const Player = () => { const playerRef = useRef(); const [playing, setPlaying] = useState(true) const [randomSecond, setRandomSecond] = useState(0) const [captchaConfirmed, setCaptchaConfirmed] = useState(false) useEffect(() => { if (playing || captchaConfirmed) { return } checkCaptcha() }, [playing]) const checkCaptcha = () => { if (window.confirm('Are you a human')) { setCaptchaConfirmed(true) setPlaying(true) } } return ( <ReactPlayer ref={playerRef} playing={playing} onDuration={(duration) => { setRandomSecond(Math.floor(Math.random() * duration)) }} onPlay={() => setPlaying(true)} onProgress={async (data) => { if (captchaConfirmed || data.playedSeconds < randomSecond) { return } setPlaying(false) }} url='https://www.youtube.com/watch?v=HYDs1FNNvfs' /> ) }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!