OSDN Git Service

VideoPlayer::onPrepared() can be called after the user pressed back in the VideoView.
authorAndrei Popescu <andreip@google.com>
Sat, 27 Feb 2010 15:47:46 +0000 (15:47 +0000)
committerAndrei Popescu <andreip@google.com>
Sat, 27 Feb 2010 16:14:04 +0000 (16:14 +0000)
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: 247600224757862475786

core/java/android/webkit/HTML5VideoViewProxy.java

index 85f1d5c..42e1539 100644 (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;