I am using YouTubeAndroidPlayer api for playing youtube videos in my application. I want to start the video from the middle,but could not able to find the methods for (start and end ) as we can find in youtube api.
https://www.youtube.com/v/BmOpD46eZoA?start=36&end=65
In YouTubeAndroidPlayer api, I had a code like below for playing a video. I cannot able to start from the middle of the video. I didnt find any methods under player to give start and end values.
I searched a lot for the solution,but didnt find any luck.Please suggest.
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
// player.cueVideo(VIDEO_ID);
player.loadVideo(xyoajjlPt_o);
}
Use the method with
timeMillis
parameter:In your case:
[EDIT]
Well, you can make use of Handler to track the current running time of the video. When the time in milliseconds has reached the point where you want to stop the video, simply call the
player.pause()
method.Here's the complete code of the activity:
P.S. A duplicate question was asked here and I've updated my answer there.