6 things developers should know to port Twilio video to Daily

If you’re thinking about porting a JavaScript application from one framework or API to a different one, you'll no doubt go through an early evaluation and comparison phase. To accurately assess how features and functionality of two different options compare, you typically need to map the vocabulary and paradigms between the frameworks, languages, or APIs you're evaluating.

In this post we will help you map some of the central vocabulary used by Twilio Video to Daily’s features and functionality. We’ll talk about application primitives like rooms, tokens, participants, and recordings. We’ll cover platform features like Daily's Global Mesh Network and simulcast. Daily’s video API provides equivalent or in many cases better features that are easier to use and give you more control over call quality and experience.

To learn more about why developers are choosing Daily over Twilio for their real time video applications, check out the Daily website. Daily is also here to help you more directly. If you’d rather have a chat, you can always reach out to us.

Application primitives

Let’s start by looking at some of the basic building blocks of a video application: rooms, tokens, participants, and recording.

Rooms

For both Twilio Video and Daily, rooms are the basic building block for connecting users and allowing them to exchange audio and video in real time.

Daily has a single room type which supports both P2P and SFU modes. In SFU mode Daily supports 1000 active participants or 100000 viewers with 25 active microphones and cameras.

Daily rooms can be created in the Daily Dashboard or by using the /rooms endpoint of the Daily REST API. Rooms are permanent by default, but can be configured with start and end times if desired.

Twilio has three* different types of rooms, each with different capabilities and participant limits:

  1. WebRTC Go rooms - Maximum of 2 participants
  2. P2P rooms - Maximum of 3 participants
  3. Group rooms - Maximum of 50 participants

A Twilio Video room is created as a specific type. Once created its type cannot be changed.

Twilio Video rooms all have a maximum lifetime of 24 hours from creation. After this time the room is destroyed and all participants disconnected.

* The legacy “Small Group Room” is a fourth Twilio Video room type which offers a maximum of 4 participants.

Tokens

Both Daily and Twilio Video use JSON Web Tokens (JWT) to control room access and session configuration on a per-user basis.

Daily meeting tokens are typically created by sending a POST request to the Daily REST API. Self-signed tokens are also accepted by Daily, allowing you to generate them using your own server-side application. If a Daily room is configured as a public room, no meeting token is required.

All Twilio Video Rooms require an access token. Access tokens are created in your own server-side application using Twilio’s helper libraries.

Participants

Both Daily and Twilio Video include the concept of a participant. Once a user joins a room they become a participant in the room.

Because Daily rooms are permanent, Daily uses the concept of a meeting session to group one or more participants in a room together during a specific time window. The Daily REST API allows your application to list current meeting sessions and meeting participants.

daily-js, Daily’s JavaScript SDK, gives you granular control over all meeting participants. You can list and update all meeting participants and handle relevant events for both local and remote meeting participants. daily-js also gives you granular control over the local participant’s permissions, tracks, local recording, and custom user data defined by you.

Twilio’s REST API allows you to list all participants in a room.

Twilio JavaScript SDKs give you control over all room participants. SDKs can list and update participants and will raise relevant events for both local and remote participants. They also give you control over the local participant including permissions, tracks, and custom user data defined by you.

Recording

Both Daily and Twilio Video support recording participants in a room.

Daily supports four recording types:

  • local - saves the finished recording as a .webm file on the participant's computer
  • cloud - records a Daily call server-side, storing media in an Amazon S3 bucket.
  • raw-tracks- captures each individual media track from a call separately and stores them in your custom S3 bucket.
  • output-byte-stream - records byte-level data locally.

When using cloud recording, Daily supports storing media in Amazon S3, including your own custom S3 bucket. Recording of participants can be initiated through the daily-js client SDK or via the REST API.

Daily cloud recording automatically composes participant videos into a single playable MP4 video, allowing you to control the composition layout through a set of common preset values or providing a custom layout using Daily's Video Component System.

Twilio Video supports only cloud recording to S3, including the ability to save to your own S3 bucket. When recording is enabled for a participant, that participant's individual audio and video tracks are recorded and stored. Composing of participant videos into a single playable format can only be done after the participant recordings are complete (aka “post-flight”) via a Video Composition Service.

Networking and quality

Underpinning a great video experience are technologies which optimize network conditions and enable video applications to react to changing network quality. Let's look at some of the features that Daily offers and how they map to Twilio Video.

Low latency networking

Video applications are particularly sensitive to network congestion and latency issues, which can result in poor call quality.

Daily has created the Global Mesh Network, which locates network edges close to your users and provides high speed, low latency interconnections across the globe. This infrastructure underpins Daily’s platform and is the foundation of Daily’s ability to deliver impressive call quality.

Twilio offers its Global Low Latency infrastructure on which its video platform is built.

Simulcast

Both Daily and Twilio support simulcast. Simulcast is a technique by which a sender encodes and publishes to SFU (Selective Forwarding Unit) the same source track at several different resolutions, bitrates, and frame rates. Each of these groups of settings is known as a simulcast layer. The SFU then decides, based on individual participant's current network conditions, which layer to send to each subscriber.

daily-js encodes three simulcast layers in desktop browsers and two layers on mobile browsers. The daily-js SDK also offers APIs that give you more granular control over the simulcast behavior of both senders and receivers.

When enabled, Twilio Video encodes 3 simulcast layers.

Twilio Video will automatically detect which simulcast layers are being used by subscribers and turn off encoding for layers not being used.

The Twilio Video JavaScript SDK offers APIs that allow you to control sender simulcast.

Conclusion

Choosing to port to new frameworks and tools is challenging. However, with some preparation and planning, it can be a great way to increase the capabilities of your application, simplify maintenance, or increase reliability and quality.

When considering a port, it’s a good idea to start by comparing your current application to the options you are considering. In this post we discussed how to map the language used by Twilio Video to Daily’s video API and highlighted some of the functionality differences between the two platforms.

Video applications can be highly complex. While Daily simplifies many parts of building a high quality real-time video application, we also understand that you may still have questions, especially if you are considering porting from another platform. Daily is here to help guide you through your evaluation and be a partner in the success of your application.

Never miss a story

Get the latest direct to your inbox.