 Chromium Code Reviews
 Chromium Code Reviews Issue 530993002:
  WebMediaPlayerImpl should notify ended event 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 530993002:
  WebMediaPlayerImpl should notify ended event 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/html/HTMLMediaElement.cpp | 
| diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp | 
| index 2a8bc6b446321e6740ccabdf0c2f7afa8509fcaa..266c59fc054c917de2a6e16900ceb079b4b383a8 100644 | 
| --- a/Source/core/html/HTMLMediaElement.cpp | 
| +++ b/Source/core/html/HTMLMediaElement.cpp | 
| @@ -3073,12 +3073,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) | 
| 
philipj_slow
2014/09/10 13:11:08
This is also temporary, to be removed after codere
 
amogh.bihani
2014/09/10 13:39:22
Yes.
 | 
| + mediaPlayerEnded(); | 
| + | 
| + updatePlayState(); | 
| +} | 
| + | 
| +void HTMLMediaElement::mediaPlayerEnded() | 
| 
philipj_slow
2014/09/10 13:24:35
Do you intend to clamp duration to currentTime som
 
amogh.bihani
2014/09/10 13:39:22
I am planning to clamp it in webmediaplayer_impl s
 | 
| +{ | 
| + WTF_LOG(Media, "HTMLMediaElement::mediaPlayerEnded"); | 
| 
philipj_slow
2014/09/10 13:11:08
There was a recent patch to add the this pointer t
 
amogh.bihani
2014/09/10 13:39:22
Acknowledged.
 | 
| + | 
| // 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; | 
| @@ -3102,9 +3113,9 @@ void HTMLMediaElement::mediaPlayerTimeChanged() | 
| // for the media element's current media controller. | 
| updateMediaController(); | 
| } | 
| - } | 
| - else | 
| + } else { | 
| m_sentEndEvent = false; | 
| + } | 
| updatePlayState(); | 
| } | 
| @@ -3112,6 +3123,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged() | 
| void HTMLMediaElement::mediaPlayerDurationChanged() | 
| { | 
| WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged(%p)", this); | 
| + refreshCachedTime(); | 
| 
philipj_slow
2014/09/10 13:11:08
This looks correct, but is it related to the other
 
amogh.bihani
2014/09/10 13:39:22
It is related to the changes done in chromium side
 | 
| // FIXME: Change MediaPlayerClient & WebMediaPlayer to convey | 
| // the currentTime when the duration change occured. The current | 
| // WebMediaPlayer implementations always clamp currentTime() to |