Java Code Examples for com.google.android.youtube.player.YouTubePlayer#cueVideo()

The following examples show how to use com.google.android.youtube.player.YouTubePlayer#cueVideo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomPlayerControlActivity.java    From YouTubePlayerView-Example with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
    if (null == player) return;
    mPlayer = player;

    displayCurrentTime();

    // Start buffering
    if (!wasRestored) {
        player.cueVideo(VIDEO_ID);
    }

    player.setPlayerStyle(PlayerStyle.CHROMELESS);
    mPlayButtonLayout.setVisibility(View.VISIBLE);

    // Add listeners to YouTubePlayer instance
    player.setPlayerStateChangeListener(mPlayerStateChangeListener);
    player.setPlaybackEventListener(mPlaybackEventListener);
}
 
Example 2
Source File: PlayerActivity.java    From search-youtube with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player,
                                    boolean restored) {
    
    //initialise the video player only if it is not restored or is not yet set
    if(!restored){

        //cueVideo takes video ID as argument and initialise the player with that video
        //this method just prepares the player to play the video
        //but does not download any of the video stream until play() is called
        player.cueVideo(getIntent().getStringExtra("VIDEO_ID"));
    }
}
 
Example 3
Source File: PlayerViewDemoActivity.java    From yt-android-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
    boolean wasRestored) {
  if (!wasRestored) {
    player.cueVideo("wKJ9KzGQq0w");
  }
}
 
Example 4
Source File: FullscreenDemoActivity.java    From yt-android-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
    boolean wasRestored) {
  this.player = player;
  setControlsEnabled();
  // Specify that we want to handle fullscreen behavior ourselves.
  player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
  player.setOnFullscreenListener(this);
  if (!wasRestored) {
    player.cueVideo("avP5d16wEp0");
  }
}
 
Example 5
Source File: FragmentDemoActivity.java    From yt-android-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
    boolean wasRestored) {
  if (!wasRestored) {
    player.cueVideo("nCgQDjiotG0");
  }
}
 
Example 6
Source File: ActionBarDemoActivity.java    From yt-android-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
    boolean wasRestored) {
  player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
  player.setOnFullscreenListener(this);

  if (!wasRestored) {
    player.cueVideo("9c6W4CCU9M4");
  }
}
 
Example 7
Source File: VideoListDemoActivity.java    From yt-android-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean restored) {
  this.player = player;
  player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
  player.setOnFullscreenListener((VideoListDemoActivity) getActivity());
  if (!restored && videoId != null) {
    player.cueVideo(videoId);
  }
}
 
Example 8
Source File: PlayerActivity.java    From wmn-safety with MIT License 4 votes vote down vote up
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
    youTubePlayer.cueVideo(youtube_video_id);
}