Compare commits
4 Commits
5f8f2ab44c
...
LINXD-2197
Author | SHA1 | Date | |
---|---|---|---|
a4d16998cd | |||
b0fad5f1db | |||
eb5aa12d65 | |||
52b4794a86 |
@ -32,4 +32,8 @@ accountId = account id of the unit on which you are doing the test
|
||||
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)
|
||||
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`
|
||||
|
||||
|
28
app.js
28
app.js
@ -112,10 +112,12 @@ const closeCall = (callId) => {
|
||||
if (videoCalls[callId]) {
|
||||
videoCalls[callId].producer?.close();
|
||||
videoCalls[callId].consumer?.close();
|
||||
videoCalls[callId]?.consumerTransport.close();
|
||||
videoCalls[callId]?.producerTransport.close();
|
||||
videoCalls[callId].router.close();
|
||||
videoCalls[callId]?.consumerTransport?.close();
|
||||
videoCalls[callId]?.producerTransport?.close();
|
||||
videoCalls[callId]?.router?.close();
|
||||
delete videoCalls[callId];
|
||||
} else {
|
||||
console.log(`The call with id ${callId} has already been deleted`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`ERROR | closeCall | callid ${callId} | ${error.message}`);
|
||||
@ -146,8 +148,10 @@ peers.on('connection', async socket => {
|
||||
|
||||
// It is triggered when the peer is disconnected
|
||||
socket.on('disconnect', () => {
|
||||
console.log('peer disconnected | socket.id', socket.id);
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`disconnect | socket ${socket.id} | callId ${callId}`);
|
||||
delete socketDetails[socket.id];
|
||||
closeCall(callId);
|
||||
});
|
||||
|
||||
/*
|
||||
@ -187,9 +191,17 @@ peers.on('connection', async socket => {
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`[createWebRtcTransport] sender ${sender} | callId ${callId}`);
|
||||
if (sender) {
|
||||
videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||
} else {
|
||||
videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||
if (!videoCalls[callId].producerTransport) {
|
||||
videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||
} else {
|
||||
console.log(`producerTransport has already been defined | callId ${callId}`);
|
||||
}
|
||||
} else if (!sender) {
|
||||
if (!videoCalls[callId].consumerTransport) {
|
||||
videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||
} else {
|
||||
console.log(`consumerTransport has already been defined | callId ${callId}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`ERROR | createWebRtcTransport | callId ${callId} | sender ${sender} | ${error.message}`);
|
||||
@ -245,7 +257,7 @@ peers.on('connection', async socket => {
|
||||
console.log(`[transport-recv-connect] socket.id ${socket.id} | callId ${callId}`);
|
||||
await videoCalls[callId].consumerTransport.connect({ dtlsParameters });
|
||||
} catch (error) {
|
||||
console.log(`ERROR | transport-recv-connect | callId ${socketDetails[socket.id]} | ERROR`);
|
||||
console.log(`ERROR | transport-recv-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||
}
|
||||
})
|
||||
|
||||
|
BIN
doc/[video] Workflow.png
Normal file
BIN
doc/[video] Workflow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 571 KiB |
Reference in New Issue
Block a user