Create your own iOS application using WebRTC

I am looking for 4 days, but can not get it. I built all the libraries and integrated them into my custom project, but I don’t know what steps should be taken to make it work. The only thing I found with the \ explain code example is tech.appear.in/2015/05/25/Getting-started-with-WebRTC-on-iOS, but it is bad and obscure for me, the source code is AppRTCDemo. I read about WebRTC for browsers, but still can't play it on iOS. Can someone explain or provide links to an explanation of how to completely create your own iOS application using the WebRTC API, such as p2p ios chat?

Besides the fact that I do not understand the logic of the code presented in the demo, I cannot understand:

1) What are ICE servers for my iOS application? Should I take care of this? Is this the server side? Should I code and run it myself, or can I use the existing Parse background?

2) What is an alarm mechanism in an iOS app? Is this the client side, or should it also be implemented on the server side?

3) And maybe someone can explain the walkthrough, maybe with some code, how to implement simple iOS p2p chat using WebRTC? For example:

"You should:

  • Create the ICE / STUN / TURN server on the parsing using this = source = and this tutorial = tutorial =.

  • Create an RTCPeerConnection using the generated ICEServer: RTCPeerConnectionFactory *pcFactory = [[RTCPeerConnectionFactory alloc] init]; RTCPeerConnection *peerConnection = [pcFactory peerConnectionWithICEServers:kICEServerURL constraints:nil delegate:self]; RTCPeerConnectionFactory *pcFactory = [[RTCPeerConnectionFactory alloc] init]; RTCPeerConnection *peerConnection = [pcFactory peerConnectionWithICEServers:kICEServerURL constraints:nil delegate:self];

  • Create a DataChannel with ...

  • Send a signal using ... here = link =

  • Set local and remote descriptions ...

  • Send data ... using ...

  • ... "or something similar.

I apologize for this, but I'm losing my mind trying to figure it out. Thanks!

+7
ios objective-c iphone native webrtc
source share
2 answers

I am not an expert at webrtc, but I will try to explain some of your questions.

Servers 1.ICE. NAT and firewalls pose a significant problem when configuring IP endpoints. therefore, IETF STUN, TURN, and ICE standards were developed to solve the NAT bypass problem. STUN helps connect IP endpoints:

  • find out if they are behind a NAT / firewall, and if so,
  • to determine the public IP address and type of firewall. STUN then uses this information to help establish peer-to-peer IP connectivity.

TURN, which Traversal stands for, using Relay NAT, provides a NAT round-back rollback method using a media relay server to facilitate media transport between endpoints.

ICE is a platform that uses both STUN and TURN to securely configure IP and multimedia transport using the SIP offer / response model for endpoints to exchange multiple IP addresses and candidate ports (such as private addresses and TURN server addresses) .

2. Alarm is a process of coordinating communication. This signaling part should be implemented by you according to your needs (for example, if you have a sip structure in place, then you will have to implement signaling). In order for the WebRTC application to create a “call”, its clients need to exchange information:

  • Session alarms used to open or close communications.
  • Error messages.
  • Media metadata such as codecs and codec settings, bandwidths and media types.
  • Key data used to establish secure connections.
  • Network data, such as the host IP address and port, visible to the outside world.

    1. Actions

for advertiser:

first create a peer-to-peer connection and pass ice candidates to it as parameters.

set event handlers for three events:

  • onicecandidate-- onicecandidate returns locally generated ICE candidates so you can pass them on to other users (for example), namely the list of ice candidates returned by STUN / TURN servers; these ice candidates contain your public ipv4 / ipv6 addresses as well as random UDP addresses.
  • onaddstream - onaddstream returns a remote stream (your friend’s microphone and camera!).
    • addStream` attaches your local microphone and camera to another partner.

Now create the SDP clause by calling the setLocalDescription function and configure the remote SDP by calling setRemoteDescription.

For the user:

  • setRemoteDescription
  • createAnswer
  • setLocalDescription
  • oniceCandidate - Upon receipt of a locally created ICE
  • addiceCandidate - When receiving an ICE sent by another partner
  • onaddstream - for remote stream to add

I hope this makes some of your doubts clear.

+4
source share

I went through the process of its implementation a few months ago. I found that the library was unstable - sometimes it worked sometimes.

Also, my iPhone always got hot when I used it.

I would not suggest using this library and common WebRTC technology for commercial projects.

This is my implementation that worked a few months ago:

https://github.com/aolszak/WebRTC-iOS

Good luck

+1
source share

All Articles