Skip to main content

The basics of building a peer to peer video call: A guide for devs

Shweta Joshi
  • Tutorial Type: Basics
  • Reading Time: 15 min
  • Building Time: N/A
Chat SDK v4 2x

Swift, Kotlin, and TypeScript SDKs

Build in-app chat, calls, and live streaming

Peer to peer video calls: An efficient communications solution

In the post-Covid era, many organizations shifted to hybrid or fully remote work teams. As these organizations, along with the average tech-savvy consumer, look for secure ways to communicate, peer to peer (P2P) video conferencing has emerged as a reliable and efficient communication solution. A peer to peer video call enables users to engage in high-quality, real-time video conversations while bypassing the need for a central server. The result is improved call quality, reduced latency, and reduced load on an organization’s central resources.

For the average consumer, P2P video calls have made it easier than ever to stay in touch and connect with loved ones from a distance. Meanwhile, businesses are leveraging peer to peer video conferencing to facilitate remote team collaboration, host engaging virtual events, and enhance customer support.

Is P2P video calling a technology that a business should implement, either for users and customers, or for internal operations? In this article, we’ll look more closely at how a peer to peer video call works, common business use cases, as well as the advantages and disadvantages of peer to peer calls.

Let’s begin with a closer look at a peer to peer video call and how it works.

What is a peer to peer video call?

A P2P video call is a type of communication in which data is transmitted directly between participating devices (often referred to as ‘clients’) without passing through a central server. This differs from a cloud-based video call, in which the participating devices route data through a central server, which subsequently processes and transmits the data between users.

The diagram below provides a basic overview of this. On the left, you can see that the client devices are connected to a central server, which is a hub for audio and video streams. On the right, all clients are connected via a P2P connection.

Cloud-based vs P2P video call
Adapted from

The technology underlying a peer to peer video call

Among the handful of technologies used for facilitating real-time audio and video transfer, WebRTC is perhaps the best known and most widely used. So what is WebRTC? WebRTC is an open source communications protocol based on peer to peer technology and serves as a framework to enable real-time data communication within the web browser.

To establish a connection, developers using WebRTC use a signaling server to set up the call. This involves an exchange of metadata between devices from the two parties. That metadata includes media capabilities and other network information. Then, WebRTC performs Interactive Connectivity Establishment (ICE) to determine the best way for the devices to connect. ICE is just a way for two peers to decide which channel to use for the P2P connection.

Interactive Connectivity Establishment (ICE) visualization
Adapted from

Ideally, it’s at this point that WebRTC establishes a direct connection for P2P communication. The connected parties can now begin exchanging data. This is what the flow diagram looks like:

P2P communication flow diagram
Adapted from medialooks

This works well in the case of a local area network or when clients are not behind a NAT. On the public internet, however, it’s quite possible that peers are behind a NAT and therefore don’t have access to each others’ IP addresses. To circumvent this, you can use a STUN server. A STUN server helps to detect a peer’s public network address information and establish a peer to peer connection behind a NAT.

The flow then looks like this:

STUN server flow chart
Adapted from medialooks

But what happens if a peer is behind a firewall? This is where a TURN server comes in. The two clients can exchange information through a TURN server, which in this case functions just like a standard media server.

TURN server flow chart
Adapted from medialooks

You may have realized that in this case, the peer to peer connection is not precisely peer to peer since a server is involved; WebRTC becomes a ‘best-effort’ peer to peer connection protocol.

In terms of security, WebRTC implements mandatory encryption for all components. It uses Secure Real-time Transport Protocol (SRTP) for audio and video streams and Datagram Transport Layer Security (DTLS) for data channels.

The potential impact on end-user devices

Without a central server to process and relay video call data, a peer to peer video call can impose a certain level of load on end-user devices. This is because each device must process audio and video streams, handle encryption and decryption, as well as manage the transmission of data over the network. The load on each device’s resources—computing, memory, and storage—has the potential to impact device performance. The extent to which device performance is affected depends on each device’s capabilities, as well as the quality and complexity of the video call.

Not that the P2P call flows outlined above are only the basics; there are many more intricacies and possible scenarios related to peer to peer connections. If you’d like to learn more, this article about WebRTC flows is an excellent place to start.

If you’d like to avoid dealing with the details of WebRTC technology and start from a highly-abstracted WebRTC-based API instead, you can work with an API like Sendbird Calls. This video calling API manages the technology underlying WebRTC in the backend, and allows you to focus specifically on the user’s calling experience. The in-app calls experience can be fast and easy to build; for example, here’s how Hinge deployed voice and video calls in just 5 weeks. Check out our many tutorials to get started with Sendbird Calls!

