title: How do I get the reference to an existing YouTube player?
body: <p><code>&lt;iframe width="560" height="315" src="//www.youtube.com/embed/M7lc1UVf-VE" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;</code></p>
  
  <p>I have a few questions on what happens when I embed a YouTube video using source code like above. The code should generate a YouTube Player object that processes the video the way users like. When I generate a Youtube Player by myself using Youtube Player API(instead of using the embed code), I can call call functions on it.</p>
  
  <pre><code>var player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      height: '390',
      width: '640',
      videoId: 'M7lc1UVf-VE',
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange
      }
    });
  }
  
  //player.playVideo(); will play the video.
  </code></pre>
  
  <p>My question is, how do I control the player object generated by the embed code? To put it in another way, from page <a href="http://www.youtube.com/watch?v=M7lc1UVf-VE" rel="noreferrer">http://www.youtube.com/watch?v=M7lc1UVf-VE</a>, how do I play the video by calling <code>SOMEPlayer.playVideo()</code>? When you go to the url, <code>ytplayer</code> object is available, but it doesn't seem to contain the necessary functions.</p>
  
  <p>This question might be a duplicate of <a href="https://stackoverflow.com/questions/17073962/youtube-player-api-retrieving-a-reference-to-an-existing-player">this</a>. </p>