how to configure mediasoup server api in ec2 aws

Thank you for this great software.

I separate both app from versatica/mediasoup-demo.
server is on port 4000 and react app on 3000. its working will on localhost.
but when I deploy server to ec2 instance its not showing the remote video as shown in the following image:

info on remote screen:


id: b07e559b-5059-47f2-af95-29c88095ca37

codec: opus

score:10, producerScore:0, producerScores:[0]


id: d48f3da5-1abd-46f4-bfa3-39e8fc6c385c

codec: VP8

resolution: 0x0

current spatial-temporal layers: undefined undefined

preferred spatial-temporal layers: 2 2 [ down ] [ up ]

priority: 1 [ down ] [ up ]

[ request keyframe ]

score:10, producerScore:0, producerScores:[0,0,0]

config details

    listenIp: '', 
    listenPort: process.env.PROTOO_LISTEN_PORT || 4000,
        cert: process.env.HTTPS_CERT_FULLCHAIN || `${__dirname}/certs/fullchain.pem`,
        key: process.env.HTTPS_CERT_PRIVKEY || `${__dirname}/certs/privatekey.pem`

                    ip: process.env.MEDIASOUP_LISTEN_IP || '', // also tried with private ip address
                    announcedIp: process.env.MEDIASOUP_ANNOUNCED_IP || '' //public ipv4 address
        initialAvailableOutgoingBitrate: 1000000,
        minimumAvailableOutgoingBitrate: 600000,
        maxSctpMessageSize: 262144,
        // Additional options that are not part of WebRtcTransportOptions.
        maxIncomingBitrate: 1500000

Here is Security groups:

How I can able to access remote stream?
I don’t know which mistake I made…

Please don’t tag users explicitly, there are more people on the forum than Inaki and Jose that have other things to do in their life.

As to the issue in your inbound rule you are most likely lacking rules for RTC port range used for actual media flow, so only WebSocket works, but not WebRTC.

what is the RTC port range and how I will be able to run WebRTC?

it is already in config.js filr

Of course it is, but according to your screenshot you didn’t open them publicly on your instance’s network rules.

will open it with tcp or udp?

Both. This is generic WebRTC, there is nothing mediasoup-specific about those ports.

check the above screen shot

It doesn’t include any UDP ports, which are preferred for WebRTC (and could be the only used by mediasoup-demo, I never used it to say for sure).

Its Working . I am very thankful to you. i was facing the problem from last week. you make my day.

now it will work if i deploy my frontend app on s3 static hosting or we need to change something in frontend side?

No idea, I guess you’ll have to try and see what happens.
You can also mark the answer as solution so that it is clear for others that question was answered.

1 Like