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('++++++++++++++++++++');
}
这是输出
++++++++++++++++++++
未定义
未定义
未定义
++++++++++++++++++++
我做错了什么?
答案 0 :(得分:0)
最后我得到了答案
这些功能在播放器处于播放状态时起作用,否则无法正常工作
if(event.data === YT.PlayerState.PLAYING){
console.log(player.getVolume());
console.log(player.getDuration());
console.log(player.getCurrentTime());
}