Warning
We are no longer allowing new customers to onboard to Twilio Video. Effective December 5th, 2026, Twilio Video will End of Life (EOL) and will cease to function for all customers. Additional information on this EOL is available in our Help Center here).
This app is a sample video conferencing app that uses the Twilio Programmable Video SDK. The open source app can be easily configured by developers to try out real-time video and audio features.
- Video conferencing with real-time video and audio
- Speaker grid layout
- Presentation layout
- Enable/disable camera
- Mute/unmute mic
- Switch between front and back camera
- Dominant speaker indicator
- Network quality indicator
- Bandwidth Profile API
NOTE: The Twilio Function that provides access tokens via a passcode should NOT be used in a production environment. This token server supports seamlessly getting started with the collaboration app, and while convenient, the passcode is not secure enough for production environments. You should use an authentication provider to securely provide access tokens to your client applications. You can find more information about Programmable Video access tokens in this tutorial.
The app requires a back-end to generate Twilio access tokens. Follow the instructions below to deploy a serverless back-end using Twilio Functions.
- Install Twilio CLI.
- Run
twilio login
and follow prompts to login to your Twilio account. - Run
twilio plugins:install @twilio-labs/plugin-rtc
. - Run
twilio rtc:apps:video:deploy --authentication passcode
. - The passcode that is output will be used later to sign in to the app.
The passcode will expire after one week. To generate a new passcode, run twilio rtc:apps:video:deploy --authentication passcode --override
.
If any errors occur after running a Twilio CLI RTC Plugin command, or the application fails to validate a passcode, then try the following steps.
- Update your application to the latest source
- Run
twilio plugins:update
to update the RTC plugin to the latest version. - Run
twilio rtc:apps:video:delete
to delete any existing authentication servers. - Run
twilio rtc:apps:video:deploy --authentication passcode
to deploy a new authentication server.
NOTE: Usage charges will apply for most room types. See pricing for more information.
After running the command to deploy a Twilio Access Token Server, the room type will be returned in the command line output. Each room type provides a different video experience. More details about these room types can be found here. The rest of this section explains how these room types affect the behavior of the video app.
Group - The Group room type allows up to fifty participants to join a video room in the app. The Network Quality Level (NQL) indicators and dominant speaker are demonstrated with this room type. Also, the VP8 video codec with simulcast enabled along with a bandwidth profile are set by default in order to provide an optimal group video app experience.
Small Group - The Small Group room type provides an identical group video app experience except for a smaller limit of four participants.
Peer-to-peer - Although up to ten participants can join a room using the Peer-to-peer (P2P) room type, it is ideal for a one to one video experience. The NQL indicators, bandwidth profiles, and dominant speaker cannot be used with this room type. Thus, they are not demonstrated in the video app. Also, the VP8 video codec with simulcast disabled and 720p minimum video capturing dimensions are also set by default in order to provide an optimal one to one video app experience. If more than ten participants join a room with this room type, then the video app will present an error.
Go - The Go room type provides a similar Peer-to-peer video app experience except for a smaller limit of two participants. If more than two participants join a room with this room type, then the video app will present an error.
If the max number of participants is exceeded, then the video app will present an error for all room types.
- Open
VideoApp/VideoApp.xcodeproj
with Xcode. - In Xcode navigate to the Signing & Capabilities pane of the project editor for the
Video-Community
target. - Change
Team
to your team. - Change
Bundle identifier
to something unique. - Check
Automatically manage signing
.
- In Xcode use the Scheme menu to select the
Video-Community
scheme. - In Xcode use the Scheme menu to select a destination. Cameras do not work in the simulator so select a device for best results.
- Run
⌘R
the app.
The Video-Internal
scheme uses authentication that is only available to Twilio employees in order to make internal testing easier.
For each device:
- Run the app.
- Enter any unique name in the
Your name
field. - Enter the passcode from Deploy Twilio Access Token Server in the
Passcode
field. - Tap
Sign in
. - Enter a room name.
- Tap
Continue
. - Configure the camera and microphone and tap
Join Now
.
The passcode will expire after one week. Follow the steps below to sign in with a new passcode.
- Generate a new passcode.
- In the app tap
Settings > Sign Out
. - Repeat the steps above.
This app uses SwiftUI. SwiftUI
and Combine work particularly well for the video collaboration features in this app, which involve a lot of real-time state changes. SwiftUI
has allowed us to build a better app with a lot less code.
If your app uses UIKit
or an older version of SwiftUI
, you should still be able to use a lot of code from this repo in your app. Here are some tips:
- UIKit can display SwiftUI views and SwiftUI can display UIKit views, so you may be able to use
SwiftUI
code from this repo even if your app is currently allUIKit
. - Use the before-swift-ui tag to view the app source prior to converting from
UIKit
toSwiftUI
. It has a lot of the same video collaboration features but the UI isn't as nice. - If you can use
SwiftUI
but have to support iOS 13, most of the app should work well. The main issue will beLazyVGrid
requires iOS 14. However our usage ofLazyVGrid
is very basic with no scrolling so it shouldn't be a lot of work to replace it with a custom grid built withHStack
andVStack
. - If you don't want to use
SwiftUI
but can useCombine
(requires iOS 13), you should be able to use all of the view models andTwilioVideo
integration code. For the UI, replace theSwiftUI
code with your ownUIKit
implementation. TheCombine
interface provided by the view models andTwilioVideo
integration layer should be nice forUIKit
to use. - If you need to support older than iOS 13, you will have to replace the
SwiftUI
code with your ownUIKit
implementation, and replace theCombine
code used in the view models andTwilioVideo
integration layer with something else. It shouldn't be a lot of work to replaceCombine
withNotificationCenter
or a multicast delegate.
For unit tests use:
Video-Internal
scheme.Video-InternalTests
target.Unit
test plan.- Quick and Nimble to write unit tests.
- Swift Mock Generator to create mocks.
UI tests require credentials that are only available to Twilio employees.
- Running tests
⌘U
will crash if the app was run⌘R
on the device previously. See issue #12 for a workaround and more details.
Twilio employees should follow these instructions for internal testing.
Apache 2.0 license. See the LICENSE file for details.