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 11.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
Before using the SDK in your project, find your Consumer Key
and Consumer Secret
by following these steps:
1. Select the SIGN IN
link located in the upper right corner of the Dolby.io page. Log in using your email and password.
2. Click the DASHBOARD
link visible in the upper right corner of the website.
3. Select your application from the APPLICATIONS
category located on the left side menu.
4. Select the API Keys
category from the drop-down menu visible under your application.
5. In the Interactivity APIs
section, you can access your Consumer Key
and Consumer Secret
.
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.
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:
(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
consumerKey
String - the consumer key available on your dashboard.consumerSecret
String - the consumer secret available on your dashboard.
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
Check the initialize the SDK instruction in the Initializing document.
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 singleNSError
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
Check the open a conference instruction in the Initializing document.
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 singleNSError
argument that indicates whether or not the connection to the server succeedes.
Example
VoxeetSDK.shared.session.close { error in }
Reference
Check the close a conference instruction in the Initializing document.
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
Check the creating a conference and joining a conference instructions in the Conferencing document.
stop conference
Stops the UI of a conference.
Example
VoxeetSDK.shared.conference.leave { error in }
Reference
Check the leaving a conference instruction in the Conferencing document.
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