[webkit-changes] [WebKit/WebKit] e6ac34: Pausing media playback after suspending media play...

danae404 noreply at github.com
Fri Aug 4 10:51:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e6ac3419306c15f2b830078c89afaf47ab1fde55
      https://github.com/WebKit/WebKit/commit/e6ac3419306c15f2b830078c89afaf47ab1fde55
  Author: destra <destra at apple.com>
  Date:   2023-08-04 (Fri, 04 Aug 2023)

  Changed paths:
    M Source/WebCore/platform/audio/PlatformMediaSession.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSuspendAllMediaPlayback.mm

  Log Message:
  -----------
  Pausing media playback after suspending media playback, and then later unsuspending media
playback should not unpause media that was playing before the original suspension
https://bugs.webkit.org/show_bug.cgi?id=259801
rdar://111917263

Reviewed by Eric Carlson.

Currently, if playing media is suspended, then a user pauses the media, when
playback is unsuspended the media begins playing again. However the desired behavior is for
the pause to be honored when media is unsuspended. This bug happens because when playback is
suspended, PlatformMediaSession::beginInterruption records the playback state to restore when
unsuspended in m_stateToRestore. But this data member is not updated if pausing occurs while
suspended.

Now, when playback is paused, PlatformMediaSession::pauseSession checks if playback is currently
interrupted (meaning it is suspended), and if so, sets m_stateToRestore to 'paused'.

1 API test added that checks that after doing suspend -> pause -> unsuspend, media that was playing
originally is now paused.

* Source/WebCore/platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::pauseSession):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSuspendAllMediaPlayback.mm:

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




More information about the webkit-changes mailing list