Youtube API returning current time

二次信任 提交于 2020-02-01 07:12:46

问题


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 completion.

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.


回答1:


getCurrentTime 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.



来源:https://stackoverflow.com/questions/9524637/youtube-api-returning-current-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!