因此,如果我使用普通代码iframe将youtube嵌入网站,我可以在VideoID之后使用modestbranding = 1删除右下角的youtube徽标 像这样
<iframe width="640" height="360" src="https://www.youtube.com/embed/ADgeqLVR6EY?modestbranding=1" frameborder="0" allowfullscreen></iframe>
但如果我使用IFrame Player API,我不知道如何删除youtube徽标,我在VideoID之后设置了modestbranding = 1,但它没有用。
<!DOCTYPE html>
<html>
<body>
<div id="player"></div>
<script>
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('player', {
height: '360',
width: '640',
videoId: 'QyhrOruvT1c?modestbranding=1' //it did not remove logo. :(
});
}
</script>
</body>
</html>
答案 0 :(得分:1)
在YT中,播放器参数无法在videoId中传递,请使用playerVars
作为
player = new YT.Player('player', {
height: '360',
width: '640',
videoId: 'QyhrOruvT1c',
playerVars: {'modestbranding':1} // <-- add this
});