Created
January 21, 2015 14:38
-
-
Save julzmon/ece9d0c4bc14864af613 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
<video autoplay controls id="videoElement"> | |
<source src="rar.mp4"> | |
<source src="rar.webm"> | |
</video> | |
<script> | |
var videoElement = document.getElementById("videoElement"); | |
document.addEventListener("visibilitychange", function() { | |
if (document.hidden) { | |
videoElement.pause(); | |
} else { | |
videoElement.play(); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment