Skip to content

Commit ca10ad9

Browse files
Merge pull request #264564 from xumo-95/master
Add configuration of audio session for iOS
2 parents b9cbee6 + 8f3dc07 commit ca10ad9

File tree

1 file changed

+23
-0
lines changed
  • articles/communication-services/quickstarts/voice-video-calling/includes/video-calling

1 file changed

+23
-0
lines changed

articles/communication-services/quickstarts/voice-video-calling/includes/video-calling/video-calling-ios.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,29 @@ AVAudioSession.sharedInstance().requestRecordPermission { (granted) in
301301
}
302302
```
303303

304+
### Configure audio session
305+
306+
You use an `AVAudioSession` object to configure your app’s audio session. Here is an example of enabling bluetooth audio device for your app:
307+
308+
```Swift
309+
func configureAudioSession() -> Error? {
310+
// Retrieve the audio session.
311+
let audioSession: AVAudioSession = AVAudioSession.sharedInstance()
312+
// set options to allow bluetooth device
313+
let options: AVAudioSession.CategoryOptions = .allowBluetooth
314+
var configError: Error?
315+
do {
316+
// Set the audio session category.
317+
try audioSession.setCategory(.playAndRecord, options: options)
318+
print("configureAudioSession successfully")
319+
} catch {
320+
print("configureAudioSession failed")
321+
configError = error
322+
}
323+
return configError
324+
}
325+
```
326+
304327
## Display local video
305328

306329
Before starting a call, you can manage settings related to video. In this quickstart, we introduce the implementation of toggling local video before or during a call.

0 commit comments

Comments
 (0)