title: YouTube iFrame has intermittent load errors
body: <p>Our software allows users to mix various media, including YouTube videos, together in a sequential timeline. We are intermittently seeing errors with loading YouTube videos loading in our player. We use the youtube iframe API. We first manually create the YouTube embed iframe, and then instantiate the YouTube iframe API, passing in the iframe. </p>
  
  <p>When this issue happens, it manifests itself as follows: The YouTube player is a black screen with the loading symbol. It stays in that state for about a minute (sometimes more) and eventually gives the error: "An error occured, please try again later", although sometimes the player just stays black indefinitely. During this minute wait, we have inspected the "Stats for Nerds" panel and see that the video seems to begin a cycle of loading different resolutions. You can see this occur beginning around the 1:00 mark of this video:</p>
  
  <p><a href="https://www.cubby.com/pl/Instant+meeting+2013-12-31.webm/_8cbafbaed7c64d828b260b41cd9db8dc" rel="nofollow">https://www.cubby.com/pl/Instant+meeting+2013-12-31.webm/_8cbafbaed7c64d828b260b41cd9db8dc</a></p>
  
  <p>We see it cycle through such resolutions as:</p>
  
  <p>426 x 240</p>
  
  <p>256 x 144</p>
  
  <p>854 x 480</p>
  
  <p>1280 x 720</p>
  
  <p>When this happens, almost always, the video plays fine after refreshing the page and trying again.We have seen it happen on solid, high speed connections as well as lower speed connections.</p>
  
  <p>Here's the iframe code snagged right from the DOM when the error was occurring:</p>
  
  <p><code>&lt;iframe id="youtube_iframe" type="text/html" width="100%" height="375" src="https://www.youtube.com/embed/FCuq3IedO9k?allowScriptAccess=always&amp;controls=0&amp;disablekb=1&amp;enablejsapi=1&amp;playsinline=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;start=151&amp;rel=0&amp;vq=large&amp;showinfo=0&amp;wmode=opaque&amp;origin=http%3A%2F%2Fwww.meograph.com" frameborder="0"&gt;&lt;/iframe&gt;</code></p>
  
  <p>Any ideas on why this could be happening or ideas on how to prevent it from happening would be very helpful. If you'd like any additional debug information (I have a screenshot of the network panel from a time this happened, for example), just let me know and I'll link it.</p>