How to play multiple video in different video view in one activity
Solution 1
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.
Solution 2
Your device should support playing multiple videos also quality of videos (HD videos) which needs high end devices else it will throw error.
I tried this code it works with all nexus devices.
Solution 3
According to this answer, it is very much possible to play multiple videos simultaneously, but it depends on the device and its hardware. The Android version doesn't seem to matter. I'd suggest you read his comments and code for a better understanding.
Basheer
Updated on June 09, 2022Comments
-
Basheer almost 2 years
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.