函数没有响应
Function are not responding
function onPlayerReady(event)
{
event.target.cueVideoById({
videoId: videos[index].vid,
startSeconds: videos[index].startSeconds,
endSeconds: videos[index].endSeconds,
suggestedQuality: videos[index].suggestedQuality
});
event.target.playVideo();
console.log('++++++++++++++++++++');
console.log(player.getVolume());
console.log(player.getDuration());
console.log(player.getCurrentTime());
console.log('++++++++++++++++++++');
}
这是输出
++++++++++++++++++++
undefined
undefined
undefined
++++++++++++++++++++
我做错了什么?
终于找到答案了
该功能在播放器处于播放状态时有效,否则无效
if (event.data === YT.PlayerState.PLAYING) {
console.log(player.getVolume());
console.log(player.getDuration());
console.log(player.getCurrentTime());
}
function onPlayerReady(event)
{
event.target.cueVideoById({
videoId: videos[index].vid,
startSeconds: videos[index].startSeconds,
endSeconds: videos[index].endSeconds,
suggestedQuality: videos[index].suggestedQuality
});
event.target.playVideo();
console.log('++++++++++++++++++++');
console.log(player.getVolume());
console.log(player.getDuration());
console.log(player.getCurrentTime());
console.log('++++++++++++++++++++');
}
这是输出
++++++++++++++++++++
undefined
undefined
undefined
++++++++++++++++++++
我做错了什么?
终于找到答案了
该功能在播放器处于播放状态时有效,否则无效
if (event.data === YT.PlayerState.PLAYING) {
console.log(player.getVolume());
console.log(player.getDuration());
console.log(player.getCurrentTime());
}