ISBX / apprtc-ios

A native iOS video chat app based on WebRTC
BSD 3-Clause "New" or "Revised" License
1.35k stars 413 forks source link

Monitoring Decibel levels #128

Open theappshed opened 6 years ago

theappshed commented 6 years ago

Hi Folks,

I've tried to add on an AVAudioSession to monitor the decibel levels of the microphone. However it seems that they constantly read as -160dB. This suggests that the App-RTC (iOS) is requiring exclusive access to the microphone. This suggests that the AVAudioSession is as good as redundant because of the way the RTC modules work.

I have managed to isolate the localAudio track and also the remoteAudio track as RTCAudioTrack objects. Is it possible somehow to measure the decibel levels of these tracks? I need to trigger an event when the decibel threshold hits a certain level and it is either of these RTCAudioTracks which can trigger it.

Many thanks Steve