Integrate voice and video chat in your iOS app
Tags: ios, tutorial, applozic, objectivec
Published: 2021-05-26 07:24:38

##Introduction

Applozic's [iOS Audio and Video Call SDK](https://github.com/AppLozic/Applozic-iOS-Audio-Video-SDK) provides you with all the necessary components to build a real time chat with voice and video capabilities within your application, and enables you as a developer to implement conversational chat, push notifications, group chat, picture in picture and many more such features!

![image](https://www.applozic.com/blog/wp-content/uploads/2021/04/support-chat-voice-and-video.png)

One of the worldwide effects of Covid-19 and the resulting governmental lockdowns was the acute <a rel="noreferrer noopener" href="https://www.reportsanddata.com/report-detail/web-real-time-communication-market" target="_blank">rise in the need for real time communication across multiple industries</a>. A few major ones, like healthcare, education, and technology support witnessed the birth and rapid growth of first to market applications that catered to the varied needs of the customer. For example, <a rel="noreferrer noopener" href="https://www.applozic.com/blog/top-6-uses-of-in-app-messaging-real-time-communication-in-healthcare/" target="_blank">the features offered in telemedicine</a> caused much needed disruption in a field with vital importance on immediate communication. 

In this tutorial, we will leverage the <a rel="noreferrer noopener" href="https://github.com/AppLozic/Applozic-iOS-Audio-Video-SDK" target="_blank">Applozic iOS Voice and Video SDK</a> to create a real time chat application that can be used across industries like real time customer support, 1 on 1 telemedicine, personal therapy, etc. <a rel="noreferrer noopener" href="https://answers.applozic.com/article/Is-Applozic-compliant-with-HIPAA" target="_blank">With HIPAA compliant security on all your conversations</a> and <a rel="noreferrer noopener" href="https://answers.applozic.com/article/How-can-we-customise-the-default-UI-or-build-our-own-UI-on-Applozic" target="_blank">programmable personalization capabilities</a> to improve customer experiences, Applozic enables you to drive better engagement, increase interactions with your users, and improve your chances of retaining those customers through high-quality video and audio.

##Creating your own real time communication app

Applozic Audio-Video Call SDK provides high-quality IP audio and video calls capabilities within your application. With this SDK, your application's users can take part in secure 1-to-1 calls and automate workflows by building reliable conversation systems through voice-calling and video-calling. You can create a standalone application for communication using this SDK, or integrate it with your existing application.

> Note: The Voice and Video SDK is a beta product and new features will be added in the upcoming months.

If you face any difficulties while following this tutorial, you can contact us at <a rel="noreferrer noopener" href="mailto:support@applozic.com" target="_blank">support@applozic.com</a>.<br>To check out our cocoapods&nbsp;sample&nbsp;app, <a rel="noreferrer noopener" href="https://github.com/AppLozic/Applozic-iOS-Audio-Video-SDK" target="_blank">click&nbsp;here.</a>

###Requirements

Here are some of the dependencies you will need:

<ul><li>Xcode 12.0 or later</li><li>CocoaPods 1.9.0 or later</li><li>Your project must target iOS 11 or higher</li></ul>


> We are assuming the following application is going to be written using Objective-C. For corresponding code in Swift, please check the documentation in our [github repository](https://github.com/AppLozic/Applozic-iOS-Audio-Video-SDK).

###Application Setup

To use the Applozic &nbsp;iOS Audio Video SDK and leverage pre-built components that you can easily customize, you can&nbsp;<a rel="noreferrer noopener" href="https://console.applozic.com/signup?product=applozic" target="_blank">sign up for Applozic&nbsp;</a>and&nbsp;<a rel="noreferrer noopener" href="https://console.applozic.com/settings/install" target="_blank">get your APP_ID from the install section of the console.</a>

##Installation - Setup the building blocks for audio and video capabilities

###Cocoapods
<ul><li>ApplozicAudioVideo is available through&nbsp;<a href="https://cocoapods.org/">CocoaPods</a>. </li><li>To install it, setup your Podfile located at /ios/Podfile and add below pod dependency:</li></ul>

<pre class="wp-block-code"><code>source 'https://github.com/CocoaPods/Specs'
use_frameworks!  # Required to add 
platform :ios, '11.0' # Required to add

target 'TARGET_NAME' do
    pod 'ApplozicAudioVideo'  # Required to add 
end</code></pre>

<ul><li>Navigate to YourApp/ios directory from terminal and run the below command:</li></ul>

<pre class="wp-block-code"><code>pod install</code></pre>

> Note:  If you do not have pod dependency, <a href="https://guides.cocoapods.org/using/getting-started.html" target="_blank" rel="noreferrer noopener">check out how to get started here.

<p><strong>The Audio-Video Call SDK includes our iOS messaging SDK. If you have added the pod 'Applozic' in your Podfile please remove that and replace it with 'ApplozicAudioVideo'.</strong></p>

###Add Permissions

Add permissions for Camera, Photo Library, Microphone, Contacts and Location usage.

> Note: We won't be asking the users for these permissions unless they use the respective feature. Due to Apple's requirement, we have to add these permissions if we are using any of their APIs related to Camera, Microphone, etc.

Open `Info.plist` from `/ios/YOUR_PROJECT_NAME/Info.plist` file and paste these permissions anywhere inside the `<dict>` tag.

```
<key>NSCameraUsageDescription</key>
<string>Allow Camera</string>
<key>NSContactsUsageDescription</key>
<string>Allow Contacts</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Allow location sharing!!</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow MicroPhone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow Photos</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Allow write access</string>
```

###Setup Application ID
<strong>At this step, you should already have&nbsp;<a rel="noreferrer noopener" href="https://console.applozic.com/signup?product=applozic" target="_blank">signed up</a>&nbsp;for Applozic and&nbsp;<a rel="noreferrer noopener" href="https://console.applozic.com/settings/install" target="_blank">obtained your APP_ID</a>.</strong>

Open the `ALChatManager.h` file and replace “applozic-sample-app” with your APP-ID.

```
#define APPLICATION_ID @"&lt;YOUR_APPLOZIC_APP_ID>"
```

<a rel="noreferrer noopener" href="https://docs.applozic.com/docs/react-native-chat-session" target="_blank">Once you are at this stage, follow the Applozic documentation</a> to complete the authentication, set up of user profiles and other such basic building blocks of your application.

##Continue this Tutorial on Applozic Blog!

We have the detailed tutorial with code snippets available on [our blog](https://www.applozic.com/blog/) for you to continue with your integration and configuration. 

[Click here to learn](https://www.applozic.com/blog/how-to-build-an-ios-app-for-real-time-communication-with-voice-and-video/) how to:

* Set up Authentication
* Add Audio/Video configuration
* Set up push notifications
* And many other features!

Please leave your feedback and doubts in the comments below!