Set up WebRTC streaming with Wowza Streaming Engine

Wowza Streaming Engine™ media server software version 4.7.7 and later supports WebRTC streaming, however, we recommend that you update to version 4.8.5 and later to capitalize on expanded functionality and enhancements to publisher reliability. WebRTC is a free, open-source project that enables real-time communication of audio, video, and data in web browsers and mobile applications. Wowza Streaming Engine can ingest source WebRTC audio and video content and deliver it to supporting players. It can also transmux or transcode WebRTC to other streaming protocols, including HLS, MPEG-DASH, RTMP, and RTSP. In addition, Wowza Streaming Engine can ingest a non-WebRTC source stream and play it back with WebRTC or WebRTC plus other scalable HTTP-based streaming protocols like HLS.

In this article, learn how to set up WebRTC streaming using Wowza Streaming Engine XML configuration files. For instructions using Wowza Streaming Engine Manager to configure WebRTC instead, see Set up WebRTC streaming with Wowza Streaming Engine Manager.

Note: This article assumes a new installation of Wowza Streaming Engine 4.7.7 or later. If you've updated from an earlier version, you must copy and paste content from the sample WebRTC Application.xml file into your Application.xml file.

About WebRTC in Wowza Streaming Engine

Wowza Streaming Engine can ingest WebRTC content from mobile and desktop browsers that support the WebRTC APIs. Supported browsers include the latest versions of Chrome, Firefox, and Safari, as well as Edge version 79 and later. SSL/TLS encryption is required for the WebRTC workflow.

When ingesting source content as WebRTC, Wowza Streaming Engine uses a WebSocket connection to the browser to retrieve the Session Description Protocol (SDP) information. This signaling exchange requires that you set up a Wowza Streaming Engine HTTP provider for the connection. 

Once it's in Wowza Streaming Engine, the WebRTC content can be delivered to viewers as is, or it can be transcoded or transmuxed to other formats for delivery. 

Before you start

You should complete the following tasks:

Configure SSL/TLS encryption for Wowza Streaming Engine

Encryption is required for all components of the WebRTC workflow. You must have a secure HTTP (HTTPS) connection to a web camera for WebRTC publishing and playback. As a result, due to cross-domain issues, you'll need to configure an SSL certificate to secure the connection between the browser and Wowza Streaming Engine for the SDP data exchange.

We recommend the free Wowza StreamLock certificate to secure this connection. The instructions in this article assume you've configured port 443 with an SSL certificate.

If you plan to use your own SSL certificate, the following resources may help you convert your SSL certificate to the Java KeyStore (JKS) format that's required by Wowza Streaming Engine. Although it's possible to use self-signed certificates with WebRTC, note that you must ensure the browser you're using to test accepts traffic encrypted with any self-signed certificates in use.

Configure WebRTC with Wowza Streaming Engine XML

You can configure WebRTC streaming in XML files at the VHost and application level.

Note: For instructions using Wowza Streaming Engine Manager to configure WebRTC instead, see Set up WebRTC streaming with Wowza Streaming Engine Manager.

Configure the HTTP provider

You must configure the HTTPWebRTCExchangeSessionInfo HTTP provider to support an SDP exchange for the WebRTC session. This is equivalent to selecting Use WebRTC for host port 443 in Wowza Streaming Engine Manager. If you have already done this, continue to Configure a live application.

Configure a live application

After the HTTP provider is added to your VHost.xml file, configure a live application for WebRTC streaming. 

Test the WebRTC workflow

In production environments, WebRTC playback and publishing pages must be hosted on a web server utilizing SSL/TLS encryption. For testing and learning purposes, Wowza provides hosted WebRTC test pages for publish and playback so you can see WebRTC in action more quickly. 

  • Wowza Streaming Engine 4.8.5 or later is required for the hosted WebRTC test pages.
  • You can use the the Wowza hosted WebRTC test pages with the latest version of Chrome, Firefox, Safari, and Microsoft Edge version 79 and later.
  • Screen share functionality for the hosted WebRTC publish and composite test page is not available on mobile devices or Safari.

Publish a test stream to Wowza Streaming Engine

Publish a test composite stream to Wowza Streaming Engine

Publish a test meeting stream to Wowza Streaming Engine

Play a test stream from Wowza Streaming Engine

For more advanced learning and testing, Wowza Media Systems provides WebRTC examples on GitHub that demonstrate how to publish and play WebRTC streams with Wowza Streaming Engine. See Use WebRTC example pages with Wowza Streaming Engine.

About port configuration for WebRTC

When configuring Wowza Streaming Engine to ingest or play streams with WebRTC, you must ensure that certain ports are accessible for client connections. 

Note: Publishing or playing WebRTC streams on a device with an endpoint security platform enabled may result in decreased video performance. During a deep packet inspection (DPI) process, the endpoint protection platform de-encrypts and then re-encrypts each AES-encrypted packet, which can cause packet delays and stuttering. To address this issue, configure your endpoint security platform to ensure that traffic over the following ports is available without deep packet inspection.

See Troubleshoot network errors for information about troubleshooting port configurations.

Port Type Description
443 TCP During the WebRTC signaling process, Wowza Streaming Engine uses a secure WebSocket connection to establish a connection between peers. This requires a port for encrypted connections using SSL/TLS. By default, port 443 is used. The SSL/TLS port is defined in a HostPort entry in [install-dir]/conf/VHost.xml.
6970 to 9999 UDP For WebRTC over UDP, Wowza Streaming Engine uses a default port range of 6970 to 9999. UDP ports are assigned dynamically, and each additional peer WebRTC connection increments the port number used. The starting port number is controlled by the DatagramStartingPort value specified in [install-dir]/conf/Server.xml.
1935 TCP For WebRTC over TCP, Wowza Streaming Engine uses a non-SSL-protected streaming port for TCP-level connections. The TCP port is defined in a HostPort entry in [install-dir]/conf/VHost.xml. By default, port 1935 is used. TCP ports are referenced in the IceCandidateIpAddresses property in [install-dir]/conf/[application-name]/Application.xml.
Note: Port 554 isn't supported for TCP ICE candidates.

More resources