LINXD-2270: Removed console logs; Update commented code

This commit is contained in:
Sergiu Toma 2022-12-27 13:11:06 +02:00
parent b3409de3ba
commit 342d09c3e6

30
app.js
View File

@ -13,40 +13,40 @@ try {
} }
const mediasoup = require('mediasoup'); const mediasoup = require('mediasoup');
let worker let worker;
/** /**
* *
* videoCalls - Dictionary of Object(s) * videoCalls - Dictionary of Object(s)
* '<callId>': { * '<callId>': {
* router: Router, router * router: Router,
* initiatorAudioProducer: Producer, * initiatorAudioProducer: Producer,
* initiatorVideoProducer: Producer, * initiatorVideoProducer: Producer,
* receiverVideoProducer: Producer, producerVideo * receiverVideoProducer: Producer,
* receiverAudioProducer: Producer, producerAudio * receiverAudioProducer: Producer,
* initiatorProducerTransport: Producer Transport, * initiatorProducerTransport: Producer Transport,
* receiverProducerTransport: Producer Transport, producerTransport * receiverProducerTransport: Producer Transport,
* initiatorConsumerVideo: Consumer, consumerVideo * initiatorConsumerVideo: Consumer,
* initiatorConsumerAudio: Consumer, consumerAudio * initiatorConsumerAudio: Consumer,
* initiatorConsumerTransport: Consumer Transport consumerTransport * initiatorConsumerTransport: Consumer Transport
* initiatorSockerId * initiatorSockerId
* receiverSocketId * receiverSocketId
* } * }
* *
**/ **/
let videoCalls = {} let videoCalls = {};
let socketDetails = {} let socketDetails = {};
app.get('/', (_req, res) => { app.get('/', (_req, res) => {
res.send('Hello from mediasoup app!') res.send('Hello from mediasoup app!')
}) });
app.use('/sfu', express.static(path.join(__dirname, 'public'))) app.use('/sfu', express.static(path.join(__dirname, 'public')));
// SSL cert for HTTPS access // SSL cert for HTTPS access
const options = { const options = {
key: fs.readFileSync(process.env.SERVER_KEY, 'utf-8'), key: fs.readFileSync(process.env.SERVER_KEY, 'utf-8'),
cert: fs.readFileSync(process.env.SERVER_CERT, 'utf-8'), cert: fs.readFileSync(process.env.SERVER_CERT, 'utf-8'),
} };
const httpsServer = https.createServer(options, app); const httpsServer = https.createServer(options, app);
@ -225,7 +225,6 @@ peers.on('connection', async socket => {
*/ */
socket.on('createWebRtcTransport', async ({ sender }, callback) => { socket.on('createWebRtcTransport', async ({ sender }, callback) => {
try { try {
console.log('🟥', socket.id, JSON.stringify(sender));
const callId = socketDetails[socket.id]; const callId = socketDetails[socket.id];
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`); console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
if (sender) { if (sender) {
@ -429,7 +428,6 @@ peers.on('connection', async socket => {
} else if (!canConsumeVideo && canConsumeAudio) { } else if (!canConsumeVideo && canConsumeAudio) {
const audioParams = await consumeAudio(callId, socket.id, rtpCapabilities) const audioParams = await consumeAudio(callId, socket.id, rtpCapabilities)
const data = { videoParams: null, audioParams }; const data = { videoParams: null, audioParams };
console.log('-----------======= data', data);
callback(data); callback(data);
} else { } else {
console.log(`[consume] Can't consume | callId ${callId}`); console.log(`[consume] Can't consume | callId ${callId}`);
@ -459,8 +457,6 @@ peers.on('connection', async socket => {
(videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerVideo.resume(); (videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerVideo.resume();
(videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerAudio.resume(); (videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerAudio.resume();
} }
// await videoCalls[callId].consumerVideo.resume();
// await videoCalls[callId].consumerAudio.resume();
} catch (error) { } catch (error) {
console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);
} }