Created
June 23, 2016 16:35
-
-
Save xombra/93e62396feb4f482bb987ea5b09851f3 to your computer and use it in GitHub Desktop.
Video Api Youtube
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
function API_YOUTUBE($video,$ancho,$alto) | |
{ ?> | |
<div class="embed-responsive embed-responsive-16by9 bordevideo"> | |
<script asyn defer> | |
var tag=document.createElement('script'); | |
tag.src ="https://www.youtube.com/player_api"; | |
var firstScriptTag =document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
var player; | |
function onYouTubePlayerAPIReady(){ | |
player=new YT.Player('ytplayer',{ | |
height:'<?php echo $alto; ?>',width:'<?php echo $ancho; ?>',controls:1, | |
videoId:'<?php echo $video; ?>' | |
}); | |
} | |
</script> | |
<div id="ytplayer"></div> | |
</div> | |
<?php | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment