From 1ed27328ca64a82442b9cfd66c6c8eb3c2492c89 Mon Sep 17 00:00:00 2001 From: Felipe Ribeiro Date: Sat, 26 Mar 2022 16:48:16 -0300 Subject: [PATCH] fix stun servers --- web/src/components/Back/index.js | 2 +- web/src/components/Loader/index.js | 2 +- web/src/screens/room/index.js | 3 ++- web/src/webrtc/peer.js | 12 ++---------- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/web/src/components/Back/index.js b/web/src/components/Back/index.js index 6b9b202..da8b454 100644 --- a/web/src/components/Back/index.js +++ b/web/src/components/Back/index.js @@ -2,7 +2,7 @@ import React from 'react' import './styles.css' const Back = ({ history }) => ( -
history.goBack()}> +
history.goBack()}> ( -
+
diff --git a/web/src/screens/room/index.js b/web/src/screens/room/index.js index 61a24fe..65121e4 100644 --- a/web/src/screens/room/index.js +++ b/web/src/screens/room/index.js @@ -129,10 +129,11 @@ export default function Room() { }) } + useEffect(() => () => cleanUp) + useEffect(() => { if (!user.profile || !user.profile.nickname) history.goBack() else init() - return cleanUp }, [user]) useEffect(() => { diff --git a/web/src/webrtc/peer.js b/web/src/webrtc/peer.js index 95d8be2..ef92d28 100644 --- a/web/src/webrtc/peer.js +++ b/web/src/webrtc/peer.js @@ -3,14 +3,6 @@ import Peer from 'simple-peer' const STUN_SERVERS = [ { url: 'stun:stun.l.google.com:19302' }, { url: 'stun:global.stun.twilio.com:3478?transport=udp' }, - { url: 'stun:stun1.l.google.com:19302' }, - { url: 'stun:stun2.l.google.com:19302' }, - { url: 'stun:stun3.l.google.com:19302' }, - { url: 'stun:stun4.l.google.com:19302' }, - { url: 'stun:stun.services.mozilla.com' }, - { url: 'stun:stun.anyfirewall.com' }, - { url: 'stun:stun.sipgate.net' }, - { url: 'stun:stun.sipgate.net:10000' }, ] function createNewPeer({ @@ -25,9 +17,9 @@ function createNewPeer({ initiator: initiator, trickle: false, config: { - iceServers: STUN_SERVERS.map((f) => { + iceServers: STUN_SERVERS.map((f) => ({ urls: f.url - }), + })), }, } if (stream) options.stream = stream