Skip to content

Fix PiP UI issues on iOS 26 #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct SimpleCallingView: View {

private func setAudioSessionPolicyOverride(for callId: String) async throws {
let call = streamVideo.call(callType: callType, callId: callId)
try await call.updateAudioSessionPolicy(AppEnvironment.audioSessionPolicy.value)
await call.updateAudioSessionPolicy(AppEnvironment.audioSessionPolicy.value)
}

private func setProximityPolicies(for callId: String) throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public struct ConnectionQualityIndicator: View {

private var size: CGFloat = 28
private var width: CGFloat = 3
private var paddingsConfig: PaddingsConfig

/// The connection quality represented by this indicator.
var connectionQuality: ConnectionQuality
Expand All @@ -20,14 +21,16 @@ public struct ConnectionQualityIndicator: View {
/// - connectionQuality: The connection quality to be represented.
/// - size: The size of the indicator view.
/// - width: The width of each segment in the indicator.
public init(
@MainActor public init(
connectionQuality: ConnectionQuality,
size: CGFloat = 28,
width: CGFloat = 3
width: CGFloat = 3,
paddingsConfig: PaddingsConfig = PaddingsConfig()
) {
self.connectionQuality = connectionQuality
self.size = size
self.width = width
self.paddingsConfig = paddingsConfig
}

public var body: some View {
Expand All @@ -41,6 +44,10 @@ public struct ConnectionQualityIndicator: View {
}
}
.frame(width: size, height: size)
.padding(.leading, paddingsConfig.leading)
.padding(.trailing, paddingsConfig.trailing)
.padding(.top, paddingsConfig.top)
.padding(.bottom, paddingsConfig.bottom)
.cornerRadius(
8,
corners: [.topLeft],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,18 @@ public struct ParticipantInfoView: View {
var participant: CallParticipant
var isPinned: Bool
var maxHeight: CGFloat
var paddingsConfig: PaddingsConfig

public init(
@MainActor public init(
participant: CallParticipant,
isPinned: Bool,
maxHeight: Float = 14
maxHeight: Float = 14,
paddingsConfig: PaddingsConfig = .participantInfoView
) {
self.participant = participant
self.isPinned = isPinned
self.maxHeight = CGFloat(maxHeight)
self.paddingsConfig = paddingsConfig
}

public var body: some View {
Expand Down Expand Up @@ -452,8 +455,10 @@ public struct ParticipantInfoView: View {
SoundIndicator(participant: participant)
.frame(maxHeight: maxHeight)
}
.padding(.all, 2)
.padding(.horizontal, 4)
.padding(.leading, paddingsConfig.leading)
.padding(.trailing, paddingsConfig.trailing)
.padding(.top, paddingsConfig.top)
.padding(.bottom, paddingsConfig.bottom)
.frame(height: 28)
.cornerRadius(
8,
Expand Down
119 changes: 119 additions & 0 deletions Sources/StreamVideoSwiftUI/Utils/PaddingsConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
// Copyright © 2025 Stream.io Inc. All rights reserved.
//

import Foundation

/// A configuration object that defines padding values for different edges.
///
/// `PaddingsConfig` allows you to specify custom padding values for leading,
/// trailing, top, and bottom edges, which can be reused across multiple UI components.
public struct PaddingsConfig {

/// The amount of padding on the leading edge.
public let leading: CGFloat

/// The amount of padding on the trailing edge.
public let trailing: CGFloat

/// The amount of padding on the top edge.
public let top: CGFloat

/// The amount of padding on the bottom edge.
public let bottom: CGFloat

/// Creates a new `PaddingsConfig` instance with the specified edge paddings.
///
/// - Parameters:
/// - leading: The padding for the leading edge. Defaults to `0`.
/// - trailing: The padding for the trailing edge. Defaults to `0`.
/// - top: The padding for the top edge. Defaults to `0`.
/// - bottom: The padding for the bottom edge. Defaults to `0`.
public init(
leading: CGFloat = 0,
trailing: CGFloat = 0,
top: CGFloat = 0,
bottom: CGFloat = 0
) {
self.leading = leading
self.trailing = trailing
self.top = top
self.bottom = bottom
}
}

extension PaddingsConfig {

/// Padding configuration for the participant info view.
///
/// - Leading: `6`
/// - Trailing: `6`
/// - Top: `2`
/// - Bottom: `2`
@MainActor public static let participantInfoView = PaddingsConfig(
leading: 6,
trailing: 6,
top: 2,
bottom: 2
)

/// Padding configuration for the participant info view in Picture-in-Picture mode.
///
/// The leading and bottom paddings vary depending on the iOS version.
@MainActor public static let participantInfoViewPiP = PaddingsConfig(
leading: leadingPaddingInfoViewPiP,
trailing: 6,
top: 2,
bottom: bottomPaddingInfoViewPiP
)

/// Padding configuration for the connection indicator view.
///
/// The trailing and bottom paddings vary depending on the iOS version.
@MainActor public static let connectionIndicator = PaddingsConfig(
leading: 0,
trailing: trailingPaddingConnectionIndicator,
top: 0,
bottom: bottomPaddingConnectionIndicator
)

/// Leading padding for the participant info view in PiP mode,
/// adjusted for iOS 26 and above.
private static var leadingPaddingInfoViewPiP: CGFloat {
if #available(iOS 26.0, *) {
return 16
} else {
return 6
}
}

/// Bottom padding for the participant info view in PiP mode,
/// adjusted for iOS 26 and above.
private static var bottomPaddingInfoViewPiP: CGFloat {
if #available(iOS 26.0, *) {
return 4
} else {
return 2
}
}

/// Trailing padding for the connection indicator,
/// adjusted for iOS 26 and above.
private static var trailingPaddingConnectionIndicator: CGFloat {
if #available(iOS 26.0, *) {
return 8
} else {
return 0
}
}

/// Bottom padding for the connection indicator,
/// adjusted for iOS 26 and above.
private static var bottomPaddingConnectionIndicator: CGFloat {
if #available(iOS 26.0, *) {
return 2
} else {
return 0
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ private struct PictureInPictureParticipantModifier: ViewModifier {
HStack {
ParticipantInfoView(
participant: participant,
isPinned: participant.isPinned
isPinned: participant.isPinned,
paddingsConfig: .participantInfoViewPiP
)

Spacer()

if showAllInfo {
ConnectionQualityIndicator(
connectionQuality: participant.connectionQuality
connectionQuality: participant.connectionQuality,
paddingsConfig: .connectionIndicator
)
}
}
Expand Down
8 changes: 6 additions & 2 deletions StreamVideo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@
40D36AE22DDE023800972D75 /* WebRTCStatsCollecting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D36AE12DDE023800972D75 /* WebRTCStatsCollecting.swift */; };
40D36AE42DDE02D100972D75 /* MockWebRTCStatsCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D36AE32DDE02D100972D75 /* MockWebRTCStatsCollector.swift */; };
40D6ADDD2ACDB51C00EF5336 /* VideoRenderer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D6ADDC2ACDB51C00EF5336 /* VideoRenderer_Tests.swift */; };
40D75C652E44F5CE000E0438 /* CameraInterruptionsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */; };
40D75C522E437FBC000E0438 /* InterruptionEffect_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C512E437FBC000E0438 /* InterruptionEffect_Tests.swift */; };
40D75C542E438317000E0438 /* RouteChangeEffect_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C532E438317000E0438 /* RouteChangeEffect_Tests.swift */; };
40D75C562E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C552E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift */; };
Expand All @@ -720,6 +719,7 @@
40D75C5F2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C5E2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift */; };
40D75C612E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C602E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift */; };
40D75C632E4396D2000E0438 /* RTCAudioStore_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C622E4396D2000E0438 /* RTCAudioStore_Tests.swift */; };
40D75C652E44F5CE000E0438 /* CameraInterruptionsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */; };
40D946412AA5ECEF00C8861B /* CodeScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946402AA5ECEF00C8861B /* CodeScanner.swift */; };
40D946432AA5F65300C8861B /* DemoQRCodeScannerButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946422AA5F65300C8861B /* DemoQRCodeScannerButton.swift */; };
40D946452AA5F67E00C8861B /* DemoCallingTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946442AA5F67E00C8861B /* DemoCallingTopView.swift */; };
Expand Down Expand Up @@ -1360,6 +1360,7 @@
84D2E37729DC856D001D2118 /* CallMemberUpdatedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37129DC856C001D2118 /* CallMemberUpdatedEvent.swift */; };
84D2E37829DC856D001D2118 /* CallMemberUpdatedPermissionEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37229DC856C001D2118 /* CallMemberUpdatedPermissionEvent.swift */; };
84D2E37929DC856D001D2118 /* CallMemberAddedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37329DC856C001D2118 /* CallMemberAddedEvent.swift */; };
84D36CE32E4A0775004E90B0 /* PaddingsConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */; };
84D419B828E7155100F574F9 /* CallContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D419B728E7155100F574F9 /* CallContainer.swift */; };
84D424C32AA0EA6300473150 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84D424C22AA0EA6300473150 /* Assets.xcassets */; };
84D425082AA61E9900473150 /* LivestreamPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D425062AA61E7C00473150 /* LivestreamPlayer.swift */; };
Expand Down Expand Up @@ -2244,7 +2245,6 @@
40D36AE12DDE023800972D75 /* WebRTCStatsCollecting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebRTCStatsCollecting.swift; sourceTree = "<group>"; };
40D36AE32DDE02D100972D75 /* MockWebRTCStatsCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockWebRTCStatsCollector.swift; sourceTree = "<group>"; };
40D6ADDC2ACDB51C00EF5336 /* VideoRenderer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRenderer_Tests.swift; sourceTree = "<group>"; };
40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterruptionsHandler.swift; sourceTree = "<group>"; };
40D75C512E437FBC000E0438 /* InterruptionEffect_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterruptionEffect_Tests.swift; sourceTree = "<group>"; };
40D75C532E438317000E0438 /* RouteChangeEffect_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteChangeEffect_Tests.swift; sourceTree = "<group>"; };
40D75C552E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAVAudioSessionPortDescription.swift; sourceTree = "<group>"; };
Expand All @@ -2253,6 +2253,7 @@
40D75C5E2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallKitAudioSessionReducer_Tests.swift; sourceTree = "<group>"; };
40D75C602E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCAudioSessionReducer_Tests.swift; sourceTree = "<group>"; };
40D75C622E4396D2000E0438 /* RTCAudioStore_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCAudioStore_Tests.swift; sourceTree = "<group>"; };
40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterruptionsHandler.swift; sourceTree = "<group>"; };
40D946402AA5ECEF00C8861B /* CodeScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeScanner.swift; sourceTree = "<group>"; };
40D946422AA5F65300C8861B /* DemoQRCodeScannerButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoQRCodeScannerButton.swift; sourceTree = "<group>"; };
40D946442AA5F67E00C8861B /* DemoCallingTopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoCallingTopView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2830,6 +2831,7 @@
84D2E37129DC856C001D2118 /* CallMemberUpdatedEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberUpdatedEvent.swift; sourceTree = "<group>"; };
84D2E37229DC856C001D2118 /* CallMemberUpdatedPermissionEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberUpdatedPermissionEvent.swift; sourceTree = "<group>"; };
84D2E37329DC856C001D2118 /* CallMemberAddedEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberAddedEvent.swift; sourceTree = "<group>"; };
84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaddingsConfig.swift; sourceTree = "<group>"; };
84D419B728E7155100F574F9 /* CallContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallContainer.swift; sourceTree = "<group>"; };
84D424C22AA0EA6300473150 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
84D425062AA61E7C00473150 /* LivestreamPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LivestreamPlayer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6776,6 +6778,7 @@
4014802F2A5317640029166A /* AudioValuePercentageNormaliser.swift */,
8457BF7B2A5BF9E0000AE567 /* ToastView.swift */,
40FAF3D22B10F611003F8029 /* UIDevice+Convenience.swift */,
84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */,
40D1657D2B5FE82200C6D951 /* HalfSheetView.swift */,
40A7C5B42E099B1600EEDF9C /* ParticipantEventResetAdapter */,
);
Expand Down Expand Up @@ -8727,6 +8730,7 @@
846FBE9128AAF52600147F6E /* SelectedParticipantView.swift in Sources */,
4072A5812DAE81CF00108E8F /* PictureInPictureVideoParticipantView.swift in Sources */,
40D1657F2B5FE8AB00C6D951 /* (null) in Sources */,
84D36CE32E4A0775004E90B0 /* PaddingsConfig.swift in Sources */,
848A73C02926314F0089AA6E /* MinimizedCallView.swift in Sources */,
40245F342BE26BC900FCF075 /* StatelessMicrophoneIconView.swift in Sources */,
8434C525289AA2E20001490A /* Fonts.swift in Sources */,
Expand Down