title: Not able to play youtube video embedded in iframe created via JS
body: <p>​Hello,
  when I embed a youtube video into iframe that is not made via HTML  tag but created with JavaScript (document.createElement()) video can not be played and only error message “Video unavailable” is shown.</p>
  
  <p>Additional info:  </p>
  
  <ul>
  <li>First iframe does not have a src attribute. </li>
  <li>The document of iframe is created programmatically. Second
  (video-embedding) iframe is part of the first iframe document.</li>
  <li>This page is running on localhost.</li>
  <li>This behavior is happening also on online applications running on own domain.</li>
  <li>This behavior does not happen for all videos, i noticed it is happening mainly with music videos.</li>
  <li>All videos have embedding enabled so this is not reason why those videos cannot be played.</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/teRpq.gif" rel="nofollow noreferrer">gif showing behavior here</a></p>
  
  <p><strong>index.html:</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;div&gt;
  &lt;iframe id="myFrame" style="width: 600px ; height: 350px" src="iframeVideo.html" frameborder="1"
  allowfullscreen=""&gt;&lt;/iframe&gt;
  &lt;/div&gt;
  &lt;div id="video"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  var container = document.getElementById("video");
  var frame = document.createElement("iframe");
  frame.style.width = "600px";
  frame.style.height = "400px";
  
  frame.onload = function () {
  if (frame.contentDocument) {
  var fdoc = frame.contentDocument;
  var vframe = fdoc.createElement("iframe");
  
  vframe.src = "https://www.youtube.com/embed/NEIwl93Yr8o";
  vframe.setAttribute("frameborder", "0");
  vframe.setAttribute("allowfullscreen", "");
  vframe.style.width = "500px";
  vframe.style.height = "281px";
  
  fdoc.body.appendChild(vframe);
  }
  }
  container.appendChild(frame);
  &lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>iframeVideo.html:</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;iframe id="myFrame" style="width: 500px ; height: 281px" src="https://www.youtube.com/embed/NEIwl93Yr8o" frameborder="0"
  allowfullscreen=""&gt;&lt;/iframe&gt;
  &lt;/html&gt;
  </code></pre>