Last active
January 6, 2017 13:05
-
-
Save JustinDFuller/ca8d3fe08f2d00ec7b04f1cd4853f79a to your computer and use it in GitHub Desktop.
Autoplay Video
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 videoContainer = document.getElementById('myVideoID'); | |
const suppressAutoplayForUser = /* Use an external service like a database to fill this in */ | |
const video = document.createElement('video'); | |
video.autoplay = suppressAutoplayForUser ? false : true; | |
video.src = 'myAwesomeVideo.mp4'; | |
video.textContent = 'Your browser does not support this media type, or the Video tag.'; | |
videoContainer.appendChild(video); | |
/* Creates: | |
<div id='myVideoID'> | |
<video src='myAwesomeVideo.mp4' autoplay> | |
Your browser does not support this media type, or the Video tag. | |
</video> | |
</div> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment