Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to play multiple video in different video view in one activity

Sample Code:

How to play the two video in one activity

public class Two_videos extends Activity 
{
VideoView video1, video2;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.two_video);

VideoView video1= (VideoView) findViewById(R.id.video1);
              video1.setVideoPath("/mnt/sdcard/Movies/com.bnb.giggle/IMG_20130415184609.mp4");
            video1.start();

VideoView video2= (VideoView) findViewById(R.id.video2);
        video2.setVideoPath("/mnt/sdcard/Movies/com.bnb.giggle/IMG_20130415184608.mp4");
        video2.start();
   }
}

cannot play two video same time.

like image 284
Basheer Avatar asked Apr 15 '13 13:04

Basheer


1 Answers

Play multiple videos is depends on hardware but if your device supports only one instance of media Player then you must call yourVideoView.stopPlayBack() for playing video in another videoview. you can resume video in first videoview by using its resume() method but after stop playing from second.

like image 117
ultimate Avatar answered Nov 07 '22 01:11

ultimate