Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: getDuration() and getCurrentTime() support please #25

Closed
cjmling opened this issue Jun 11, 2018 · 2 comments
Closed

Feature Request: getDuration() and getCurrentTime() support please #25

cjmling opened this issue Jun 11, 2018 · 2 comments
Labels

Comments

@cjmling
Copy link

cjmling commented Jun 11, 2018

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
Copy link
Member

goto-bus-stop commented Jun 11, 2018

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()
  }}
/>

@cjmling
Copy link
Author

cjmling commented Jun 11, 2018

Ok that should work great :D

but currently , it never called back? #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants