mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-17 07:39:21 +08:00
Generating colors at the right rtime
This commit is contained in:
parent
cbb65c7005
commit
5bddd4463d
@ -37,10 +37,10 @@ var VideoChat = {
|
||||
socket: io(),
|
||||
remoteVideoWrapper: document.getElementById("wrapper"),
|
||||
localVideo: document.getElementById("local-video"),
|
||||
peerColors: new Map(),
|
||||
peerConnections: new Map(),
|
||||
recognition: undefined,
|
||||
borderColor: undefined,
|
||||
peerColors: new Map(),
|
||||
|
||||
// Call to getUserMedia (provided by adapter.js for cross browser compatibility)
|
||||
// asking for access to both the video and audio streams. If the request is
|
||||
@ -98,17 +98,17 @@ var VideoChat = {
|
||||
},
|
||||
});
|
||||
|
||||
VideoChat.borderColor = uuidToColor(VideoChat.socket.id);
|
||||
VideoChat.localVideo.srcObject = stream;
|
||||
VideoChat.localVideo.style.border = `3px solid ${VideoChat.borderColor}`;
|
||||
|
||||
// Now we're ready to join the chat room.
|
||||
VideoChat.socket.emit("join", roomHash);
|
||||
VideoChat.borderColor = uuidToColor(VideoChat.socket.id);
|
||||
VideoChat.localVideo.style.border = `3px solid ${VideoChat.borderColor}`;
|
||||
|
||||
// Add listeners to the websocket
|
||||
VideoChat.socket.on("full", chatRoomFull);
|
||||
VideoChat.socket.on("offer", VideoChat.onOffer);
|
||||
VideoChat.socket.on("willInitiateCall", VideoChat.call);
|
||||
VideoChat.socket.on("initiateCall", VideoChat.call);
|
||||
|
||||
// Set up listeners on the socket
|
||||
VideoChat.socket.on("candidate", VideoChat.onCandidate);
|
||||
|
Loading…
Reference in New Issue
Block a user