Переглянути джерело

Merge branch 'master' of https://git.nanodreamtech.com/wkw/wallet_app

wkw 1 тиждень тому
батько
коміт
c9650c78a9
2 змінених файлів з 12 додано та 1 видалено
  1. 2 1
      src/common/constant/msgType.js
  2. 10 0
      src/views/im/hook/messagesHook.js

+ 2 - 1
src/common/constant/msgType.js

@@ -19,4 +19,5 @@ export const MSG_TYPE_MAP = [
 
 export const MESSAGE_TYPE_USER = 1; // 单聊
 export const MESSAGE_TYPE_GROUP = 2; // 群聊
- 
+ 
+export const MESSAGE_TRANS_TYPE = "webrtc";

+ 10 - 0
src/views/im/hook/messagesHook.js

@@ -1,4 +1,5 @@
 import { MSG_TYPE, MSG_TYPE_MAP } from "@/common/constant/msgType";
+import * as Constant from "@/common/constant/Constant";
 
 // 发送消息处理
 export const setMessageHook = (message, state) => { 
@@ -35,6 +36,7 @@ export const setMessageHook = (message, state) => {
   }
 };
 
+// 接收到消息处理
 export const handleMessageHook = (message, state) => {
   // 文本消息
   message.avatar = state.toUserInfo.avatar;
@@ -68,4 +70,12 @@ export const handleMessageHook = (message, state) => {
       toUsername: message.to,
     });
   }
+  // 音频通话
+  if (message.contentType === MSG_TYPE.AUDIO_ONLINE) {
+     if (message.contentType >= Constant.DIAL_MEDIA_START && messagePB.contentType <= Constant.DIAL_MEDIA_END) {
+            this.dealMediaCall(messagePB);
+            return;
+        }
+        const { type, sdp, iceCandidate } = JSON.parse(messagePB.content);
+  }
 };