The Reality of Building WebRTC Live Streaming Solutions

Hermes
Agora.io
Published in
9 min readMar 13, 2024

In today’s hybrid world, real-time video has become ubiquitous across all aspects of society. As businesses shift away from linking to general services like Zoom and Google Meets for their video needs, they are weighing their options on whether or not to build their own or work with a provider.

Last week I was on a call with the founder of a successful brick-and-mortar retail business with a bustling e-commerce division. They are looking to bring live commerce into their business and debating on building it themselves with WebRTC or working with a Communications Platform as a Service (CPaaS).

As a founder who built two successful businesses from the ground up, he convinced his team could build a solution using WebRTC. I didn’t want to appear as doubting to his team, so I encouraged him to try it out. As the discussion progressed, we came upon the topic of scale and the need to integrate these live features into an existing e-commerce business; including web and mobile apps with hundreds of thousands of users.

At that moment I realized he was underestimating the pitfalls, the time, effort, and depth of knowledge it would take to build and launch a DIY solution at that scale. The allure of a DIY approach often needs to be tempered with an honest discussion around the challenges that emerge as companies attempt to launch and scale real-time engagement solutions.

DIY (WebRTC) or choosing a CPaaS provider is a common discussion I have with founders and developers. It comes up so often, that I’ve put together this post to highlight the realities businesses need to understand when seeking to innovate while grappling with the opportunities and pitfalls inherent in WebRTC-based solutions.

Unpacking the Promise of WebRTC

The initial attraction of DIY using WebRTC stems from: its simplicity in enabling real-time communication; its cost-effectiveness; and the autonomy it offers over the technology stack. WebRTC, an open-source protocol developed by Google, is supported by all major browsers, eliminating the need for third-party audio and video streaming plugins. This ease of use and broad compatibility is a major factor why companies consider using WebRTC for their live streaming needs.

However, it’s important to understand that while WebRTC is easy to setup and works great in small-scale situations, it becomes complex as it scales. WebRTC as technology was designed for Peer-2-Peer connections without intermediary servers; meaning it can’t handle large audiences on its own. Maintaining broadcast-quality streams across more than a handful of users requires investment in infrastructure and expertise.

DIY Roadblocks & The Infrastructure Quagmire

Developers scaling live streaming solutions leveraging WebRTC face countless technical challenges. These include: ensuring the architecture can handle an increased number of users; managing data efficiently across distributed systems; and delivering consistent quality across various devices and network conditions.

Top Challenges:

  1. Scalability of Architecture: WebRTC applications can adopt different architectural approaches such as Mesh, Forwarding (SFU), Multipoint (MCU), and Hybrid architectures. Each one has its advantages and limitations, which I discuss in detail in a separate post.
  2. Efficiency and Quality of Service: As the number of users grows, managing bandwidth is crucial. SFU architecture, for example, is more scalable and bandwidth-efficient than Mesh but requires careful management to prevent quality degradation as the number of participants increases. Also, ensuring high-quality service across diverse network conditions and device capabilities remains a persistent challenge, regardless of architecture choice.
  3. Infrastructure Management: Implementing auto-scaling infrastructure, such as utilizing Kubernetes for automating deployment under increased demand. However, this introduces complexities in ensuring communication between services and data persistence to ensure consistency and reliability.
  4. Adapting to Network Conditions: A crucial aspect of scaling WebRTC solutions is their adaptability to varying network conditions. The backend needs to detect the network conditions and dynamically adjust quality to maintain an optimal user experience.

As any application becomes successful and the user base grows, DIY/WebRTC solutions will require more attention and resources, distracting from the core business. Consider this, as users and usage scale, instead of unmanaged P2P connections, there is a shift from Mesh to client-server connections with media servers (SFU/MCU). This shift means taking control of all the connections, this includes between users and your infrastructure along with internal communication between SFU/MCU media servers.

The task of building and maintaining a scalable infrastructure for live streaming is both complex and resource-intensive. Ask any expert in the industry and they’ll highlight the importance of early planning for scalability, emphasizing that addressing scalability too late in the development process can lead to significant challenges.

The Unseen Tolls: The Real Costs of DIY Scaling

DIY live streaming solutions involve several cost factors that can escalate quickly with the increased demand when a business scales. The biggest costs are server capacity and infrastructure maintenance, which is code for: this will divert resources and budgets from core business functions.

Don’t just take my word for it, take a look at the story of ████████████, a unicorn startup that had an ambitious plan to build their own live streaming solution to support their core business, a Live Shopping platform. Initially lured by the allure of complete control over their technology stack and the potential cost savings, the team was confident in their ability to navigate the complexities of real-time video and audio streaming. They planned to build a platform that could support their immediate needs and grow alongside their burgeoning audience.

As the platform found its product market fit, it experienced exponential growth in popularity. As the user base grew 100x in under 6m, the team quickly faced the harsh realities of scaling their DIY solution. The demand for high-quality, uninterrupted streaming experiences intensified, pushing the boundaries of their initial setup.

