2016-09-08 100 views
0
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

未定義

++++++++++++++++++++


我在做什麼錯?

+0

爲什麼這些player.function()被投擲未定義??? – nishant

回答

0

最後我得到了答案

當玩家在玩的狀態,否則將無法正常工作

這些功能的工作,如果(event.data === YT.PlayerState.PLAYING){

  console.log(player.getVolume()); 
      console.log(player.getDuration()); 
      console.log(player.getCurrentTime()); 

}