From 8aab46abca2cd0c100c90a569f6fc058ce6db5a8 Mon Sep 17 00:00:00 2001 From: Andrei Popescu Date: Sat, 27 Feb 2010 15:47:46 +0000 Subject: 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 --- core/java/android/webkit/HTML5VideoViewProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/java/android/webkit/HTML5VideoViewProxy.java') diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java index 85f1d5cb4dd4..42e153988a21 100644 --- a/core/java/android/webkit/HTML5VideoViewProxy.java +++ b/core/java/android/webkit/HTML5VideoViewProxy.java @@ -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; -- cgit v1.2.3