Created
November 29, 2017 08:26
-
-
Save yoannmoinet/c3b862a7223880efe30d9967b9fc34e3 to your computer and use it in GitHub Desktop.
Video missing support error handling.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const video = document.querySelector('video'); | |
video.addEventListener('error', () => { | |
switch (video.error.code) { | |
case video.error.MEDIA_ERR_DECODE: | |
case video.error.MEDIA_ERR_SRC_NOT_SUPPORTED: | |
// Video format not supported. | |
break; | |
case video.error.MEDIA_ERR_ABORTED: | |
case video.error.MEDIA_ERR_NETWORK: | |
default: | |
// Any other errors, handle this differently. | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment