[webkit-changes] [WebKit/WebKit] d1ed61: Configure now playing media session to support ext...

rsfuller noreply at github.com
Fri Feb 21 16:16:11 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d1ed61f568c7dbcfca9b7f7f535618d03b6fa820
      https://github.com/WebKit/WebKit/commit/d1ed61f568c7dbcfca9b7f7f535618d03b6fa820
  Author: Ryan Fuller <ryanfuller at apple.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModel.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm
    M Source/WebCore/platform/ios/PlaybackSessionInterfaceIOS.h
    M Source/WebCore/platform/ios/PlaybackSessionInterfaceIOS.mm
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm
    M Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
    M Source/WebKit/Platform/ios/PlaybackSessionInterfaceLMK.mm
    M Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.h
    M Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaPlayer.swift
    M Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaTypes.swift
    M Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaPlayer.h
    M Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaTypes.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm
    M WebKitLibraries/SDKs/xros2.0-additions.sdk/System/Library/PrivateFrameworks/LinearMediaKit.framework/LinearMediaKit.tbd
    M WebKitLibraries/SDKs/xrsimulator2.0-additions.sdk/System/Library/PrivateFrameworks/LinearMediaKit.framework/LinearMediaKit.tbd

  Log Message:
  -----------
  Configure now playing media session to support external playback
https://bugs.webkit.org/show_bug.cgi?id=287684
rdar://137156850

Reviewed by Andy Estes.

Add a new visionOS WKWebView method to enable configuring the now playing media
session for external playback. This puts the visionOS media player into a
custom presentation (external) and returns the media player's view controller
to the caller who has the responsibility to present it. It also provides a method
to exit this external playback.

On entering presentation, it sets the playerIdentifier for the video element
which normally gets set as part of the fullscreen flow but we are bypassing that
route in this mode -- without this the media player will not be able to render.
It also puts LinearMediaPlayer in a new presentationState (.external) which
allows WebKit to configure the player as needed without affecting video playing
outside of this feature. Finally, it makes and returns the player view
controller.

On exiting presentation, it sets the state of linearMediaPlayer back to .inline
presentation and tears down the configuration. Importantly, it clears the video
receiver endpoint to allow the media session to render in its non-LMK
presentation.

While this mode is similar conceptually to fullscreen, it intentionally does not
latch onto the fullscreen element state, as it should be a separate mode and the
media element should not falsely believe it is in a fullscreen presentation.
While in external presentation, fullscreen mode is prevented from being entered.

Note: Remove LinearMediaPlayer's fullscreenSceneBehavior property until it is
able to be published (rdar://122435030).

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setPlayerIdentifierForVideoElement):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::setPlayerIdentifierForVideoElement):
* Source/WebCore/platform/cocoa/PlaybackSessionModel.h:
* Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h:
* Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::setPlayerIdentifierForVideoElement):
* Source/WebCore/platform/ios/PlaybackSessionInterfaceIOS.h:
* Source/WebCore/platform/ios/PlaybackSessionInterfaceIOS.mm:
(WebCore::PlaybackSessionInterfaceIOS::setVideoPresentationInterface):
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h:
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm:
(WebCore::VideoPresentationInterfaceIOS::VideoPresentationInterfaceIOS):
(WebCore::VideoPresentationInterfaceIOS::enterExternalPlayback):
(WebCore::VideoPresentationInterfaceIOS::exitExternalPlayback):
* Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm:
* Source/WebKit/Platform/ios/PlaybackSessionInterfaceLMK.mm:
(-[WKLinearMediaPlayerDelegate linearMediaPlayerClearVideoReceiverEndpoint:]):
(WebKit::PlaybackSessionInterfaceLMK::supportsLinearMediaPlayerChanged):
* Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.h:
* Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm:
(WebKit::VideoPresentationInterfaceLMK::enterExternalPlayback):
(WebKit::VideoPresentationInterfaceLMK::exitExternalPlayback):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _enterExternalPlaybackForNowPlayingMediaSessionWithCompletionHandler:]):
(-[WKWebView _exitExternalPlaybackWithCompletionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::setPlayerIdentifierForVideoElement):
(WebKit::PlaybackSessionManagerProxy::setPlayerIdentifierForVideoElement):
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::enterExternalPlaybackForNowPlayingMediaSession):
(WebKit::WebPageProxy::exitExternalPlayback):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setPlayerIdentifierForVideoElement):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaPlayer.swift:
(SwiftOnlyData.fullscreenSceneBehaviors):
(WKSLinearMediaPlayer.enterExternalPresentation(_:(any Error)?) -> Void:)):
(WKSLinearMediaPlayer.exitExternalPresentation(_:(any Error)?) -> Void:)):
(WKSLinearMediaPlayer.enterFullscreen(_:(any Error)?) -> Void:)):
(WKSLinearMediaPlayer.exitFullscreen(_:(any Error)?) -> Void:)):
(WKSLinearMediaPlayer.presentationStateChanged(_:)):
(WKSLinearMediaPlayer.fullscreenSceneBehaviorsPublisher):
(WKSLinearMediaPlayer.toggleInlineMode):
(WKSLinearMediaPlayer.willEnterFullscreen):
(WKSLinearMediaPlayer.willExitFullscreen):
* Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaTypes.swift:
(WKSLinearMediaPresentationState.description):
* Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaPlayer.h:
* Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaTypes.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setPlayerIdentifierForVideoElement):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h:
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in:
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::setPlayerIdentifierForVideoElement):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h:
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::VideoPresentationManager::setPlayerIdentifierForVideoElement):

Canonical link: https://commits.webkit.org/290837@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