🏷 Question
Is there any way to have a listener 'roomCompleted' or something similar? in JS!
I notice that room.on('disconnected') is triggered if the room is completed on the backend or if the local participant left the room
how can I differentiate between both cases?
Hi @alielkhateeb ,
Can you elaborate on what you mean by "roomCompleted". Does it mean that everybody else but the LocalParticipant have left the Room? If so, you can use the "participantDisconnected" event as follows:
room.on('participantDisconnected', () => {
if (room.participants.size === 0) {
console.log('Room completed');
}
});
Please let me know if you have a different definition of "roomCompleted".
Thanks,
Manjesh Malavalli
Hey @manjeshbhargav
No I didn't mean that, cause when everybody leaves the room, they can still rejoin, and the room status is set to completed automatically if it was idle for 5 mins, this is the kind of completed I meant.
It can happen in one of 2 situations:
$client->video
->rooms("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
->update("completed");So what I want to do is, when someone call the Rest API as mentioned above to force a room to completed status, I want the participants in that room to be kicked LOL.
When I use room.on('disconnected') listener it is fired whenever the user leave the room, not only when the room is set to completed. So that is my question, how to differentiate between a local participant leaving the room and someone set the room status to completed through the Rest API?
Sorry if I am not clear enough, let me know if the question is not clear I will give you some drawings to elaborate more.
Thanks!
We would also appreciate this.
It would be ideal to differentiate between a participant becoming disconnected if:
completedHey @markandrus is there any hope of getting this more granular reporting?
Yes, @jamesgraham — the feature request on the backend is tagged VIDEO-1550. We will provision a distinct error code in the 531XX block, "Room errors". For example, it might be "Room completed". Then, if you were to be disconnected from the Room due to completion, you'd unambiguously know what happened.
@jamesgraham let me also clarify:
disconnect, will emit the "disconnected" event _without_ an error.Thanks, we look forward to 1.9.0 and any updated docs 🎉
Reopening until we actually do the release.
This was released in twilio-video.[email protected].
Most helpful comment
This was released in twilio-video.[email protected].