Skip to content

Conversation

ipavlidakis
Copy link
Contributor

@ipavlidakis ipavlidakis commented Aug 13, 2025

🔗 Issue Links

Resolves https://linear.app/stream/issue/IOS-916/videoproximity-doesnt-stop-local-video-and-its-visible-on-remote

🎯 Goal

This revisions provides improvements in situations that causing CallSettings to update rapidly. With the updates, we can now ensure serial updates for those rapid changes.

🛠 Implementation

WebRTCStateAdapter now handles CallSettings updates as enqueued operations. In that way every update request will be passed the current CallSettings at the moment and is expected to return the update it needs. In this way we provide step by step updates in CallSettings rather than complete replacements.

🧪 Manual Testing Notes

  • With proximity policies enabled
  • Join call
  • Move your hand close to the front camera
  • Notice that video and speaker should be disabled
  • Move your hand away from the front camera
  • Video and Speaker should be reenabled
  • Do that multiple times with varying speed
  • When you move away from the front camera, video and speaker should always be restored

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • This change should receive manual QA
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (tutorial, CMS)

Copy link

github-actions bot commented Aug 13, 2025

Public Interface

- public final class CallSettings: ObservableObject, Sendable, Equatable, ReflectiveStringConvertible  
+ public final class CallSettings: ObservableObject, Sendable, Equatable, CustomStringConvertible  
-   
+   public var description: String
- 
+   
-   public convenience init(_ response: CallSettingsResponse,file: StaticString = #file,function: StaticString = #function,line: UInt = #line)
+ 
-   public init(audioOn: Bool = true,videoOn: Bool = true,speakerOn: Bool = true,audioOutputOn: Bool = true,cameraPosition: CameraPosition = .front,file: StaticString = #file,function: StaticString = #function,line: UInt = #line)
+   public convenience init(_ response: CallSettingsResponse,file: StaticString = #file,function: StaticString = #function,line: UInt = #line)
-   
+   public init(audioOn: Bool = true,videoOn: Bool = true,speakerOn: Bool = true,audioOutputOn: Bool = true,cameraPosition: CameraPosition = .front,file: StaticString = #file,function: StaticString = #function,line: UInt = #line)
- 
+   
-   public static func ==(lhs: CallSettings,rhs: CallSettings)-> Bool
+ 
+   public static func ==(lhs: CallSettings,rhs: CallSettings)-> Bool

 public struct LogSubsystem: OptionSet, CustomStringConvertible, Sendable  
-   public var description: String
+   public static let audioRecording
-   
+   public var description: String
- 
+   
-   public init(rawValue: Int)
+ 
+   public init(rawValue: Int)

 open class StreamCallAudioRecorder: @unchecked Sendable  
-   open private lazy var metersPublisher: AnyPublisher<Float, Never>
+   @Published open private var meters: Float
-   
+   @Published open private var isRecording: Bool
- 
+   
-   public init(filename: String)
+ 
-   
+   public convenience init()
- 
+   
-   open func startRecording(ignoreActiveCall: Bool = false)async 
+ 
-   open func stopRecording()async
+   open func startRecording(ignoreActiveCall: Bool = false)
+   open func stopRecording()

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Aug 13, 2025

SDK Size

title develop branch diff status
StreamVideo 8.21 MB 8.19 MB -17 KB 🚀
StreamVideoSwiftUI 2.29 MB 2.29 MB 0 KB 🟢
StreamVideoUIKit 2.41 MB 2.41 MB 0 KB 🟢
StreamWebRTC 9.85 MB 9.85 MB 0 KB 🟢

@ipavlidakis ipavlidakis force-pushed the fix/callsettings-rapid-updates branch from fe52a50 to 05ea240 Compare August 19, 2025 12:35
@ipavlidakis ipavlidakis changed the base branch from develop to fix/local-audio-waveform-not-always-working August 19, 2025 12:35
@ipavlidakis ipavlidakis self-assigned this Aug 19, 2025
@ipavlidakis ipavlidakis added bug Something isn't working enhancement New feature or request labels Aug 19, 2025
@ipavlidakis ipavlidakis marked this pull request as ready for review August 19, 2025 12:40
@ipavlidakis ipavlidakis requested a review from a team as a code owner August 19, 2025 12:40
@@ -119,10 +119,6 @@ extension WebRTCCoordinator.StateMachine.Stage {

try Task.checkCancellation()

await observeCallSettingsUpdates()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was here to forward CallSettings to the publisher PeerConnection. However, because it was relying on the Combine chain for updates, it was always a time-fracture behind.

Now, we are removing this and moving the publiher peerconnection update directly on the WebRTCStateAdapter next to when it updates its own CallSettings.

/// Observes updates to the `callSettings` and ensures that any changes are
/// reflected in the publisher. This ensures that updates to audio, video, and
/// audio output settings are applied correctly during a WebRTC session.
private func observeCallSettingsUpdates() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I haven't seen a replacement for this? How do we listen to updates now?

Base automatically changed from fix/local-audio-waveform-not-always-working to develop August 20, 2025 09:38
@ipavlidakis ipavlidakis force-pushed the fix/callsettings-rapid-updates branch from 5b8fb49 to bb4ac08 Compare August 20, 2025 09:48
@ipavlidakis ipavlidakis merged commit bf957cb into develop Aug 20, 2025
1 check passed
@ipavlidakis ipavlidakis deleted the fix/callsettings-rapid-updates branch August 20, 2025 09:49
Copy link

@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants