Hi everyone.
I dev mediasoup server base on GitHub - Dirvann/mediasoup-sfu-webrtc-video-rooms: A simple video conferencing example using the mediasoup sfu
When I run in localhost. everything is good.
But when I run server on docker(window 11 , Docker Desktop), no audio playing on receiver phone.
It seems like some rtc port is not working
Here is server log:
Produce {
type: 'audio',
name: 'testaccount1',
id: '09497751-5456-471e-9a00-f92c12574a99'
}
Consuming {
name: 'testaccount3',
producer_id: '09497751-5456-471e-9a00-f92c12574a99',
consumer_id: '1709d577-8021-4f23-acb3-43779763d85c'
}
Here is receiver client log:
LOG New producers [{"producer_account_name": "Account 1", "producer_id": "09497751-5456-471e-9a00-f92c12574a99", "producer_name": "testaccount1", "producer_socket_id": "wXI6aBPYOlvhUf1bAAAX"}]
LOG Closing consumer: 1709d577-8021-4f23-acb3-43779763d85c
But I can’t hear any audio playing.
Docker file:
FROM node:16
WORKDIR /app
# Install DEB dependencies and others.
RUN apt-get update \
&& apt-get install -y net-tools build-essential python3 python3-pip valgrind
COPY package-lock.json .
COPY package.json .
COPY firebase.json .
RUN npm install
COPY src src
COPY ssl ssl
EXPOSE 3016
EXPOSE 10000-10100
RUN npm i -g nodemon
CMD npm start
Config.js:
const os = require("os");
// const ifaces = os.networkInterfaces();
function getListenIps() {
const listenIps = [];
if (typeof window === "undefined") {
const os = require("os");
const networkInterfaces = os.networkInterfaces();
const ips = [];
if (networkInterfaces) {
for (const [key, addresses] of Object.entries(networkInterfaces)) {
addresses.forEach((address) => {
if (address.family === "IPv4") {
listenIps.push({ ip: address.address, announcedIp: null });
} else if (address.family === "IPv6" && address.address[0] !== "f") {
/* ignore link-local and other special ipv6 addresses.
* https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml
*/
listenIps.push({ ip: address.address, announcedIp: null });
}
});
}
}
}
if (listenIps.length === 0) {
listenIps.push({ ip: "127.0.0.1", announcedIp: null });
}
// console.log(listenIps);
return listenIps;
}
module.exports = {
// listenIp: "192.168.1.12",
listenPort: 3016,
sslCrt: "../ssl/cert.pem",
sslKey: "../ssl/key.pem",
mediasoup: {
// Worker settings
numWorkers: Object.keys(os.cpus()).length,
worker: {
rtcMinPort: 10000,
rtcMaxPort: 10100,
logLevel: "warn",
logTags: [
"info",
"ice",
"dtls",
"rtp",
"srtp",
"rtcp",
// 'rtx',
// 'bwe',
// 'score',
// 'simulcast',
// 'svc'
],
},
// Router settings
router: {
mediaCodecs: [
{
kind: "audio",
mimeType: "audio/opus",
clockRate: 48000,
channels: 2,
},
{
kind: "video",
mimeType: "video/VP8",
clockRate: 90000,
parameters: {
"x-google-start-bitrate": 1000,
},
},
],
},
// WebRtcTransport settings
webRtcTransport: {
listenIps: getListenIps(),
maxIncomingBitrate: 1500000,
initialAvailableOutgoingBitrate: 1000000,
},
},
};
Here is Docker run command:
docker run -d -p 3016:3016 -p 10000-10100:10000-10100/tcp -p 10000-10100:10000-10100/udp -it walkie-talkie-rn-server
Thank you.
Vu.