4

I am creating an ios application using webRTC for video conferencing. I want to detect who is talking in the peer connection.

To be more specific,I want to detect the audio activity of the remote peer I am connected to so that I can detect the person who is currently speaking.

codeGeek
  • 259
  • 4
  • 17

2 Answers2

3

This can be implemented by measuring the value of "audioOutputLevel" in peer-connection stats reports. The Function that will you should study is

- (void)peerConnection:(RTCPeerConnection*)peerConnection didGetStats:(NSArray*)stats
Sajid Zeb
  • 1,806
  • 18
  • 32
codeGeek
  • 259
  • 4
  • 17
  • I cannot find this method in pod 'WebRTC'. Can you please elaborate a little more? thanks. – Fawad Masud Aug 30 '17 at 07:48
  • The exact method can be found in https://cocoapods.org/pods/libjingle_peerconnection. But if you are using WebRTC pod try finding the similar delegate – codeGeek Aug 30 '17 at 07:50
1

Check out this guide for building a sample WebRTC iOS application.

Check the section WebRTC Stats reporting

For example, audioSendInputLevel property indicates mic input level even while audio track disabled, so you can check if user is currently speaking/talking.

Daniel
  • 10,641
  • 12
  • 47
  • 85
  • I don't want an api. i have implemented all features except this one. – codeGeek Aug 30 '16 at 09:07
  • Hey codeGeek, has there been some update on this issue so far? I would love to know how you solved your problem! – DeveloBär Oct 30 '16 at 00:29
  • 1
    @DeveloBär This can be implemented by measuring the audio level in peerconnection stats. The Function that will you should study is - (void)peerConnection:(RTCPeerConnection*)peerConnection didGetStats:(NSArray*)stats – codeGeek Apr 04 '17 at 06:09