Bug 206661 - HTMLMediaElement should not remove the media session at DOM suspension time
Summary: HTMLMediaElement should not remove the media session at DOM suspension time
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
: 206760 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-01-23 06:56 PST by youenn fablet
Modified: 2020-01-27 23:05 PST (History)
15 users (show)

See Also:


Attachments
Patch (11.55 KB, patch)
2020-01-23 07:04 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (11.48 KB, patch)
2020-01-23 23:39 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (13.90 KB, patch)
2020-01-24 08:50 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2020-01-23 06:56:33 PST
HTMLMediaElement should not remove the media session at DOM suspension time
Comment 1 youenn fablet 2020-01-23 06:56:43 PST
<rdar://problem/58800787>
Comment 2 youenn fablet 2020-01-23 07:04:24 PST
Created attachment 388539 [details]
Patch
Comment 3 Eric Carlson 2020-01-23 08:01:22 PST
Comment on attachment 388539 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388539&action=review

> Source/WebCore/ChangeLog:16
> +        Partially revert the behavior by calling the same code as clientWiillPausePlayback but make sure updateNowPlayingInfo is calling asynchronously when suspending the media element.

s/clientWiillPausePlayback/clientWillPausePlayback/

Also, this line is really long.

> Source/WebCore/html/HTMLMediaElement.cpp:2331
> +        queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this] {

Why not TaskSource::MediaElement?

> Source/WebCore/platform/audio/PlatformMediaSession.cpp:253
> +    bool shouldDelayCallingUpdateNowPlaying = false;
> +    return processClientWillPausePlayback(shouldDelayCallingUpdateNowPlaying);
> +}
> +
> +void PlatformMediaSession::clientWillBeDOMSuspended()
> +{
> +    bool shouldDelayCallingUpdateNowPlaying = true;
> +    processClientWillPausePlayback(shouldDelayCallingUpdateNowPlaying);

Why not pass a PlatformMediaSessionManager::DelayCallingUpdateNowPlaying instead of a bool? Or maybe define the enum in this class and use it in PlatformMediaSessionManager
Comment 4 youenn fablet 2020-01-23 23:39:04 PST
Created attachment 388656 [details]
Patch
Comment 5 youenn fablet 2020-01-24 08:50:00 PST
Created attachment 388699 [details]
Patch
Comment 6 youenn fablet 2020-01-24 08:51:47 PST
Thanks for the review Eric, I took it all!
As of iOS failure, this is due to the test simulating scrolling but waiting for an event while scrolling.
Given scrolling is suspending DOM objects, events cannot really happen during that time. I updated the test accordingly.
Comment 7 WebKit Commit Bot 2020-01-25 04:27:44 PST
Comment on attachment 388699 [details]
Patch

Clearing flags on attachment: 388699

Committed r255116: <https://trac.webkit.org/changeset/255116>
Comment 8 WebKit Commit Bot 2020-01-25 04:27:46 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Alexey Proskuryakov 2020-01-27 23:05:38 PST
*** Bug 206760 has been marked as a duplicate of this bug. ***