Skip to contentSkip to navigationSkip to topbar
On this page

Using Twilio Video side by side with WebRTC


The Twilio Video SDK for iOS is based upon a fork of the Chromium WebRTC project (webrtc.org(link takes you to an external page)). This heritage presents an interesting challenge when using other WebRTC dependencies alongside Twilio in your iOS application.

If you use the WebRTC Objective-C APIs or another Chromium WebRTC based SDK, read on to learn how you can eliminate class conflicts with Twilio Video.


How do conflicts occur

how-do-conflicts-occur page anchor

Objective-C doesn't support the concept of namespaces. Instead, developers typically use a 3-4 letter prefix to uniquely identify their classes. WebRTC classes are prefixed with RTC, while Twilio Video classes are prefixed with TVI.

Consider the following Podfile which consumes both Twilio Video and WebRTC.

1
source 'https://github.com/CocoaPods/Specs'
2
3
target 'TARGET_NAME' do
4
platform :ios, '9.0'
5
pod 'TwilioVideo', '2.2.2'
6
pod 'GoogleWebRTC'
7
end

Some classes with the RTC prefix are present both in WebRTC (publicly) and in Twilio Video (privately). When classes are loaded by the Objective-C runtime, any conflicts which occur are raised in your console logs:

Xcode interface displaying a ViewController.swift file for a video SDK with error logs in the console.

You can see that classes like RTCAudioSession are provided by both libraries. When classes conflict at runtime, the version which is loaded is undefined. This could result in unexpected behavior or crashes in your application.


How to resolve class conflicts

how-to-resolve-class-conflicts page anchor

One technique used to resolve class conflicts is to rename (prefix) the impacted classes. From version 2.3.0, Twilio Video prefixes RTC classes with TVI. For example, RTCAudioSession becomes TVIRTCAudioSession.

If you want to use Twilio Video side by side with other WebRTC dependencies we recommend that you update to version 2.3.0 or newer to eliminate class conflicts. For the latest version information, see the iOS SDK Changelog.