Youtube Javascript API - 禁用相关视频

Youtube Javascript API - disable related videos(Youtube Javascript API - 禁用相关视频)
本文介绍了Youtube Javascript API - 禁用相关视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,这似乎记录得很差,或者我在文档中看不到它.我基本上不想要使用 JavaScript API 的相关视频 (?rel=0).

Right, this seems to be poorly documented or I can't see it in the documentation. I basically want no related videos (?rel=0) using the JavaScript API.

$players[$vidIdPlaceholderRef] = new YT.Player('player_' + $vidIdPlaceholderRef, {
    height: '550',
    width: '840',
    videoId: $vidId
});

是我所拥有的.

我也试过了:

$players[$vidIdPlaceholderRef] = new YT.Player('player_' + $vidIdPlaceholderRef, {
    height: '550',
    width: '840',
    videoId: $vidId + '?rel=0',
    rel : 0
});

没有运气.有谁知道可以添加的选项(尝试 rel : 0 没有运气)

with no luck. Does any one know of an option which can be added (tried rel : 0 with no luck )

推荐答案

rel"是一个播放器参数,在这里指定:

"rel" is a player parameter, as specified here:

https://developers.google.com/youtube/player_parameters#rel

要将播放器参数添加到 iframe 播放器,您需要指定第二个构造函数参数的 playerVars 属性(在撰写本文时已记录在 此处,以及 IFrame API 文档页面)

To add player parameters to iframe players, you need to specify the playerVars property of the second constructor argument (at the time of writing this is documented here, and on the IFrame API documentation page)

例如

new YT.Player('playerid', {
    height: '550',
    width: '840',
    videoID: 'video_id',
    playerVars: {rel: 0, showinfo: 0, ecver: 2}
});

这篇关于Youtube Javascript API - 禁用相关视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)