Search code examples
javascriptjqueryeventstimeouthtml5-video

HTML 5 Video Request timed out Event


When safari's loading a <video> and it fails (due to poor internet connection or what have you)

it throws this error to the console

Failed to load resource: Request timed out

There must be some sort of event handler on HTML5 video tag that we can catch

Any Suggestions?


Solution

  • According to W3School You can do this

    var vid = document.getElementById("myVideo");
    vid.onerror = function() {
        alert("Error! Something went wrong");
    // do something else
    
    };