Skip to content

Commit a989edb

Browse files
expose num_participants attribute (#177)
* expose num_participants attribute * fix. --------- Co-authored-by: cloudwebrtc <duanweiwei1982@gmail.com>
1 parent 35cafbe commit a989edb

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Runtime/Scripts/Room.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public class Room
130130
public string Sid { private set; get; }
131131
public string Name { private set; get; }
132132
public string Metadata { private set; get; }
133+
public uint NumParticipants { private set; get; }
133134
public LocalParticipant LocalParticipant { private set; get; }
134135
public ConnectionState ConnectionState { private set; get; }
135136
public bool IsConnected => RoomHandle != null && ConnectionState != ConnectionState.ConnDisconnected;
@@ -233,6 +234,7 @@ internal void UpdateFromInfo(RoomInfo info)
233234
Sid = info.Sid;
234235
Name = info.Name;
235236
Metadata = info.Metadata;
237+
NumParticipants = info.NumParticipants;
236238
}
237239

238240
internal void OnRpcMethodInvocationReceived(RpcMethodInvocationEvent e)
@@ -492,6 +494,17 @@ internal void OnEventReceived(RoomEvent e)
492494
E2EeStateChanged?.Invoke(participant, e.E2EeStateChanged.State);
493495
}
494496
break;
497+
case RoomEvent.MessageOneofCase.RoomUpdated:
498+
{
499+
UpdateFromInfo(e.RoomUpdated);
500+
}
501+
break;
502+
case RoomEvent.MessageOneofCase.Moved:
503+
{
504+
// Participants moved to new room.
505+
UpdateFromInfo(e.Moved);
506+
}
507+
break;
495508
}
496509
}
497510

0 commit comments

Comments
 (0)