Is it possible to create my own youtube playlist with Youtube Api
Is it possible to create my own YouTube playlist with YouTube API?
I would like to take a list of YouTube id's, and append the videos to my page.
Is it possible?
Thank you
是的,您可以使用播放列表创建播放列表 - >插入。
HTML:
<div id="player"></div>
Javascript:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'M7lc1UVf-VE',
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
//here you load your playlist
event.target.loadPlaylist(playlist: [youtubeIds]);
}
链接地址: http://www.djcxy.com/p/28952.html