我不希望它立即开始播放,我将如何调整代码以使其在页面加载时不开始?
代码: https://jsfiddle.net/qnbyg5x9/114/
let player;
function next() {
player.loadPlaylist({
"listType": "playlist",
"list": "TLGGCePU6hOj6WQyMjEyMjAxOA",
"index": newRandomNumber(0, 10),
});
player.setShuffle({
"shufflePlaylist": true
});
}
let oldNumber = 0;
let NewNumber = 10;
function newRandomNumber(min, max) {
oldNumber = NewNumber;
NewNumber = Math.floor(Math.random() * max) + min;
if (NewNumber == oldNumber) {
newRandomNumber(min, max);
} else {
return NewNumber;
}
}
function onPlayerReady(event) {
next();
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED) {
next();
}
}