|
@@ -142,6 +142,7 @@ export default {
|
|
userMonitor: {},
|
|
userMonitor: {},
|
|
client: null,
|
|
client: null,
|
|
localStream: null,
|
|
localStream: null,
|
|
|
|
+ isHandup: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -270,6 +271,20 @@ export default {
|
|
domEmpty(document.getElementById("communication-host"));
|
|
domEmpty(document.getElementById("communication-host"));
|
|
remoteStream.play("communication-host", { objectFit: "contain" });
|
|
remoteStream.play("communication-host", { objectFit: "contain" });
|
|
});
|
|
});
|
|
|
|
+ this.client.on("stream-removed", (event) => {
|
|
|
|
+ // 监考端手动挂断时也会触发这个事件
|
|
|
|
+ const remoteStream = event.stream;
|
|
|
|
+ if (
|
|
|
|
+ remoteStream.getUserId() !== student.sourceUserId ||
|
|
|
|
+ remoteStream.getType() !== "main" ||
|
|
|
|
+ this.isHandup
|
|
|
|
+ )
|
|
|
|
+ return;
|
|
|
|
+ console.log(event);
|
|
|
|
+ console.log(`${remoteStream.getUserId()}已退出房间!`);
|
|
|
|
+ this.notifyError("对方已挂断!");
|
|
|
|
+ this.hangup();
|
|
|
|
+ });
|
|
|
|
|
|
// 加入房间
|
|
// 加入房间
|
|
let roomJoinResult = true;
|
|
let roomJoinResult = true;
|
|
@@ -314,13 +329,18 @@ export default {
|
|
recordId: student.examRecordId,
|
|
recordId: student.examRecordId,
|
|
source: student.source,
|
|
source: student.source,
|
|
});
|
|
});
|
|
|
|
+ this.isHandup = false;
|
|
},
|
|
},
|
|
async hangup() {
|
|
async hangup() {
|
|
|
|
+ if (this.isHandup) return;
|
|
|
|
+ this.isHandup = true;
|
|
this.$refs.SecondTimer.end();
|
|
this.$refs.SecondTimer.end();
|
|
// 结束学生的通话
|
|
// 结束学生的通话
|
|
await communicationOver({
|
|
await communicationOver({
|
|
recordId: this.curStudent.examRecordId,
|
|
recordId: this.curStudent.examRecordId,
|
|
source: this.curStudent.source,
|
|
source: this.curStudent.source,
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ console.log("结束通话状态异常!");
|
|
});
|
|
});
|
|
this.curStudent = {};
|
|
this.curStudent = {};
|
|
|
|
|