mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Rady to connect to other peers
This commit is contained in:
parent
8febe2a523
commit
59cd9e0fb4
@ -232,6 +232,11 @@ class UserWebSocket {
|
||||
case "new_call_signal":
|
||||
SendEvent("newCallSignal", msg.data);
|
||||
break;
|
||||
|
||||
case "call_peer_ready":
|
||||
SendEvent("callPeerReady", msg.data);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
console.error("WS Unspported kind of message!", msg);
|
||||
|
@ -97,6 +97,13 @@ document.addEventListener("newCallSignal", (e) => {
|
||||
OpenConversations.get(detail.callID).NewSignal(detail.peerID, detail.data)
|
||||
});
|
||||
|
||||
document.addEventListener("callPeerReady", (e) => {
|
||||
const detail = e.detail;
|
||||
|
||||
if(OpenConversations.has(detail.callID))
|
||||
OpenConversations.get(detail.callID).PeerReady(detail.peerID)
|
||||
})
|
||||
|
||||
|
||||
document.addEventListener("wsClosed", () => {
|
||||
// Close all the current conversations
|
||||
|
@ -96,6 +96,11 @@ class CallWindow extends CustomEvents {
|
||||
callID: this.conv.ID
|
||||
})
|
||||
|
||||
// Start to connect to ready pears
|
||||
for(const user of currMembersList)
|
||||
if(user.userID != userID() && user.ready)
|
||||
await this.PeerReady(user.userID)
|
||||
|
||||
// Start to stream audio & video
|
||||
await this.startStreaming();
|
||||
|
||||
@ -195,6 +200,10 @@ class CallWindow extends CustomEvents {
|
||||
convID: this.conv.ID
|
||||
})
|
||||
|
||||
|
||||
if(this.mainPeer)
|
||||
this.mainPeer.destroy();
|
||||
|
||||
if(propagate)
|
||||
this.emitEvent("close");
|
||||
}
|
||||
@ -325,6 +334,10 @@ class CallWindow extends CustomEvents {
|
||||
});
|
||||
}
|
||||
|
||||
async PeerReady(peerID) {
|
||||
alert("Start to receive " + peerID)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles new signals
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user