嵌入 YouTube 播放列表,以便播放列表选项始终可见. [英] Embed a YouTube playlist so playlist options are always visible.

查看:46
本文介绍了嵌入 YouTube 播放列表,以便播放列表选项始终可见.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将 YouTube 嵌入式播放器与播放列表结合使用,并使播放列表始终可见?或者,有没有办法在默认情况下打开播放列表按钮?到目前为止,我的研究表明 showinfo=1 选项用于使播放列表始终可见,但似乎不再起作用.

解决方案

这是一个很好的 JS 插件,适用于 YouTube API v.3 https://github.com/Giorgio003/Youtube-TV

它模仿了原生 YouTube 播放列表的外观和功能.您必须从 YouTube 频道获取 API 密钥并在 ytv.js 中进行设置.

var apiKey = 'YOUR_API_KEY_HERE';

链接 CSS 和 JS

<script src="src/ytv.js" type="text/javascript"></script>

创建您的播放列表容器.[注意:容器必须有高度.]

然后调用JS

document.addEventListener("DOMContentLoaded", function(event) {var controller = new YTV('YourPlayerID', {用户:'Youtube 用户名'});});

Is there a way to utilize the YouTube embedded player with a playlist and have the playlist always visible? Alternately, is there a way to have the playlist button on by default? My research so far indicates that the showinfo=1 option is used to make the playlist always visible but that does not seem to work anymore.

解决方案

This is a nice JS plugin that works with the YouTube API v.3 https://github.com/Giorgio003/Youtube-TV

It imitates the look and functionality of the native YouTube Playlist. You must get an API key from your YouTube Channel and set it in ytv.js.

var apiKey = 'YOUR_API_KEY_HERE';

Link the CSS and JS

<link href="src/ytv.css" type="text/css" rel="stylesheet" />
<script src="src/ytv.js" type="text/javascript"></script>

Create your playlist container. [NOTE: the container must have a height.]

<div id="YourPlayerID"></div>

Then call the JS

document.addEventListener("DOMContentLoaded", function(event) {
    var controller = new YTV('YourPlayerID', {
       user: 'YoutubeUsername'
    });
});

这篇关于嵌入 YouTube 播放列表,以便播放列表选项始终可见.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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