VideoPlayer::onPrepared() can be called after the user pressed back in the VideoView.

This can cass a NPE since our Timer would have been destroyed by then.

Add call to VideoView.stopPlayback() when the view is dismissed by the user.

Fix b: 2476002, 2475786, 2475786
This commit is contained in:
Andrei Popescu
2010-02-27 15:47:46 +00:00
parent b5e15690dc
commit 8aab46abca

View File

@@ -131,6 +131,7 @@ class HTML5VideoViewProxy extends Handler
mTimer = null;
mCurrentProxy.playbackEnded();
mCurrentProxy = null;
mVideoView.stopPlayback();
mLayout.removeView(mVideoView);
mVideoView = null;
if (mProgressView != null) {
@@ -218,11 +219,10 @@ class HTML5VideoViewProxy extends Handler
}
public static void onPrepared() {
mTimer.schedule(new TimeupdateTask(mCurrentProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
if (mProgressView == null || mLayout == null) {
return;
}
mTimer.schedule(new TimeupdateTask(mCurrentProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
mProgressView.setVisibility(View.GONE);
mLayout.removeView(mProgressView);
mProgressView = null;