How To Display Two Videos Simultaneously With Surface View
I am a beginner in android development. I was trying to display a video with surface view using media codec for which i am successful. Now I want to add one more video at run time
Solution 1:
Try this
publicclassCustomPictureActivityextendsActivity {
/** Called when the activity is first created. */
VideoView vd1,vd2;
@OverridepublicvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vd1=(VideoView) findViewById(R.id.v1);
vd2=(VideoView) findViewById(R.id.v2);
vd1.setVideoURI(Uri.parse("/mnt/sdcard/file.mp4"));
vd1.setMediaController(newMediaController(this));
vd1.requestFocus();
vd1.start();
vd2.setVideoURI(Uri.parse("/mnt/sdcard/android.mp4"));
vd2.setMediaController(newMediaController(this));
vd2.requestFocus();
vd2.start();
}
}
Your xml code should be like this:
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="horizontal" ><VideoViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.5"android:id="@+id/v1"/><VideoViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.5"android:id="@+id/v2"/></LinearLayout>
May this will help you.
Post a Comment for "How To Display Two Videos Simultaneously With Surface View"