<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Media &quot;ended&quot; event incorrectly fires when currentTime is set"
   href="https://bugs.webkit.org/show_bug.cgi?id=150348">150348</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Media &quot;ended&quot; event incorrectly fires when currentTime is set
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Major
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>HTML Events
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>andrewleung&#64;sfu.ca
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=263535" name="attach_263535" title="Sample HTML page with an externally-linked audio file to demonstrate the bug">attachment 263535</a> <a href="attachment.cgi?id=263535&amp;action=edit" title="Sample HTML page with an externally-linked audio file to demonstrate the bug">[details]</a></span>
Sample HTML page with an externally-linked audio file to demonstrate the bug

The Media &quot;ended&quot; event appears to fire incorrectly when the currentTime property is altered after the media has ended playback. When that happens, the event does not fire properly again until after the playback ends a second time. I attached a sample HTML file to demonstrate the issue.

Steps to reproduce:

1. On a page that has a video/audio element, attach an &quot;ended&quot; event listener
2. In the event handler, alert a message
3. In the event handler, sets the currentTime property to 0
4. Play the video/audio until it ends
5. Play the video/audio a second time until it ends

Expected results:

The message should be alerted only once every time the playback ends.

Actual results:

The message gets alerted twice at the end of the first playback. The message does not get alerted at all at the end of the second playback.

Tested browsers:

Safari 8.0.8 on OS X 10.10.5   -- NOT affected
Safari 9.0 on OS X 10.10.5     -- affected
Safari 9.0 on OS X 10.11       -- affected
WebKit r191315 on OS X 10.10.5 -- affected
MobileSafari on iOS 8.4.1      -- NOT affected
MobileSafari on iOS 9.0.2      -- affected</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>