Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

WebRTC and the webserver.exe

Discussion in 'Unity Render Streaming' started by dave_m_moore, Dec 14, 2022.

  1. dave_m_moore

    dave_m_moore

    Joined:
    Jul 28, 2016
    Posts:
    39
    Hi All,
    After failing to get the Render Streaming functionality working, I have decided to look at streaming video using the WebRTC interface. However, I'm a bit confused about servers.

    My requirement is to simply stream Unity video to either a browser or another Unity instance. So, really I don't want to involve a server as I would consider this to be a peer-to-peer transfer only. However, it appears that I have to have a 'stun' server to negotiate formats and offerings (ie. I have no choice but to introduce a server into the system). When I looked at the Render Streaming functionality, Unity provided a webserver (webserver.exe). My question is, can I use this webserver.exe as a stun server for WebRTC, or do I need something different? My assumption would it be that it is fine because I am led to believe that Render Steaming functionality is simply a higher level implementation based on WebRTC, so I assume that webserver.exe is providing the stun capability in that case.

    Any ideas?
    Thanks in advance,
    Dave
     
  2. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    288
    The STUN server is provided by Google for free, so you can use it.
    stun.l.google.com:19302
    stun1.l.google.com:19302
    stun2.l.google.com:19302
    stun3.l.google.com:19302
    stun4.l.google.com:19302
     
  3. dave_m_moore

    dave_m_moore

    Joined:
    Jul 28, 2016
    Posts:
    39
    Thanks, but one assumes these are on the internet. I'm not on the internet, but on a private network so I wouldn;t be able to access those.
     
  4. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    288
    In the case of WebRTC connection between PCs in LAN, STUN server is basically unnecessary.
    Therefore, create an instance without arguments when creating an RTCPeerConnection instance and try running it.
    Code (CSharp):
    1. var pc = new RTCPeerConnection();