diff --git a/JianGongYun/TRTC/LiveClassroom.cs b/JianGongYun/TRTC/LiveClassroom.cs index db72085..6c5075b 100644 --- a/JianGongYun/TRTC/LiveClassroom.cs +++ b/JianGongYun/TRTC/LiveClassroom.cs @@ -147,7 +147,10 @@ namespace JianGongYun.TRTC WSClient.ReconnectionHappened.Subscribe((info) => { Console.WriteLine($"Reconnection happened, type: {info.Type}"); - WSClient.Send($"{{code:10000,nick:\"{CurrentClassroomEntity.TeacherName}\",\"room\":\"push_{ClassId}\"}}");//进房间 + if (WSClient.IsRunning) + { + WSClient.Send($"{{code:10000,nick:\"{CurrentClassroomEntity.TeacherName}\",\"room\":\"push_{ClassId}\"}}");//进房间 + } liveWinMode.WSConneced = true; }); WSClient.DisconnectionHappened.Subscribe((info) => @@ -164,7 +167,10 @@ namespace JianGongYun.TRTC Heartbeat.Interval = TimeSpan.FromSeconds(5); Heartbeat.Tick += new EventHandler((a, b) => { - WSClient.Send("{code:10016}");//向服务器发送心跳包 + if (WSClient.IsRunning) + { + WSClient.Send("{code:10016}");//向服务器发送心跳包 + } }); Heartbeat.Start(); @@ -456,7 +462,7 @@ namespace JianGongYun.TRTC { if (liveWinMode.MicRunning) { - if (tag=="mic") + if (tag == "mic") { liveWinMode.MicMute = mute.HasValue ? mute.Value : !liveWinMode.MicMute; if (liveWinMode.MicMute)