LINXD-2270-p2 #19
13
app.js
13
app.js
@ -200,9 +200,9 @@ peers.on('connection', async socket => {
|
|||||||
console.log('[createRoom] callId', callId);
|
console.log('[createRoom] callId', callId);
|
||||||
videoCalls[callId] = { router: await worker.createRouter({ mediaCodecs }) }
|
videoCalls[callId] = { router: await worker.createRouter({ mediaCodecs }) }
|
||||||
console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`);
|
console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`);
|
||||||
videoCalls[callId].initiatorSockerId = socket.id
|
|
||||||
} else {
|
|
||||||
videoCalls[callId].receiverSocketId = socket.id
|
videoCalls[callId].receiverSocketId = socket.id
|
||||||
|
} else {
|
||||||
|
videoCalls[callId].initiatorSockerId = socket.id
|
||||||
}
|
}
|
||||||
socketDetails[socket.id] = callId;
|
socketDetails[socket.id] = callId;
|
||||||
// rtpCapabilities is set for callback
|
// rtpCapabilities is set for callback
|
||||||
@ -453,6 +453,10 @@ const consumeAudio = async (callId, rtpCapabilities) => {
|
|||||||
console.log('producer of consumer closed', callId);
|
console.log('producer of consumer closed', callId);
|
||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(isInitiator(callId, sockId)) {
|
||||||
|
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
id: videoCalls[callId].consumerAudio.id,
|
id: videoCalls[callId].consumerAudio.id,
|
||||||
producerId: videoCalls[callId].producerAudio.id,
|
producerId: videoCalls[callId].producerAudio.id,
|
||||||
@ -461,9 +465,8 @@ const consumeAudio = async (callId, rtpCapabilities) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isInitiator = async (callId, socketId) => {
|
const isInitiator = (callId, socketId) => {
|
||||||
if (videoCalls[callId].initiatorSockerId === socketId) return true;
|
return (videoCalls[callId].initiatorSockerId === socketId);
|
||||||
else return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user