YouTube embed showinfo has been deprecated

后端 未结 8 2086
抹茶落季
抹茶落季 2020-12-10 12:06

We are using a YouTube video on our website as a hero banner.

However few days ago it started showing it\'s title, watch later button and a share button. We were abl

相关标签:
8条回答
  • 2020-12-10 12:35

    <div id="schnitt">
    
    <iframe width="500" height="280" src="https://www.youtube.com/embed/rlR4PJn8b8I?controls=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    
    </div>
    
    <style>
    #schnitt {
    height:250px;
    overflow:hidden;
    }
    
    iframe {
    margin-top:-55px;
    }

    0 讨论(0)
  • 2020-12-10 12:39

    I was looking at the same problem and the only solution I found is to set the video in autoplay and place a transparent layer over the youtube box.

    The user would not be able to interact with the player, but it can be useful in some situation like banner.

    Unfortunately the code doesn't seem to run correctly on stackoverflow I also add a jsfiddle: http://jsfiddle.net/z3dqpuy0/

    .yt-cntainer {
      position: relative;
    }
    		
    .yt-mask {
      position: absolute;
    	top: 0;
    	bottom: 0;
    	left: 0;
    	right: 0;
    }
    <div class="yt-cntainer">
      <iframe id="vid-player-1" src="https://www.youtube.com/embed/Bey4XXJAqS8?enablejsapi=1&rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0"></iframe>
      <div class="yt-mask"></div>
    </div>

    0 讨论(0)
提交回复
热议问题