有没有办法使用 iframe api 在暂停时隐藏相关的 Youtube 视频? [英] Is there a way of hiding related Youtube videos on pause with iframe api?

查看:41
本文介绍了有没有办法使用 iframe api 在暂停时隐藏相关的 Youtube 视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 iframe API,我想在页面上嵌入一些视频,但我不想在用户暂停视频时显示相关视频.

I'm working with the iframe API and I want to embed some videos on a page, but I don't want to show related videos when a user pauses the video.

我知道在 2018 年 9 月之后,Youtube 取消了在视频末尾或暂停视频时隐藏相关视频的可能性.

I know that after September 2018 Youtube removed the possibility of hiding related videos at the end or when pausing a video.

我知道参数 rel=0 现在显示来自视频上传者的同一帐户的相关视频.

I know the parameter rel=0 now shows related videos from the same account of the video uploader.

我也知道这个问题已经被回答过很多次了,但我见过至少一个网站没有出现这种情况.示例:https://earth.stanford.edu/

I also know the question has been answered many times, but I've seen at least one site where that's not happening. Example: https://earth.stanford.edu/

要生成 iframe,我使用以下代码:

To generate the iframe i'm using the following code:

function onYouTubeIframeAPIReady() {
    player = new YT.Player('player1', {
        height: '360',
        width: '640',
        videoId: 'lPVBrRd9wCo',
        playerVars: {
            rel: '0',
            showinfo: '0',
            loop: '1',
            playlist: 'lPVBrRd9wCo',
            autoplay: '1',
            mute: '1',
            iv_load_policy: '3',
            'ytp-pause-overlay': '0'
        },
        events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
        }
    });
}

https://codepen.io/romualdinho/pen/wZbxmj中的完整代码

是否有其他方法可以在暂停时隐藏相关视频?斯坦福是如何做到的?我尝试了相同的方式,相同的参数等,但没有.他们甚至能够隐藏视频的标题.

Is there another way of hiding related videos on pause? How does Stanford do it? I tried the same way, same parameters, etc, but nothing. They even have been able to hide the title of the video.

是否有某种 Google 帐户允许这样做?(优质、非营利、教育等)

Is there some kind of Google Account that allows that? (premium, nonprofit, educational, etc.)

谢谢!

推荐答案

Google/YouTube 早在 2018 年 10 月就结束了对 rel=0 的支持.到目前为止,我知道没有办法阻止它.我认为使用广告和 cookie 拦截器,他们正在损失收入,因此将人们吸引到 YouTube.com 是他们的答案.再次,它是免费的.

Google/YouTube ended support of rel=0 back in October 2018. So far, I know of no way to prevent it. I think that with ad and cookie blockers, they are losing revenue, so driving people to YouTube.com is their answer. Again, it's free.

这篇关于有没有办法使用 iframe api 在暂停时隐藏相关的 Youtube 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