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

246
Views
¿Cómo detectar el error 401 al cargar video src?

Actualmente uso seguimiento, pero el event revela poco sobre el error.

 const video = document.getElementById("video") const source = video.getAttribute("data-source") video.src = source; video.addEventListener("error", (event) => { console.log("BOOM") })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

"... Pero el event revela poco sobre el error".

Bueno, pusiste console.log("BOOM") como respuesta. Nunca iba a ser informativo.

Desea detectar el tipo de error de: MEDIA_ERR_NETWORK o MEDIA_ERR_SRC_NOT_SUPPORTED .

Prueba algo como esto:

 video.addEventListener("error", (event) => { handle_Media_Errors (event) } ); function handle_Media_Errors (evt) { //# code credits: https://gist.github.com/wilmoore/3252894 //# video playback failed - show a message saying why... switch (evt.target.error.code) { case evt.target.error.MEDIA_ERR_DECODE: console.log('Media Error ::: The video could not be decoded.'); break; case evt.target.error.MEDIA_ERR_ABORTED: console.log('Media Error ::: video playback was aborted.'); break; case evt.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED: console.log('Media Error ::: The video could not be loaded or its format is not supported.'); break; case evt.target.error.MEDIA_ERR_NETWORK: console.log('Media Error ::: Video download failed due to a network error'); break; default: console.log('Media Error ::: An unknown error with your media file has occurred.'); break; } }
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!