Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 530993002: WebMediaPlayerImpl should notify ended event Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index f1a270cdece73a6f1201df876ebba5beab02f0df..05575c3ee96e357f9145d2c49c1ed5efa2b64651 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -3113,12 +3113,23 @@ void HTMLMediaElement::mediaPlayerTimeChanged()
// movie time.
scheduleTimeupdateEvent(false);
+ // TODO(amogh.bihani): Remove this once chromium change lands (codereview.chromium.org/533543004/).
double now = currentTime();
double dur = duration();
+ if (!std::isnan(dur) && dur && now >= dur && directionOfPlayback() == Forward)
+ mediaPlayerEnded();
+
+ updatePlayState();
+}
+
+void HTMLMediaElement::mediaPlayerEnded()
+{
+ WTF_LOG(Media, "HTMLMediaElement::mediaPlayerEnded");
+
// When the current playback position reaches the end of the media resource when the direction of
// playback is forwards, then the user agent must follow these steps:
- if (!std::isnan(dur) && dur && now >= dur && directionOfPlayback() == Forward) {
+ if (!std::isnan(duration()) && directionOfPlayback() == Forward) {
// If the media element has a loop attribute specified and does not have a current media controller,
if (loop() && !m_mediaController) {
m_sentEndEvent = false;
@@ -3142,9 +3153,9 @@ void HTMLMediaElement::mediaPlayerTimeChanged()
// for the media element's current media controller.
updateMediaController();
}
- }
- else
+ } else {
m_sentEndEvent = false;
+ }
updatePlayState();
}
@@ -3152,6 +3163,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged()
void HTMLMediaElement::mediaPlayerDurationChanged()
{
WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged(%p)", this);
+ refreshCachedTime();
// FIXME: Change MediaPlayerClient & WebMediaPlayer to convey
// the currentTime when the duration change occured. The current
// WebMediaPlayer implementations always clamp currentTime() to
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698