LINXD-2197: Added comments; Catch errors; Fix package.json start:run script #8

Merged
sergiu merged 4 commits from LINXD-2197-refactor-improving-mediasoup-web-socket-component into master 2022-09-27 10:00:25 +00:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit eb5aa12d65 - Show all commits

View File

@ -33,3 +33,7 @@ producer = it will always be true because you are the producer
(it's possible to put false, but then you have to have another client with producer true) (it's possible to put false, but then you have to have another client with producer true)
assetName = asset name of the unit on which you are doing the test assetName = asset name of the unit on which you are doing the test
assetType = asset type of the unit on which you are doing the test assetType = asset type of the unit on which you are doing the test
### Demo project
The demo project used initially and then modified for our needs `https://github.com/jamalag/mediasoup2`

8
app.js
View File

@ -186,10 +186,10 @@ peers.on('connection', async socket => {
try { try {
const callId = socketDetails[socket.id]; const callId = socketDetails[socket.id];
console.log(`[createWebRtcTransport] sender ${sender} | callId ${callId}`); console.log(`[createWebRtcTransport] sender ${sender} | callId ${callId}`);
if (sender) { if (sender && !videoCalls[callId].producerTransport) {
videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback); videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback)
} else { } else if (!sender && !videoCalls[callId].consumerTransport) {

It could be useful to see a message when the transport is already present.

Producer transport already present. Ignoring. callId=... assetId=...

It could be useful to see a message when the transport is already present. _Producer transport already present. Ignoring. callId=... assetId=..._
videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback); videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback)
} }
} catch (error) { } catch (error) {
console.log(`ERROR | createWebRtcTransport | callId ${callId} | sender ${sender} | ${error.message}`); console.log(`ERROR | createWebRtcTransport | callId ${callId} | sender ${sender} | ${error.message}`);