<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - CurrentTime on mediaController is set as 0 when playback is completed."
   href="https://bugs.webkit.org/show_bug.cgi?id=149154#c11">Comment # 11</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - CurrentTime on mediaController is set as 0 when playback is completed."
   href="https://bugs.webkit.org/show_bug.cgi?id=149154">bug 149154</a>
              from <span class="vcard"><a class="email" href="mailto:sangdeug.kim&#64;samsung.com" title="sangdeug &lt;sangdeug.kim&#64;samsung.com&gt;"> <span class="fn">sangdeug</span></a>
</span></b>
        <pre>Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=261294&amp;action=diff" name="attach_261294" title="Patch">attachment 261294</a> <a href="attachment.cgi?id=261294&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=261294&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=261294&amp;action=review</a>

<span class="quote">&gt;&gt;&gt;&gt; Source/WebCore/html/MediaController.cpp:458
&gt;&gt;&gt;&gt;          break;
&gt;&gt;&gt; 
&gt;&gt;&gt; Instead of adding a new instance variable to track state, can you just set current time to 0 when playback state changes from ENDED to PLAYING?
&gt;&gt;&gt; 
&gt;&gt;&gt;     case PLAYING:
&gt;&gt;&gt;         if (oldReadyState == ENDED)
&gt;&gt;&gt;             m_clock-&gt;setCurrentTime(0);
&gt;&gt;&gt;         eventName = eventNames().playingEvent;
&gt;&gt;&gt;         m_clock-&gt;start();
&gt;&gt;&gt;         startTimeupdateTimer();
&gt;&gt;&gt;         break;
&gt;&gt; 
&gt;&gt; I tried to using oldPlaybackState but during my test, sometimes I observed that the WAITING event is comming between ENDED and PLAYING. 
&gt;&gt; 
&gt;&gt; e.g) 
&gt;&gt; ENDED -&gt; PLAYING
&gt;&gt; ENDED -&gt; WAITING -&gt; PLAYING
&gt;&gt; 
&gt;&gt; To cover both case, I added a new variable to track state.
&gt; 
&gt; OK. In any case, you should handle this in the switch statement:
&gt; 
&gt;     case PLAYING:
&gt;         if (m_resetCurrentTimeInNextPlay)
&gt;             m_clock-&gt;setCurrentTime(0);
&gt;         m_resetCurrentTimeInNextPlay = false;
&gt;         eventName = eventNames().playingEvent;
&gt;         m_clock-&gt;start();
&gt;         startTimeupdateTimer();
&gt;         break;</span >

Done.

<span class="quote">&gt;&gt;&gt;&gt; Source/WebCore/html/MediaController.h:157
&gt;&gt;&gt;&gt; +    bool m_resetCurrentTimeInNextPlay;
&gt;&gt;&gt; 
&gt;&gt;&gt; For new code, we should initialize in the header:
&gt;&gt;&gt; 
&gt;&gt;&gt;     bool m_resetCurrentTimeInNextPlay { false };
&gt;&gt; 
&gt;&gt; It's initialized in constructor, do I need initialize in head also?
&gt; 
&gt; For new code, the WebKit style is initialize in the header instead of in the constructor.</span >

Done.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>