Issue with pixel streaming server's configuration

Hi guys,

We’re really interested in using the new Pixel Streaming feature. We have, so far, managed to make it work within the local network, thanks to the instructions contained on the Pixel Streaming documentation.

However, when trying to setup the signaling server to work with TURN and STUN servers, in order to be able to stream the app over the Internet, I’m running with an issue.

According to the forementioned documentation, in order for the signaling server to point into the TURN and STUN servers -which will enable outside connections to communicate with the computer running the application- you need to modify the content of the config.json file in the SignallingWebServer folder, adding a value for peerConnectionOptions. However, if I include the information on the servers following the example included on the Reference section of the documentation ( { ‘iceServers’: {‘urls’: <url1>,<url2>,<url3>,…]}] }} ), I get a syntax error when running the batch file to start the signaling server.

Given this, I went to JSONlint to validate the content of the file, and got a validation when replacing the (’) for (") in the **peerConnectionOptions **entry. I then proceeded to make the modifications on the config.json file, only to get the following result:

SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at Object.<anonymous> (C:\Program Files\Epic Games\UE_4.21\Engine\Source\Programs\PixelStreaming\WebServers\SignallingWebServer\cirrus.js:121:45)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

This is happening when trying with the IP address of a TURN server running on a VPS, and also when trying to point to the TURN and STUN servers included on the package.
My knowledge of js is very limited (I think that can be pretty obvious by now), so any help or pointing on the right direction will be deeply appreciated.

Thanks!

If you’re putting it into the config file, could you try it like this:


"peerConnectionOptions": "{ \"iceServers\": {\"urls\": \"stun:34.250.222.95:19302\"]}] }"

and see if using double-quotes with backslashes works for you?

Hi @Ro-Su- , thanks for your help.

That syntax validates as correct, but unfortunately I’m getting the same “Unexpected token o in JSON at position 1” error when trying to run the batch file.

Fow what I have read, I thought it might have something to do with a parse instruction on the cirrus.js in case of not defining the peerConnectionOptions. I’ve made a copy of the original file for backup, and then proceeded to remove that instruction on the original one.

I’m now getting this as result when running the Signaling Server:

11:48:53.111 peerConnectionOptions = {}
(node:7292) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
11:48:53.118 Listening to proxy connections on: 8888
11:48:53.119 Http listening on *: 80

I’m taking this as a little step forward, as I have finally made the SignalingServer to run with the desired config file. However, the “peerConnectionOptions = {}” line makes me think that maybe it’s taking that option as void anyway.

I will keep looking on it, and let you know if any progress is made.

Thanks!

could you post exactly the peerConnectionOptions line that you’re using? Maybe there’s a missing bracket or something.

Hi @Ro-Su- , this is how I’m currently running the config.json file:

{
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“UseAuthentication”: false,
“LogToFile”: true,
“HomepageFile”: “player.htm”,
“AdditionalRoutes”: {},
“publicIp”: “181.XXX.XXX.129”,
“peerConnectionOptions”: {
“iceServers”:
{
“urls”:
“turn:93.XXX.XXX.193:3478”,
“stun:93.XXX.XXX.193:3478”
]
}
]
}
}

And this is the result I’m getting when I run the run.bat for the Signaling Server:

npm WARN saveError EPERM: operation not permitted, rename ‘C:\Program Files\Epic Games\UE_4.21\Engine\Source\Programs\PixelStreaming\WebServers\SignallingWebServer\package-lock.json.593269185’ -> ‘C:\Program Files\Epic Games\UE_4.21\Engine\Source\Programs\PixelStreaming\WebServers\SignallingWebServer\package-lock.json’
npm WARN cirrus-webserver@0.0.1 No repository field.
npm WARN cirrus-webserver@0.0.1 No license field.

audited 391 packages in 2.361s
found 1 low severity vulnerability
run npm audit fix to fix them, or npm audit for details
19:56:38.332 Config: {
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“UseAuthentication”: false,
“LogToFile”: true,
“HomepageFile”: “player.htm”,
“AdditionalRoutes”: {},
“publicIp”: “181.XXX.XXX.129”,
“peerConnectionOptions”: {
“iceServers”:
{
“urls”:
“turn:93.XXX.XXX.193:3478”,
“stun:93.XXX.XXX.193:3478”
]
}
]
}
}
19:56:38.468 peerConnectionOptions = {}
(node:8952) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
19:56:38.477 Listening to proxy connections on: 8888
19:56:38.478 Http listening on *: 80

Am I missing something in order to make the Signaling Server to connect with the TURN server? Under this configuration, I’m able to see the remote app in the local network, but still unable to do so over the Internet.

Thanks in advance!

I would like to also jump in and say I am in the exact situation. I can access locally the unreal instance, and remotely I can access the web “front end”.

Internally: I type the local IP “192.100.100.237” and it loads, as well as the external IP “173.XX.XX.196” and it loads up.

Externally: I type in the external IP of our network, firewall is set up to forward to a internal machine, the HTML site loads and says “Click to start”, and then “Starting connection to server, please wait…” remains.

my config.JSON

{
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“UseAuthentication”: false,
“LogToFile”: true,
“peerConnectionOptions”: “{ “iceServers”: {“urls”: “stun:173.XX.XX.196:19302”]}] }”,
“HomepageFile”: “player.htm”,
“AdditionalRoutes”: {}
}

