From 0642bd43a451ca4bbb569349d372b8fd3081f8f7 Mon Sep 17 00:00:00 2001 From: xfe18827675401 Date: Mon, 6 Nov 2023 03:49:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E5=92=8C=E8=A7=86=E9=A2=91=E4=BC=A0=E8=BE=93?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E9=87=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CyberComm.cs" | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git "a/XFE\345\220\204\347\261\273\346\213\223\345\261\225/CyberComm.cs" "b/XFE\345\220\204\347\261\273\346\213\223\345\261\225/CyberComm.cs" index 53abab4..84180d5 100644 --- "a/XFE\345\220\204\347\261\273\346\213\223\345\261\225/CyberComm.cs" +++ "b/XFE\345\220\204\347\261\273\346\213\223\345\261\225/CyberComm.cs" @@ -871,7 +871,11 @@ public enum XCCBinaryMessageType /// /// 音频消息 /// - Audio + Audio, + /// + /// 视频消息 + /// + Video } /// /// XFE网络通信明文返回消息类型 @@ -885,7 +889,15 @@ public enum XCCTextMessageType /// /// 图片消息 /// - Image + Image, + /// + /// 音频消息 + /// + Audio, + /// + /// 视频消息 + /// + Video } class XCCNetWorkBase { @@ -1120,11 +1132,15 @@ public async Task StartXCC(bool autoReconnect = true, int reconnectMaxTimes = -1 case "[XCCTextMessage]": messageType = XCCTextMessageType.Text; break; - case "[XCCImage]": messageType = XCCTextMessageType.Image; break; - + case "[XCCAudio]": + messageType = XCCTextMessageType.Audio; + break; + case "[XCCVideo]": + messageType = XCCTextMessageType.Video; + break; default: break; } @@ -1156,6 +1172,9 @@ public async Task StartXCC(bool autoReconnect = true, int reconnectMaxTimes = -1 case "audio": messageType = XCCBinaryMessageType.Audio; break; + case "video": + messageType = XCCBinaryMessageType.Video; + break; case "callback": UpdateTaskTrigger?.Invoke(true, messageId); continue; @@ -1203,7 +1222,7 @@ public async Task StartXCC(bool autoReconnect = true, int reconnectMaxTimes = -1 /// 待发送的文本 /// 最长超时时长 /// 服务器接收校验是否成功 - public async Task SendTextMessage(string message, int timeout = 10000) + public async Task SendTextMessage(string message, int timeout = 30000) { var messageId = Guid.NewGuid().ToString(); return await SendTextMessage(message, messageId, timeout); @@ -1337,7 +1356,7 @@ public async Task SendImage(string filePath) { try { - return await SendSignedBinaryMessage(File.ReadAllBytes(filePath), "image", 30000); + return await SendSignedBinaryMessage(File.ReadAllBytes(filePath), "image", 60000); } catch (Exception ex) { @@ -1345,6 +1364,23 @@ public async Task SendImage(string filePath) } } /// + /// 发送视频 + /// + /// 视频路径 + /// 服务器接收校验是否成功 + /// + public async Task SendVideo(string filePath) + { + try + { + return await SendSignedBinaryMessage(File.ReadAllBytes(filePath), "video", 300000); + } + catch (Exception ex) + { + throw new XFECyberCommException("客户端发送视频到服务器时出现异常", ex); + } + } + /// /// 发送音频 /// /// 二进制音频流