YouTube标题,共享,观看按钮已删除

时间:2019-02-08 11:22:35

标签: javascript jquery html html5 youtube

当我尝试将视频用作网站背景时,标题和按钮会显示在Youtube视频的顶部。我希望从YouTube顶部的顶部删除标题,观看和共享按钮。我已经尝试了一切,但没有任何效果。

我已附上我的代码。我试图用jQuery注入它,但是根本没有运气。

<iframe src="https://www.youtube.com/embed/5iNr0Tp13hY?mode=opaque&rel=0&autohide=1&showinfo=0&controls=0&wmode=transparent" frameborder="0" width="100%" height="100%"></iframe>
$('iframe').load(function() {
  $('iframe').contents().find("head").append($("<style type='text/css'>  .ytp-chrome-top.ytp-show-watch-later-title.ytp-share-button-visible.ytp-show-share-title.ytp-show-cards-title { display: none !important; } </style>"));
});

1 个答案:

答案 0 :(得分:1)

使用jquery.mb.YTPlayer代替使用iFrame,更简单。

将.js文件调用为HTML

<script src="style/js/jquery.mb.YTPlayer.js"></script>

然后使用

调用视频

<div id="P1" class="player video-container" data-property="{videoURL:'https://www.youtube.com/watch?XXXXXXX',containment:'#video', autoPlay:true, showControls:false, mute:true, startAt:6, opacity:1, loop:1}"></div>

showControls:false隐藏控件,您可以在文档中找到所有选项。

相关问题