Bandwidth became a much larger cost as more viewers joined seeking HD streaming options, significantly driving up bandwidth consumption. The struggles of maintaining server capacity soon followed. So many users were complaining of poor-quality video streams and glitchy connections, that it got to a point where their tech leadership had to divert most of their senior devs to supporting infrastructure and off of projects that were focused on features to increase revenue.

To accommodate the growing audience and ensure a seamless viewing experience, the startup had to continuously add more servers and upgrade existing hardware, further escalating expenses. The complexity of managing this expanding infrastructure and the need for constant maintenance began to divert valuable resources and attention away from core business functions and innovation. Eventually the team responsible for live streaming was larger than the team focused on building out core features and improving the platform's user experience.

Despite their technical expertise, the team needed help balancing their live-streaming service's operational demands and their strategic business goals. The allure of DIY scalability had faded, overshadowed by the escalating costs, complexity, and the realization that their approach was no longer sustainable. Recognizing that the disadvantages of continuing their DIY efforts —operational complexity and financial implications — had begun to outweigh the initial benefits, the team faced a tough decision: Keep going the path with their in-house solution OR pivot and find a CPaaS provider.

Acknowledging the issue and its long-term implications led the team to pivot. They began exploring and testing specialized live streaming service providers, seeking solutions that offered scalability, reliability, and cost-effectiveness without the burden of extensive in-house management.

The shift in their approach was based on understanding the value of focusing on their core business while leveraging the external expertise of a top CPaaS provider. Upon integrating Agora, the business stabilized its run-away infrastructure costs. The team was also able to add several new features ahead of schedule, thanks to Agora’s suite of real-time APIs and SDKs.

The Core of Streaming: Quality + Reliability

Whether it’s a startup’s live streaming platform gaining traction or a mature business activating live stream features on existing digital properties, stream quality will always be a concern. Developers implementing real-time video face the perfect storm of technical hurdles: buffering, latency, and video degradation. Each one of these can severely impact the user experience and a platform’s reputation. While these terms get tossed around a lot, it’s important to understand their role and how they impact the experience.

Starting with buffering, the most common issue users encounter with live streams. Buffering occurs when the video stream can’t download quickly enough for uninterrupted playback. This leads to pauses in the video playback which can frustrate viewers. This issue often arises from insufficient server capacity or inadequate content delivery networks (CDNs) that fail to handle the increased load efficiently. As the audience grows, the demand on the servers intensifies, making it crucial for the platform to scale its infrastructure proactively to minimize buffering.

The second most common issue is video degradation, when the video quality drops to a lower resolution it appears pixelated, and poor audio quality, is another issue that escalates with audience growth. This degradation often results from bandwidth limitations, either on the broadcasting side or the viewer’s end. Ensuring high-quality video requires substantial bandwidth and processing power, which must scale with the audience size to prevent degradation. Many developers deploy adaptive bitrate solutions to adjust the stream quality based on the viewer’s internet speed. However, ensuring a consistently high-quality experience across all devices and network conditions remains challenging.

Last and arguably the biggest challenge is Latency, characterized as the delay between the live action happening and the moment it is viewed on the user’s screen. In live streaming, low latency is vital to real-time interactions among viewers or between viewers and the broadcaster. High latency can disrupt the live feeling. In the case of live auctions, gaming, sports events, and interactive shows, it severely diminishes the real-time aspect of the stream.

Here’s where a Communication Platform as a Service (CPaaS) provider like Agora proves to be invaluable. Agora providers offer pre-built, scalable solutions that remove the complexities and allow teams to focus on their core business.

Agora’s solutions include advanced live voice and video communication SDKs, data signaling SDKs for real-time synchronization, and SDKs for interactive chat. Agora also has all the supporting APIs for insights, moderation, recording, and transcription. These tools are designed to support a wide range of applications, from social and educational to gaming and e-commerce platforms, enabling developers to build engaging, interactive web and native applications efficiently.

Making The Choice

The allure of DIY solutions and the initial appeal of technologies like WebRTC, while promising control and cost-efficiency, inevitably encounter scalability challenges and operational complexities that can stifle growth. WebRTC’s innovative potential is significantly hampered by its limitations for enterprise-level applications without heavy investment in infrastructure and expertise. These are not mere technicalities but strategic obstacles diverting resources from businesses’ core missions.

Choosing between pursuing a DIY path or partnering with a specialized provider like Agora is a defining strategic decision. It’s about prioritizing core business goals and revenue, rather than wasting efforts on managing complex, non-core technology challenges.

As you explore live streaming solutions, I invite you to explore Agora’s suite of real-time APIs and SDKs. Take advantage of real-time solutions that will set your business on a path to success, with reliability and excellence.

--

--

Hermes
Agora.io

Director of DevRel @ Agora.io … former CTO @ webXR.tools & AR Engineer @ Blippar — If you can close your eyes & picture it, I can find a way to build it