Android YoutubePlayer to automatically play Youtube video

I use the YoutubePlayer API to play videos from youtube. My problem is to automatically play back videos starting with ads using the "Youtubeplayerfragment", starting with videos loading 1.loadvideo (videoid), but skipping ads. 2. cuevideo (videoid) cue video, but does'nt auto play.so how to automatically play video along with ads.

+4
source share
1 answer

Instead of player.cuevideo (videoid) use player.loadVideo (videoId)

@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
    if (!wasRestored) {
        player.loadVideo(strYoutubeId);
    }
}
+10
source

All Articles