What Is WebRTC?November 27, 2018
As demand grows for interactive live video platforms, more providers are looking for an efficient and effective way to deliver low-latency video with browser-based streaming. WebRTC is a popular option among software engineers and developers—but is it right for your streaming use case?
In this post, we’ll explore what WebRTC is and isn’t suited for, and how Wowza Streaming Engine™ software leverages this innovative technology to broadcast live content to users in real time.
What Is WebRTC?
WebRTC is a free, open framework for the web that, as the name implies, enables Real-Time Communications (RTC) through browsers. This protocol creates a near simultaneous exchange of communication, utilizing a peer-to-peer connection between browsers without requiring plug-ins.
WebRTC enables multiple browsers to communicate with one another directly, allowing for video conferencing between individuals and small groups. It also enables the development of high-quality RTC apps for browsers, allowing browser-to-browser communication through a set of common protocols.
How does this work? WebRTC employs three HTML5 APIs that are built into the Chrome, Firefox and Safari browsers. These APIs turn the browsers into encoders for video streaming, which then connect directly to other browsers for playback.
Is WebRTC Right for You?
If you’re considering using WebRTC, you’ll need to determine whether it’s the best fit for your streaming workflow.
When to Use WebRTC
WebRTC may be a good fit for you if:
You require group video conferencing or real-time interactivity. Depending on your implementation, WebRTC may be a good option for group video conferencing and interactive use cases with smaller audiences. As long as you’re using WebRTC for your publish and playback, the technology supports real-time communication (less than .5 seconds) in good network conditions, facilitating nearly concurrent interactions.
If you want to delay the playback time, or try to synchronize playback across multiple devices, you may want to capture with WebRTC, but use HTTP Live Streaming (HLS) for playback, using metadata and timecode to control the time you want referenced from playback.
You need to build and/or broadcast through a web app quickly and easily, without heavy infrastructure. Since WebRTC makes use of HTML5 APIs, it allows you to utilize many of the features built into the HTML5 programming language through a lightweight, embedded framework. This makes it easy for developers to build web-based apps using WebRTC, and for users to take advantage of the functional offerings without having to download clients or use plug-ins.
The features enabled by WebRTC include the ability to screenshare and to perform browser-based encoding, so users can live stream from their browser window to other viewers and participants on the web.
When WebRTC May Not Be a Good Fit
There are some streaming workflows that may not be well-suited to using WebRTC. WebRTC may not be ideal for your use case if:
You need to stream at scale, or prepare for ‘viral’ viewership spikes. All developers hope their streaming applications will go viral, with thousands or even millions of viewers watching. However, with that many users comes a big scalability question. Currently, WebRTC is very limited in its ability to scale without a network of live-repeating servers, like Wowza Streaming Engine, that can handle the load.
According to WebRTC expert Tsahi Levent-Levi, whenever you connect one browser to another with a direct stream, you have to create and utilize a peer connection. But there is a limit to the number of concurrent peer connections a browser will allow; on Chrome, the limit is 500 connections, but Levant-Levi recommends no more than 50.
Because WebRTC utilizes peering networks, there still has to be a nearby node to help distribute the stream to other local hosts—and peering across a global network can be incredibly difficult unless you’re pairing WebRTC with a network of servers.
You need broadcast-quality streaming. Today, you can’t reliably stream broadcast-quality video through a WebRTC infrastructure. A certain bitrate, speed and level of network connectivity is required in order to get high-quality content to end viewers, but you can’t control the networks or connections those viewers are using to access your content.
The WebRTC protocol is currently limited to supporting VP9 and .H264 video—which means larger file sizes will bog down the network. To support 4K or broadcast-quality 1080p60 resolutions, you’ll need to be able to transcode for playback on a variety of devices, while sending the highest-quality source to your transcoder.
WebRTC in Wowza Streaming Engine
Many of the issues with WebRTC noted above can be alleviated by using a media server such as Wowza Streaming Engine. Media servers provide greater control over your streaming and connectivity, and allow you to provide a more consistent viewing experience for all users—rather than kicking out viewers with bad connections, or downgrading everyone’s experience to accommodate one poor network.
“If you are broadcasting, then a media server is mandatory. And no. Google doesn’t offer such a free service or even open-source code that is geared towards that use case,” Levent-Levi says.
But Wowza Streaming Engine now supports WebRTC, offering broadcast opportunities that go beyond peer-to-peer. Using WebRTC with Wowza Streaming Engine can help alleviate concerns about quality and scalability, while optimizing bandwidth. Learn more about how it works in this video:
In a traditional peer-to-peer connection, each browser connects directly to all the other browsers in the group—burning up bandwidth in the process. But with Wowza Streaming Engine, each browser only needs to establish one connection to the media server, which then ingests all the incoming video streams and combines them for playback by the individual browsers. This allows for real-time streaming using less bandwidth and fewer connections.
What’s more, Wowza Streaming Engine allows egress to occur via WebRTC for distribution to larger audiences. It can also transcode streams for other communication protocols, such as HLS or RTMP, albeit at a higher latency. This allows for large-scale global viewing though more widely accepted standards and using a wider selection of players.
Benefits of Using WebRTC With Wowza Streaming Engine
There are several benefits to building and deploying apps using WebRTC with Wowza Streaming Engine as your media server. These include:
Browser-Based Encoded Streaming
Using only a web browser and Wowza Streaming Engine, users can generate, record and deliver low-latency WebRTC-encoded streams—without the need for additional encoders or plug-ins.
Scaling WebRTC and Going Beyond Peer-to-Peer
Traditionally, WebRTC is known to be a nightmare when it comes to scalability. With Wowza Streaming Engine, you can move beyond peer-to-peer communications and broadcast live streams to a large audience. The best way to scale your stream is to use the transcoder feature in Wowza Streaming Engine to transcode the WebRTC stream into any standard output format. Then you can deliver the stream over Apple HLS, Adobe HDS, or MPEG-DASH, enabling you to scale your stream and reach a larger audience.
If it’s necessary to deliver the stream with low latency, we recommend using Wowza Streaming Engine and using the Stream Targets feature to send the stream to Wowza Streaming Cloud Ultra Low Latency targets.
Bandwidth-Optimized Video Conferencing
Wowza Streaming Engine makes it easy to set up multi-person video conferences using WebRTC. It enables low-latency sessions between multiple users, while optimizing bandwidth by minimizing the number of connections each client must establish and maintain.
Ready to see how Wowza Streaming Engine can enhance your WebRTC live streaming? Sign up for a free trial today.