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