<button onclick="getError()" type="button">Get error state</button> <br> <video id="video1" controls="controls" autoplay="autoplay"> <source src="mov_broken.mp4" type="video/mp4"> <source src="mov_broken.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <script> myVid=document.getElementById("video1"); function getError() { alert(myVid.error.code); } </script> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>