Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

### 🔄 Changed
### 🐞 Fixed
- An issue that was causing the speaker to toggle nonstop. [#968](https://github.com/GetStream/stream-video-swift/pull/968)

# [1.34.0](https://github.com/GetStream/stream-video-swift/releases/tag/1.34.0)
_October 07, 2025_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ final class CallAudioSession: @unchecked Sendable {
private func initialAudioSessionConfiguration() {
let state = audioStore.state
let requiresCategoryUpdate = state.category != .playAndRecord
let requiresModeUpdate = state.mode != .voiceChat && state.mode != .videoChat
let requiresModeUpdate = state.mode != .voiceChat

guard requiresCategoryUpdate || requiresModeUpdate else {
log.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct DefaultAudioSessionPolicy: AudioSessionPolicy {
return .init(
isActive: callSettings.audioOutputOn,
category: .playAndRecord,
mode: callSettings.videoOn ? .videoChat : .voiceChat,
mode: .voiceChat,
options: .playAndRecord(
videoOn: callSettings.videoOn,
speakerOn: callSettings.speakerOn,
Expand All @@ -42,7 +42,7 @@ public struct DefaultAudioSessionPolicy: AudioSessionPolicy {
return .init(
isActive: callSettings.audioOutputOn,
category: .playAndRecord,
mode: callSettings.videoOn && callSettings.speakerOn ? .videoChat : .voiceChat,
mode: .voiceChat,
options: .playAndRecord(
videoOn: callSettings.videoOn,
speakerOn: callSettings.speakerOn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public struct OwnCapabilitiesAudioSessionPolicy: AudioSessionPolicy {
: .playback

let mode: AVAudioSession.Mode = category == .playAndRecord
? callSettings.videoOn && callSettings.speakerOn ? .videoChat : .voiceChat
? .voiceChat
: .default

let categoryOptions: AVAudioSession.CategoryOptions = category == .playAndRecord
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ protocol AVAudioSessionProtocol {
/// Configures the audio session category and options.
/// - Parameters:
/// - category: The audio category (e.g., `.playAndRecord`).
/// - mode: The audio mode (e.g., `.videoChat`).
/// - mode: The audio mode (e.g., `.voiceChat`).
/// - categoryOptions: The options for the category (e.g., `.allowBluetooth`).
/// - Throws: An error if setting the category fails.
func setCategory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class StreamCallAudioRecorder_CategoryMiddlewareTests: XCTestCase, @unchec
validation.isInverted = true
subject.dispatcher = .init { _, _, _, _ in }

audioStore.dispatch(.audioSession(.setCategory(.playAndRecord, mode: .videoChat, options: [])))
audioStore.dispatch(.audioSession(.setCategory(.playAndRecord, mode: .voiceChat, options: [])))

await safeFulfillment(of: [validation], timeout: 1)
}
Expand All @@ -36,7 +36,7 @@ final class StreamCallAudioRecorder_CategoryMiddlewareTests: XCTestCase, @unchec
validation.isInverted = true
subject.dispatcher = .init { _, _, _, _ in }

audioStore.dispatch(.audioSession(.setCategory(.record, mode: .videoChat, options: [])))
audioStore.dispatch(.audioSession(.setCategory(.record, mode: .voiceChat, options: [])))

await safeFulfillment(of: [validation], timeout: 1)
}
Expand All @@ -52,7 +52,7 @@ final class StreamCallAudioRecorder_CategoryMiddlewareTests: XCTestCase, @unchec
}
}

audioStore.dispatch(.audioSession(.setCategory(.playback, mode: .videoChat, options: [])))
audioStore.dispatch(.audioSession(.setCategory(.playback, mode: .voiceChat, options: [])))

await safeFulfillment(of: [validation])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class DefaultAudioSessionPolicyTests: XCTestCase, @unchecked Sendable {
)

XCTAssertEqual(configuration.category, .playAndRecord)
XCTAssertEqual(configuration.mode, .videoChat)
XCTAssertEqual(configuration.mode, .voiceChat)
XCTAssertEqual(
configuration.options,
[
Expand All @@ -56,7 +56,7 @@ final class DefaultAudioSessionPolicyTests: XCTestCase, @unchecked Sendable {
)

XCTAssertEqual(configuration.category, .playAndRecord)
XCTAssertEqual(configuration.mode, .videoChat)
XCTAssertEqual(configuration.mode, .voiceChat)
XCTAssertEqual(
configuration.options,
[
Expand Down Expand Up @@ -97,7 +97,7 @@ final class DefaultAudioSessionPolicyTests: XCTestCase, @unchecked Sendable {
)

XCTAssertEqual(configuration.category, .playAndRecord)
XCTAssertEqual(configuration.mode, .videoChat)
XCTAssertEqual(configuration.mode, .voiceChat)
XCTAssertEqual(
configuration.options,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda

// Then
XCTAssertEqual(configuration.category, .playAndRecord)
XCTAssertEqual(configuration.mode, .videoChat)
XCTAssertEqual(configuration.mode, .voiceChat)
XCTAssertEqual(
configuration.options,
[
Expand Down Expand Up @@ -144,23 +144,6 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda

// MARK: - Tests for different video settings

func testConfiguration_WhenVideoOnSpeakerOn_ReturnsVideoChatMode() async {
// Given
currentDeviceType = .phone
await fulfilmentInMainActor { self.currentDevice.deviceType == self.currentDeviceType }
let callSettings = CallSettings(audioOn: true, videoOn: true, speakerOn: true)
let ownCapabilities: Set<OwnCapability> = [.sendAudio, .sendVideo]

// When
let configuration = subject.configuration(
for: callSettings,
ownCapabilities: ownCapabilities
)

// Then
XCTAssertEqual(configuration.mode, .videoChat)
}

func testConfiguration_WhenVideoOffSpeakerOnBackgroundFalse_ReturnsVoiceChatMode() async {
// Given
currentDeviceType = .phone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ final class RTCAudioSessionReducer_Tests: XCTestCase, @unchecked Sendable {
action: .audioSession(
.setCategory(
.playAndRecord,
mode: .videoChat,
mode: .voiceChat,
options: [
.allowBluetooth,
.mixWithOthers
Expand All @@ -160,7 +160,7 @@ final class RTCAudioSessionReducer_Tests: XCTestCase, @unchecked Sendable {
)?.first
)
XCTAssertEqual(input.category, AVAudioSession.Category.playAndRecord.rawValue)
XCTAssertEqual(input.mode, AVAudioSession.Mode.videoChat.rawValue)
XCTAssertEqual(input.mode, AVAudioSession.Mode.voiceChat.rawValue)
XCTAssertEqual(input.categoryOptions, [.allowBluetooth, .mixWithOthers])
}

Expand All @@ -175,7 +175,7 @@ final class RTCAudioSessionReducer_Tests: XCTestCase, @unchecked Sendable {
action: .audioSession(
.setCategory(
.playAndRecord,
mode: .videoChat,
mode: .voiceChat,
options: [
.allowBluetooth,
.mixWithOthers
Expand All @@ -188,7 +188,7 @@ final class RTCAudioSessionReducer_Tests: XCTestCase, @unchecked Sendable {
)

XCTAssertEqual(updatedState.category, .playAndRecord)
XCTAssertEqual(updatedState.mode, .videoChat)
XCTAssertEqual(updatedState.mode, .voiceChat)
XCTAssertEqual(updatedState.options, [.allowBluetooth, .mixWithOthers])
}

Expand Down