-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply fixes for when a device has no earPiece
- Loading branch information
1 parent
4b7af4a
commit fb7ad4a
Showing
8 changed files
with
109 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...StreamVideo/Utils/AudioSession/Extensions/CallSettings+RTCAudioSessionConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Copyright © 2025 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import AVFoundation | ||
import Foundation | ||
import StreamWebRTC | ||
|
||
extension CallSettings { | ||
|
||
var audioSessionConfiguration: RTCAudioSessionConfiguration { | ||
let category: AVAudioSession.Category = audioOn == true | ||
|| speakerOn == true | ||
|| videoOn == true | ||
? .playAndRecord | ||
: .playback | ||
|
||
let mode: AVAudioSession.Mode = category == .playAndRecord | ||
? speakerOn == true ? .videoChat : .voiceChat | ||
: .default | ||
|
||
let categoryOptions: AVAudioSession.CategoryOptions = category == .playAndRecord | ||
? .playAndRecord | ||
: .playback | ||
|
||
let result = RTCAudioSessionConfiguration.webRTC() | ||
result.category = category.rawValue | ||
result.mode = mode.rawValue | ||
result.categoryOptions = categoryOptions | ||
|
||
return result | ||
} | ||
} | ||
|
||
extension RTCAudioSessionConfiguration: @unchecked Sendable { | ||
|
||
override open var description: String { | ||
[ | ||
"RTCAudioSessionConfiguration", | ||
"(", | ||
[ | ||
"category:\(AVAudioSession.Category(rawValue: category))", | ||
"mode:\(AVAudioSession.Mode(rawValue: mode))", | ||
"categoryOptions:\(categoryOptions)" | ||
].joined(separator: ", "), | ||
")" | ||
].joined() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters