Created
October 25, 2018 15:10
-
-
Save unicoder88/278a3455cef79d8ea7579cdec6a08b41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(function() { | |
/** | |
* Video element | |
* @type {HTMLElement} | |
*/ | |
var video = document.getElementById("my-video"); | |
/** | |
* Check if video can play, and play it | |
*/ | |
function captureEvent (event) { | |
console.log(event.type); | |
} | |
video.addEventListener("abort", captureEvent); | |
video.addEventListener("canplay", captureEvent); | |
video.addEventListener("canplaythrough", function (event) { | |
console.log(event.type); | |
console.info("automatically starting play"); | |
video.play(); | |
}); | |
video.addEventListener("durationchange", captureEvent); | |
video.addEventListener("emptied", captureEvent); | |
video.addEventListener("encrypted", captureEvent); | |
video.addEventListener("ended", captureEvent); | |
video.addEventListener("error", captureEvent); | |
video.addEventListener("interruptbegin", captureEvent); | |
video.addEventListener("interruptend", captureEvent); | |
video.addEventListener("loadeddata", captureEvent); | |
video.addEventListener("loadedmetadata", captureEvent); | |
video.addEventListener("loadstart", captureEvent); | |
video.addEventListener("mozaudioavailable", captureEvent); | |
video.addEventListener("pause", function (event) { | |
console.log(event.type); | |
console.info("automatically restarting play"); | |
video.play(); | |
}); | |
video.addEventListener("play", captureEvent); | |
video.addEventListener("playing", captureEvent); | |
video.addEventListener("progress", function (event) { | |
console.log(event.type); | |
}); | |
video.addEventListener("ratechange", captureEvent); | |
video.addEventListener("seeked", captureEvent); | |
video.addEventListener("seeking", captureEvent); | |
video.addEventListener("stalled", captureEvent); | |
video.addEventListener("suspend", function (event) { | |
console.log(event.type); | |
}); | |
video.addEventListener("timeupdate", captureEvent); | |
video.addEventListener("volumechange", captureEvent); | |
video.addEventListener("waiting", captureEvent); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment