Skip to content

Commit

Permalink
Cherry-pick 4abab8a. rdar://123284989
Browse files Browse the repository at this point in the history
    [visionOS] Enable Linear Media Player at build time and runtime
    https://bugs.webkit.org/show_bug.cgi?id=269767
    rdar://123284989

    Reviewed by Wenson Hsieh.

    Set ENABLE_LINEAR_MEDIA_PLAYER to 1 and enabled the LinearMediaPlayerEnabled runtime setting by
    default.

    While here, fixed an issue where the wrong mach port was specified in the GPU process seatbelt
    profile for using FigVideoTarget rendering and adjusted the imports of WebKitSwift headers to avoid
    creating a circular dependency in the Xcode build system.

    * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
    * Source/WTF/wtf/PlatformEnable.h:
    * Source/WebKit/Platform/ios/PlaybackSessionInterfaceLMK.mm:
    * Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm:
    * Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb.in:
    * Source/WebKit/WebKit.xcodeproj/project.pbxproj:
    * Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaPlayer.h:
    * Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaTypes.h:

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

Identifier: 274471.474@safari-7619.1.5-branch
  • Loading branch information
aestes authored and Dan Robson committed Feb 20, 2024
1 parent 5d73ee5 commit e2cd4b5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3979,7 +3979,7 @@ LegacyOverflowScrollingTouchEnabled:

LinearMediaPlayerEnabled:
type: bool
status: unstable
status: internal
category: media
humanReadableName: "Linear Media Player"
humanReadableDescription: "Enable LinearMediaPlayer for fullscreen video"
Expand All @@ -3988,7 +3988,7 @@ LinearMediaPlayerEnabled:
WebKitLegacy:
default: false
WebKit:
default: false
default: true
WebCore:
default: false

Expand Down
3 changes: 1 addition & 2 deletions Source/WTF/wtf/PlatformEnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,9 @@
#define ENABLE_EXTENSION_CAPABILITIES 1
#endif

// FIXME: Re-enable once rdar://122200702 is resolved.
#if !defined(ENABLE_LINEAR_MEDIA_PLAYER) \
&& USE(LINEARMEDIAKIT)
#define ENABLE_LINEAR_MEDIA_PLAYER 0
#define ENABLE_LINEAR_MEDIA_PLAYER 1
#endif

#if !defined(ENABLE_WRITING_SUGGESTIONS) \
Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/Platform/ios/PlaybackSessionInterfaceLMK.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@

#if ENABLE(LINEAR_MEDIA_PLAYER)

#import "WKSLinearMediaPlayer.h"
#import "WKSLinearMediaTypes.h"
#import <WebCore/MediaSelectionOption.h>
#import <WebCore/PlaybackSessionModel.h>
#import <WebCore/TimeRanges.h>
#import <WebKitSwift/WebKitSwift.h>
#import <wtf/OSObjectPtr.h>
#import <wtf/WeakPtr.h>

Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
#if ENABLE(LINEAR_MEDIA_PLAYER)

#import "PlaybackSessionInterfaceLMK.h"
#import "WKSLinearMediaPlayer.h"
#import "WKSLinearMediaTypes.h"
#import <UIKit/UIKit.h>
#import <WebCore/WebAVPlayerLayerView.h>
#import <WebKitSwift/WebKitSwift.h>
#import <pal/spi/vision/LinearMediaKitSPI.h>

namespace WebKit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
(global-name "com.apple.coremedia.capturesource") ; Also for video capture (<rdar://problem/15794291>).
(global-name "com.apple.coremedia.cpe.xpc") ; Needed for HDR playback.
#if ENABLE(LINEAR_MEDIA_PLAYER)
(global-name "com.apple.coremedia.videotarget.xpc") ; Needed for FigVideoTarget
(global-name "com.apple.coremedia.mediaplaybackd.videotarget.xpc") ; Needed for FigVideoTarget
#endif
(global-name "com.apple.coremedia.remotequeue"))
(allow mach-lookup
Expand Down
4 changes: 4 additions & 0 deletions Source/WebKit/WebKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,8 @@
A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */; };
A183494224EF467800BDC9A8 /* SharedBufferReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC5DB9121488E16006CB8A8 /* SharedBufferReference.h */; };
A188D2E52B6B0F4E00E65A08 /* WKVisibilityPropagationView.h in Headers */ = {isa = PBXBuildFile; fileRef = A188D2E22B6B0F4E00E65A08 /* WKVisibilityPropagationView.h */; };
A192C25B2B844600004B8B20 /* WKSLinearMediaPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = A14F9B742B68CA6B00AD9C56 /* WKSLinearMediaPlayer.h */; };
A192C25C2B844A31004B8B20 /* WKSLinearMediaTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A14F9B612B686DD200AD9C56 /* WKSLinearMediaTypes.h */; };
A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A19DD3BF1D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h */; };
A1A4FE5A18DCE9FA00B5EA8A /* _WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A4FE5C18DCE9FA00B5EA8A /* _WKDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */; };
Expand Down Expand Up @@ -17206,6 +17208,8 @@
BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */,
1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */,
513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */,
A192C25B2B844600004B8B20 /* WKSLinearMediaPlayer.h in Headers */,
A192C25C2B844A31004B8B20 /* WKSLinearMediaTypes.h in Headers */,
93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */,
DF7A231C291B088D00B98DF3 /* WKSnapshotConfigurationPrivate.h in Headers */,
57FD318722B35170008D0E8B /* WKSOAuthorizationDelegate.h in Headers */,
Expand Down
15 changes: 14 additions & 1 deletion Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,25 @@
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION

#import <UIKit/UIKit.h>
#import <WebKitSwift/WKSLinearMediaTypes.h>

NS_ASSUME_NONNULL_BEGIN

@class LMPlayableViewController;
@class WKSLinearMediaPlayer;
@class WKSLinearMediaTimeRange;
@class WKSLinearMediaTrack;

typedef NS_ENUM(NSInteger, WKSLinearMediaContentMode);
typedef NS_ENUM(NSInteger, WKSLinearMediaContentType);
typedef NS_ENUM(NSInteger, WKSLinearMediaPresentationMode);
typedef NS_ENUM(NSInteger, WKSLinearMediaViewingMode);

typedef NS_OPTIONS(NSInteger, WKSLinearMediaFullscreenBehaviors) {
WKSLinearMediaFullscreenBehaviorsSceneResize = 1 << 0,
WKSLinearMediaFullscreenBehaviorsSceneSizeRestrictions = 1 << 1,
WKSLinearMediaFullscreenBehaviorsSceneChromeOptions = 1 << 2,
WKSLinearMediaFullscreenBehaviorsHostContentInline = 1 << 3,
};

API_AVAILABLE(visionos(1.0))
@protocol WKSLinearMediaPlayerDelegate <NSObject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ typedef NS_ENUM(NSInteger, WKSLinearMediaViewingMode) {
WKSLinearMediaViewingModeSpatial
};

typedef NS_OPTIONS(NSInteger, WKSLinearMediaFullscreenBehaviors) {
WKSLinearMediaFullscreenBehaviorsSceneResize = 1 << 0,
WKSLinearMediaFullscreenBehaviorsSceneSizeRestrictions = 1 << 1,
WKSLinearMediaFullscreenBehaviorsSceneChromeOptions = 1 << 2,
WKSLinearMediaFullscreenBehaviorsHostContentInline = 1 << 3,
};

API_AVAILABLE(visionos(1.0))
@interface WKSLinearMediaTimeRange : NSObject
+ (instancetype)new NS_UNAVAILABLE;
Expand Down

0 comments on commit e2cd4b5

Please sign in to comment.