-
-
Notifications
You must be signed in to change notification settings - Fork 758
Utilities
Pierfrancesco Soffritti edited this page Jun 30, 2018
·
2 revisions
The documentation has been moved in the readme of the project. This wiki is outdated.
To track the state of a YouTubePlayer object you simply need to listen to its onStateChange()
method calls.
To make this even simpler, the library provides an utility class called YouTubePlayerStateTracker
.
To use it you simply need to create an instance of YouTubePlayerStateTracker
and add it as listener to the YouTubePlayer object you want to track. From there you will be able to get the internal state of the player using your tracker.
YouTubePlayerStateTracker tracker = new YouTubePlayerStateTracker();
youTubePlayer.addListener(tracker);
tracker.getCurrentState();
tracker.getCurrentSecond();
tracker.getVideoDuration();
tracker.getVideoId();