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.2+, 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 VoxeetUXKit.framework, VoxeetSDK.framework, and WebRTC.framework into your Xcode project (needs to be dropped in 'Embedded Binaries'). More information is available here.

Using CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 70 thousand libraries and is used in over 3 million apps. CocoaPods can help you scale your projects elegantly.

You can install CocoaPods with the following command:

$ sudo gem install cocoapods

To integrate VoxeetUXKit into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'VoxeetUXKit', '~> 1.0'

Run pod install to build dependencies.

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 VoxeetUXKit.framework, VoxeetSDK.framework, and WebRTC.framework into 'Embedded Binaries'.

Dependencies

The UXKit uses external libraries (like SDWebImage) 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 and Kingfisher has been replaced by SDWebImage)

Voxeet Conference Kit usage

initialize

This method initializes the Voxeet frameworks.

Parameters

Example

import VoxeetSDK
import VoxeetUXKit

@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")
        VoxeetUXKit.shared.initialize()
        
        // Example of public variables to change the conference behavior.
        VoxeetSDK.shared.pushNotification.push.type = .none
        VoxeetSDK.shared.conference.defaultBuiltInSpeaker = false
        VoxeetSDK.shared.conference.defaultVideo = false
        VoxeetUXKit.shared.appearMaximized = true
        VoxeetUXKit.shared.telecom = false
        
        return true
    }
}

Reference

https://voxeet.com/documentation/sdk/initialization#initialize-the-sdk

open

It connects to a conference similarly to logging in. 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

  • info VTParticipantInfo - A participant 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 info = VTParticipantInfo(externalID: "1234", name: "Username", avatarURL: "https://voxeet.com/logo.jpg")
VoxeetSDK.shared.session.open(info: info) { error in }

Reference

https://voxeet.com/documentation/sdk/initialization#open-a-session

close

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.close { error in }

Reference

https://voxeet.com/documentation/sdk/initialization#close-a-session

start conference

Starts the UI of a conference.

Example

// Create a conference (with a custom conference alias).
let options = VTConferenceOptions()
options.alias = conferenceAlias
VoxeetSDK.shared.conference.create(options: options, success: { conference in
    // Join the created conference.
    let joinOptions = VTJoinOptions()
    joinOptions.constraints.video = false
    VoxeetSDK.shared.conference.join(conference: conference, options: joinOptions, success: { conference in
    }, fail: { error in
    })
}, fail: { error in
})

References

https://voxeet.com/documentation/sdk/conferencing#creating-a-conference https://voxeet.com/documentation/sdk/conferencing#joining-a-conference

stop conference

Stops the UI of a conference.

Example

VoxeetSDK.shared.conference.leave { error in }

Reference

https://voxeet.com/documentation/sdk/conferencing#leaving-a-conference

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.

VoxeetUXKit.shared.appearMaximized = true

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

VoxeetUXKit.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:

  • SDWebImage an asynchronous image downloader with cache support as a UIImageView category
  • Starscream a conforming WebSocket (RFC 6455) client library in Swift for iOS and OSX
  • Alamofire a HTTP networking library written in Swift
  • SwiftyJSON a tool for handling JSON data in Swift

SDK version

1.3.2