Not sure what to do here.

Hi @tmulford , do you have a TURN server running on the same computer that is running the UE app?

I’m trying to make it work with a TURN built on a VPS server, but I cannot even see the frontend page when trying to access the external IP. Maybe changing that can make me advance a little step forward.

Since I’ve posted this question, I’ve done a lot of experimenting, since most of this “JSON”, Batch editing, “TURN/STUN” stuff is all new to me, learning as I know. At this point the only thing that almost works is using a TURN server from a free provide (numb.viagenie.ca). Since doing that, I get up to the point where I get “WebRTC connected, waiting for video”

this is my current config.JSON

{
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“UseAuthentication”: false,
“LogToFile”: true, “HomepageFile”: “player.htm”,
“AdditionalRoutes”: {},
“publicIp”: “173.XX.XX.196”,
“peerConnectionOptions”: “{“iceServers”:{“urls”:“stun:numb.viagenie.ca”,“turn:numb.viagenie.ca”],“username":"info@cadrender.com”,“credential”:“XXXXXXXX”}]}”
}

I don’t know how to run the TURN server. When I run the EXE it immediately opens and closes. I would be trilled to have a working usable turn server on my local box, for testing at least, to get this up and running. The STUN server seems to not be working.

I installed CoTurn on a Ubuntu C3 instance through Paperspace and I get the same results as you @tmulford It shows the remote connecting and then times out with NewState=kIceConnectionFailed


{
    "UseFrontend": false,
    "UseMatchmaker": false,
    "UseHTTPS": false,
    "UseAuthentication": false,
    "LogToFile": true,
    "HomepageFile": "player.htm",
    "AdditionalRoutes": {},
    "publicIp": "13.X.X.158",
    "peerConnectionOptions": "{\"iceServers\":{\"urls\":\"stun: 10.X.X.X:3478\",\"turn: 10.X.X.X:5349\"],\"username\":\"USERNAME\",\"credential\":\"PASSWORD\"}]}"
}

I’ve also tried Twilio NAT TURN/STUN but no luck on that either. I get the same results with timeout.

I’ve opened Ports 80, 8124, 8888 on Window Azure NV6 instance too.

I’m investigating how to confirm the CoTurn is properly configured but I followed the guide here. https://www.nomachine.com/AR07N00894

on aws’s wwindws server its working fine. strange that u getting error from linux. do a try 1st in windows server. if it works there than move the code to linux server

@Muzaheed Could you share your configs??

@Muzaheed yes, please do. We’re also in the same boat here not being able to run the application over the web and use the STUN/TURN server

Hi All,

I’m in the exact situation as @tmulford:

So I tried adding the info for the TURN server following the example from the documentation:

“{“iceServers”:{“urls”:“stun: 34.250.222.95:19302”,“turn: 34.250.222.95:19312”],“username”:”<TURN_Username>“,“credential”:”<TURN_Password>“}]}”

The thing is, after I set username and password in the config.json, where do I use them to actually access the page through the TURN server?

I tried directing the Signalling Server to the “login.htm” page instead of the “player.htm” one but It doesn’t help. The page returns “Cannot POST /login”

What am I missing?

Thanks,
Luigi

@luigibluemilk if everything is set up correctly, you never need to access the STUN or TURN server directly. You just use the basic player.htm page, and when you press Play in the player widget, the stun/turn servers are used behind the scenes to relay the video into the player widget.

The username and password in the documentation work with the TURN server that you’ll find in the Engine/Source/ThirdParty/WebRTC/rev.23789/programs/Win64/VS2017/release folder. If you’re using some different TURN server, you may need to put different credentials in the config.

thank you!

I’ve since figured all this out and thought I’d put something out there to help those who are as clueless as I was just a few months ago about ice connections, stun/turn servers, signaling, webRTC proxy, and all that goes with getting this working on a public IP.

There are two examples I shared. One is using AWS and the other is using Azure. Both examples run everything off the same machine. You can, however, use multiple instances if you want like installing coturn and running the stun/turn on a AWS Ubuntu instance and then running the signaling and webRTC on a Azure instance. However, I’m not going to cover that scenario since the 2 other examples should give you a good starting point for customizing your solution. I will say, it’s much easier to run everything off a single instance then dealing with load balancing and other optimizations when using more then one instance.

You’ll notice I did not block out the public IPs I use because I wanted to show everything. Those IPs are for testing purposes only and since they are only on for a few minutes here and there they have no value to you.

https://croftinteractive.blogspot.com

Hope it helps someone.

Thanks your share !

Hey Dude,

Very much appreciated on the stuff you have provided.
I’m a little puzzled, I am streaming on my own PC and have updated each file accordingly (i.e. Public IP , Username, Password) as per your examples .
It all runs fine on Localhost, however, I’m having issues trying to sort the firewall/packing settings for AVG.
Have you any pointers, please, to as where I’m going wrong. I’m so not an Infrastructure Engineer, so sorry for my ignorance here.

Kind regards,

Dominic

The Packet Rules:

All the best,

Dom

Those AVG settings are from your Azure or AWS account?
The documents are for hosting UE4 apps in the cloud on AWS/Azure and streaming those apps via a public IP to a browser. It does not cover running this via LAN or from your personal machine to the outside world.