我创建了一个小的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; ?>
谢谢你的帮助
担
最佳答案
https://developers.google.com/youtube/player_parameters#release_notes_08_23_2018
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.
关于youtube - 相关的youtube视频,尽管REL = 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53048764/