Adding video calls to messaging

How to add video call capabilities to the messaging components

Video call SDK dependency

To add video calls capability to the messaging module, add the video call dependency to your app.

Swift Package Manager

The NablaVideoCall SDK comes as a part of Nabla SPM package. Since you should have added our repository as a dependency to your app already, you only need to link the NablaVideoCall library to your target. There are two ways to do it, depending on how you are using SPM.

If you've added Nabla package from xcode, simply add the library to your target:

  • Select your project in Xcode
  • Go tot the General tab
  • In the Frameworks, Libraries and Embedded Content section
  • Click the + button
  • Add NablaVideoCall

If you are using a Package.swift file, add this line to your target.dependencies array:

.product(name: "NablaVideoCall", package: "nabla-ios"),

Cocoapods

Add the following dependencies in your Podfile

pod 'NablaVideoCall'

And then run pod install to update your project.

Project settings

Few project settings are required before being able to use NablaVideoCall.

Set up camera and microphone usage descriptions

It is mandatory to define some NSMicrophoneUsageDescription and NSCameraUsageDescription before requesting the camera & microphone permissions. Otherwise, your app will crash.

You can define those in your Info.plist file. More info here and there.

Register your app for VOIP background execution

By default, iOS apps are inactive when sent to background. This means that your users won't be able to hear or speak if they switch to another app while inside a video call.

To prevent this, you must add the UIBackgroundModes key to your Info.plist file, then add a voip item. If done correctly, Xcode should recognize those keys and replace them with human-readable descriptions:

Link to the documentation.

Disable BITCODE for debug builds

We are using the WebRTC library to implement NablaVideoCall. This library does not support BITCODE for debug builds. You must disable it in your Build Settings. Find the Enable Bitcode key, expand it, and set it to no for debug builds.

Set up video call module

The next step is to set up the NablaVideoCallModule when you init the NablaClient:

import NablaCore

class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      NablaClient.initialize(
        apiKey: "YOUR_API_KEY",
        modules: [
          NablaMessagingModule(),
          NablaVideoCallModule() // Add this line
        ]
      )

      // ...

      return true
    }
}

Build and run your app, you should now be able to receive video call CTAs in a conversation and answer them.

Your first video call

Preview of the video call

From the Nabla Console, a provider can now send a video call CTA that the patient can tap to join the call.

The patient will have to accept the Microphone and Camera permissions and will then be able to join the call.