Handling the active-share-change event when one joins the channel after someone shared the screen

Hi @vic.yang

I am using version 1.4.1 of zoom video SDK.
So when I join the zoom channel when more than 2 participants are already in the channel, at that time only 2 events are coming of user-added, one for the self and one for some other user.
For the rest of the users, the user-added event is not coming.

Hey @vk-jangid

Did you mean only the new participant can receive the complete user-added message? The rest participants are not able to receive them, so they are not aware of the new coming participant?

Thanks
Vic

No No, I meant that like If I am a user and I am joining a channel that already has more than 2 participants in that. So I am getting only 2 events of user-added, one with my own data and one for some other user who is already in the channel.
But for the rest of the participants, I am not getting user-added events.

Hey @vk-jangid

In my understanding, you wanna one user-added event per participant. Is that right?

And could you explain “the rest of the participants”? Have they included in the payload of the second user-added event?

Thanks
Vic

Yes, I want one user-added event per participant. this is how it is supposed to happen, right?

Otherwise, what is the point of sending 2 user-added events, one with the data of the self-user and the second for some random user in the session?

By rest of the participants, I mean, like in a channel 5 participants are already there and after that, I am joining a channel, so in that case, 2 events which are coming was one with my data, the second one with some random user from the 5 participants and for the rest of the 4 participants there are no events.

Hey @vk-jangid

The payload of the ‘user-added’ is an array. The first event payload contains the self-user, and the second one contains users that are already in the session before joining.

Thanks
Vic

Hi @vic.yang

It’s not reproducing now but the day I reported here at that time I was able to reproduce it.

Anyway, I wanted to know the status of the issues I reported here for which you said that they would be fixed in the upcoming releases.

  • The handling for the speakerOnly functionality (major issue)
  • Some minor issues like device-change event firing when switching the microphone,
  • Incorrect value of isShareAudioMuted
  • Calling startAudio function when the microphone permission is not given, doesn’t give the error when calling the function after one time

So are they all fixed now?

Hey @vk-jangid

It was fixed in the Video SDK Web 1.4.1. Also, we have released version 1.5.0, you can use the latest one.

Thanks
Vic

This issue is still there, when i am doing as mentioned below then it is not working for me.

await mediaStream.startShareScreen(document.querySelector('#self-screen'));
await mediaStream.muteShareAudio();

but when i am doing this way then it is working as expected.

await mediaStream.startShareScreen(document.querySelector('#self-screen'));
setTimeout(() => {
  mediaStream.muteShareAudio();
}, 1000);

Hi @vic.yang, Please test this case as well -

await mediaStream.startAudio({ speakerOnly: true });

// after some time
try {
  await mediaStream.stopAudio();
  await mediaStream.startAudio({ speakerOnly: false }); // this will throw an error of USER_FORBIDDEN_MICROPHONE
} catch (err) {
  if (err.reason === 'USER_FORBIDDEN_MICROPHONE') {
    mediaStream.startAudio({ speakerOnly: true });
  }
}

After getting the error when i am trying to start the audio with speakerOnly option then it is not working.

First of all, i think it should be handled by your end that if the user is in speakerOnly mode and then if user tries to start the microphone but the mic is blocked then after the error the audio should immediately switch to the speakerOnly.

Second, if this can’t be handled at your end then we should be able to call startAudio with speakerOnly option in the catch block.

Also can you tell me about this error and a log message, what does it mean and how can we handle this. Sometimes, It comes after calling startAudio()

Hi @vic.yang,

Let’s assume that a session has 3 participants (A, B, and C, here A is the host)
Now already B is sharing the screen but at that time A starts the screen share and because A is the host the screen share stop at B and the control goes to A.

But in this scenario, only B gets the active-share-change event, and C doesn’t get that event because of that, the screen shared by A can’t be rendered at C’s end.

Please check this issue as well.

Hey @vk-jangid

Mute share audio can be done in the share-audio-change event, now you’re able to get the correct share audio state via mediaStream.getShareAudioStatus()

Why do we not suggest muting share audio right after the mediaStream. startShareScreen method? Capturing the screen and capturing the audio are different processes in Video SDK, they are independent. We cannot guarantee they work as you expected.

Thanks
Vic

Hey @vk-jangid

That’s a tricky issue. I have reproduced it.
For now, a workaround to solve it is to wrap the fallback startAudio with speakerOnly:true into a setTimeout callback.

 try {
    await stream.stopAudio();
    await stream.startAudio({ speakerOnly: false }); // this will throw an error of USER_FORBIDDEN_MICROPHONE
  } catch (err) {
    if (err.reason === "USER_FORBIDDEN_MICROPHONE") {
      setTimeout(()=>{
        stream.startAudio({ speakerOnly: true });
      },100)
     
    }
  }

Why does calling stream.startAudio({ speakerOnly: true }); synchronously not take effect? Inside the Video SDK, when the microphone is blocked, we will take time to do the cleanup work. So it conflicts with the second attempt.

Thanks
Vic

Ok, I reported this issue because, in our earlier conversation, you said it was working fine for you when you were calling muteShareAudio right after the startShareScreen call.

Ok, will it be fixed in the upcoming release?

Also, what about this?

Hey @vk-jangid

Not the upcoming release. We will estimate the impact and find a better way to solve this.

Thanks
Vic

Hey @vk-jangid

Instead of the active-share-change event, we will notify the share-content-change event. The shared content will be changed automatically.

Thanks
Vic

Ok, but why is the user who was sharing the screen previously getting the active-share-change event?

Hey @vk-jangid

The user who was sharing the screen will get two events, first is the passively-stop-share event and then the active-share-change event.

There is a stop-start process, so the active-share-change is fired.

Thanks
Vic