|
@@ -1,4 +1,5 @@
|
|
import { MSG_TYPE, MSG_TYPE_MAP } from "@/common/constant/msgType";
|
|
import { MSG_TYPE, MSG_TYPE_MAP } from "@/common/constant/msgType";
|
|
|
|
+import * as Constant from "@/common/constant/Constant";
|
|
|
|
|
|
// 发送消息处理
|
|
// 发送消息处理
|
|
export const setMessageHook = (message, state) => {
|
|
export const setMessageHook = (message, state) => {
|
|
@@ -35,6 +36,7 @@ export const setMessageHook = (message, state) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// 接收到消息处理
|
|
export const handleMessageHook = (message, state) => {
|
|
export const handleMessageHook = (message, state) => {
|
|
// 文本消息
|
|
// 文本消息
|
|
message.avatar = state.toUserInfo.avatar;
|
|
message.avatar = state.toUserInfo.avatar;
|
|
@@ -68,4 +70,12 @@ export const handleMessageHook = (message, state) => {
|
|
toUsername: message.to,
|
|
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);
|
|
|
|
+ }
|
|
};
|
|
};
|