diff options
| author | Andrei Popescu <andreip@google.com> | 2010-04-14 13:30:23 +0100 |
|---|---|---|
| committer | Andrei Popescu <andreip@google.com> | 2010-04-14 17:31:17 +0100 |
| commit | c4fbceb57bcfbabb6e370e2dd6448184dc116015 (patch) | |
| tree | f7ecaf74425701dd7851e6d8f6fb00ce7b64ad2b /core/java/android/webkit/HTML5VideoViewProxy.java | |
| parent | 9cb66e89cd0c4bfa8d77591719023b7153fee9b9 (diff) | |
Make sure the onended event is dispatched even when
the user dismisses the video before it plays to completion.
Fix bug: 2533272
Change-Id: I73f216f4f416f5fdca0bbba2244b88666f8f6eac
Diffstat (limited to 'core/java/android/webkit/HTML5VideoViewProxy.java')
| -rw-r--r-- | core/java/android/webkit/HTML5VideoViewProxy.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java index eee80251fd5d..eda2e72af376 100644 --- a/core/java/android/webkit/HTML5VideoViewProxy.java +++ b/core/java/android/webkit/HTML5VideoViewProxy.java @@ -132,6 +132,7 @@ class HTML5VideoViewProxy extends Handler if (mVideoView.isPlaying()) { mVideoView.stopPlayback(); } + mCurrentProxy.dispatchOnEnded(); mCurrentProxy = null; mLayout.removeView(mVideoView); mVideoView = null; @@ -154,7 +155,7 @@ class HTML5VideoViewProxy extends Handler if (mCurrentProxy != null) { // Some other video is already playing. Notify the caller that its playback ended. - proxy.playbackEnded(); + proxy.dispatchOnEnded(); return; } @@ -245,7 +246,10 @@ class HTML5VideoViewProxy extends Handler // MediaPlayer.OnCompletionListener; public void onCompletion(MediaPlayer mp) { - playbackEnded(); + // The video ended by itself, so we need to + // send a message to the UI thread to dismiss + // the video view and to return to the WebView. + sendMessage(obtainMessage(ENDED)); } // MediaPlayer.OnErrorListener @@ -254,11 +258,9 @@ class HTML5VideoViewProxy extends Handler return false; } - public void playbackEnded() { + public void dispatchOnEnded() { Message msg = Message.obtain(mWebCoreHandler, ENDED); mWebCoreHandler.sendMessage(msg); - // also send a message to ourselves to return to the WebView - sendMessage(obtainMessage(ENDED)); } public void onTimeupdate() { |
