Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohaodu committed Jun 1, 2024
1 parent 9497c52 commit 075c987
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 4 additions & 9 deletions packages/web-chat-x-vue/src/classes/PeerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ export class PeerManager {
});
if (!this.communication.value.accepted) {
console.log("User declined the call.");
this.communication.value.await = true;
this.communication.value.accepted = false;
} else {
this.mediaStream.value = await navigator.mediaDevices.getUserMedia({
video: this.communication.value.video,
audio: this.communication.value.audio,
});
}
this.communication.value.await = true;
this.communication.value.accepted = false;
});
});
this.nearPeer.on("call", async (call: MediaConnection) => {
Expand Down Expand Up @@ -259,13 +259,8 @@ export class PeerManager {

// 释放媒体流资源
releaseMediaStream = () => {
this.communication.value = {
await: true,
call: false,
accepted: false,
video: false,
audio: false,
};
this.communication.value.await = true;
this.communication.value.accepted = false;
if (this.mediaStream.value) {
const tracks = this.mediaStream.value.getTracks();
tracks.forEach((track) => track.stop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ onUnmounted(() => {
});
function hungUp() {
elDialogVisible.value = false;
peerManager.mediaConnect?.value?.close();
if (peerManager.mediaConnect.value) {
peerManager.mediaConnect.value.close();
} else {
console.log(peerManager.mediaConnect, peerManager.mediaConnect.value);
}
}
function reject() {
Expand Down

0 comments on commit 075c987

Please sign in to comment.