Bug 233257

Summary: Safari intermittently stopping playing Spotify Web Player (currentTime goes backwards)
Product: WebKit Reporter: Sam Sneddon [:gsnedders] <gsnedders>
Component: MediaAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://open.spotify.com/
See Also: https://bugs.webkit.org/show_bug.cgi?id=221413
Attachments:
Description Flags
Patch none

Description Sam Sneddon [:gsnedders] 2021-11-17 08:20:46 PST
Every so often, it appears that HTMLVideoElement plays beyond the end of the duration (i.e., media.currentTime > media.duration), and there appears to be some case where the currentTime can move _backwards_ while playing in that state.

Specifically, looking at timeupdate events:

[Log] currentTime: 197.2047248660011, duration: 197.09333333333333, lastTimeUpdatePosition: 196.95360709999474 (vendor~web-player.526a81f5.js, line 1)
[Log] currentTime: 197.09790954431364, duration: 197.09333333333333, lastTimeUpdatePosition: 197.20374170400382 (vendor~web-player.526a81f5.js, line 1)

(lastTimeUpdatePosition is from their own JS, but updated for each event, currentTime and duration are from the HTMLVideoElement)

Ultimately, this causes their JS to throw an exception (because, except when seeking or changing track, they assume currentTime will always progress forwards), causing playback to stop.
Comment 1 Radar WebKit Bug Importer 2021-11-17 08:21:02 PST
<rdar://problem/85504967>
Comment 2 Jer Noble 2021-11-17 08:44:27 PST
Likely a bug in our currentTime heuristic, where we allow currentTime > duration.
Comment 3 Jer Noble 2021-12-14 10:09:32 PST
*** Bug 234302 has been marked as a duplicate of this bug. ***
Comment 4 Jer Noble 2021-12-14 10:10:59 PST
Created attachment 447140 [details]
Patch
Comment 5 EWS 2021-12-14 14:37:30 PST
Committed r287050 (245247@main): <https://commits.webkit.org/245247@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447140 [details].