Team:UNIK Copenhagen
From 2013.igem.org
SigneKarlsen (Talk | contribs) |
SigneKarlsen (Talk | contribs) |
||
Line 304: | Line 304: | ||
<h3><span>Watch our video</span><br> | <h3><span>Watch our video</span><br> | ||
<span>Learn about our project</span></h3></div> | <span>Learn about our project</span></h3></div> | ||
- | + | <!-- <div id="vid"> | |
<iframe width="480" height="300" src="//www.youtube.com/embed/Y6xQG2dA0tA?feature=player_detailpage&wmode=opaque" frameborder="0" allowfullscreen></iframe> | <iframe width="480" height="300" src="//www.youtube.com/embed/Y6xQG2dA0tA?feature=player_detailpage&wmode=opaque" frameborder="0" allowfullscreen></iframe> | ||
</div> | </div> | ||
+ | --> | ||
+ | <div id="vid"></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: '300', | ||
+ | width: '480', | ||
+ | videoId: 'Y6xQG2dA0tA', | ||
+ | events: { | ||
+ | 'onReady': onPlayerReady, | ||
+ | 'onStateChange': onPlayerStateChange | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // 4. The API will call this function when the video player is ready. | ||
+ | function onPlayerReady(event) { | ||
+ | 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. | ||
+ | function onPlayerStateChange(event) { | ||
+ | if (event.data == YT.PlayerState.PLAYING) { | ||
+ | pauseSlider = true; | ||
+ | } else{ | ||
+ | pauseSlider = false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | |||
</div> | </div> | ||
</li> | </li> |
Revision as of 22:54, 2 October 2013