[webkit-changes] [WebKit/WebKit] c320bb: [Cocoa] Slack.com audible notifications interrupt ...

Jer Noble noreply at github.com
Mon Oct 30 09:33:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c320bb08e139b6a698594f0320827767771259fd
      https://github.com/WebKit/WebKit/commit/c320bb08e139b6a698594f0320827767771259fd
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-10-30 (Mon, 30 Oct 2023)

  Changed paths:
    M LayoutTests/media/audio-background-playback-playlist-expected.txt
    M LayoutTests/media/audio-background-playback-playlist.html
    A LayoutTests/media/content/short.mp3
    A LayoutTests/media/ios/short-audio-now-playing-expected.txt
    A LayoutTests/media/ios/short-audio-now-playing.html
    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/cocoa/MediaSessionManagerCocoa.mm

  Log Message:
  -----------
  [Cocoa] Slack.com audible notifications interrupt Music.app and steal NowPlaying status
https://bugs.webkit.org/show_bug.cgi?id=263750
rdar://114667001

Reviewed by Eric Carlson.

Many sites use short-duration audio sources via the <audio> element as
"alert" sounds. When these sounds are played, they are categorized by
existing heuristics as MediaPlayback, and will cause the application to
request NowPlayingApplication status. This breaks playback in other media
playing applications on the system, and prevents hardware playback buttons
from resuming playback from the original application after the interruption.

Add a heuristic for "short duration audio playback" defined by "audio with
a duration of less-than-or-equal-to the AOL youvegotmail.mp3 sound".

* LayoutTests/media/ios/short-audio-now-playing-expected.txt: Added.
* LayoutTests/media/ios/short-audio-now-playing.html: Added.
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::mediaElementSessionInfoForSession):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::mediaSessionDuration const):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager const):
(WebCore::isElementLargeEnoughForMainContent):
(WebCore::isElementLongEnoughForMainContent):
* Source/WebCore/html/MediaElementSession.h:
* Source/WebCore/platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::isEnded const):
(WebCore::PlatformMediaSession::duration const):
(WebCore::PlatformMediaSessionClient::mediaSessionDuration const):
* Source/WebCore/platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSessionClient::isSuspended const):
(WebCore::PlatformMediaSessionClient::isPlaying const):
(WebCore::PlatformMediaSessionClient::isAudible const):
(WebCore::PlatformMediaSessionClient::isEnded const):
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::sessionWillEndPlayback):

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




More information about the webkit-changes mailing list