title: Play video one after another simultaneously smoothly [without visible switching from one to another]
body: <p>I am new to android and want to play videos one after another simultaneously so that it looks like continuous video.</p>
  
  <p>I have found this link on stackoverflow very helpful. <a href="https://stackoverflow.com/questions/11560445/how-to-play-videos-one-after-another-simultaneously">how-to-play-videos-one-after-another-simultaneously</a>
  When I am using this then though I am able to play videos one after another, 
  <strong>But switching from one segment to other results in <em>pause the video for a second before playing next one</em>.</strong>  So It don't looks like continuous videos due to this.</p>
  
  <p>Please help me to resolve my problem.
  Here is my Code.</p>
  
  <pre><code>public class VideoActivity extends Activity{
  
       VideoView videoView, videoView1;
       MediaController mc;
       int count = 0;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_video);
  
          videoView = (VideoView) findViewById(R.id.VVSimpleVideo);
          setup();
          videoView.setOnCompletionListener(completionListener);
  
      }
  
      public void setup() {
  
          String _path = "/mnt/sdcard/Video/"+count+".mp4";
          videoView.setVideoPath(_path);
          videoView.start();
          count++;
      }
  
  
      private OnCompletionListener completionListener=new OnCompletionListener() {
  
          public void onCompletion(MediaPlayer mp) {
              mp.stop();
              setup();
          }
      };
  
  }
  </code></pre>
  
  <p><strong>Now I have tried to play by taking two instances of VideoView class.</strong>
  Tried to play the first video by first player and second video by second player,
  Third video from first player and fourth video from second player  and so on.</p>
  
  <p>But still I am not able to play the video smoothly and the same problem exist.</p>
  
  <p>Here is my code with double player.</p>
  
  <pre><code>public class VideoActivity extends Activity{
  
       VideoView videoView, videoView1;
       MediaController mc;
       int count = 0;
       String _path;
       String _path1;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_video);
  
          videoView = (VideoView) findViewById(R.id.VVSimpleVideo);
          _path = "/mnt/sdcard/Video/"+count+".mp4";
          videoView.setVideoPath(_path);
           videoView.start();
          //setup();
          videoView.setOnCompletionListener(completionListener);
  
          videoView1 = (VideoView) findViewById(R.id.VVSimpleVideo);
  
          videoView1.setOnCompletionListener(completionListener1);
          count++;
          _path1 = "/mnt/sdcard/Video/"+count+".mp4";
          videoView1.setVideoPath(_path1);
      }
  
      public void setup() {
  
  
          videoView.start();
          count++;
          _path1 = "/mnt/sdcard/Video/"+count+".mp4";
          videoView1.setVideoPath(_path1);
      }
  
      public void setup1() {
  
  
          videoView1.start();
  
          count++;
          _path = "/mnt/sdcard/Video/"+count+".mp4";
          videoView.setVideoPath(_path);
      }
  
      private OnCompletionListener completionListener=new OnCompletionListener() {
  
          public void onCompletion(MediaPlayer mp) {
              mp.stop();
              setup1();       
  
          }
      };
  
      private OnCompletionListener completionListener1=new OnCompletionListener() {
  
          public void onCompletion(MediaPlayer mp) {
              mp.stop();
  
              setup();        
  
          }
      };
  
  }
  </code></pre>