Skip to content

Instantly share code, notes, and snippets.

@polatengin
Created October 16, 2016 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polatengin/04603b1e70d5811f6cfb650527c0310f to your computer and use it in GitHub Desktop.
Save polatengin/04603b1e70d5811f6cfb650527c0310f to your computer and use it in GitHub Desktop.
HTML5 video element ile sayfanın arkaplanında video oynatmak
<!doctype html>
<html lang="tr">
<head>
<title>Tam ekran video</title>
<meta charset="utf-8" />
</head>
<body>
</body>
</html>
<video id="backgroundVideo" controls loop muted>
<source src="http://www.enginpolat.com/wp-content/uploads/2016/03/HTML5VideoElement.mp4" type="video/mp4" />
<source src="http://www.enginpolat.com/wp-content/uploads/2016/03/HTML5VideoElement.webm" type="video/webm" />
<source src="http://www.enginpolat.com/wp-content/uploads/2016/03/HTML5VideoElement.ogg" type="video/ogg" />
</video>
<script>
window.onresize = function() {
var video = document.querySelector("#backgroundVideo");
video.play();
video.width = window.innerWidth;
video.height = window.innerHeight;
};
window.onload = function() { window.onresize(); };
</script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment