YouTube embed showinfo has been deprecated

后端 未结 8 2178
抹茶落季
抹茶落季 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:25

    If you need to hide the info, ideally go for Vimeo pro (which properly supports a no info embed),

    Otherwise there is a simple workaround:

    https://jsfiddle.net/10ov5hgw/1/

    It cuts off the bottom & top 60px of the iframe, but via overflow rather than a gross looking black bar on top, so video still looks fullscreen the entire time (and barely any of the video is cutout if you force 720) ,

    This hack supports having to support mobile views aswell, without heavily impacting the visible area of the video.

    .video-container{
      width:100vw;
      height:100vh;
      overflow:hidden;
      position:relative;
    }
    .video-container iframe,{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }
    .video-container iframe, {
      pointer-events: none;
    }
    .video-container iframe{
      position: absolute;
      top: -60px;
      left: 0;
      width: 100%;
      height: calc(100% + 120px);
    }
    .video-foreground{
      pointer-events:none;
    }
    
    

提交回复
热议问题