Domain name AND Server behind NAT - fix for javascript files

Issues when playing with WebRTC Player

Domain name AND Server behind NAT - fix for javascript files

Postby admin » Mon Aug 27, 2018 3:11 pm

As described in
viewtopic.php?f=29&t=3552
viewtopic.php?f=29&t=3555

When you are specifying domain name instead of IP address (domain name must be used for signaling over secure websocket) of the server as a parameter to javascript player/publisher function in your web page,
AND your server is behind NAT, then you need to make a change in
unrealwebrtcplayer.js for playing and in unrealwebrtcpublisher.js for publishing.

What you need to do:
In unrealwebrtcplayer.js or unrealwebrtcpublisher.js, find function EnsureValidCandidate
1. Modify first line of that function: remove the last condition from the if: "|| !ValidateIPaddress(ipAddress)", so the modified line is:
if ((candidate.search(ipAddress) !== -1) || !useSingleWebRTCPort || (ipAddress == "127.0.0.1")) {
2. Modify third line from the bottom of that function: instead of
candLines[ipIndex] = ipAddress;
hardcode your server public IP, for example, "11.11.11.11":
candLines[ipIndex] = "11.11.11.11";
admin
Site Admin
 
Posts: 954
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

cron