[webkit-changes] [WebKit/WebKit] 002319: [iOS] Control Center pause button does not work wh...

aestes noreply at github.com
Tue Oct 22 00:19:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0023194995639a5dd0bb0de13cc7ee2776dc16c6
      https://github.com/WebKit/WebKit/commit/0023194995639a5dd0bb0de13cc7ee2776dc16c6
  Author: Andy Estes <aestes at apple.com>
  Date:   2024-10-22 (Tue, 22 Oct 2024)

  Changed paths:
    M Source/WebCore/platform/cocoa/RemoteCommandListenerCocoa.h
    M Source/WebCore/platform/cocoa/RemoteCommandListenerCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaSession.mm

  Log Message:
  -----------
  [iOS] Control Center pause button does not work when playing videos on cnn.com
https://bugs.webkit.org/show_bug.cgi?id=281885
rdar://137242342

Reviewed by Eric Carlson.

When a website sets a MediaSession action handler, WebKit unregisters its default set of
MediaRemote commands (which includes play and pause commands) and registers for only the commands
that correspond to action handlers set by the website. If a website sets action handlers not
including "play" and "pause" actions then Control Center on iOS continues to show a play/pause
button, but it's non-functional since WebKit has not registered support for -- and therefore is not
delivered -- its corresponding remote commands.

The MediaSession spec [1] says the following in 3.4:
>It is RECOMMENDED for user agents to implement a default handler for the play and pause media
>session actions if none was provided for the active media session.

This change adopts this recommendation by ensuring that when a website sets MediaSession action
handlers, play and pause commmands are registered with MediaRemote at a minimum. If the website did
not set action handlers for these commands then the default action is performed (i.e. play() or
pause() is called on the media element).

Added an API test.

[1] https://w3c.github.io/mediasession/#actions-model

* Source/WebCore/platform/cocoa/RemoteCommandListenerCocoa.h:
* Source/WebCore/platform/cocoa/RemoteCommandListenerCocoa.mm:
(WebCore::defaultCommands):
(WebCore::minimalCommands):
(WebCore::RemoteCommandListenerCocoa::updateSupportedCommands):
(WebCore::RemoteCommandListenerCocoa::defaultCommands): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaSession.mm:
(TestWebKitAPI::MediaSessionTest::webViewPid):
(TestWebKitAPI::TEST_F(MediaSessionTest, MinimalCommands)):

Canonical link: https://commits.webkit.org/285546@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list