这里是诀窍

来源: 2021-11-30 20:39:12 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

我就是试试两个不一样的embed Code:

<p><iframe allow="accelerometer; autoplay=1; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/BQH5umzC2uY?&amp;autoplay=1" title="YouTube video player" width="560"></iframe></p>

<p>&nbsp;</p>

<div id="ytplayer">&nbsp;</div>
<script>
  // Load the IFrame Player API code asynchronously.
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/player_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // Replace the 'ytplayer' element with an <iframe> and
  // YouTube player after the API code downloads.
  var player;
  function onYouTubePlayerAPIReady() {
    player = new YT.Player('ytplayer', {
      height: '360',
      width: '640',
      videoId: 'BQH5umzC2uY'
    });
  }
</script>