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

341
Views
React js La carga de video no funciona usando createObjectURL

Utilicé la etiqueta de entrada en reaccionar js para seleccionar el elemento de video, pero no está obteniendo una vista previa del video. Ya usé UseEffect y la clave para el selector de video, pero aún no puedo ver el video. Y "videoRef.current?.load()" me da error (TypeError: _videoRef$current.load no es una función). ¿Algún otro método para usar o cómo debo reescribir mi código, por favor ayuda?

 const handleChange = (event) => { const file = event.target.files[0]; if (!file) return; setVideoSrc(URL.createObjectURL(file)); }; const videoRef = useRef(); useEffect(() => { videoRef.current?.load(); }, [media.projectMedia]); <input type='file' className='form-control form-control-sm' id='media-URL' accept='image/*,audio/*,gif/*,video/mp4,video/x-m4v,video/*' onChange={(event) => { handleChange(event); } } /> <video key={media.projectMedia} ref={videoRef} width='260' height='150' controls> <source src={videoSrc} /> Your browser does not support the video tag. </video>

ingrese la descripción de la imagen aquí

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

0

este trabajo para mi

 const [videoSrc, setVideoSrc] = useState(null); const handleChange = (event) => { const file = event.target.files[0]; if (!file) return; setVideoSrc(URL.createObjectURL(file)); }; const videoRef = useRef(); useEffect(() => { videoRef.current?.load(); }, [videoSrc]); return ( <> <input type='file' className='form-control form-control-sm' id='media-URL' accept='image/*,audio/*,gif/*,video/mp4,video/x-m4v,video/*' onChange={(event) => { handleChange(event); } } /> <video ref={videoRef} width='260' height='150' controls> <source src={videoSrc} /> Your browser does not support the video tag. </video> </> );
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!