mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 22:09:21 +00:00
Improved the way ready messages are sent
This commit is contained in:
parent
be22b55f89
commit
69fffc2f32
@ -680,6 +680,10 @@ ComunicWeb.components.calls.callWindow = {
|
|||||||
ComunicWeb.components.calls.callWindow.createPeerConnection(call, member, false);
|
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){
|
createPeerConnection: function(call, member, isInitiator){
|
||||||
|
|
||||||
var peerConnection = {
|
var peerConnection = {
|
||||||
peer: undefined
|
peer: undefined,
|
||||||
|
connected: false
|
||||||
};
|
};
|
||||||
call.streams["peer-" + member.userID] = peerConnection;
|
call.streams["peer-" + member.userID] = peerConnection;
|
||||||
|
|
||||||
@ -727,6 +732,10 @@ ComunicWeb.components.calls.callWindow = {
|
|||||||
peerConnection.video.remove();
|
peerConnection.video.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peer.on("connect", function(){
|
||||||
|
peerConnection.connected = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
peer.on("error", function(err){
|
peer.on("error", function(err){
|
||||||
console.error("Peer error !", err, member);
|
console.error("Peer error !", err, member);
|
||||||
@ -750,11 +759,6 @@ ComunicWeb.components.calls.callWindow = {
|
|||||||
peer.on("stream", function(stream){
|
peer.on("stream", function(stream){
|
||||||
ComunicWeb.components.calls.callWindow.streamAvailable(call, member, 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())
|
if(member.userID > userID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//Check if peer connection is already being created
|
||||||
|
if(call.streams.hasOwnProperty("peer-" + member.userID))
|
||||||
|
return;
|
||||||
|
|
||||||
this.createPeerConnection(call, member, true);
|
this.createPeerConnection(call, member, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user