HTML Audio/Video DOM error Event
Example
//Accessing the element
var vid = document.getElementById("myVideo");
//Creating a function
vid.onerror = function() {
alert("Error! Something went wrong");
};
Meaning
The error event run when an error occurred during the loading of an audio/video.
Standard Syntax
HTML:
<element onerror="myScript">
JavaScript:
object.onerror=function(){myScript};
JavaScript, using the addEventListener() method::
object.addEventListener("error", myScript);
Advertisement