mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 09:58:51 +00:00
Improved the way ready messages are sent
This commit is contained in:
parent
be22b55f89
commit
69fffc2f32
@ -679,6 +679,10 @@ ComunicWeb.components.calls.callWindow = {
|
||||
//Else we have to create peer
|
||||
ComunicWeb.components.calls.callWindow.createPeerConnection(call, member, false);
|
||||
}
|
||||
|
||||
//Send ready message if the connection is not established yet
|
||||
if(!call.streams["peer-" + member.userID].connected)
|
||||
call.signalClient.sendReadyMessage(member.user_call_id);
|
||||
|
||||
});
|
||||
|
||||
@ -695,7 +699,8 @@ ComunicWeb.components.calls.callWindow = {
|
||||
createPeerConnection: function(call, member, isInitiator){
|
||||
|
||||
var peerConnection = {
|
||||
peer: undefined
|
||||
peer: undefined,
|
||||
connected: false
|
||||
};
|
||||
call.streams["peer-" + member.userID] = peerConnection;
|
||||
|
||||
@ -727,6 +732,10 @@ ComunicWeb.components.calls.callWindow = {
|
||||
peerConnection.video.remove();
|
||||
}
|
||||
|
||||
peer.on("connect", function(){
|
||||
peerConnection.connected = true;
|
||||
});
|
||||
|
||||
|
||||
peer.on("error", function(err){
|
||||
console.error("Peer error !", err, member);
|
||||
@ -750,11 +759,6 @@ ComunicWeb.components.calls.callWindow = {
|
||||
peer.on("stream", function(stream){
|
||||
ComunicWeb.components.calls.callWindow.streamAvailable(call, member, stream);
|
||||
});
|
||||
|
||||
|
||||
//If this peer does not initialize connection, inform other peer we are ready
|
||||
if(!isInitiator)
|
||||
call.signalClient.sendReadyMessage(member.user_call_id);
|
||||
},
|
||||
|
||||
|
||||
@ -776,6 +780,10 @@ ComunicWeb.components.calls.callWindow = {
|
||||
if(member.userID > userID())
|
||||
return;
|
||||
|
||||
//Check if peer connection is already being created
|
||||
if(call.streams.hasOwnProperty("peer-" + member.userID))
|
||||
return;
|
||||
|
||||
this.createPeerConnection(call, member, true);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user