RESOLVED FIXED 192829
[WebKitLegacy] Media playback pauses on scroll
https://bugs.webkit.org/show_bug.cgi?id=192829
Summary [WebKitLegacy] Media playback pauses on scroll
Jer Noble
Reported 2018-12-18 13:58:58 PST
[WebKitLegacy] Media playback pauses on scroll
Attachments
Patch (36.38 KB, patch)
2018-12-18 14:02 PST, Jer Noble
no flags
Patch (38.73 KB, patch)
2018-12-18 14:52 PST, Jer Noble
no flags
Patch for landing (38.33 KB, patch)
2019-01-04 11:04 PST, Jer Noble
no flags
Jer Noble
Comment 1 2018-12-18 14:01:00 PST
Jer Noble
Comment 2 2018-12-18 14:02:00 PST
EWS Watchlist
Comment 3 2018-12-18 14:06:39 PST
Attachment 357610 [details] did not pass style-queue: ERROR: Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 21 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jer Noble
Comment 4 2018-12-18 14:52:46 PST
EWS Watchlist
Comment 5 2018-12-18 14:55:04 PST
Attachment 357615 [details] did not pass style-queue: ERROR: Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 24 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 6 2018-12-21 13:16:45 PST
Comment on attachment 357615 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=357615&action=review > Source/WebCore/dom/Document.cpp:1727 > + platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); Nit: you might as well update stopAllMediaPlaybackForDocument to take a Document reference. > Source/WebCore/html/HTMLMediaElement.cpp:834 > + INFO_LOG(LOGIDENTIFIER, "src = ", value); We shouldn't log urls in release builds. You can have this only log in a debug build by changing it to something like INFO_LOG(LOGIDENTIFIER, "src = ", URL { URL { }, value }); > Source/WebCore/page/Page.cpp:1738 > + for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { > + if (auto* document = frame->document()) > + document->suspendAllMediaPlayback(); > + } > + > + m_mediaPlaybackIsSuspended = true; Nit: it is probably slightly safer to set m_mediaPlaybackIsSuspended before suspending the documents, in case they do something that causes this to be called again.
Jer Noble
Comment 7 2018-12-21 13:32:33 PST
(In reply to Eric Carlson from comment #6) > Comment on attachment 357615 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=357615&action=review > > > Source/WebCore/dom/Document.cpp:1727 > > + platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); > > Nit: you might as well update stopAllMediaPlaybackForDocument to take a > Document reference. > > > Source/WebCore/html/HTMLMediaElement.cpp:834 > > + INFO_LOG(LOGIDENTIFIER, "src = ", value); > > We shouldn't log urls in release builds. You can have this only log in a > debug build by changing it to something like > > INFO_LOG(LOGIDENTIFIER, "src = ", URL { URL { }, value }); Yeah, this was a debugging statement that shouldn't have gone into this patch; I'll delete it. > > Source/WebCore/page/Page.cpp:1738 > > + for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { > > + if (auto* document = frame->document()) > > + document->suspendAllMediaPlayback(); > > + } > > + > > + m_mediaPlaybackIsSuspended = true; > > Nit: it is probably slightly safer to set m_mediaPlaybackIsSuspended before > suspending the documents, in case they do something that causes this to be > called again. No, it needs to happen afterwards, because pause() checks whether playback is allowed, which it won't be if playback is suspended.
Jer Noble
Comment 8 2019-01-04 11:04:22 PST
Created attachment 358337 [details] Patch for landing
EWS Watchlist
Comment 9 2019-01-04 11:07:32 PST
Attachment 358337 [details] did not pass style-queue: ERROR: Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 24 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 10 2019-01-04 14:23:24 PST
Comment on attachment 358337 [details] Patch for landing Clearing flags on attachment: 358337 Committed r239640: <https://trac.webkit.org/changeset/239640>
WebKit Commit Bot
Comment 11 2019-01-04 14:23:26 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 12 2019-01-05 10:43:50 PST
Comment on attachment 358337 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=358337&action=review > Source/WebCore/ChangeLog:15 > + Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause > + video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls > + suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior. What was the cause of the bug though?
Jer Noble
Comment 13 2019-01-07 09:22:30 PST
(In reply to Simon Fraser (smfr) from comment #12) > Comment on attachment 358337 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=358337&action=review > > > Source/WebCore/ChangeLog:15 > > + Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause > > + video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls > > + suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior. > > What was the cause of the bug though? WebKitLegacy uses suspendActiveDOMObjects(PageWillBeSuspended) during active scroll operations.
Aakash Jain
Comment 14 2019-02-28 07:33:55 PST
The ScrollingDoesNotPauseMedia API Test added in this patch seems to be failing consistently. It would be nice to fix that soon to keep the automation green/happy.
Note You need to log in before you can comment on or make changes to this bug.