(function() {
  this.onYouTubeIframeAPIReady = function() {
    var onPlayerReady, onPlayerStateChange, player, videoId;
    onPlayerReady = function(event) {
      var playButton, skipButton;
      playButton = $('#play-button');
      playButton.on('click', function() {
        player.playVideo();
        return $('#overlay').hide();
      });
      skipButton = $('#skip-button');
      return skipButton.on('click', function() {
        return $('#video-container').hide();
      });
    };
    onPlayerStateChange = function(event) {
      var containerButton;
      containerButton = $('#video-container');
      return containerButton.on('click', function(e) {
        if (e.target !== this) {
          return;
        }
        $('#video-container').hide();
      });
    };
    videoId = $('#player').data('video-id');
    player = new YT.Player('player', {
      height: '531',
      width: '944',
      videoId: videoId,
      playerVars: {
        'showinfo': 0,
        'rel': 0
      },
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange
      }
    });
  };

  this.youTubeIframeHandler = function() {
    var firstScriptTag, player, tag;
    tag = document.createElement('script');
    tag.src = 'https://www.youtube.com/iframe_api';
    firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    player = void 0;
  };

}).call(this);

//# sourceMappingURL=youtube.js.map
