Created
July 12, 2012 19:23
-
-
Save nagisa/3100300 to your computer and use it in GitHub Desktop.
Automatically replay HTML5 videos. Works with YT, Vimeo, etc, etc.
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
// Long version | |
document.querySelector('video').addEventListener('ended', function(e){ | |
var target = e.currentTarget; | |
target.currentTime = 0; | |
target.play(); | |
} | |
}); | |
// Short version (snippet, bookmarklet?) | |
document.querySelector("video").addEventListener("ended",function(a){a=a.currentTarget;a.currentTime=0;a.play()}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment