the dialog layout look like this,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:id="@+id/videoview"
android:layout_width="640dp"
android:layout_height="400dp"
android:layout_centerInParent="true" >
</VideoView>
<FrameLayout
android:id="@+id/videoViewWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
</FrameLayout>
</RelativeLayout>
in your Dilalog Frgament make a instance of videoview,
mVideoView = (VideoView) view.findViewById(R.id.videoview);
next set video uri from local or play using video url, after that,use setOnPreparedListener listener and set media controller,
mVideoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub
mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {
@Override
public void onVideoSizeChanged(MediaPlayer mp,
int width, int height) {
/*
* add media controller
*/
mc = new MediaController(MainActivity.this);
mVideoView.setMediaController(mc);
/*
* and set its position on screen
*/
mc.setAnchorView(mVideoView);
((ViewGroup) mc.getParent()).removeView(mc);
((FrameLayout) findViewById(R.id.videoViewWrapper))
.addView(mc);
mc.setVisibility(View.VISIBLE);
}
});
mVideoView.start();
}
});