Youtube Javascript API - disable related videos(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 - 禁用相关视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Youtube Javascript API - 禁用相关视频


基础教程推荐
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01