Skip to content

Instantly share code, notes, and snippets.

@xombra
Created June 23, 2016 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xombra/93e62396feb4f482bb987ea5b09851f3 to your computer and use it in GitHub Desktop.
Save xombra/93e62396feb4f482bb987ea5b09851f3 to your computer and use it in GitHub Desktop.
Video Api Youtube
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