Last active
January 27, 2017 19:08
-
-
Save bulbul84/c36e2f9f021e79d9b084e56318b51f21 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
.fullscreen-bg { | |
bottom: 0; | |
height: 100%; | |
width: 100%; | |
left: 0; | |
overflow: hidden; | |
position: relative; | |
right: 0; | |
top: 0; | |
z-index: -100; | |
} | |
.fullscreen-bg__video, #myVideo, #player { | |
position: relative; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
background: #000; | |
} | |
.logo_area:before { | |
position: absolute; | |
background: #000; | |
left: 0; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
content: ""; | |
opacity: .40; | |
z-index: -1; | |
} |
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
<iframe id="myVideo" class="fullscreen-bg__video" width="560" height="315" src="https://www.youtube.com/embed/H1Tu1j7ic_0?&rel=0&version=3&autoplay=1&autohide=1&modestbranding=1&controls=0&showinfo=0&searchinfo=0&loop=1&playlist=H1Tu1j7ic_0" frameborder="0" allowfullscreen volume="0"></iframe> | |
<!--Youtube Options doc: | |
https://developers.google.com/youtube/player_parameters | |
--> | |
<div class="fullscreen-bg"> | |
<div id="player"></div> | |
<script> | |
// 2. This code loads the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); | |
tag.src = "https://www.youtube.com/iframe_api"; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
// 3. This function creates an <iframe> (and YouTube player) | |
// after the API code downloads. | |
var player; | |
function onYouTubeIframeAPIReady() { | |
player = new YT.Player('player', { | |
height: '195', | |
width: '260', | |
videoId: 'H1Tu1j7ic_0', | |
playerVars: { 'autoplay': 1, 'controls': 0, playlist: 'H1Tu1j7ic_0', loop: 1,rel: 0, showinfo: 0, searchinfo: 0, modestbranding: 1,}, | |
events: { | |
'onReady': onPlayerReady, | |
'onStateChange': onPlayerStateChange | |
} | |
}); | |
} | |
// 4. The API will call this function when the video player is ready. | |
function onPlayerReady(event) { | |
event.target.setVolume(0); | |
event.target.playVideo(); | |
} | |
// 5. The API calls this function when the player's state changes. | |
// The function indicates that when playing a video (state=1), | |
// the player should play for six seconds and then stop. | |
var done = false; | |
function onPlayerStateChange(event) { | |
if (event.data == YT.PlayerState.PLAYING && !done) { | |
// setTimeout(stopVideo, 6000); | |
done = true; | |
} | |
event.target.setVolume(0); | |
} | |
</script> | |
<!-- | |
<iframe id="myVideo" class="fullscreen-bg__video" width="560" height="315" src="https://www.youtube.com/embed/H1Tu1j7ic_0?&rel=0&version=3&autoplay=1&controls=0&showinfo=0&searchinfo=0&loop=0&modestbranding=1&playlist=H1Tu1j7ic_0&volume=0" frameborder="0" allowfullscreen volume="0"></iframe> | |
--> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment