youtube shit

for alex

HTML

<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<body>
<div>
hey just writing a thing
</div>
<div id="player"></div>
</body>

JavaScript

// 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: '390',
    width: '640',
    videoId: '8_dXp0eF8s0',
    playerVars: {
   //  'autoplay': 1,
     'controls': 0,
     'autohide': 1,
     'wmode': 'opaque',
     'showinfo': 0,
     'loop': 1,
     'mute': 1,
     'playlist': '8_dXp0eF8s0'
    },
    events: {
      'onReady': onPlayerReady
    }
  });
}

// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
  //event.target.playVideo();
}

function stopVideo() {
  player.stopVideo();
}
      
//could consider using an event handler function to re-play (loop) the video.

document.getElementsByTagName("body")[0].addEventListener("touchstart", function(){player.playVideo();console.log("HEY");}, false);