user3136597
user3136597

Reputation: 51

Android YoutubePlayer to auto play Youtube videos

i am using YoutubePlayer API to play videos from youtube.My problem is to auto play videos starting with ads using "Youtubeplayerfragment" starting with 1.loadvideo(videoid) auto plays videos but skips ads 2.using cuevideo(videoid) cue's video but does'nt auto play.so how to auto play videos along with ads.

Upvotes: 5

Views: 3732

Answers (1)

Arun
Arun

Reputation: 2840

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);
    }
}

Upvotes: 13

Related Questions