test
This commit is contained in:
parent
af85026bd2
commit
6efa8005b0
100
app.js
100
app.js
@ -258,35 +258,19 @@ peers.on('connection', async socket => {
|
|||||||
if (typeof dtlsParameters === 'string') dtlsParameters = JSON.parse(dtlsParameters);
|
if (typeof dtlsParameters === 'string') dtlsParameters = JSON.parse(dtlsParameters);
|
||||||
|
|
||||||
console.log(`[transport-connect] socket ${socket.id} | callId ${callId}`);
|
console.log(`[transport-connect] socket ${socket.id} | callId ${callId}`);
|
||||||
|
|
||||||
if (!isInitiator(callId, socket.id)) {
|
if (!isInitiator(callId, socket.id)) {
|
||||||
await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters });
|
await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters });
|
||||||
// if (!isInitiator(callId, socket.id)) {
|
|
||||||
console.log('🟥 Emit to initiatorSocket');
|
|
||||||
videoCalls[callId].initiatorSocket.emit('new-producer', {
|
videoCalls[callId].initiatorSocket.emit('new-producer', {
|
||||||
callId
|
callId
|
||||||
});
|
});
|
||||||
|
|
||||||
// } else {
|
|
||||||
// console.log('🟥 Emit to receiverSocket');
|
|
||||||
// videoCalls[callId].receiverSocket.emit('new-producer', {
|
|
||||||
// callId
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters });
|
await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters });
|
||||||
// if (!isInitiator(callId, socket.id)) {
|
|
||||||
// console.log('🟥 Emit to initiatorSocket');
|
|
||||||
// videoCalls[callId].initiatorSocket.emit('new-producer', {
|
|
||||||
// callId
|
|
||||||
// });
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
console.log('🟥 Emit to receiverSocket');
|
|
||||||
videoCalls[callId].receiverSocket.emit('new-producer', {
|
videoCalls[callId].receiverSocket.emit('new-producer', {
|
||||||
callId
|
callId
|
||||||
});
|
});
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
|
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||||
}
|
}
|
||||||
@ -303,86 +287,6 @@ peers.on('connection', async socket => {
|
|||||||
if (typeof rtpParameters === 'string') rtpParameters = JSON.parse(rtpParameters);
|
if (typeof rtpParameters === 'string') rtpParameters = JSON.parse(rtpParameters);
|
||||||
|
|
||||||
console.log(`[transport-produce] kind: ${kind} | socket: ${socket.id} | callId: ${callId}`);
|
console.log(`[transport-produce] kind: ${kind} | socket: ${socket.id} | callId: ${callId}`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const router = videoCalls[callId].router;
|
|
||||||
|
|
||||||
// router.observer.on("newtransport", (transport) => {
|
|
||||||
// transport.observer.on("newproducer", (producer) => {
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "new producer created [worker.pid:%d, router.id:%s, transport.id:%s, producer.id:%s]",
|
|
||||||
// worker.pid, router.id, transport.id, producer.id
|
|
||||||
// );
|
|
||||||
|
|
||||||
// // if (!isInitiator(callId, socket.id)) {
|
|
||||||
// // console.log('🟥 Emit to initiatorSocket');
|
|
||||||
// // videoCalls[callId].initiatorSocket.emit('new-producer', {
|
|
||||||
// // callId
|
|
||||||
// // });
|
|
||||||
|
|
||||||
// // } else {
|
|
||||||
// // console.log('🟥 Emit to receiverSocket');
|
|
||||||
// // videoCalls[callId].receiverSocket.emit('new-producer', {
|
|
||||||
// // callId
|
|
||||||
// // });
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// console.log('$$$$ isInitiator(callId, socket.id)', isInitiator(callId, socket.id));
|
|
||||||
// console.log('socket.id', socket.id);
|
|
||||||
// console.log('videoCalls', videoCalls);
|
|
||||||
// videoCalls[callId].receiverSocket.emit('new-producer', {
|
|
||||||
// callId
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // videoCalls[callId].initiatorSocket.emit('new-producer', {
|
|
||||||
// // callId
|
|
||||||
// // });
|
|
||||||
// // videoCalls[callId].receiverSocket.emit('new-producer', {
|
|
||||||
// // callId
|
|
||||||
// // });
|
|
||||||
// // socket.emit('new-producer', {
|
|
||||||
// // callId
|
|
||||||
// // });
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// console.log('&&&&&&&&&&&&&&&&', error.message);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (kind === 'video') {
|
if (kind === 'video') {
|
||||||
if (!isInitiator(callId, socket.id)) {
|
if (!isInitiator(callId, socket.id)) {
|
||||||
|
@ -20455,6 +20455,7 @@ setTimeout(() => {
|
|||||||
|
|
||||||
socket.on('new-producer', ({ callId }) => {
|
socket.on('new-producer', ({ callId }) => {
|
||||||
console.log(`🟥 new-producer | callId: ${callId}`);
|
console.log(`🟥 new-producer | callId: ${callId}`);
|
||||||
|
consume()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ setTimeout(() => {
|
|||||||
|
|
||||||
socket.on('new-producer', ({ callId }) => {
|
socket.on('new-producer', ({ callId }) => {
|
||||||
console.log(`🟥 new-producer | callId: ${callId}`);
|
console.log(`🟥 new-producer | callId: ${callId}`);
|
||||||
|
consume()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user