Bug 223795 - Now Playing content isn't updated when media session's Metadata is modified
Summary: Now Playing content isn't updated when media session's Metadata is modified
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks: 223731
  Show dependency treegraph
 
Reported: 2021-03-26 05:49 PDT by Jean-Yves Avenard [:jya]
Modified: 2021-03-30 07:12 PDT (History)
11 users (show)

See Also:


Attachments
Patch (13.65 KB, patch)
2021-03-26 06:17 PDT, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (18.23 KB, patch)
2021-03-26 06:42 PDT, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (18.14 KB, patch)
2021-03-26 06:48 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff
Patch (18.24 KB, patch)
2021-03-28 20:53 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff
Patch (20.11 KB, patch)
2021-03-29 19:19 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2021-03-26 05:49:56 PDT
Currently the Now Playing content is updated when the PlatformMediaSessionManager (MediaSessionManagerCocoa) requests from the PlatformMediaSession (MediaElementSession).

The PlatformMediaSession will retrieve the Media Session metadata and then pass it on.

When the Media Session metadata gets updated (like after retrieving the image data), for the PlatformMediaSessionManager to refresh the Now Playing content, the user must interact with the media element (such as seeking, changing the focus of the window, pausing the video etc).

If no such interaction is to occur, then the Now Playing will show stale data.

We need to notify the PlatformMediaSession that the Metadata got updated and refresh the Now Playing content.

Bug 222158 introduced a mechanism to set observer of the Metadata content. We will use it to fix this bug.
Comment 1 Radar WebKit Bug Importer 2021-03-26 05:50:04 PDT
<rdar://problem/75883478>
Comment 2 Jean-Yves Avenard [:jya] 2021-03-26 05:52:12 PDT
Additionally, by implementing the Media Session observer it will allow to set default action when a Media Session handler isn't defined.
Comment 3 Jean-Yves Avenard [:jya] 2021-03-26 06:17:55 PDT
Created attachment 424345 [details]
Patch
Comment 4 Jean-Yves Avenard [:jya] 2021-03-26 06:42:20 PDT
Created attachment 424346 [details]
Patch
Comment 5 Jean-Yves Avenard [:jya] 2021-03-26 06:44:57 PDT
Issue with forward declaration and Optional, changing method prototype to use reference instead
Comment 6 Jean-Yves Avenard [:jya] 2021-03-26 06:48:16 PDT
Created attachment 424347 [details]
Patch

Fix unresolved symbol on TVOS
Comment 7 Eric Carlson 2021-03-28 16:55:39 PDT
Comment on attachment 424345 [details]
Patch

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

> Source/WebCore/html/MediaElementSession.cpp:213
> +        session->removeObserver(*m_observer);

You could give MediaSessionObserver a pointer to the media session and have it call add/removeObserver automatically
Comment 8 Jean-Yves Avenard [:jya] 2021-03-28 20:53:11 PDT
Created attachment 424521 [details]
Patch
Comment 9 Eric Carlson 2021-03-29 15:03:50 PDT
Comment on attachment 424521 [details]
Patch

I'm afraid this will need to be rebased.
Comment 10 Jean-Yves Avenard [:jya] 2021-03-29 19:19:49 PDT
Created attachment 424611 [details]
Patch

rebase
Comment 11 Jean-Yves Avenard [:jya] 2021-03-29 22:36:38 PDT
Comment on attachment 424611 [details]
Patch

unrelated iPhoto.Framework failure.
Comment 12 EWS 2021-03-30 07:12:12 PDT
Committed r275203: <https://commits.webkit.org/r275203>

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