Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android YoutubePlayer to auto play Youtube videos

Tags:

android

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.

like image 525
user3136597 Avatar asked Dec 26 '13 12:12

user3136597


1 Answers

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);
    }
}
like image 145
Arun Avatar answered Nov 02 '22 23:11

Arun