diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 447fdaf4da..6c712977e6 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13021,8 +13021,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 156.0.0; + branch = daniel/duckplayer.pip.subfeature; + kind = branch; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7f1e18672c..d1aa3f5ef9 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "e9e239fe5dfeab87dcacbf5a31c8f555623a4ce2", - "version" : "156.0.0" + "branch" : "daniel/duckplayer.pip.subfeature", + "revision" : "dfac22c6048b3d0cdda799b1b6e7b6919f24b686" } }, { diff --git a/DuckDuckGo/YoutubePlayer/DuckPlayer.swift b/DuckDuckGo/YoutubePlayer/DuckPlayer.swift index b6d24743d3..3996a64106 100644 --- a/DuckDuckGo/YoutubePlayer/DuckPlayer.swift +++ b/DuckDuckGo/YoutubePlayer/DuckPlayer.swift @@ -115,6 +115,7 @@ final class DuckPlayer { ) { self.preferences = preferences isFeatureEnabled = privacyConfigurationManager.privacyConfig.isEnabled(featureKey: .duckPlayer) + isPiPFeatureEnabled = privacyConfigurationManager.privacyConfig.isSubfeatureEnabled(DuckPlayerSubfeature.pip) mode = preferences.duckPlayerMode bindDuckPlayerModeIfNeeded() @@ -202,7 +203,14 @@ final class DuckPlayer { @MainActor private func encodedSettings(with webView: WKWebView?) async -> InitialSetupSettings { - let isPiPEnabled = webView?.configuration.allowsPictureInPictureMediaPlayback == true + var isPiPEnabled = webView?.configuration.allowsPictureInPictureMediaPlayback == true + + // Disable WebView PiP if if the subFeature is off + if !isPiPFeatureEnabled { + webView?.configuration.allowsPictureInPictureMediaPlayback = false + isPiPEnabled = false + } + let pip = InitialSetupSettings.PIP(status: isPiPEnabled ? .enabled : .disabled) let playerSettings = InitialSetupSettings.PlayerSettings(pip: pip) @@ -223,6 +231,7 @@ final class DuckPlayer { } private var modeCancellable: AnyCancellable? private var isFeatureEnabledCancellable: AnyCancellable? + private var isPiPFeatureEnabled: Bool private func bindDuckPlayerModeIfNeeded() { if isFeatureEnabled {