Index: content/renderer/media/android/webmediaplayer_android.cc |
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc |
index 35e898e9bac8dba0ea903ec4571ad4eec8ade2cc..86a9a6b39177e20101b8d88ec54de30f1fdd207e 100644 |
--- a/content/renderer/media/android/webmediaplayer_android.cc |
+++ b/content/renderer/media/android/webmediaplayer_android.cc |
@@ -752,14 +752,15 @@ void WebMediaPlayerAndroid::OnMediaMetadataChanged( |
} |
void WebMediaPlayerAndroid::OnPlaybackComplete() { |
- // When playback is about to finish, android media player often stops |
- // at a time which is smaller than the duration. This makes webkit never |
- // know that the playback has finished. To solve this, we set the |
- // current time to media duration when OnPlaybackComplete() get called. |
interpolator_.SetBounds(duration_, duration_); |
- client_->timeChanged(); |
+ // If the duration in the metadata is not correct, then actual duration should |
+ // be updated in blink. |
+ if (duration() != currentTime()) |
+ OnDurationChanged(base::FromSecondsD(currentTime())); |
+ |
+ client_->mediaEnded(); |
- // if the loop attribute is set, timeChanged() will update the current time |
+ // If the 'loop' attribute is set, mediaEnded() will update the current time |
// to 0. It will perform a seek to 0. As the requests to the renderer |
// process are sequential, the OnSeekComplete() will only occur |
// once OnPlaybackComplete() is done. As the playback can only be executed |