Using your own stun/turn server
Hi there. Great work on this app, very elegant.
For privacy/security purposes I would like to use my own stun/turn server. What do I need to do to implement that?
It looks like there's a large list of servers in the ICE_SERVERS array at the top of script.js. Some of these contain a single url, some contain multiple urls, and some contain username/credentials data.
Assuming I've deployed my own stun/turn server which requires "username" as the username and "password" as the password, what would my ICE_SERVERS array need to look like?
Perhaps something like:
const ICE_SERVERS = [
{
urls: "stun:video.MYDOMAIN.com:3478",
username: "username",
credential: "password",
},
];
?
Don't forget to add the Stun Server too:
const ICE_SERVERS = [
{
urls: "stun:YourStun"
},
{
urls: "turn:YourTurn",
username: "turnUsername",
credential: "turnPassword",
},
];
I recommend only to set one Stun & Turn.
Take a look to coturn and here an example on how to setup it.
It could be improved slightly by putting this config in an .env file to not be hardcoded.
However I agree, it's a well done app, simple and very intuitive to understand, it did a great job!