Compare commits

..

1 Commits

Author SHA1 Message Date
56835d6660 added log for dtls transport-connect 2022-10-05 15:44:46 +03:00

16
app.js
View File

@ -215,14 +215,12 @@ peers.on('connection', async socket => {
socket.on('transport-connect', async ({ dtlsParameters }) => {
try {
const callId = socketDetails[socket.id];
// console.log('🔴 typeof dtlsParameters', typeof dtlsParameters);
// console.log('🟢 dtlsParameters', JSON.parse(dtlsParameters));
// console.log('🟡 dtlsParameters', dtlsParameters);
if (typeof dtlsParameters === 'string') dtlsParameters = JSON.parse(dtlsParameters);
console.log(`[transport-connect] socket.id ${socket.id} | callId ${callId}`);
await videoCalls[callId].producerTransport.connect({ dtlsParameters });
} catch (error) {
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.stack}`);
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
}
});
@ -231,9 +229,11 @@ peers.on('connection', async socket => {
- For the router with the id callId, we make produce on producerTransport
- Create the handler on producer at the 'transportclose' event
*/
socket.on('transport-produce', async ({ kind, rtpParameters, appData }) => {
socket.on('transport-produce', async ({ kind, rtpParameters, appData }, callback) => {
try {
const callId = socketDetails[socket.id];
if (typeof rtpParameters === 'string') rtpParameters = JSON.parse(rtpParameters);
console.log('[transport-produce] | socket.id', socket.id, '| callId', callId);
videoCalls[callId].producer = await videoCalls[callId].producerTransport.produce({
kind,
@ -246,6 +246,11 @@ peers.on('connection', async socket => {
console.log('transport for this producer closed', callId)
closeCall(callId);
});
// Send back to the client the Producer's id
// callback({
// id: videoCalls[callId].producer.id
// });
} catch (error) {
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
}
@ -385,7 +390,6 @@ const createWebRtcTransportLayer = async (callId, callback) => {
dtlsParameters: transport.dtlsParameters,
};
console.log(`createWebRtcTransportLayer | params.dtlsParameters ${params.dtlsParameters}`);
// Send back to the client the params
callback({ params });