i found a way to show a video inside of a dialog. but it's still kind of buggy.
the code is quick and dirty, no exception catching etc.
i created a new xml file called videoview. it contains a linearlayout and a videoview.
Using java Syntax Highlighting
Context mContext = (Context) activity; // activity is the main activity
Dialog dialog = new Dialog(mContext);
dialog.setTitle("Video");
dialog.setContentView(R.layout.videoview); // set the layout of the dialog
VideoView myVideo = (VideoView) dialog.findViewById(R.id.VideoView01);
myVideo.setVideoPath("/sdcard/video.wmv");
MediaController mc = new MediaController(mContext);
mc.setMediaPlayer(myVideo);
mc.setAnchorView(myVideo);
myVideo.setMediaController(mc);
myVideo.requestFocus();
myVideo.start();
dialog.show();
Parsed in 0.033 seconds, using
GeSHi 1.0.8.4
ok, video playback works fine, but some problems occured:
1. the mediacontroller is bound to the activity and the dialog "lays over" the activity, so the mc can't be clicked.
i can define own buttons that work like the mediacontroller.
2. the layout of the dialog gets kind of crashed as the videoview resizes its view after scaling the video. picture attached...
suggestions for solving the second problem would be very nice!