Bug 150348 - Media "ended" event incorrectly fires when currentTime is set
Summary: Media "ended" event incorrectly fires when currentTime is set
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: All Other
: P2 Major
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-10-19 17:31 PDT by Andrew Leung
Modified: 2016-01-25 09:55 PST (History)
6 users (show)

See Also:


Attachments
Sample HTML page with an externally-linked audio file to demonstrate the bug (631 bytes, text/html)
2015-10-19 17:31 PDT, Andrew Leung
no flags Details
Proposed patch. (4.73 KB, patch)
2016-01-25 08:04 PST, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Leung 2015-10-19 17:31:07 PDT
Created attachment 263535 [details]
Sample HTML page with an externally-linked audio file to demonstrate the bug

The Media "ended" 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 "ended" 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
Comment 1 Radar WebKit Bug Importer 2016-01-19 15:49:18 PST
<rdar://problem/24247974>
Comment 2 Eric Carlson 2016-01-25 08:04:21 PST
Created attachment 269751 [details]
Proposed patch.
Comment 3 WebKit Commit Bot 2016-01-25 09:55:26 PST
Comment on attachment 269751 [details]
Proposed patch.

Clearing flags on attachment: 269751

Committed r195540: <http://trac.webkit.org/changeset/195540>
Comment 4 WebKit Commit Bot 2016-01-25 09:55:31 PST
All reviewed patches have been landed.  Closing bug.