I have a MediaController mc
and VideoView videoView
which are linked as follows:
videoView.setMediaController(mc);
But, I also want to play/pause the video by clicking the video. So, I add:
//Play/Pause the Video on Clicking Video
videoView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (videoView.isPlaying()) {
videoView.pause();
} else {
int stopPosition = videoView.getCurrentPosition();
videoView.seekTo(stopPosition);
videoView.start();
}
return false;
}
});
The code works fine. But, when I click the video, the video pauses. But, the MediaController icon for play/pause
is not changed. Is there a work around?
Try calling mc.show(0) in your onTouch() method.