title: Adding event callback for YouTube JS Player API when related video clicked
body: <p>YouTube's <a href="https://developers.google.com/youtube/iframe_api_reference#Adding_event_listener" rel="nofollow">iFrame embed JS player API </a> allows you to add callbacks to certain events. I want to add a callback for when a related video at the end of a video is selected.</p>
  
  <p>To be more specific, when viewing a video in an embed, at the end it displays related videos within the embed. I want to run some code when one of those is selected. How can this be accomplished? I see that there is an onStateChange but none of the states are related to related videos. Do I need to add an onStateChange for YT.PlayerState.PLAYING and then compare the playing video to the original video to see if they're different somehow?</p>