admin管理员组文章数量:1431426
I'm using the youtube iframe api and can't seem to find anything in the documentation or on google that references how to get the returned values on current media pletion.
I'm needing to build a script where I can past in time variables, in which when the variable matches up with the current time played an event can be triggered.
I know in the embed API there is one, player.getCurrentTime():Number
but doesn't seem to be one for the iframe API. I'm sure someone would of noticed this before.
I'm using the youtube iframe api and can't seem to find anything in the documentation or on google that references how to get the returned values on current media pletion.
I'm needing to build a script where I can past in time variables, in which when the variable matches up with the current time played an event can be triggered.
I know in the embed API there is one, player.getCurrentTime():Number
but doesn't seem to be one for the iframe API. I'm sure someone would of noticed this before.
- You can answer below, then select that answer is correct. That way you can close this question out. – user1228 Commented Mar 8, 2012 at 17:02
- I'm using the youtube frame api and player.getCurrentTime() is working fine for me... even if I get a console error "player.getCurrentTime is not a function". – httpete Commented Mar 13, 2012 at 16:52
- I couldn't do it at the time due to needing to wait 2 days – Bankzilla Commented Mar 14, 2012 at 0:14
1 Answer
Reset to default 4getCurrentTime
is also available in youtube iframe source.
To get current time code, I used a math.floor.
time = Math.floor(Video.YTPlayer.getCurrentTime());
This will always return whole numbers and will constantly round down numbers to its whole.
本文标签: javascriptYoutube API returning current timeStack Overflow
版权声明:本文标题:javascript - Youtube API returning current time - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745550751a2662932.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论