[webkit-changes] [WebKit/WebKit] f4af2e: [visionOS] YouTube audio in background tab stops a...

Aditya Keerthi noreply at github.com
Mon Sep 4 18:24:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f4af2e26b34ee49fd74408a08dcc41e519eec23a
      https://github.com/WebKit/WebKit/commit/f4af2e26b34ee49fd74408a08dcc41e519eec23a
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-09-04 (Mon, 04 Sep 2023)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h

  Log Message:
  -----------
  [visionOS] YouTube audio in background tab stops after looking away from Safari for one minute
https://bugs.webkit.org/show_bug.cgi?id=261050
rdar://113459873

Reviewed by Tim Horton.

On visionOS, scenes are backgrounded after they are out of the user's field of
view for one minute. This is similar to iPadOS, where the device is locked when
looking away from the screen for two minutes (configurable via Settings).
However, unlike iPadOS, visionOS has no device-level idle state, as the display
is always on when the device is in use, and always off when it is not.

The only way to prevent the aforementioned scene backgrounding is to disable
the application-level idle timer. This timer is currently only disabled when the
document containing a playing media element is visible. If the media element is
playing and in a hidden document (as is the case in a background tab), a system
sleep assertion is taken instead. This assertion has no meaning as there is no
"user-idle" state while the device is in use. Consequently, the idle timer is
active, the scene gets backgrounded after one minute, and playback is paused
by WebKit as the notification is received.

To fix, ensure the idle timer remains disabled when media is playing in a
hidden document.

* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldDisableSleep const):
* Source/WebCore/html/HTMLMediaElement.h:

Drive-by: Specify the smallest underlying type for the `SleepType` enum class.
Canonical link: https://commits.webkit.org/267615@main




More information about the webkit-changes mailing list