Version: iOS SendBirdCalls 1.9.2
Device: iPhonse XR, 14.4.1
BjGKbEx5Gx79HDpF8_uA0s.xccrashpoint.zip (220.4 KB)
Version: iOS SendBirdCalls 1.9.2
Device: iPhonse XR, 14.4.1
BjGKbEx5Gx79HDpF8_uA0s.xccrashpoint.zip (220.4 KB)
Hi @James, thanks for reporting this issue.
Would you be able to share the code snippet that calls this function?
Hi @mininny
Lib
func setAudioRecognizerAndReceiver(receiver: ((_ value: String?) -> Void)?) {
self.receiverAudioLevel = receiver
var prevValue = 0
self.audioRecognizer = TCARAudioRecognizer()
self.audioRecognizer?.startAudioRecognizer()
self.audioRecognizer?.voiceAudioPower = { averagePower in
if let userId = AuthManager.userIdString {
let value = averagePower > -40 ? 1 : 0
if value == prevValue {
return
}
prevValue = value
self.call?.updateCustomItems(customItems: [userId:String(value)], completionHandler: { items, keys, error in
})
}
}
}
//ARAudioRecognizer
class TCARAudioRecognizer: NSObject, ARAudioRecognizerDelegate {
var audioRecognizer: ARAudioRecognizer?
var voiceAudioLevel: ((_ level: Float) -> Void)? = nil
var voiceAudioPower: ((_ averagePower: Float) -> Void)? = nil
func startAudioRecognizer() {
self.audioRecognizer = ARAudioRecognizer()
self.audioRecognizer?.delegate = self
}
func stopAudioRecognizer() {
self.audioRecognizer?.stop()
self.voiceAudioLevel = nil
self.voiceAudioPower = nil
}
//[ARAudioRecognizerDelegate
func audioRecognized(_ recognizer: ARAudioRecognizer!) {
}
func audioLevelUpdated(_ recognizer: ARAudioRecognizer!, level lowPassResults: Float) {
self.voiceAudioLevel?(lowPassResults)
}
func audioLevelUpdated(_ recognizer: ARAudioRecognizer!, averagePower: Float, peakPower: Float) {
self.voiceAudioPower?(averagePower)
}
//]
}