Show Audio Levels
Audio Level
The audio level for every speaking peer can be retrieved by listening to 'onUpdatedSpeakers' callback in 'HMSUpdateListener', like so.
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.
Have a suggestion? Recommend changes ->