Feature Request: getDuration() and getCurrentTime() support please
cjmling opened this issue · 2 comments
cjmling commented
I tried to look into doc if it already support but doesn't seems like.
Will be nice to have this support. Personally I want to able to do stuff when player played till certain times/percent.
I tried setInterval
in createPlayer
and was able to get the data.
Sample codes can be seen here.
http://www.opimedia.be/DS/webdev/YouTube/
var current = youTubePlayer.getCurrentTime();
var duration = youTubePlayer.getDuration();
goto-bus-stop commented
You can get a reference to the YouTube Player object using the onReady
event handler, by doing something like:
<YouTube
onReady={(event) => {
const youTubePlayer = event.target
// now you can do:
youTubePlayer.getCurrentTime()
}}
/>