YouTube API Android auto start

What you are looking for is the Youtube API’s loadVideo method. From the docs:

public abstract void loadVideo (String videoId)

Loads and plays the specified video.

You can use it like this:

 public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
    boolean wasRestored) {
  this.player = player;
  player.loadVideo(; // where is a String of a Youtube video ID

In a similar vein, there is also the cueVideo method, which adds the video to the playlist, but does not automatically start playing the video.

Leave a Comment