title: Cast videos in queue by Chromecast stop playing video automatically after some time
body: <p>Cast video using Chromecast in a queue is working fine. As per my requirement, it's need to play video constantly for hours on the screen. For that  i get bunch of video urls from server for 5 to 10 videos. When 2 video are remain i get new bunch and i append in a queue. Videos are with the length around 40 to 50 seconds.</p>
  
  <p>It continues play for about 45 to 60 min not more than that. It stops than.</p>
  
  <p>I want it to play for hours...</p>
  
  <p>Can any one Help me to come out from this issue. Any help will be useful for me.</p>
  
  <p>Here is my code to play queue.</p>
  
  <pre><code>public void queuePlay(ArrayList&lt;CastModel&gt; data) {
  
      ArrayList&lt;MediaQueueItem&gt; queueList = new ArrayList&lt;&gt;();
  
      for (int i = 0; i &lt; data.size(); i++) {
  
          MediaMetadata mediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
  
          mediaMetadata.putString(MediaMetadata.KEY_TITLE, data.get(i).vTitle);
          mediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, data.get(i).vName);
          mediaMetadata.addImage(new WebImage(Uri.parse(data.get(i).vImage)));
  
          JSONObject extraData = null;
  
          try {
  
              extraData = getJsonOfObject(data.get(i));
              if (extraData == null)
                  extraData = new JSONObject();
  
          } catch (Exception e) {
              Log.i(TAG, "queuePlay: exception " + e.toString());
          }
  
  
          MediaInfo mediaInfo = new MediaInfo.Builder(data.get(i).vVideo)
                  .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                  .setContentType("videos/mp4")
                  .setMetadata(mediaMetadata)
                  .setCustomData(extraData)
                  .setStreamDuration(30 * 1000)
                  .build();
          MediaQueueItem item = new MediaQueueItem.Builder(mediaInfo).build();
          queueList.add(item);
      }
  
  
      MediaQueueItem[] queueArray = new MediaQueueItem[queueList.size()];
      queueArray = queueList.toArray(queueArray);
  
      remoteMediaClient = sessionManager.getCurrentCastSession().getRemoteMediaClient();
      remoteMediaClient.queueLoad(queueArray, 0, REPEAT_MODE_REPEAT_OFF, null);
  
      remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
          @Override
          public void onStatusUpdated() {
  
              try {
                  Thread.sleep(1000); // Hold for a while
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
  
              MediaStatus mMediaStatus = remoteMediaClient.getMediaStatus();
              if (mMediaStatus != null &amp;&amp; mMediaStatus.getQueueItems() != null) {
  
                  if (queueItemPlayedPosition &lt; mMediaStatus.getCurrentItemId()) {
                      Log.w(TAG, "onStatusUpdated: Delete video " + queueItemPlayedPosition);
                      updateCastList(false);
                      queueItemPlayedPosition++;
                  }
  
                  Log.e(TAG, "onStatusUpdated getCurrentItemId " + remoteMediaClient.getMediaStatus().getCurrentItemId() + " *** onStatusUpdated: getQueueItemCount *** " + mMediaStatus.getQueueItemCount());
              } 
  
          }
  
          @Override
          public void onMetadataUpdated() {
  
          }
  
          @Override
          public void onQueueStatusUpdated() {
  
          }
  
          @Override
          public void onPreloadStatusUpdated() {
  
          }
  
          @Override
          public void onSendingRemoteMediaRequest() {
          }
      });
  }
  </code></pre>