Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Configuring Audio, Video Input and Output devices

Deprecation Notice - all 1.x Versions
Please note that all Programmable Video iOS SDK 1.x versions are deprecated. Version 3.x is the latest version of the Programmable Video iOS SDK. Please see the Getting Started Guide for more information.

In this guide we’ll show you how to configure Audio routes and Video inputs in your Twilio Video application.

Selecting a specific Video Input

The TVICameraCapturer class captures from a TVICameraCaptureSource, and provides frames to a TVILocalVideoTrack. You can check what camera sources are available on your device by using the class method TVICameraCapturer.availableSources().

Add selected video source to local track

// The default initializer will succeed if the front camera is available.

if let camera = TVICameraCapturer(source: .frontCamera),
    let videoTrack = TVILocalVideoTrack(capturer: camera) {

    // TVIVideoView is a TVIVideoRenderer and can be added to any TVIVideoTrack.
    let renderer = TVIVideoView(frame: view.bounds)

    // Add renderer to the video track

    self.localVideoTrack = videoTrack = camera
} else {
    print("Couldn't create TVICameraCapturer or TVILocalVideoTrack")

// Select between the front and (wide) back camera.
func flipCamera() {
    if let camera = camera {
        if (camera.source == .frontCamera) {
        } else {

Selecting specific Audio routes

Typically, the audio input & output route is chosen by the end user via Control Center. The TVIAudioOutput enumeration can override this configuration and it constrains the available route choices that the user sees in Control Center. Use the TVIAudioController.audioOutput property to choose a setting appropriate for your use case.

Note: In all cases the route configuration chosen must support full duplex audio, such as a bluetooth headset or conference speaker system.

Rate this page:

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.