|
49 | 49 | EventTypes = Literal[ |
50 | 50 | "participant_connected", |
51 | 51 | "participant_disconnected", |
| 52 | + "participant_active", |
52 | 53 | "local_track_published", |
53 | 54 | "local_track_unpublished", |
54 | 55 | "local_track_subscribed", |
@@ -339,6 +340,8 @@ def on(self, event: EventTypes, callback: Optional[Callable] = None) -> Callable |
339 | 340 | - Arguments: `participant` (RemoteParticipant) |
340 | 341 | - **"participant_disconnected"**: Called when a participant leaves the room. |
341 | 342 | - Arguments: `participant` (RemoteParticipant) |
| 343 | + - **"participant_active"**: Called when a remote participant becomes active and is ready to receive data messages. |
| 344 | + - Arguments: `participant` (RemoteParticipant) |
342 | 345 | - **"local_track_published"**: Called when a local track is published. |
343 | 346 | - Arguments: `publication` (LocalTrackPublication), `track` (Track) |
344 | 347 | - **"local_track_unpublished"**: Called when a local track is unpublished. |
@@ -581,7 +584,7 @@ def unregister_text_stream_handler(self, topic: str): |
581 | 584 | self._text_stream_handlers.pop(topic) |
582 | 585 |
|
583 | 586 | async def disconnect( |
584 | | - self, *, reason: DisconnectReason = DisconnectReason.CLIENT_INITIATED |
| 587 | + self, *, reason: DisconnectReason.ValueType = DisconnectReason.CLIENT_INITIATED |
585 | 588 | ) -> None: |
586 | 589 | """Disconnects from the room.""" |
587 | 590 | if not self.isconnected(): |
@@ -667,6 +670,11 @@ def _on_room_event(self, event: proto_room.RoomEvent): |
667 | 670 | rparticipant = self._remote_participants.pop(identity) |
668 | 671 | rparticipant._info.disconnect_reason = event.participant_disconnected.disconnect_reason |
669 | 672 | self.emit("participant_disconnected", rparticipant) |
| 673 | + elif which == "participant_active": |
| 674 | + rp = self._retrieve_remote_participant(event.participant_active.participant_identity) |
| 675 | + if rp: |
| 676 | + rp._info.state = proto_participant.PARTICIPANT_STATE_ACTIVE |
| 677 | + self.emit("participant_active", rp) |
670 | 678 | elif which == "local_track_published": |
671 | 679 | sid = event.local_track_published.track_sid |
672 | 680 | lpublication = self.local_participant.track_publications[sid] |
|
0 commit comments