当我单击按钮时,我想从一个频道上传的最后一个视频“跳转”到另一个频道。
现在,我可以使用不同的方法浏览上一个或下一个视频。但是我不知道如何从一个频道跳到另一个频道...
到目前为止,这是我的代码:
// CHANNEL'S LIST
var channels = [
marvel.channelName,
dcComics.channelName,
miniac.channelName,
tabletopMinions.channelName,
nextLevelPainting.channelName,
angelGiraldez.channelName,
theBeastsOfWar.channelName,
corvusBelli.channelName
];
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '315',
width: '560',
autoplay: '0',
controls: '1',
rel: '0',
fs: '0',
modestbranding: '1',
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
event.target.loadPlaylist({
list: channels,
listType: 'user_uploads'
});
}
// CHANNEL NAVIGATION FUNCTION
var currentChannel = 0;
// Next
function nextChannel() {
currentChannel++;
if (currentChannel > channels.length) {
currentChannel = channels.length;
}
}
// Previous
function prevChannel() {
currentChannel--;
if (currentChannel < 0) {
currentChannel = 0;
}
}
// Playback Controls
$("#next").click( function () {
player.nextVideo();
});
$("#prev").click( function () {
player.previousVideo();
});