|
3 | 3 | const ICE_SERVERS_CONFIG = {
|
4 | 4 | iceServers: [
|
5 | 5 | {
|
6 |
| - urls: "stun:stun.l.google.com:19302", |
| 6 | + urls: "stun:115.85.180.162", |
7 | 7 | },
|
| 8 | + // TURN 서버 추가했는데 잘 되는듯? |
8 | 9 | {
|
9 |
| - urls: "stun:stun1.l.google.com:19302", |
10 |
| - }, |
11 |
| - { |
12 |
| - urls: "stun:stun2.l.google.com:19302", |
13 |
| - }, |
14 |
| - { |
15 |
| - urls: "stun:stun3.l.google.com:19302", |
16 |
| - }, |
17 |
| - { |
18 |
| - urls: "stun:stun4.l.google.com:19302", |
| 10 | + urls: "turn:115.85.180.162", |
| 11 | + username: "classvar", |
| 12 | + credential: "classvar", |
19 | 13 | },
|
| 14 | + // { |
| 15 | + // urls: "stun:stun1.l.google.com:19302", |
| 16 | + // }, |
| 17 | + // { |
| 18 | + // urls: "stun:stun2.l.google.com:19302", |
| 19 | + // }, |
| 20 | + // { |
| 21 | + // urls: "stun:stun3.l.google.com:19302", |
| 22 | + // }, |
| 23 | + // { |
| 24 | + // urls: "stun:stun4.l.google.com:19302", |
| 25 | + // }, |
20 | 26 | ],
|
21 | 27 | };
|
22 | 28 |
|
@@ -137,18 +143,17 @@ function call() {
|
137 | 143 |
|
138 | 144 | pcClient.onicecandidate = (event) => {
|
139 | 145 | socket.emit(NEW_PEER_ICE_CANDIDATE, event.candidate);
|
140 |
| - // trace("ICE candidate:", event.candidate); |
| 146 | + trace("ICE candidate:", event.candidate); |
141 | 147 | };
|
142 | 148 |
|
143 | 149 | socket.on(NEW_PEER_ICE_CANDIDATE, (candidate) => {
|
144 |
| - // trace("receiving new remote Ice Candidate: "); |
145 | 150 | pcClient
|
146 | 151 | .addIceCandidate(candidate)
|
147 | 152 | .then(() => {
|
148 | 153 | trace("client: new Remote Ice Candidate: ", candidate);
|
149 | 154 | })
|
150 | 155 | .catch((e) => {
|
151 |
| - trace("Error adding new Remote Ice Candidate: ", e); |
| 156 | + trace("Error adding new Remote Ice Candidate: ", candidate, e); |
152 | 157 | });
|
153 | 158 | });
|
154 | 159 |
|
@@ -260,6 +265,27 @@ function call() {
|
260 | 265 | trace("Failed to setLocalDescription: " + error.toString());
|
261 | 266 | });
|
262 | 267 | });
|
| 268 | + |
| 269 | + setTimeout(() => { |
| 270 | + pcClient.getSenders().map((sender) => { |
| 271 | + const kindOfTrack = sender.track?.kind; |
| 272 | + if (sender.transport) { |
| 273 | + const iceTransport = sender.transport.iceTransport; |
| 274 | + const logSelectedCandidate = () => { |
| 275 | + const selectedCandidatePair = |
| 276 | + iceTransport.getSelectedCandidatePair(); |
| 277 | + console.log( |
| 278 | + `SELECTED ${kindOfTrack || "unknown"} SENDER CANDIDATE PAIR`, |
| 279 | + selectedCandidatePair |
| 280 | + ); |
| 281 | + }; |
| 282 | + iceTransport.onselectedcandidatepairchange = logSelectedCandidate; |
| 283 | + logSelectedCandidate(); |
| 284 | + } else { |
| 285 | + // retry at some time later |
| 286 | + } |
| 287 | + }); |
| 288 | + }, 3000); |
263 | 289 | }
|
264 | 290 | }
|
265 | 291 |
|
|
0 commit comments