LH-276: Add close-producer event handler; Update client #30
27
app.js
27
app.js
@ -389,19 +389,32 @@ peers.on('connection', async (socket) => {
|
|||||||
try {
|
try {
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
const socketId = socket.id;
|
const socketId = socket.id;
|
||||||
|
let audioParams, videoParams;
|
||||||
|
|
||||||
console.log(`[consume] socket ${socket.id} | callId: ${callId}`);
|
console.log(`[consume] socket ${socketId} | callId: ${callId}`);
|
||||||
|
|
||||||
if (typeof rtpCapabilities === 'string') rtpCapabilities = JSON.parse(rtpCapabilities);
|
if (typeof rtpCapabilities === 'string') rtpCapabilities = JSON.parse(rtpCapabilities);
|
||||||
|
|
||||||
callback({
|
|
||||||
videoParams: await consumeVideo({ callId, socketId, rtpCapabilities }),
|
|
||||||
audioParams: await consumeAudio({ callId, socketId, rtpCapabilities }),
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[consume] | ERROR | callId: ${socketDetails[socket.id]} | error: ${error.message}`);
|
console.error(`[consume] | ERROR | callId: ${callId} | error: ${error.message}`);
|
||||||
callback({ params: { error } });
|
callback({ params: { error } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
videoParams = await consumeVideo({ callId, socketId, rtpCapabilities });
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[consume] | ERROR | videoParams | callId: ${callId} | error: ${error.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
audioParams = await consumeAudio({ callId, socketId, rtpCapabilities });
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[consume] | ERROR | audioParams | callId: ${callId} | error: ${error.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback({
|
||||||
|
videoParams,
|
||||||
|
audioParams,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user