YT 播放器 getCurrentTime() 返回 0

时间:2021-05-12 11:04:48

标签: javascript reactjs iframe youtube-iframe-api

我使用的是 Youtube Iframe Api。我想每秒获取 iframe 的当前时间。但是,当我运行代码时,它总是返回“0”。这是我正在使用的代码:

setInterval(() => {
 var ts = player.getCurrentTime();
 console.log(ts);
});

非常感谢任何帮助!
谢谢!

0 个答案:

没有答案