Skip to content

Commit ef8316f

Browse files
Fix PiP UI issues on iOS 26 (#909)
1 parent ed1749a commit ef8316f

File tree

6 files changed

+102
-9
lines changed

6 files changed

+102
-9
lines changed

DemoApp/Sources/Views/CallView/CallingView/SimpleCallingView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct SimpleCallingView: View {
185185

186186
private func setAudioSessionPolicyOverride(for callId: String) async throws {
187187
let call = streamVideo.call(callType: callType, callId: callId)
188-
try await call.updateAudioSessionPolicy(AppEnvironment.audioSessionPolicy.value)
188+
await call.updateAudioSessionPolicy(AppEnvironment.audioSessionPolicy.value)
189189
}
190190

191191
private func setProximityPolicies(for callId: String) throws {

Sources/StreamVideoSwiftUI/CallView/ConnectionQualityIndicator.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public struct ConnectionQualityIndicator: View {
1111

1212
private var size: CGFloat = 28
1313
private var width: CGFloat = 3
14+
private var paddingsConfig: EdgeInsets
1415

1516
/// The connection quality represented by this indicator.
1617
var connectionQuality: ConnectionQuality
@@ -23,11 +24,13 @@ public struct ConnectionQualityIndicator: View {
2324
public init(
2425
connectionQuality: ConnectionQuality,
2526
size: CGFloat = 28,
26-
width: CGFloat = 3
27+
width: CGFloat = 3,
28+
paddingsConfig: EdgeInsets = EdgeInsets()
2729
) {
2830
self.connectionQuality = connectionQuality
2931
self.size = size
3032
self.width = width
33+
self.paddingsConfig = paddingsConfig
3134
}
3235

3336
public var body: some View {
@@ -41,6 +44,7 @@ public struct ConnectionQualityIndicator: View {
4144
}
4245
}
4346
.frame(width: size, height: size)
47+
.padding(paddingsConfig)
4448
.cornerRadius(
4549
8,
4650
corners: [.topLeft],

Sources/StreamVideoSwiftUI/CallView/VideoParticipantsView.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,18 @@ public struct ParticipantInfoView: View {
411411
var participant: CallParticipant
412412
var isPinned: Bool
413413
var maxHeight: CGFloat
414+
var paddingsConfig: EdgeInsets
414415

415416
public init(
416417
participant: CallParticipant,
417418
isPinned: Bool,
418-
maxHeight: Float = 14
419+
maxHeight: Float = 14,
420+
paddingsConfig: EdgeInsets = .participantInfoView
419421
) {
420422
self.participant = participant
421423
self.isPinned = isPinned
422424
self.maxHeight = CGFloat(maxHeight)
425+
self.paddingsConfig = paddingsConfig
423426
}
424427

425428
public var body: some View {
@@ -452,8 +455,7 @@ public struct ParticipantInfoView: View {
452455
SoundIndicator(participant: participant)
453456
.frame(maxHeight: maxHeight)
454457
}
455-
.padding(.all, 2)
456-
.padding(.horizontal, 4)
458+
.padding(paddingsConfig)
457459
.frame(height: 28)
458460
.cornerRadius(
459461
8,
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//
2+
// Copyright © 2025 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import SwiftUI
6+
7+
extension EdgeInsets {
8+
9+
/// Padding configuration for the participant info view.
10+
///
11+
/// - Leading: `6`
12+
/// - Trailing: `6`
13+
/// - Top: `2`
14+
/// - Bottom: `2`
15+
public static let participantInfoView = EdgeInsets(
16+
top: 2,
17+
leading: 6,
18+
bottom: 2,
19+
trailing: 6
20+
)
21+
22+
/// Padding configuration for the participant info view in Picture-in-Picture mode.
23+
///
24+
/// The leading and bottom paddings vary depending on the iOS version.
25+
public static let participantInfoViewPiP = EdgeInsets(
26+
top: 2,
27+
leading: leadingPaddingInfoViewPiP,
28+
bottom: bottomPaddingInfoViewPiP,
29+
trailing: 6
30+
)
31+
32+
/// Padding configuration for the connection indicator view.
33+
///
34+
/// The trailing and bottom paddings vary depending on the iOS version.
35+
public static let connectionIndicator = EdgeInsets(
36+
top: 0,
37+
leading: 0,
38+
bottom: bottomPaddingConnectionIndicator,
39+
trailing: trailingPaddingConnectionIndicator
40+
)
41+
42+
/// Leading padding for the participant info view in PiP mode,
43+
/// adjusted for iOS 26 and above.
44+
private static var leadingPaddingInfoViewPiP: CGFloat {
45+
if #available(iOS 26.0, *) {
46+
return 16
47+
} else {
48+
return 6
49+
}
50+
}
51+
52+
/// Bottom padding for the participant info view in PiP mode,
53+
/// adjusted for iOS 26 and above.
54+
private static var bottomPaddingInfoViewPiP: CGFloat {
55+
if #available(iOS 26.0, *) {
56+
return 4
57+
} else {
58+
return 2
59+
}
60+
}
61+
62+
/// Trailing padding for the connection indicator,
63+
/// adjusted for iOS 26 and above.
64+
private static var trailingPaddingConnectionIndicator: CGFloat {
65+
if #available(iOS 26.0, *) {
66+
return 8
67+
} else {
68+
return 0
69+
}
70+
}
71+
72+
/// Bottom padding for the connection indicator,
73+
/// adjusted for iOS 26 and above.
74+
private static var bottomPaddingConnectionIndicator: CGFloat {
75+
if #available(iOS 26.0, *) {
76+
return 2
77+
} else {
78+
return 0
79+
}
80+
}
81+
}

Sources/StreamVideoSwiftUI/Utils/PictureInPicture/PictureInPictureParticipantModifier.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ private struct PictureInPictureParticipantModifier: ViewModifier {
4141
HStack {
4242
ParticipantInfoView(
4343
participant: participant,
44-
isPinned: participant.isPinned
44+
isPinned: participant.isPinned,
45+
paddingsConfig: .participantInfoViewPiP
4546
)
4647

4748
Spacer()
4849

4950
if showAllInfo {
5051
ConnectionQualityIndicator(
51-
connectionQuality: participant.connectionQuality
52+
connectionQuality: participant.connectionQuality,
53+
paddingsConfig: .connectionIndicator
5254
)
5355
}
5456
}

StreamVideo.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@
711711
40D36AE22DDE023800972D75 /* WebRTCStatsCollecting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D36AE12DDE023800972D75 /* WebRTCStatsCollecting.swift */; };
712712
40D36AE42DDE02D100972D75 /* MockWebRTCStatsCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D36AE32DDE02D100972D75 /* MockWebRTCStatsCollector.swift */; };
713713
40D6ADDD2ACDB51C00EF5336 /* VideoRenderer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D6ADDC2ACDB51C00EF5336 /* VideoRenderer_Tests.swift */; };
714-
40D75C652E44F5CE000E0438 /* CameraInterruptionsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */; };
715714
40D75C522E437FBC000E0438 /* InterruptionEffect_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C512E437FBC000E0438 /* InterruptionEffect_Tests.swift */; };
716715
40D75C542E438317000E0438 /* RouteChangeEffect_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C532E438317000E0438 /* RouteChangeEffect_Tests.swift */; };
717716
40D75C562E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C552E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift */; };
@@ -720,6 +719,7 @@
720719
40D75C5F2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C5E2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift */; };
721720
40D75C612E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C602E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift */; };
722721
40D75C632E4396D2000E0438 /* RTCAudioStore_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C622E4396D2000E0438 /* RTCAudioStore_Tests.swift */; };
722+
40D75C652E44F5CE000E0438 /* CameraInterruptionsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */; };
723723
40D946412AA5ECEF00C8861B /* CodeScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946402AA5ECEF00C8861B /* CodeScanner.swift */; };
724724
40D946432AA5F65300C8861B /* DemoQRCodeScannerButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946422AA5F65300C8861B /* DemoQRCodeScannerButton.swift */; };
725725
40D946452AA5F67E00C8861B /* DemoCallingTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D946442AA5F67E00C8861B /* DemoCallingTopView.swift */; };
@@ -1360,6 +1360,7 @@
13601360
84D2E37729DC856D001D2118 /* CallMemberUpdatedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37129DC856C001D2118 /* CallMemberUpdatedEvent.swift */; };
13611361
84D2E37829DC856D001D2118 /* CallMemberUpdatedPermissionEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37229DC856C001D2118 /* CallMemberUpdatedPermissionEvent.swift */; };
13621362
84D2E37929DC856D001D2118 /* CallMemberAddedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2E37329DC856C001D2118 /* CallMemberAddedEvent.swift */; };
1363+
84D36CE32E4A0775004E90B0 /* PaddingsConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */; };
13631364
84D419B828E7155100F574F9 /* CallContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D419B728E7155100F574F9 /* CallContainer.swift */; };
13641365
84D424C32AA0EA6300473150 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84D424C22AA0EA6300473150 /* Assets.xcassets */; };
13651366
84D425082AA61E9900473150 /* LivestreamPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D425062AA61E7C00473150 /* LivestreamPlayer.swift */; };
@@ -2244,7 +2245,6 @@
22442245
40D36AE12DDE023800972D75 /* WebRTCStatsCollecting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebRTCStatsCollecting.swift; sourceTree = "<group>"; };
22452246
40D36AE32DDE02D100972D75 /* MockWebRTCStatsCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockWebRTCStatsCollector.swift; sourceTree = "<group>"; };
22462247
40D6ADDC2ACDB51C00EF5336 /* VideoRenderer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRenderer_Tests.swift; sourceTree = "<group>"; };
2247-
40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterruptionsHandler.swift; sourceTree = "<group>"; };
22482248
40D75C512E437FBC000E0438 /* InterruptionEffect_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterruptionEffect_Tests.swift; sourceTree = "<group>"; };
22492249
40D75C532E438317000E0438 /* RouteChangeEffect_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteChangeEffect_Tests.swift; sourceTree = "<group>"; };
22502250
40D75C552E4385FE000E0438 /* MockAVAudioSessionPortDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAVAudioSessionPortDescription.swift; sourceTree = "<group>"; };
@@ -2253,6 +2253,7 @@
22532253
40D75C5E2E438AC0000E0438 /* CallKitAudioSessionReducer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallKitAudioSessionReducer_Tests.swift; sourceTree = "<group>"; };
22542254
40D75C602E438BBF000E0438 /* RTCAudioSessionReducer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCAudioSessionReducer_Tests.swift; sourceTree = "<group>"; };
22552255
40D75C622E4396D2000E0438 /* RTCAudioStore_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCAudioStore_Tests.swift; sourceTree = "<group>"; };
2256+
40D75C642E44F5CE000E0438 /* CameraInterruptionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterruptionsHandler.swift; sourceTree = "<group>"; };
22562257
40D946402AA5ECEF00C8861B /* CodeScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeScanner.swift; sourceTree = "<group>"; };
22572258
40D946422AA5F65300C8861B /* DemoQRCodeScannerButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoQRCodeScannerButton.swift; sourceTree = "<group>"; };
22582259
40D946442AA5F67E00C8861B /* DemoCallingTopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoCallingTopView.swift; sourceTree = "<group>"; };
@@ -2830,6 +2831,7 @@
28302831
84D2E37129DC856C001D2118 /* CallMemberUpdatedEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberUpdatedEvent.swift; sourceTree = "<group>"; };
28312832
84D2E37229DC856C001D2118 /* CallMemberUpdatedPermissionEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberUpdatedPermissionEvent.swift; sourceTree = "<group>"; };
28322833
84D2E37329DC856C001D2118 /* CallMemberAddedEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallMemberAddedEvent.swift; sourceTree = "<group>"; };
2834+
84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaddingsConfig.swift; sourceTree = "<group>"; };
28332835
84D419B728E7155100F574F9 /* CallContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallContainer.swift; sourceTree = "<group>"; };
28342836
84D424C22AA0EA6300473150 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
28352837
84D425062AA61E7C00473150 /* LivestreamPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LivestreamPlayer.swift; sourceTree = "<group>"; };
@@ -6776,6 +6778,7 @@
67766778
4014802F2A5317640029166A /* AudioValuePercentageNormaliser.swift */,
67776779
8457BF7B2A5BF9E0000AE567 /* ToastView.swift */,
67786780
40FAF3D22B10F611003F8029 /* UIDevice+Convenience.swift */,
6781+
84D36CE22E4A0775004E90B0 /* PaddingsConfig.swift */,
67796782
40D1657D2B5FE82200C6D951 /* HalfSheetView.swift */,
67806783
40A7C5B42E099B1600EEDF9C /* ParticipantEventResetAdapter */,
67816784
);
@@ -8727,6 +8730,7 @@
87278730
846FBE9128AAF52600147F6E /* SelectedParticipantView.swift in Sources */,
87288731
4072A5812DAE81CF00108E8F /* PictureInPictureVideoParticipantView.swift in Sources */,
87298732
40D1657F2B5FE8AB00C6D951 /* (null) in Sources */,
8733+
84D36CE32E4A0775004E90B0 /* PaddingsConfig.swift in Sources */,
87308734
848A73C02926314F0089AA6E /* MinimizedCallView.swift in Sources */,
87318735
40245F342BE26BC900FCF075 /* StatelessMicrophoneIconView.swift in Sources */,
87328736
8434C525289AA2E20001490A /* Fonts.swift in Sources */,

0 commit comments

Comments
 (0)