iOS Platform Overview

Carthage compatible

Twilio's Programmable Video iOS SDK lets you add real time voice and video to your native iOS applications.

Prerequisites

  • Xcode 9.0+
  • Swift projects must use Swift 3.0 or higher
  • CocoaPods 1.0.0+
  • Support for iOS 9.0+

Run the QuickStart app

To get started with Twilio Video, you should download and run a QuickStart application [Swift, Objective-C].

Using a Simulator

You can use the iOS Simulator that comes with Xcode to do your testing, but local video will not be shared since the Simulator cannot access a camera. If you have an iOS device, you can now run apps from Xcode on your device without a paid developer account.

The QuickStart repository [Swift, Objective-C] contains additional examples. These examples demonstrate the usage of new features and also let you build more complex applications.

To add Video to your app, follow the Getting Started Guide

Add the SDK

The iOS Video framework can be installed using Carthage, CocoaPods or manually, as you prefer.

Carthage

You can add Programmable Video for iOS by adding the following line to your Cartfile:

github "twilio/twilio-video-ios"

Then run carthage bootstrap (or carthage update if you are updating your SDKs)

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

Add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/TwilioVideo.framework

CocoaPods

source 'https://github.com/CocoaPods/Specs'

platform :ios, '9.0'

target 'TARGET_NAME' do
    pod 'TwilioVideo', '~> 2.2'
end

Then run pod install to install the dependencies for your project.

Manual

TwilioVideo.framework is distributed as a dynamic iOS framework that you can drag and drop into your existing projects.

View all Video iOS Releases here or just download the latest Video framework here.

Once you've downloaded and unpacked the framework, navigate to your Xcode project's General settings page. Drag and drop TwilioVideo.framework onto the Embedded Binaries section. Ensure that "Copy items if needed" is checked and press Finish. This will add TwilioVideo.framework to both the Embedded Binaries and Linked Frameworks and Libraries sections.

Next, you will need to open your project's Linked Frameworks and Libraries configuration. You should see the TwilioVideo.framework there already. Add the following frameworks to that list:

  • AudioToolbox.framework
  • VideoToolbox.framework
  • AVFoundation.framework
  • CoreTelephony.framework
  • GLKit.framework
  • CoreMedia.framework
  • SystemConfiguration.framework
  • libc++.tbd

In your Build Settings, you will also need to modify "Other Linker Flags" to include -ObjC.

Before distributing your app to the  App Store, you will need to strip the simulator binaries from the embedded framework. Navigate to your target's Build Phases screen and create a new "Run Script Phase". Ensure that this new run script phase is after the Embed Frameworks phase. Paste the following command in the script text field:

/bin/bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/TwilioVideo.framework/remove_archs"

Background Modes

To allow a connection to a Room to be persisted while an application is running in the background, you must select the Audio, AirPlay, and Picture in Picture background mode from the Capabilities project settings page.

Supported Devices

The iOS SDK supports iOS 9.0 or higher. It is built for armv7, arm64, x86 and x86_64 architectures with Bitcode slices for armv7 and arm64 devices. Devices based on the A5 SoC (iPhone 4s, iPad 2, iPad Mini 1, iPod Touch 5G) are not supported, and the SDK will not perform well on them.

Migrating from 1.x to 2.x

The Programmable Video iOS SDK is available in two versions. Our 2.0 releases are now "Generally Available" (GA) and represent our latest releases with the following new features:

  • H.264 encoding and decoding.
  • Codec preferences.
  • Bandwidth controls.
  • Subscription focused APIs.
  • Track names, Track level errors.
  • Data Tracks.
  • Custom Audio Devices.

Our 1.x releases are still GA and represent stable APIs that are supported with only critical bug fixes. Refer to our migration guide for migrating your applications from 1.x to 2.x.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.