I started mediasoup server with express backend and started video streaming. while 15s first, I can see my video and then automatically I got ‘Producer transport closed’ and can’t see my video. Please help me fix that asap. Very urgent issue.
Hi amg, rather than a bug, this is most likely a misconfiguration on your end.
This issue is most likely caused by a firewall or NAT configuration problem that’s blocking the RTP ports used by mediasoup. Here’s how to troubleshoot and resolve it:
1. Firewall Configuration
Ensure the UDP/TCP port range specified in your mediasoup config (typically 40000–49999) is open on:
Your server’s local firewall (e.g., iptables, ufw)
Any cloud provider’s network security group, such as AWS Security Groups or GCP firewall rules
2. Correct announcedAddress (Public IP)
When your mediasoup server is behind NAT (e.g., Docker, EC2, VM), you must set the announcedAddress to your public IPv4 address so clients can reach the correct endpoint.
If you’re deploying on Amazon EC2, use your Elastic IP as the announcedAddress.
If you’re running mediasoup inside Docker, consider using network_mode: 'host' to avoid NAT issues.
3. Transport Lifecycle Handling
The error 'Producer transport closed' usually means the transport was unexpectedly terminated, which is often a result of network issues like blocked or unreachable RTP ports. The above steps typically resolve this.
Final Step: Restart
After applying the changes, restart your mediasoup server to apply the updated configuration.