-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create audio-levels.mdx * Update audio-levels.mdx
- Loading branch information
1 parent
7bc13d9
commit ea6f1cd
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
docs/ios/v2/how-to-guides/set-up-video-conferencing/audio-levels.mdx
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,21 @@ | ||
--- | ||
title: Show Audio Levels | ||
nav: 4.46 | ||
--- | ||
|
||
## Audio Level | ||
|
||
The audio level for every speaking peer can be retrieved by listening to 'onUpdatedSpeakers' callback in 'HMSUpdateListener', like so. | ||
|
||
```swift | ||
public func on(updated speakers: [HMSSpeaker]) { | ||
if let firstSpeakingPeer = speakers.first { | ||
let audioLevel = firstSpeakingPeer.level | ||
// Use this audio level | ||
// level : `Int` The level of the audio. It may vary from 0-100. A higher value indicates a higher speaking volume. | ||
... | ||
} | ||
} | ||
``` | ||
|
||
Note: on(updated speakers) is called when set of speaking peers change in the conference call. These are called active speakers. If you'd live to know the current dominant speaker, you can just get the first speaker in the list as the speaker list is sorted based on their audio levels, that is, loudest speaker is first in the list. |