2

In my application there are some buttons on top of the screen and a video view under that.

In the oncreate event I start playing a mainvideo.mp4 in the VideoView and set it for looping.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.main);
    VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
    videoView.setVideoURI("android.resource://"+getPackageName() + "/"+R.raw.mainvideo);
    videoView.requestFocus();
    videoView.start();
} 

If the user clicks any of the buttons I want to change the video played by the VideoView to to buttonvideo.mp4. Below is the button onclick event code

Uri uri = Uri.parse("android.resource://"+getPackageName() + "/"+R.raw.buttonvideo);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();

When I tried using android 2.2 phone, once the button is clicked , the videoview disappears for a second and then plays the new video. I want the transition from one video to another as smooth as possible.

I tried this in another phone with android 4.0+ and this works flawlessly.Have seen some other applications do this, so there should be some way may be by overriding some event or custom videoview.Any idea?

user1263019
  • 221
  • 5
  • 14
  • Try calling videoView.suspend() or videoView.pause() before videoView.setVideoURI(uri), see if this helps. – yorkw Mar 12 '12 at 21:41

0 Answers0