Embedding WebRTC iOS SDK into your mobile application
WCS iOS SDK is a framework you can link to your code to carry out operations with video streams and calls. This article shows main functions and code examples.
Opening the project and preparing iOS SDK for work
You can download WCS iOS SDK here. Then, unpack the archive into any folder.
After the archive is unpacled, you should open the WCSExample project in Xcode. Connect iPhone or iPad via USB and select it in the list of devices as shown on the picture. Then, click ‘Play’ to build and run the app on your iPhone or iPad.
If there are errors while building the project, adjust paths as shown on the screenshot below.
To do this, you need just four steps:
- cd WCSExample/FPWCSApi.framework
- rm -f FPWCSApi
- rm -f Headers
- ln -sf Versions/A/FPWCSApi FPWCSApi
- ln -sf Versions/A/Headers Headers
WCS iOS SDK main functions
The main functions of the API are listed in the FPWCSApi.h file of the framework:
Main functions of the Streaming Min example
The main functions include:
- API initialization
- Connecting to the server
- Publishing (sending) and playing of a video stream
Initialization of the API is performed in the following of the Streaming Min example, ViewController.m
Establishing connection to the server using the ‘connect’ function in ViewController.m
Playing and publishing (sending) of a video stream are implemented in the same file, ViewController.m, via the calls to the ‘playStream’ and ‘publishStream’ API functions.
So, we have shown initialization and work of the main API functions: connect, playStream, publishStream. This is a bare minimum of functions that allows to establish connection to the server and send or play a video stream from the mobile application.
The complete list of functions, handling of statuses and errors can be found in WCS iOS SDK documentation
Main functions of the Phone Min example
The main functions in this example are:
- API initialization
- Establishing connection
- Calling
- Answering the incoming call
Initialization of the API is performed in the ViewController.m file of the Phone Min example:
Connection is established in the connect method in the LoginViewController.m file:
When the ‘Call’ button is clicked, the outgoing call is established. This is implemented in the same file of the example, LoginViewController.m.
To answer the incoming call, the ‘answer’ function is used as shown in the LoginViewController.m example.
Therefore, here we have shown how the API is initialized for the Phone Min example and specified three functions required for a video chat or a SIP call:
- connect
- call
- answer
The complete list of funtions, handling of statuses and errors can be found in WCS iOS SDK documentation
Summary of using the iOS SDK code and Streaming Min and Phone Min examples
Here, we have shown how the Objective-C code is organized in Streaming Min and Phone Min examples in the Xcode development framework. You can use these examples to develop your own applications for streaming video, broadcasts, bideo chats and video calls to SIP and mobile telephones.
You can find screenshots of Streaming Min and Phone Min example tests in the Testing section.
Download Web Call Server 5
System requirements: Linux x86_64, 1 core CPU, 1 Gb RAM, Java
Installation:
- wget https://flashphoner.com/download-wcs5-server.tar.gz
- Unpack and install using ‘install.sh’
- Launch server using command ‘service webcallserver start’
- Open the web interface http://host:9091 and activate your license
If you are using Amazon EC2, you don’t need to download anything.
If your project requires another level of support or any additional custom features or development, please feel free to contact us sales@flashphoner.com with any questions.