forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
34 changed files
with
324 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.