Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am Developing an app, In this user can play multiple videos at a time in single layout file. For this i am using Video Views to play videos. my problem is user clicks save button the layout file was converted and saved as a video file into sdcard. If the user open saved file it plays multiple videos.

can any one give me an idea how can i do that?

I am using Following Code to play multiple videos at time.

public class MainActivity extends Activity {

String SrcPath = "sdcard/sample1.mp4";
String SrcPath2 = "sdcard/sample2.mp4";


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
myVideoView.setVideoURI(Uri.parse(SrcPath));
// MediaController mc=new MediaController(getApplicationContext());
// myVideoView.setMediaController(new MediaController(this));
// mc.setAnchorView(myVideoView);
//mc.setMediaPlayer(myVideoView);
//myVideoView.setMediaController(mc);

myVideoView.setOnPreparedListener(new OnPreparedListener() {

@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub




myVideoView.start();

myVideoView.requestFocus();
mp.start();


}
});


// myVideoView.start();

final VideoView myVideoView2 = (VideoView)findViewById(R.id.myvideoview2);
myVideoView2.setVideoURI(Uri.parse(SrcPath2));
// myVideoView2.setMediaController(new MediaController(this));


myVideoView2.setOnPreparedListener(new OnPreparedListener() {

@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub

myVideoView2.start();
myVideoView2.requestFocus();
mp.start();
mp.setVolume(0f, 0f);

}
});
// myVideoView2.start();
}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900