If you open the video click, you will notice that the video starts playing from the 36th second and stops at the 65th second.

I’m not sure if there exists any direct method that gives this kind of functionality with the YouTube Android Player API. However, if there is/are any such direct implementation/s, please feel free to comment below and I will update the post.

The Workaround

To implement a similar functionality with YouTube Android Player API there needs a little workaround to be done. In my example, I’ve used a Handler and the Runnable interface to keep a track of the video’s current time (in milliseconds). Every second, a condition is checked to see if the video’s (current) time has reached the user specified end time.

Note: This was a question posted on StackOverflow and this was my answer to it.