How to confirm connection has been established

78 views
Skip to first unread message

potato

unread,
Jun 21, 2017, 10:23:45 AM6/21/17
to discuss-webrtc
I say connection has been established means now i don't need to do anything and can share video between peers.
//when this method called?
- (void)peerConnection:(RTCPeerConnection *)peerConnection
           addedStream
:(RTCMediaStream *)stream

//or when newState changed to RTCICEConnectionCompleted?
- (void)peerConnection:(RTCPeerConnection *)peerConnection
    iceConnectionChanged:(RTCICEConnectionState)newState
I'm writing an one to many video sharing iOS app(create many connections),so i want to start a new connection after previous connection has been established but how to confirm connection has been established or is there an better way?

Yongje Lee

unread,
Jun 22, 2017, 3:48:12 AM6/22/17
to discuss-webrtc
Just check whether iceConnectionState of RTCPeerconnection is RTCIceConnectionState[Connected|Completed].
Or make a new connection when you get the RTCIceConnectionStateConnected from iceConnectionChanged.
Message has been deleted

potato

unread,
Jun 23, 2017, 10:21:03 AM6/23/17
to discuss-webrtc
I tested it on my iphone simulator(one peer) and firefox browser(the other peer) and I found that ice state can changed to connected (simulator also can receive video sended from firefox browser)even i haven't send candidate to the firefox browser.

Nils Ohlmeier

unread,
Jun 23, 2017, 6:44:55 PM6/23/17
to discuss...@googlegroups.com

On Jun 23, 2017, at 07:21, potato <gaox...@foxmail.com> wrote:

I tested it on my iphone simulator(one peer) and firefox browser(the other peer) and I found that ice state can changed to connected (simulator also can receive video sended from firefox browser)even i haven't send candidate to the firefox browser.

In case of the two ICE stacks being able to communicate directly in the same local network it is sufficient that only one side learns how to reach the other side. Because that makes it contact the other peer via a binding request. And the other side learn the candidate from the incoming binding request.

Your test result might also be different because Firefox still uses aggressive nomination in its ICE. So as soon as it receives a binding response it will declare success and start using that pair. Where other implementations using full nomination will not start on the first binding request + response exchange.

Best
  Nils Ohlmeier

signature.asc

potato

unread,
Jun 23, 2017, 8:34:24 PM6/23/17
to discuss-webrtc
Thank you very much.
Reply all
Reply to author
Forward
0 new messages