我创建了一个小型youtube画廊。单击缩略图之一可在主DIV中播放视频。尽管我在youtube iframe源中设置了REL = 0,但相关视频仍在显示。任何想法为什么会这样? 这是发生问题的页面: https://www.itaysharf.com/%D7%A0%D7%99%D7%95%D7%95%D7%9F-%D7%A8%D7%A9%D7%AA%D7%99%D7%AA/
HTML和JS代码:
$(".video_wrapper li").click(function() {
$('html, body').animate({
scrollTop: $("#bigvid").offset().top
}, 1000);
});
$(".video_wrapper").on('click',"a", function(event) {
event.preventDefault();
event.stopImmediatePropagation();
event.stopPropagation();
$(".video_case iframe").prop("src", $(event.currentTarget).attr("href"));
});
<div class="video_case" id="bigvid">
<iframe width="705" height="445" src="https://www.youtube.com/embed/<?php the_field('main-video'); ?>?rel=0" frameborder="0" allowfullscreen allow="autoplay"></iframe>
<span class="desc"> <?php the_field('video-desc'); ?></span>
</div>
<?php if (get_field('video-id-1')): ?>
<div class="video_wrapper">
<ul>
<li class="video_thumbnail"><a href="https://www.youtube.com/embed/<?php the_field('video-id-1'); ?>?rel=0&autoplay=1" class="video-1" title=""><span class="video-btn"></span><img src="https://img.youtube.com/vi/<?php the_field('video-id-1'); ?>/mqdefault.jpg" alt="<?php the_field('video-alt-1'); ?>"/></a></li>
<li class="video_thumbnail"><a href="https://www.youtube.com/embed/<?php the_field('video-id-2'); ?>?rel=0&autoplay=1" class="video-2" title=""><span class="video-btn"></span><img src="https://img.youtube.com/vi/<?php the_field('video-id-2'); ?>/mqdefault.jpg" alt="<?php the_field('video-alt-2'); ?>"/></a></li>
<li class="video_thumbnail"><a href="https://www.youtube.com/embed/<?php the_field('video-id-3'); ?>?rel=0&autoplay=1" class="video-3" title=""><span class="video-btn"></span><img src="https://img.youtube.com/vi/<?php the_field('video-id-3'); ?>/mqdefault.jpg" alt="<?php the_field('video-alt-3'); ?>"/></a></li>
</ul>
</div>
<?php endif; ?>
感谢您的帮助 丹
答案 0 :(得分:0)
https://developers.google.com/youtube/player_parameters#release_notes_08_23_2018
rel参数的行为在2018年9月25日或之后发生更改。更改的结果是您将无法禁用相关视频。但是,您可以选择指定播放器中显示的相关视频应与刚刚播放的视频来自同一频道。