I have a VideoView which I want to use to play a movieclip. I use it like this to play it and it works.
VideoView vv = new VideoView(this);
vv.setVideoURI(Ur
Try this line.This worked for me. if(player!=null)player.release();
@Override
protected void onDestroy() {
super.onDestroy();
player.pause();
if(player!=null)player.release();
player = null;
videoSurface = null;
controller = null;
}
My variation on the @tommyd theme:
Set the drawable to a static video frame, then spam the message queue. After some time, clear the drawable so video frames render. Then, before completion, set the static image back.
mMovieView.setBackgroundDrawable(bg);
mMovieView.start();
final int kPollTime= 25;
mMovieView.postDelayed(new Runnable() {
private final int kStartTransitionInThreshold= 50;
private final int kStartTransitionOutThreshold= 250;
private boolean mTransitioned= false;
@Override
public void run() {
if (mMovieView.isPlaying()) {
if (mMovieView.getCurrentPosition() > kStartTransitionInThreshold && !mTransitioned) {
mMovieView.setBackgroundDrawable(null); // clear to video
mTransitioned= true;
}
if (mMovieView.getDuration() - mMovieView.getCurrentPosition() < kStartTransitionOutThreshold)
mMovieView.setBackgroundDrawable(bg);
}
mMovieView.postDelayed(this, kPollTime); // come back in a bit and try again
}
}, kPollTime);