title: YouTube live Stream partially working on android
body: <p>I finally got YouTube live streaming to play on my app, the only inconvenience is when I go into full screen mode the player stops and it doesn't play anymore, also sometimes when I stop the player and try to play again it plays for 2 seconds then stops, I know YouTube live is on beta stage but that doesn't mean we couldn't find a solution for this, does anybody have any suggestions on how to solve this issue?</p>
  
  <p>LiveYouTube.java</p>
  
  <pre><code>public class LiveYouTube extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {
  public static final String API_KEY = "AIzaSyBMwV1heA9q75LkybRCK5SXXTJWADRtmDh4";
  
  //http://youtu.be/&lt;VIDEO_ID&gt;
  public static final String VIDEO_ID = "URS94beDtJA";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      /** attaching layout xml **/
      setContentView(R.layout.youtubelive);
  
      /** Initializing YouTube player view **/
      YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player);
      youTubePlayerView.initialize(API_KEY, this);
  }
  
  @Override
  public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) {
      Toast.makeText(this, "Failured to Initialize!", Toast.LENGTH_LONG).show();
  }
  
  @Override
  public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
      /** add listeners to YouTubePlayer instance **/
      player.setPlayerStateChangeListener(playerStateChangeListener);
      player.setPlaybackEventListener(playbackEventListener);
  
      /** Start buffering **/
      if (!wasRestored) {
          player.cueVideo(VIDEO_ID);
      }
  }
  
  private PlaybackEventListener playbackEventListener = new PlaybackEventListener() {
  
      @Override
      public void onBuffering(boolean arg0) {
      }
  
      @Override
      public void onPaused() {
      }
  
      @Override
      public void onPlaying() {
      }
  
      @Override
      public void onSeekTo(int arg0) {
      }
  
      @Override
      public void onStopped() {
      }
  
  };
  
  private PlayerStateChangeListener playerStateChangeListener = new PlayerStateChangeListener() {
  
      @Override
      public void onAdStarted() {
      }
  
      @Override
      public void onError(ErrorReason arg0) {
      }
  
      @Override
      public void onLoaded(String arg0) {
      }
  
      @Override
      public void onLoading() {
      }
  
      @Override
      public void onVideoEnded() {
      }
  
      @Override
      public void onVideoStarted() {
      }
  };
  </code></pre>
  
  <p>youtubelive.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
  &lt;RelativeLayout
      android:id="@+id/rel"
      android:layout_width="fill_parent"
      android:layout_height="@dimen/play_list_row_height"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:background="#c00311" &gt;
  
      &lt;TextView
          android:id="@+id/tv_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:ellipsize="end"
          android:gravity="center"
          android:text="LIVE VIDEO"
          android:textColor="@color/video_descrption_top_bar_text"
          android:textSize="@dimen/video_view_top_bar_font_size"
          android:textStyle="bold" /&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;com.google.android.youtube.player.YouTubePlayerView
      android:id="@+id/youtube_player"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#fff"
      android:padding="0dp" /&gt;
  
  &lt;ImageView
      android:id="@+id/logo"
      android:layout_width="340dp"
      android:layout_height="wrap_content"
      android:layout_marginTop="-13dp"
      android:src="@drawable/shadow_line" /&gt;
  </code></pre>
  
  <p></p>