Unable to play WebRTC when the server is behind NAT router

Issues when playing with WebRTC Player

Unable to play WebRTC when the server is behind NAT router

Postby sueboy » Wed May 30, 2018 10:31 pm

Use OBS Virtual Cam cache Chrome web page, then use WebRTC_Publisher can get virtual cam on LAN.

WebRTC_Publisher Page set is correct, Get Publishing in progress...

Now Internet people want to watch WebRTC, so Open Firewall NAT 5119 tcp/udp, 5135 tcp/udp. It's open 100% sure.

Then use WebRTC player.html edit all infomation, but do two file: 1、use ip localhost 2、use internet ip like 11.11.11.11.
11.11.11.11 is Firewall NAT public ip.

Watch WebRTC:
1、On Lan see is ok, can watch.

2、On Internet is not ok, can't watch.


[BUG]
On 2, If see ws,can see some info. This time to check Demo from Unreal website, see what's different.
Different is candidate "ip"

Unreal demo is public ip xxx.xxx.xxx.xx
But my WebRTC player only get Local IP 192.168.1.xxx

[Resolve]
unrealwebrtcplayer.js

Find this line: var serverEndpoint = JSON.parse(strArr[1]);
then the following

serverEndpoint.candidate = serverEndpoint.candidate.replace("192.168.1.xxx","11.11.11.11")

192.168.1.xxx is output websize pc or server ip
11.11.11.11 is public ip

All code is like this:

var serverEndpoint = JSON.parse(strArr[1]);
serverEndpoint.candidate = serverEndpoint.candidate.replace("192.168.1.xxx","11.11.11.11")

Reload WebRTC player can watch from 11.11.11.11.
sueboy
 
Posts: 0
Joined: Wed May 30, 2018 10:17 pm

Re: Unable to play WebRTC when the server is behind NAT rout

Postby admin » Thu May 31, 2018 1:01 pm

Hi, thanks for reporting.

I have updated the subject so it better describes the problem.
The issue can be easily solved by your code, but we will update the unrealwebrtcplayer.js with more generic fix.
admin
Site Admin
 
Posts: 912
Joined: Fri Aug 21, 2009 10:13 am

Re: Unable to play WebRTC when the server is behind NAT rout

Postby admin » Thu May 31, 2018 9:16 pm

This issue is fixed; unrealwebrtcplayer.js is updated on our website.
Same with publishing javascript.

Thanks again for reporting.
admin
Site Admin
 
Posts: 912
Joined: Fri Aug 21, 2009 10:13 am

Re: Unable to play WebRTC when the server is behind NAT rout

Postby admin » Wed Jun 20, 2018 10:04 pm

Clarification:

The updated unrealwebrtcplayer.js fixes the NAT issue only if the IP address of media server is used;
it does NOT fix the NAT issue if domain name is used. The reason is - WebRTC does not support hostname for ICE candidate address, it must be the IP address.

When using domain name, you need to fix the script by yourself, hardcoding your server's public IP, like you did.
Also, refer to http://www.umediaserver.net/phpBB3/view ... =29&t=3555
for another way of fixing the script (you will still need to hardcode the right IP address).
admin
Site Admin
 
Posts: 912
Joined: Fri Aug 21, 2009 10:13 am


Return to Playing with WebRTC Player

Who is online

Users browsing this forum: No registered users and 1 guest