YouTube embed showinfo has been deprecated

2019-02-13 17:49发布

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 able to hide them using &showinfo=0 at the end if the URL.

I found out that showinfo has been deprecated and thus you can no longer hide the fact that it is a YouTube video showing there.

Is there any other parameter that might be able to do the same thing?

You cannot do it with CSS or JavaScript as it is an iframe.

Any ideas are much appreciated.

UPDATE:

Any layer or mask over the video doesn't help, as the info shows when the video is loading, or if you click outside the browser, the video will pause and the info shows.

Hiding the top ~60px works, but it is not a good solution for me.

5条回答
时光不老,我们不散
2楼-- · 2019-02-13 18:20

Directly from show info

Note: This is a deprecation announcement for the showinfo parameter. In addition, the behavior for the rel parameter is changing. Titles, channel information, and related videos are an important part of YouTube’s core user experience, and these changes help to make the YouTube viewing experience consistent across different platforms.

The behavior for the rel parameter is changing on or after September 25, 2018. The effect of the change is that you will not be able to disable related videos. However, you will have the option of specifying that the related videos shown in the player should be from the same channel as the video that was just played.

It clearly states that this is something they consider to be part of the cor youtube experience. There is no suggestion of a workaround or a new parameter that you could send to archive the old results. They are removing it. If you tried to force it out using javascript and css i would almost suggest you are against the TOC which states your not allowed to change that display. People should know you are showing something from YouTube

查看更多
Bombasti
3楼-- · 2019-02-13 18:33

Well, I just noticed it as well. It sucks and ruins the aesthetics. So I just did a

header {
    /* remove when YT got its brain back */
    margin-top: -56px;
}

while hoping that they'll re-add showinfo=0 again.

查看更多
时光不老,我们不散
4楼-- · 2019-02-13 18: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>

查看更多
劳资没心,怎么记你
5楼-- · 2019-02-13 18:43

The solution I found aesthetically most pleasing is to lay a high res thumbnail over the video and hide it at hover. This also deals with the problem that the youtube preview is low res and looks cheap in my opinion.

Check it out here: http://jsfiddle.net/d9D9E/1/

Had to write code in order to show the js fiddle :/

.video-thumbnail{
    z-index:300;
    position:absolute;
    top:0;
    left:0;
    width:100%;
}

.video-thumbnail:hover{
    display:none;
}
查看更多
劫难
6楼-- · 2019-02-13 18:43

Not having 'rel=0' is irritating, but there is a work around. If you work with the IFrame API, (as opposed to embedding an iframe ex http://youtu.be/?videoIDxxx...) you can get the event for the stopping (completing) of the video, then cue up the video by ID into the player. See https://developers.google.com/youtube/iframe_api_reference#Playback_controls for reference to the basic player.

 
....

<div id="player1"></div>

<script type="text/javascript">
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

var player ;

function onYouTubeIframeAPIReady()
    {
    player = new YT.Player('player1', 
        { 
        videoId: 'YourVideoId',
        events: {
            'onStateChange': onPlayerStateChange
             }
        });

    }; // onYOuTubeIframeAPIReady
    		
function onPlayerStateChange(event)
    { 
    // Alt approach //if( event.data  == 0){ location.reload()}
    if( event.data  == 0)
        { player.cueVideoById({videoId:'YourVideoID',
                               suggestedQuality: 'hd720'})
        };
    } 

     </script>

查看更多
登录 后发表回答