DEV Community

Unpublished Post. This URL is public but secret, so share at your own discretion.

Twilio to Agora Migration Guide for iOS

Introduction

This guide will assist you in migrating your existing Twilio Video implementation to the Agora Video SDK. If you are initiating a new project, it is advised to refer to the Agora Video SDK documentation.

Quick start

Quick start demos for swift are provided. Check them out at Quick Start Demo. Additional demos can be found at More Demos.

Please follow the documentation at api-ref.agora.io.

Step 1: Obtain Agora Video SDK Keys

To access Agora services and integrate them into your project, follow these steps to obtain the necessary information from the Agora Console:

  1. App ID:
    • Log in to the Agora Console and navigate to your project.
    • Find the "App ID," a randomly generated string unique to your App. This ID is crucial for identifying your application within Agora.
  2. Temporary Token:
    • When clients from your App join a channel, they need a Token for authentication.
    • Generate a temporary Token from the Agora Console, which has a validity period of 24 hours. This Token is used to authenticate users joining your channel.
  3. Channel Name:
    • Define a unique string as the "Channel Name" to identify and label your channel.

By completing these steps, you'll have the necessary credentials to integrate Agora services into your application. Refer to the Agora Console for detailed guidance on accessing and managing these credentials.

Step 2: Install Agora Video SDK

Install

Using CocoaPods:

1.Ensure that you have installed CocoaPods.

2.In Terminal, navigate to the project path, and run the pod init command to create a Podfile in the project folder.

3.Open Podfile, and add the Video SDK pod.

< CODE BLOCK >
https://gist.github.com/tadaspetra/e562ce1e1a7cea2a1d07169de5ac8ba1

4.Replace version with the version of Video SDK that you want to integrate.

5.Return to Terminal, and run the pod install command to install Video SDK. Once you successfully install Video SDK:, it shows Pod installation complete! in Terminal, and you can see an xcworkspace file in the project folder.

6.Open the generated xcworkspace file.

Download Video SDK:

1.Extract the files from the iOS download to a local folder, .

2.From the libs folder of the downloaded SDK package, copy the files or subfolders you need to the root of your project folder.

3.In Xcode, link your target to the frameworks or libraries you have copied. Be sure to choose Embed & Sign from the pop-up menu in the Embed column.

Apple does not allow an app extension to contain any dynamic library. If you are integrating the Agora SDK to an app extension, choose Do Not Embed in the Embed column.

The Agora SDK uses libc++ (LLVM) by default. Contact support@agora.io if you want to use libstdc++ (GNU). Video SDK: provides FAT image libraries with multi-architecture support for both 32/64-bit audio emulators and 32/64-bit audio/video real devices.

Remove Twilio SDK from your project:

Remove the listing for TwilioVideo in the Podfile and run pod install as necessary to remove the Twilio Video SDK.

Step 3: Start and Join Sessions

Twillo:

< CODE BLOCK >
https://gist.github.com/tadaspetra/15f19f39918b8c2a976165c29196c79a

Agora:

< CODE BLOCK >
https://gist.github.com/tadaspetra/061a0db1fc85178dc760334bdc19f2f0

Step 4: Create Local Audio and Video Tracks and Publish

Twilio:

< CODE BLOCK >
https://gist.github.com/tadaspetra/d333cdd9a7b3b035af40ead6f4fcced5

Agora:

< CODE BLOCK >
https://gist.github.com/tadaspetra/76aae63f6c0e162e7099d79d482ce6c1

Step 5: Render Remote User Video

Twilio:

< CODE BLOCK >
https://gist.github.com/tadaspetra/32a26089b691972de739c3f0f3c63e4f

Agora:

< CODE BLOCK >
https://gist.github.com/tadaspetra/5eee714ad7dad03f8a8e0965c4ddc4f8

Step 6: Audio Controller

Twilio:

< CODE BLOCK >
https://gist.github.com/tadaspetra/3f16c90f6447d8cdd5f219696e4af625

Agora:

< CODE BLOCK >
https://gist.github.com/tadaspetra/9ff4993928a39ae7c65d4eef35cd95dc

Step 7: Leave and End Sessions

Twilio:

< CODE BLOCK >
https://gist.github.com/tadaspetra/e2ef69e34666c95ac9f220417b9d0c2f

Agora:

< CODE BLOCK >
https://gist.github.com/tadaspetra/0af4f179e52db543203ece00271fa01a

Additional Agora Video SDK Features

The Agora Video SDK provides a rich set of features that can enhance your video conferencing application. Here are some key features and information to consider:

  1. Platform Support:
    • Agora Video SDK supports a variety of platforms, including Android, iOS, Web, Linux, macOS, and Windows. Additionally, it offers wrappers for popular frameworks like Flutter and React Native.
  2. Cloud Recording:
    • Agora Video SDK provides cloud recording capabilities, allowing you to capture and store your sessions for later playback or archival purposes. Consult the Agora Video SDK documentation for details on implementing this feature.
  3. Screen Sharing:
    • Implement screen sharing in your application using Agora's screen-sharing capabilities. This feature is valuable for collaborative work and presentations.
  4. Plug-in Architecture:
    • Agora's support for plug-ins enhances the extensibility of your video application. You can seamlessly integrate additional functionalities or customize features by leveraging Agora's plug-in architecture.
  5. Tree-Shaking:
    • Agora Video SDK supports tree-shaking, enabling you to optimize your application's bundle size by eliminating unused code during the build process. This ensures that your application remains lightweight and performs efficiently.
  6. Secure Communication:
    • Agora's end-to-end encryption ensures that the communication between users in a session is highly secure. This feature enhances privacy and protects sensitive information exchanged during video conferences.

For comprehensive details on Agora Video SDK features and how to implement them, refer to the Agora Video SDK Documentation.

Explore the full potential of Agora Video SDK to create a robust and feature-rich video conferencing experience. If you have specific feature requirements, consult the documentation for guidance on implementation.

Top comments (0)