how to find whether a user is publisher or subscriber in opentok?

284 Views Asked by At

I am working on an iOS application (Swift) in which I have used tokbox SDK for adding video chat into iOS app and now I want to add mute/unmute and video on/off buttons to video chat.

In my ios application, I want to add single mute/unmute and video on/off buttons common for both publisher and subscriber at the bottom of the screen.

Assume there are 2 people who joined the call, when publisher clicks on mute button only publisher audio should be muted and like wise for subscriber.

How to find whether a user is publisher or subscriber so that I can mute their individual audio?

Can anyone guide me?

1

There are 1 best solutions below

0
abdulajet On

If I am understanding correctly you want to be able to mute in a two-person 1 to 1 call?

To mute a person in a call you need to stop publishing audio to the session. This means that anyone subscribed to this publisher will not get the audio. It also works the same way for video.

So as long as you are toggling audio/video for the publisher it will work fine. In a 1 to 1 call like this, both users/devices are publishing and subscribing at the same time.

Device A is publishing audio/video to a session, and subscribing to audio/video from the session (in this case from Device B).

Device B is publishing audio/video to a session, and subscribing to audio/video from the session (in this case from Device A).

More info is available here: https://tokbox.com/developer/guides/audio-video/ios-swift/