WebRTC Configuration

LB Phone uses WebRTC to transmit video and audio between players. This is used in video calls, InstaPic live, and for recording nearby players voices.

You can modify the Config.RTCConfig table in lb-phone/config/config.lua to change the WebRTC settings. You can read more about the settings at Mozilla's documentation (opens in a new tab).

TURN Server

To fix issues with video calls and InstaPic live not working, you need to set up a TURN server.

Cloudflare

The phone comes with built-in support for Cloudflare's Realtime TURN server.

  1. Open lb-phone/config/config.lua

  2. Set Config.DynamicWebRTC.Enabled = true

  3. Set Config.DynamicWebRTC.Service = "cloudflare"

  4. Create a Cloudflare account

  5. Go to Realtime -> TURN Server (opens in a new tab)

  6. Press "Create"

  7. Optionally, set a name for the TURN server

  8. Press "Create"

  9. Save the Turn Token ID and API Token values in a secure location. You will need these in the next step, so you can keep the page open.

  10. Open lb-phone/server/apiKeys.lua. In the WEBRTC table, set TokenID to your Turn Token ID and APIToken to your API Token. Make sure to add quotes around the values, like this:

    lb-phone/server/apiKeys.lua
    WEBRTC = {
        TokenID = "6tixd89deru5dn3in1la93am7yhhbq3g",
        APIToken = "becst6d09fk3q6wumib9jf4zou6ppcn9mecr7a1ne2povhu4tedwyuu49q8bqn6y",
    }
  11. Press "Finish" in the Cloudflare dashboard

  12. Restart LB Phone or your server

Metered

You can also use a service like metered (opens in a new tab). To do this, create an account and get your TURN server credentials. Then, press "Show ICE Servers Array" and copy from the content of the iceServers array, like this:

{
    urls: "stun:stun.relay.metered.ca:80",
},
{
    urls: "turn:global.relay.metered.ca:80",
    username: "",
    credential: "",
},
{
    urls: "turn:global.relay.metered.ca:80?transport=tcp",
    username: "",
    credential: "",
},
{
    urls: "turn:global.relay.metered.ca:443",
    username: "",
    credential: "",
},
{
    urls: "turns:global.relay.metered.ca:443?transport=tcp",
    username: "",
    credential: "",
},

Finally, open lb-phone/config/config.lua and set your iceServers in the Config.RTCConfig table.

lb-phone/config/config.lua
Config.RTCConfig = {
    iceServers = {
        {
            urls: "stun:stun.relay.metered.ca:80",
        },
        {
            urls: "turn:global.relay.metered.ca:80",
            username: "",
            credential: "",
        },
        {
            urls: "turn:global.relay.metered.ca:80?transport=tcp",
            username: "",
            credential: "",
        },
        {
            urls: "turn:global.relay.metered.ca:443",
            username: "",
            credential: "",
        },
        {
            urls: "turns:global.relay.metered.ca:443?transport=tcp",
            username: "",
            credential: "",
        },
    }
}