Description
when one person is sharing the screen and some other participant either joins the channel after that or refreshes their screen then the active-share-change event is coming even before the user-added event, and because of that, the canvas element for the screen-share is not in the DOM at that moment, because in our UI the canvas element for the screen share is added in each participants’ card which populates after getting the user-added event.
I have added a screenshot of the console where the first console is of active-share-screen event and then user-added and user-updated.
Which Web Video SDK version?
Using 1.3.0 Web video SDK version
In the Video SDK Web, we provide an API named getActiveShareUserId, when a user joined after someone has started sharing, you can get the shared user via this API, if the value is not null, then use the startShareView(canvas,userId) to render the shared content.
One more issue I am facing currently with the startAudio used with speakerOnly option.
In this case, what is happening is that after calling startAudio with speakerOnly being true then I am not able to start the microphone afterward.
I tried calling unmuteAudio after that and startAudio with no parameter but still the mic is not starting.
If you specified speakerOnly option in startAudio method, you are unable to connect the microphone until stop the audio explicitly via stopAudio and re-connect the audio without the speakerOnly option via startAudio.
One more issue is happening that when I am calling the startAudio with speakerOnly option and then i am stopping the audio and again starting the audio by using stopAudio and startAudio (without speakerOnly option) in the case where the microphone permission is not given at the browser level then sometime ‘USER_FORBIDDEN_MICROPHONE’ error is coming but sometimes it doesn’t.
Why is that?
I tried this in the sample app by calling the startAudio function with speakerOnly parameter being true for once and after that always false but the same issue is there as well.
What do you mean when you mentioned ’ the microphone permission is not given at the browser level '? Does the permission request dialog not appear?
If the permission request dialog pops but the user doesn’t grant the permission(Click the ‘block’ or doesn’t click anything), the Video SDK cannot obtain access to the microphone, then will return ‘USER_FORBIDDEN_MICROPHONE’ error.
And what browser are you using? Chrome, Firefox, Safari, or Edge?
I meant that I blocked the microphone permission, and then when I call the startAudio function then sometime it is throwing the error but sometimes it doesn’t.
It’s happening only in the case when at first I called the startAudio function with speakerOnly option and after that when I am trying to start the mic by stopping the audio and starting the audio without speakerOnly option then sometimes error is coming and sometimes it doesn’t.
I will give you more information about the startAudio method. If the speakerOnly option is set, the Video SDK will not request the microphone permission, otherwise, the microphone permission is required.
The case where I am expecting the error is only where the speakerOnly is set to false.
As I said earlier, At the beginning of the session I am calling startAudio with speakerOnly set to true. At this time I am not expecting any error in any case.
After some time in the session, when I am trying to turn on the mic, As per your suggestion I am stopping the audio first (by calling stopAudio function), and then calling startAudio with speakerOnly set to false.
Only in this case, I am expecting the error but it is not coming, the startAudio function is running successfully.
Let me try to use pseudo code to describe your actions:
async function audioHandler(){
/* The microphone permission was blocked*/
await stream.startAudio({speakerOnly:true});
/* After some other things, rejoin the audio with the microphone connected*/
await stream.stopAudio();
await stream.startAudio(); // Can hear the sound, but cannot speak? And no error on the console?
}
We found this issue, it will be fixed in the next release.
For the current version(1.4.0), if the microphone permission was blocked before the second start audio (without speakerOnly option), a refreshing page action is required.
Ok, and one more thing which I am confused about is that when I am starting the audio with speakerOnly option the participant’s data object is as follows -
so in this case how to show on the UI that the microphone is off or on?
I was using the muted key to decide the mic on and off state but in the speakerOnly state the muted value is false, and I can’t use this.
The participant item doesn’t provide detailed audio information, so you’d better maintain the state of the microphone connected locally, via speakerOnly or the rejected promise USER_FORBIDDEN_MICROPHONE.
Hope this can help you.