Business use cases for peer to peer video calls

Many organizations have good reason to support P2P video calling as part of their operations. Some common use cases for peer to peer video calling include:

  • Remote collaboration: Video calls foster better communication and collaboration among hybrid or fully remote teams, allowing them to work more effectively on projects without the need for in-person meetings.

  • Customer support: Integrating video calls into customer support services can provide a personalized customer experience, resolving issues more quickly while building stronger customer connections.

  • Telehealth: Healthcare providers can use video calls to conduct virtual consultations with patients, reducing the need for in-person visits and improving access to care. The end-to-end encryption of P2P video calls can contribute to fulfilling healthcare-related security and compliance requirements, especially related to digital health.

  • Online education: Video calls can be used to facilitate one-on-one remote learning, providing an interactive and dynamic learning environment.

Finally, let’s look at the advantages and disadvantages of peer to peer video calls. You can find a quick summary below; the details are discussed in the next section.

Pros and cons of peer to peer video calls

Let’s discuss these in detail.

Advantages of a peer to peer video call

With each year, devices are improving in performance while remaining affordable for the average end user. At the same time, network speeds increase and high-bandwidth connectivity becomes more available. All of these factors contribute to making P2P video calls a norm for modern communication.

Superior call quality

P2P video calls minimize latency and packet loss. With data transmitted directly between devices (in the best case) rather than through a central server, a peer to peer video call removes the potential for additional delays or bottlenecks. With a direct connection between devices, call participants enjoy smoother video and audio transmission. The result is a superior communication experience for both businesses and consumers.

Reduced costs

Implementing P2P video calls can be more cost-effective for businesses, as they don’t need to invest in or maintain expensive server infrastructure. They also don’t need to subscribe to cloud-based calling services, which can get very expensive very quickly. Additionally, peer to peer technology can offer lower ongoing operational costs, bringing further cost savings.

Enhanced security

P2P video calls can provide increased security. The absence of a central server reduces the surface area for attack in terms of data breaches, unauthorized access to sensitive information, and call eavesdropping. Data in a P2P network (which, in the context of P2P video calling, comprises of audio and video streams) is encrypted on the sender’s device, transmitted securely to the receiver’s device, and then decrypted on the receiver’s device. This end-to-end encryption helps to protect against malicious attacks and ensures that private conversations remain private.

Stronger network resilience

P2P networks can be seen as more resilient than centralized systems, in which the central server could become a single point of failure. For example, in a peer to peer video call of several participants, even if one participant experiences connectivity issues, the network can continue to function without significant disruption. This network resilience makes P2P video calls a strong choice for businesses that require dependable communication solutions.

Disadvantages of a peer to peer video call

P2P video calling is not without its disadvantages, which include the following:

Degraded performance if end-user devices are unreliable

P2P video calls consume more resources on the end-user device, which is responsible for data encryption, decryption, and processing. The resulting resource load may therefore impact the overall performance of the device. End users with slower internet connections or older devices with limited capabilities may struggle to maintain optimal call quality.

Possibility of legal and compliance issues

Some jurisdictions may have regulations that restrict the use of P2P technology and end-to-end encrypted communication. This introduces challenges for businesses seeking to operate in those jurisdictions, as the companies risk non-compliance. Organizations must be aware of local laws and regulations governing the use of P2P communication in order to avoid potential penalties or fines.

Implementation complexity if building from scratch

Implementing a P2P video call application from scratch can be incredibly complicated, as it requires specific domains of expertise for setup, development, configuration, and maintenance. When organizations decide to roll out their own P2P video calling system, they will need to invest considerable engineering resources.

Build on a strong foundation: The Calls SDKs from Sendbird

As we’ve looked at P2P video calls, we have covered topics ranging from peer to peer technology, business use cases, and the advantages and disadvantages of peer to peer video calling. As your business considers whether implementing P2P video calls is right for you, remember that you don’t need to build the peer to peer video call ecosystem from the ground up.

Sendbird Calls allows you to build high-quality voice and video calling capabilities into your web and mobile apps with a video calling API. You can build a fully customized solution using the Sendbird Calls platform API, and our highly abstracted client SDKs:

Sign up to start using Sendbird with a free (forever!) Developer plan. You can also request a demo to see Sendbird Calls in action and learn more about how Sendbird can meet your needs. Our experts are always happy to help!

Happy P2P calls building! ✨