Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 04e0a64601921fa8f768610f715769c44d3ad712
https://github.com/WebKit/WebKit/commit/04e0a64601921fa8f768610f715769c44d3ad712
Author: Youenn Fablet <[email protected]>
Date: 2024-02-28 (Wed, 28 Feb 2024)
Changed paths:
M Source/WebCore/Modules/mediasession/MediaSession.cpp
M Source/WebCore/Modules/mediasession/MediaSession.h
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/html/HTMLMediaElement.h
M Source/WebCore/html/MediaElementSession.cpp
M Source/WebCore/html/MediaElementSession.h
M Source/WebCore/platform/audio/PlatformMediaSession.cpp
M Source/WebCore/platform/audio/PlatformMediaSession.h
M Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
M Source/WebCore/platform/audio/PlatformMediaSessionManager.h
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
Log Message:
-----------
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
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes