|Summary:||HTML5 audio .ended event not fired when app in background or phone screen is off|
|Product:||WebKit||Reporter:||Judah Gabriel Himango <judahgabriel>|
|Component:||Media||Assignee:||Jer Noble <jer.noble>|
|Severity:||Major||CC:||beidson, calvaris, cdumez, commit-queue, craigwharding, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, jond, jonlee, mathiasrechtzigel, philipj, sergio, webkit-bug-importer|
|Hardware:||iPhone / iPad|
Description Judah Gabriel Himango 2017-06-13 14:48:26 PDT
Comment 2 Eric Carlson 2017-06-14 08:26:30 PDT
The web proces, normally suspended when in the background, is kept alive while playing audio (and for a few other reasons). The 'ended' event is fired asynchronously, so while the event is scheduled immediately when playback finishes, the task is suspended before the next runloop so the event doesn't fire until the process resumes. We should probably postpone suspension for a few cycles when playback stops to give scripts an opportunity to restart playback.
Comment 3 Judah Gabriel Himango 2017-06-14 09:53:29 PDT
>> "We should probably postpone suspension for a few cycles when playback stops to give scripts an opportunity to restart playback." Ah, that would wonderful and would fix the problem perfectly.
Comment 4 craigwharding 2017-08-11 04:29:31 PDT
Hi any idea when this could be committed and it starts to hit upstream?
Comment 5 Brady Eidson 2017-08-11 06:50:23 PDT
(In reply to craigwharding from comment #4) > Hi any idea when this could be committed and it starts to hit upstream? There's nothing to be committed because there's no patch yet. (This is an open source project)
Comment 6 Judah Gabriel Himango 2018-01-22 08:25:22 PST
This morning I received more reports of this same bug from my users on iOS. Any chance we get this fixed in 2018?
Comment 7 Mathias Rechtzigel 2019-01-18 10:45:15 PST
Confirmed still an issue.
Comment 8 Jer Noble 2019-11-13 12:53:01 PST
*** Bug 204080 has been marked as a duplicate of this bug. ***
Comment 10 Eric Carlson 2019-11-14 05:12:42 PST
Comment on attachment 383493 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383493&action=review r=me once the bots are happy > LayoutTests/media/audio-background-playback-playlist-expected.txt:2 > +RUN(internals.setMediaElementRestrictions(audio, "RequireUserGestureForAudioRateChange")) Oops, look like you need to regenerate this file. > LayoutTests/media/audio-background-playback-playlist.html:20 > + run('audio.load()'); > + testExpected('internals.bestMediaElementForShowingPlaybackControlsManager("NowPlaying")', audio); It would be better to test for NowPlaying status after a delay, e.g. after an 'emptied' event.
Comment 12 WebKit Commit Bot 2019-11-20 10:32:09 PST
Comment on attachment 383656 [details] Patch for landing Clearing flags on attachment: 383656 Committed r252692: <https://trac.webkit.org/changeset/252692>
Comment 13 WebKit Commit Bot 2019-11-20 10:32:11 PST
All reviewed patches have been landed. Closing bug.