UXKit Voxeet Swift

Voxeet UXKit

The Voxeet UXKit is a framework based on VoxeetSDK. A sample application is available on GitHub repository.

Requirements

  • Operating systems: iOS 9.0 and later versions
  • IDE: Xcode 11+
  • Languages: Swift 5.1+, Objective-C, React Native, Cordova
  • Supported architectures: armv7, arm64, i386, x86_64

Installation of the iOS SDK

Get your credentials

Get a consumer key and consumer secret for your application from your developer account dashboard.

If you are a new user, sign up for a Voxeet developer account and create an application. You can create one application using a trial account. Upgrade to a paid account to use multiple applications and to continue using Voxeet when your trial expires.

Project setup

Enable background mode (path: Target settings ▸ Capabilities ▸ Background Modes):

  • Turn on 'Audio, AirPlay and Picture in Picture'
  • Turn on 'Voice over IP'

To support CallKit (receive incoming calls when an application is not working) with VoIP push notification, enable 'Push Notifications'. Then upload your VoIP push certificate to the Voxeet developer portal.

Capabilities

Add two new keys in the Info.plist to enable needed permissions:

  • Privacy - Microphone Usage Description
  • Privacy - Camera Usage Description

Installation

using Carthage

Carthage is a decentralized dependency manager that builds dependencies and provides binary frameworks.

Install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate UXKit into your Xcode project using Carthage, specify it in your Cartfile:

github "voxeet/voxeet-uxkit-ios" ~> 1.0

Run carthage update to build the frameworks and drag VoxeetConferenceKit.framework, VoxeetSDK.framework, and WebRTC.framework into your Xcode project (needs to be dropped in 'Embedded Binaries'). More information is available here.

Manual installation

Download the lastest zip file:

Unzip it and drag and drop frameworks into your project.

Then, select 'Copy items if needed' with the right target. In the general tab of your target, add the VoxeetConferenceKit.framework, VoxeetSDK.framework, and WebRTC.framework into 'Embedded Binaries'.

Dependencies

The UXKit uses external libraries (like Kingfisher) for downloading and caching images from the web (avatars). Download this framework from this link or install it with Carthage (or CocoaPods).

After that, 'Embedded Binaries' and 'Linked Frameworks and Libraries' should contain the following sections:

“Frameworks”

(WebRTC.framework missing on this screenshot)

Voxeet Conference Kit usage

initialize

This method initializes the Voxeet frameworks.

Parameters

Example

import VoxeetSDK
import VoxeetConferenceKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        // Voxeet SDKs initialization.
        VoxeetSDK.shared.initialize(consumerKey: "YOUR_CONSUMER_KEY", consumerSecret: "YOUR_CONSUMER_SECRET")
        VoxeetConferenceKit.shared.initialize()
        
        // Example of public variables to change the conference behavior.
        VoxeetSDK.shared.pushNotification.type = .none
        VoxeetSDK.shared.conference.defaultBuiltInSpeaker = false
        VoxeetSDK.shared.conference.defaultVideo = false
        VoxeetConferenceKit.shared.appearMaximized = true
        VoxeetConferenceKit.shared.telecom = false
        
        return true
    }
}

Reference

https://github.com/voxeet/voxeet-sdk-ios#initialize-the-voxeet-sdk

connect

This method is optional. It connects to a conference similarly to logging in. To use it, the SDK needs to be initialized with connectSession set to false. This method is useful if CallKit is implemented (VoIP push notifications). In such a situation, if there is an invitation, notifications can be received when the session is opened.

Optional parameters

  • user VTUser - A user to be linked to our server.
  • completion ((_ error: NSError) -> Void) - A block object to be executed when the server connection sequence ends. This block does not return any value and takes a single NSError argument indicating whether or not the connection to the server succeeded.

Example

let user = VTUser(externalID: "1234", name: "Username", avatarURL: "https://voxeet.com/logo.jpg")
VoxeetSDK.shared.session.connect(user: user) { error in }

Reference

https://github.com/voxeet/voxeet-sdk-ios#connect

disconnect

This method is optional. Closes a session similarly to logging out. It stops the socket and stops sending VoIP push notifications.

Parameters

  • completion ((_ error: NSError?) -> Void)? - A block object to be executed when the server connection sequence ends. This block has no return value and takes a single NSError argument that indicates whether or not the connection to the server succeedes.

Example

VoxeetSDK.shared.session.disconnect { error in }

Reference

https://github.com/voxeet/voxeet-sdk-ios#disconnect

start conference

Starts the UI of a conference.

Example

// Create a conference.
VoxeetSDK.shared.conference.create(success: { json in
    guard let confID = json?["conferenceId"] as? String else { return }
    
    // Join the created conference.
    VoxeetSDK.shared.conference.join(conferenceID: confID, video: false, userInfo: nil, success: { json in
    }, fail: { error in
    })
    
}, fail: { error in
})

References

https://github.com/voxeet/voxeet-sdk-ios#create https://github.com/voxeet/voxeet-sdk-ios#join

stop conference

Stops the UI of a conference.

Example

VoxeetSDK.shared.conference.leave { error in }

Reference

https://github.com/voxeet/voxeet-sdk-ios#leave

useful variables

To maximize or minimize a conference, use the appearMaximized (as in the example below). By default, the conference appears maximized. Change the value to false if you wish to minimize it.

VoxeetConferenceKit.shared.appearMaximized = true

The telecom option takes all the participants out of the conference in a case when someone hangs up.

VoxeetConferenceKit.shared.telecom = false

CallKit sound and image

If CallKitSound.mp3 is overridden, the ringing sound is replaced by the desired mp3.

If IconMask.png is overridden, the default CallKit image is replaced by other desired image (40x40px).

Tech

The Voxeet iOS SDK and ConferenceKit rely on these open source projects:

  • Kingfisher a lightweight, pure-Swift library for downloading and caching images from the web
  • Starscream a conforming WebSocket (RFC 6455) client library in Swift for iOS and OSX
  • Alamofire an HTTP networking library written in Swift
  • SwiftyJSON a tool for handling JSON data in Swift

SDK version

1.2.5