Get selected candidate

139 views
Skip to first unread message

Buğra İşgüzar

unread,
Jan 30, 2021, 4:00:46 PM1/30/21
to discuss-webrtc

Hi,

I want to get selected candidate to know about connection type. I just need to know is it using turn for relaying data or connected directly.

Just tried something with https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/onicecandidate but couldn't get selected/running candidate. All suggestions are welcome

Sergey Kobelev

unread,
Feb 1, 2021, 1:13:23 PM2/1/21
to discuss-webrtc
Hi!

If I understand you correctly, you can get active ICE from Stats

воскресенье, 31 января 2021 г. в 00:00:46 UTC+3, biis...@gmail.com:
Message has been deleted

Buğra İşgüzar

unread,
Feb 1, 2021, 3:45:42 PM2/1/21
to discuss-webrtc
Thanks Sergey!

If you are pointing to the getStats method of  RTCPeerConnection object, it's returning an object with a property named as "size" and a number as a value. I couldn't figure it out :/. I'm connecting over local candidates for now. Can it be the cause of this situation?

1 Şubat 2021 Pazartesi tarihinde saat 21:13:23 UTC+3 itibarıyla Sergey Kobelev şunları yazdı:

Philipp Hancke

unread,
Feb 1, 2021, 3:54:19 PM2/1/21
to discuss...@googlegroups.com
There is a sample for that:
gets you the ip of the active candidate pair using stats.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/fb91d53f-87fc-442a-a426-05e9b6bbebdfn%40googlegroups.com.

Julius Kiesian

unread,
Sep 4, 2021, 8:36:07 AM9/4/21
to discuss-webrtc
I'm just wondering, what if both remote and local candidates are "relay" and the relay IPs belong different turn servers? Which one will be used in the end?

Philipp Hancke

unread,
Sep 4, 2021, 8:49:51 AM9/4/21
to discuss...@googlegroups.com
both. TURN servers can talk to each other using plain udp and not knowing the other end is using TURN.

Zakhar S

unread,
Sep 4, 2021, 9:12:19 AM9/4/21
to discuss...@googlegroups.com
Both. Traffic will go like this: 
[WebRTC A] <==> [TURN 1] <==> [TURN 2] <==> [WebRTC B]

4 сент. 2021 г., в 15:36, Julius Kiesian <julius....@gmail.com> написал(а):

I'm just wondering, what if both remote and local candidates are "relay" and the relay IPs belong different turn servers? Which one will be used in the end?
Reply all
Reply to author
Forward
0 new messages