illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.9k stars 1.51k forks source link

wsl2 connection issues #538

Open kitsunekyo opened 1 year ago

kitsunekyo commented 1 year ago

i'm trying to run my node-media-server application within wsl2 (ubuntu), and my obs is running on windows. when i try to connect i get a connection error, as if the publish url is not reachable. but i can access http://localhost:8000/admin/ in the browser without any issues.

18:05:51.416: [rtmp stream: 'simple_stream'] Connecting to RTMP URL rtmp://localhost/live...
18:05:51.416: [rtmp stream: 'simple_stream'] Interface: Software Loopback Interface 1 (type 24, 1073 mbps)
18:05:53.422: localhost/live is offline. Try a different server (ECONNREFUSED).
18:05:53.422: [rtmp stream: 'simple_stream'] Connection to rtmp://localhost/live failed: -2
18:05:53.422: ==== Streaming Stop ================================================

if i run the same application in windows (via powershell), the connection works without any problems.

i have already tried disabling my firewall to see if my system is blocking traffic, but this didnt change anything. this is most likely not an issue with the code itself, but i'd appreciate help regardless. i'm certainly not the only one running this on wsl2

davidevaliante commented 1 year ago

Had the same issue and solved it by getting the wsl local address from the powershell via wsl hostname -I and using it instead of localhost