diff --git a/livekit-rtc/livekit/rtc/__init__.py b/livekit-rtc/livekit/rtc/__init__.py index bfecba2b..b6784af7 100644 --- a/livekit-rtc/livekit/rtc/__init__.py +++ b/livekit-rtc/livekit/rtc/__init__.py @@ -16,7 +16,7 @@ from ._proto import stats_pb2 as stats from ._proto.e2ee_pb2 import EncryptionState, EncryptionType -from ._proto.participant_pb2 import ParticipantKind +from ._proto.participant_pb2 import ParticipantKind, DisconnectReason from ._proto.room_pb2 import ( ConnectionQuality, ConnectionState, @@ -98,6 +98,7 @@ "LocalParticipant", "Participant", "ParticipantKind", + "DisconnectReason", "RemoteParticipant", "ConnectError", "Room", diff --git a/livekit-rtc/livekit/rtc/participant.py b/livekit-rtc/livekit/rtc/participant.py index 351182b8..6b4ae805 100644 --- a/livekit-rtc/livekit/rtc/participant.py +++ b/livekit-rtc/livekit/rtc/participant.py @@ -107,6 +107,11 @@ def kind(self) -> proto_participant.ParticipantKind.ValueType: """Participant's kind (e.g., regular participant, ingress, egress, sip, agent).""" return self._info.kind + @property + def disconnect_reason(self) -> proto_participant.DisconnectReason.ValueType: + """Reason for the participant's disconnection.""" + return self._info.disconnect_reason + class LocalParticipant(Participant): """Represents the local participant in a room.""" @@ -413,7 +418,8 @@ async def run_handler(): response_error = error except Exception as error: logger.exception( - f"Uncaught error returned by RPC handler for {method}. Returning APPLICATION_ERROR instead. Original error: {error}", + f"Uncaught error returned by RPC handler for { + method}. Returning APPLICATION_ERROR instead. Original error: {error}", ) response_error = RpcError._built_in( RpcError.ErrorCode.APPLICATION_ERROR @@ -432,7 +438,8 @@ async def run_handler(): if res.rpc_method_invocation_response.error: logger.exception( - f"error sending rpc method invocation response: {res.rpc_method_invocation_response.error}" + f"error sending rpc method invocation response: { + res.rpc_method_invocation_response.error}" ) async def set_metadata(self, metadata: str) -> None: diff --git a/livekit-rtc/livekit/rtc/version.py b/livekit-rtc/livekit/rtc/version.py index e61f7a55..11ac8e1a 100644 --- a/livekit-rtc/livekit/rtc/version.py +++ b/livekit-rtc/livekit/rtc/version.py @@ -1 +1 @@ -__version__ = "0.18.4" +__version__ = "0.19.0"