优化消息发送函数,设定音视频通话的记录发送规则

This commit is contained in:
2022-03-01 10:40:00 +08:00
parent 04d9d772c4
commit dbda19870f
11 changed files with 324 additions and 102 deletions

View File

@@ -75,7 +75,7 @@
// 关闭扬声器
volumeOff: false,
// 通话时长
duration: 0,
duration: 0,
interval: null
}
},
@@ -83,7 +83,7 @@
this.avatarSize = utils.rpx2px(200)
this.targetId = e.targetId
this.mediaType = e.mediaType
this.isCall = Boolean(e.isCall)
this.isCall = Boolean(e.isCall)
// 进入页面开启外呼
if (this.isCall) {
CallLib.startSingleCall(this.targetId, this.mediaType, '');
@@ -131,25 +131,9 @@
}
},
methods: {
afterHangup() {
clearInterval(this.interval)
const targetId = this.targetId
const sentStatus = 30
const messageContent = {
objectName: 'RC:InfoNtf',
userInfo: this.$store.getters.sender,
message: JSON.stringify({
mediaType: this.mediaType,
connected: this.connected,
duration: this.duration
})
}
const sentTime = 0
if (this.isCall) {
IMLib.insertOutgoingMessage(1, targetId, sentStatus, messageContent, sentTime)
} else {
IMLib.insertIncomingMessage(1, targetId, targetId, sentStatus, messageContent, sentTime)
}
afterHangup() {
clearInterval(this.interval)
// duration: this.duration
uni.$emit('onReceiveMessage_' + this.targetId, {
targetId: this.targetId
})
@@ -179,9 +163,9 @@
CallLib.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false)
CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
}, 200)
}
this.interval = setInterval(() => {
this.duration++
}
this.interval = setInterval(() => {
this.duration++
}, 1000)
},
// 切换主屏显示人