-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor MediaSessionManagerCocoa::nowPlayingEligibleSession to allow…
… non HTMLMediaElement eligible sessions https://bugs.webkit.org/show_bug.cgi?id=270090 rdar://123632916 Reviewed by Jean-Yves Avenard. We want to allow AudioContext to be used as media playback with AudioSession API. For that, it needs to be on par with HTMLMediaElement, and for instance trigger NowPlayingInfo updates. This patch is refactoring code to untie a bit HTMLMediaElement and NowPlayingInfo computation. It should not have any impact on behavior since this patch is not adding code to actually allow AudioContext to be handled like HTMLMediaElement (for instance pay/pause from the control center). We introduce MediaSession::updateNowPlayingInfo and NavigatorMediaSession::mediaSessionIfExists to allow updating NowPlayingInfo according MediaSession from either HTMLMediaElement or other media producers. We introduce getters for nowPlayingInfo and isNowPlayingEligible on PlatformMediaSession which are being forwarded to each client. We update HTMLMediaElement/MediaElementSession implementation accordingly. We introduce PlatformMediaSessionManager::bestEligibleSessionForRemoteControls to filter sessions according presentation types. We then get two lists of media sessions, one of web audio and one of media (HTMLMediaElement basically). If the HTMLMediaElement list is empty, we look at WebAudio sessions, otherwise we look at HTMLMediaElement sessions. We introduce selectBestMediaSession so that sorting is done by each session subtype. This allows to fix the layering violation from MediaSessionManagerCocoa::nowPlayingEligibleSession.: * Source/WebCore/Modules/mediasession/MediaSession.cpp: (WebCore::MediaSession::updateNowPlayingInfo): * Source/WebCore/Modules/mediasession/MediaSession.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::bestMediaElementForRemoteControls): (WebCore::HTMLMediaElement::nowPlayingInfo const): (WebCore::HTMLMediaElement::selectBestMediaSession): * Source/WebCore/html/HTMLMediaElement.h: * Source/WebCore/html/MediaElementSession.cpp: (WebCore::MediaElementSession::hasNowPlayingInfo const): (WebCore::MediaElementSession::computeNowPlayingInfo const): (WebCore::MediaElementSession::nowPlayingInfo const): Deleted. * Source/WebCore/html/MediaElementSession.h: * Source/WebCore/platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::nowPlayingInfo const): (WebCore::PlatformMediaSession::isNowPlayingEligible const): (WebCore::PlatformMediaSession::selectBestMediaSession): (WebCore::PlatformMediaSessionClient::nowPlayingInfo const): * Source/WebCore/platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSessionClient::isNowPlayingEligible const): (WebCore::PlatformMediaSessionClient::selectBestMediaSession): * Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::bestEligibleSessionForRemoteControls): * Source/WebCore/platform/audio/PlatformMediaSessionManager.h: * Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h: * Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::nowPlayingEligibleSession): (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Canonical link: https://commits.webkit.org/275460@main
- Loading branch information
Showing
12 changed files
with
121 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters