Skip to content

Commit 0a0f38f

Browse files
authored
[Fix]Mute state misalignment (#772)
1 parent 65a3759 commit 0a0f38f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

55
# Upcoming
66

7-
### 🔄 Changed
7+
### 🐞 Fixed
8+
- Fix an issue causing audio/video misalignment with the server. [#772](https://github.com/GetStream/stream-video-swift/pull/772)
89

910
# [1.21.0](https://github.com/GetStream/stream-video-swift/releases/tag/1.21.0)
1011
_April 22, 2025_

Sources/StreamVideoSwiftUI/CallViewModel.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ open class CallViewModel: ObservableObject {
178178
/// The variable will be reset to `false` when `leaveCall` will be invoked.
179179
private(set) var localCallSettingsChange = false
180180

181+
private var hasAcceptedCall = false
182+
181183
public var participants: [CallParticipant] {
182184
let updateParticipants = call?.state.participants ?? []
183185
return updateParticipants.filter {
@@ -444,6 +446,7 @@ open class CallViewModel: ObservableObject {
444446
Task {
445447
let call = streamVideo.call(callType: callType, callId: callId)
446448
do {
449+
hasAcceptedCall = true
447450
try await call.accept()
448451
enterCall(
449452
call: call,
@@ -453,6 +456,7 @@ open class CallViewModel: ObservableObject {
453456
customData: customData
454457
)
455458
} catch {
459+
hasAcceptedCall = false
456460
self.error = error
457461
setCallingState(.idle)
458462
self.call = nil
@@ -671,7 +675,9 @@ open class CallViewModel: ObservableObject {
671675
)
672676
save(call: call)
673677
enteringCallTask = nil
678+
hasAcceptedCall = false
674679
} catch {
680+
hasAcceptedCall = false
675681
log.error("Error starting a call", error: error)
676682
self.error = error
677683
setCallingState(.idle)
@@ -792,7 +798,7 @@ open class CallViewModel: ObservableObject {
792798
switch callingState {
793799
case let .incoming(incomingCall)
794800
where event.callCid == callCid(from: incomingCall.id, callType: incomingCall.type) && event.user?.id == streamVideo.user
795-
.id && enteringCallTask == nil:
801+
.id && !hasAcceptedCall:
796802
/// If the call that was accepted is the incoming call we are presenting, then we reject
797803
/// and set the activeCall to the current one in order to reset the callingState to
798804
/// inCall or idle.

0 commit comments

Comments
 (0)