Compare commits

..

8 Commits

5 changed files with 29 additions and 2 deletions

View File

@ -5,7 +5,7 @@ WORKDIR /app
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y build-essential pip net-tools iputils-ping iproute2 curl apt-get install -y build-essential pip net-tools iputils-ping iproute2 curl
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs RUN apt-get install -y nodejs
COPY . /app/ COPY . /app/

View File

@ -1,5 +1,22 @@
# Video server # Video server
### Running Docker
Output from history. Customize with your own container identifier
```Bash
docker build -t linx-video .
docker ps
docker stop ad5
docker rm ad5
docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/tcp -p 2000-2200:2000-2200/udp linx-video
docker logs 736 -f
cat .env
docker logs 736 -f
```
### Generating certificates ### Generating certificates
##### To generate SSL certificates you must: ##### To generate SSL certificates you must:

10
app.js
View File

@ -542,6 +542,15 @@ const isInitiator = (callId, socketId) => {
return videoCalls[callId]?.initiatorSocket?.id === socketId; return videoCalls[callId]?.initiatorSocket?.id === socketId;
}; };
const emitToParticipants = (callId, event, message) => {
try {
videoCalls[callId].receiverSocket.emit(event, message);
videoCalls[callId].initiatorSocket.emit(event, message);
} catch (error) {
console.error(`[emitToParticipants] | ERROR | callId: ${callId} | error: ${error.message}`);
}
}
/* /*
- Called from at event 'createWebRtcTransport' and assigned to the consumer or producer transport - Called from at event 'createWebRtcTransport' and assigned to the consumer or producer transport
- It will return parameters, these are required for the client to create the RecvTransport - It will return parameters, these are required for the client to create the RecvTransport
@ -584,6 +593,7 @@ const createWebRtcTransportLayer = async (callId, callback) => {
console.log(`[ICE STATE CHANGE] callId: ${callId} | State: ${iceState}`); console.log(`[ICE STATE CHANGE] callId: ${callId} | State: ${iceState}`);
if (iceState === 'failed' || iceState === 'disconnected') { if (iceState === 'failed' || iceState === 'disconnected') {
console.warn(`⚠️ ICE failure detected for callId: ${callId}! Possible UDP blockage.`); console.warn(`⚠️ ICE failure detected for callId: ${callId}! Possible UDP blockage.`);
emitToParticipants(callId, 'connection-failed', { callId });
} }
}); });

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

View File

@ -29,4 +29,4 @@
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"watchify": "^4.0.0" "watchify": "^4.0.0"
} }
} }