|
@@ -341,7 +341,7 @@ const sendAudioMessage = async (event) => {
|
|
content: text.value, // 如果有文本内容
|
|
content: text.value, // 如果有文本内容
|
|
contentType: MSG_TYPE.AUDIO, // 音频消息类型
|
|
contentType: MSG_TYPE.AUDIO, // 音频消息类型
|
|
messageType: MESSAGE_TYPE_USER, // 单聊消息
|
|
messageType: MESSAGE_TYPE_USER, // 单聊消息
|
|
- to: route.query.uuid, // 接收方ID
|
|
|
|
|
|
+
|
|
fileSuffix: "wav", // 使用webm后缀更准确
|
|
fileSuffix: "wav", // 使用webm后缀更准确
|
|
file: audioData, // 将Uint8Array转为普通数组
|
|
file: audioData, // 将Uint8Array转为普通数组
|
|
};
|
|
};
|
|
@@ -363,7 +363,7 @@ const sendMessage = () => {
|
|
content: text.value,
|
|
content: text.value,
|
|
contentType: MSG_TYPE.TEXT, // 1: 文本消息
|
|
contentType: MSG_TYPE.TEXT, // 1: 文本消息
|
|
messageType: MESSAGE_TYPE_USER, // 1: 单聊天
|
|
messageType: MESSAGE_TYPE_USER, // 1: 单聊天
|
|
- to: route.query.uuid,
|
|
|
|
|
|
+
|
|
};
|
|
};
|
|
wsStore.sendMessage(message);
|
|
wsStore.sendMessage(message);
|
|
text.value = "";
|
|
text.value = "";
|
|
@@ -377,7 +377,6 @@ const afterRead = async (file) => {
|
|
content: text.value, // 如果有文本内容
|
|
content: text.value, // 如果有文本内容
|
|
contentType: MSG_TYPE.IMAGE, // 音频消息类型
|
|
contentType: MSG_TYPE.IMAGE, // 音频消息类型
|
|
messageType: MESSAGE_TYPE_USER, // 单聊消息
|
|
messageType: MESSAGE_TYPE_USER, // 单聊消息
|
|
- to: route.query.uuid, // 接收方ID
|
|
|
|
fileSuffix: file.type, // 使用webm后缀更准确
|
|
fileSuffix: file.type, // 使用webm后缀更准确
|
|
file: new Uint8Array(arrayBuffer), // 将Uint8Array转为普通数组
|
|
file: new Uint8Array(arrayBuffer), // 将Uint8Array转为普通数组
|
|
};
|
|
};
|
|
@@ -403,7 +402,6 @@ const startAudioOnline = async () => {
|
|
rtcStore.initConnection(MESSAGE_TYPE_USER, {
|
|
rtcStore.initConnection(MESSAGE_TYPE_USER, {
|
|
fromUsername: walletStore.username,
|
|
fromUsername: walletStore.username,
|
|
from: walletStore.account,
|
|
from: walletStore.account,
|
|
- to: route.query.uuid,
|
|
|
|
});
|
|
});
|
|
// 获取本地媒体流并添加到连接
|
|
// 获取本地媒体流并添加到连接
|
|
try {
|
|
try {
|
|
@@ -445,6 +443,7 @@ const formatTime = (timestamp) => {
|
|
|
|
|
|
// 页面生命周期
|
|
// 页面生命周期
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
+ wsStore.toUserInfo.uuid = route.query.uuid;
|
|
wsStore.getMessages({
|
|
wsStore.getMessages({
|
|
uuid: walletStore.account,
|
|
uuid: walletStore.account,
|
|
messageType: 1,
|
|
messageType: 1,
|