Set up WebRTC streaming with Wowza Streaming Engine Manager

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, HDS, RTMP, RTSP, and Microsoft Smooth Streaming. 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 Manager. To configure XML files for WebRTC instead, see Set up WebRTC streaming with Wowza Streaming Engine.

Video tutorial: Using WebRTC with Wowza Streaming Engine


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 secure 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. 

Configure SSL/TLS encryption and an HTTP provider for WebRTC


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.

  1. Obtain an SSL certificate, and configure Wowza Streaming Engine to use it for secure streaming. See Get SSL certificates from the Wowza Streaming Engine StreamLock service for detailed steps using Wowza StreamLock.
  2. When configuring host port 443 to use the certificate for WebRTC signaling, you must select Use WebRTC. This configures the HTTPWebRTCExchangeSessionInfo HTTP provider to support an SDP exchange for the WebRTC session. 
    1. In Wowza Streaming Engine Manager, click the Server tab, and then click Virtual Host Setup in the contents panel.
    2. In the Virtual Host Setup page, click Edit, click Add Host Port
    3. Enter the required settings, and ensure that Use WebRTC is selected.
    VHost configuration dialog
Note: If you plan to use your own SSL certificate instead, 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 a live application for WebRTC


After the SSL/TLS encryption and the WebRTC HTTP provider are enabled on the Virtual Host Setup page, configure a live application for WebRTC streaming using Wowza Streaming Engine Manager. This example uses the live application that's included in the default Wowza Streaming Engine installation. 

  1. In Wowza Streaming Engine Manager, click the Applications tab at the top of the page and then select the live application in the contents panel.
  2. In the contents panel, click WebRTC.
  3. On the Setup tab, click Edit to configure WebRTC.

    WebRTC configuration page
     
  4. Under WebRTC Enabled Features, select the appropriate settings:
    1. Select Publish WebRTC to Wowza Streaming Engine to ingest WebRTC source streams to this application.
    2. Select Play WebRTC from Wowza Streaming Engine to deliver WebRTC content for playback from this application.
    3. Select Query published stream names to enable querying names of published WebRTC streams for this application.
  5. Under ICE Candidate Setup, specify the network connections over which WebRTC communication can occur. Click Add ICE Candidate and do the following:
    1. Select either UDP (recommended) or TCP as the ICE candidate transport protocol.
    2. Change the IP address to the publicly-accessible Wowza Streaming Engine server IP address.
    3. For TCP candidates, you must specify a port to use for WebRTC streaming. The default streaming port for Wowza Streaming Engine is 1935. For UDP candidates, the port is dynamically assigned.
    4. Click OK to save your ICE Candidate.
    5. If needed, add additional ICE Candidates, and adjust their preferred order using the Priority up and down arrows.
  6. If you have Publish WebRTC to Wowza Streaming Engine enabled, specify one or more Publish Video Codecs in the preferred order of use:
    1. Click Add Codec, and then select the codec from the drop down list.
    2. If necessary, adjust the order of the video codecs using the Priority up and down arrows.
    3. Click OK to save your Publish Video Codecs priority list.
  7. Click Save and then restart the application.

The application runs whenever Wowza Streaming Engine is running.

Note:  You can configure optional WebRTC properties that are not available in Wowza Streaming Engine Manager in the [install-dir]/conf/[applicationName]/Application.xml file. See Configure a live application to see descriptions of additional properties for WebRTC.

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. 

Notes:
  • Wowza Streaming Engine 4.8.5 or later is required for the hosted WebRTC publish and playback 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.

Publish a test stream to Wowza Streaming Engine

  1. On the WebRTC page, Setup tab, click Open WebRTC Publish Page.

    The WebRTC publish page opens in a new tab. Be sure to grant access to your camera and microphone when prompted.
  2. Configure the settings for the publish page:
    1. In the Signaling URL field, enter the secure WebSocket URL to connect to the Wowza Streaming Engine WebRTC sessions listener: 
      wss://[ssl-certificate-domain-name]/webrtc-session.json
      where ssl-certificate-domain-name is the secure domain name for your Wowza Streaming Engine instance.

      If using Wowza StreamLock, for example, the Signaling URL looks something like this:
      wss://5ab4321c0d123.streamlock.net/webrtc-session.json

      If you are connecting WebRTC sessions using a port other than the standard SSL/TLS port 443, you must include that non-standard port in the Signaling URL:
      wss://5ab4321c0d123.streamlock.net:[SSL-port-number]/webrtc-session.json
    2. Enter an Application Name that matches the WebRTC live application you configured.
    3. For Stream Name, enter a name for the stream, such as myStream.
    4. Configure the remaining settings selections, as needed.
       
      Note: The frame rate and frame size settings constrain the camera and microphone input and aren't included in the SDP provided to Wowza Streaming Engine. The browser may adjust the frame rate to accommodate changes in network conditions.
  3. To publish an example WebRTC stream from this page into Wowza Streaming Engine, click Publish.
  4. To test publishing from a different browser or with a different device, click Copy config (copy config icon) to copy the configuration settings and share them.

Play a test stream from Wowza Streaming Engine

  1. On the WebRTC page, Setup tab, click Open WebRTC Play Page.

    The WebRTC play page opens in a new tab.
  2. Configure the settings for the play page:
    1. Enter the same Signaling URL, Application Name, and Stream Name that you entered on the Publish page.
       
  3. To play the example WebRTC stream from Wowza Streaming Engine, click Play.
  4. To test playback in a different browser or with a different device, click Copy config (copy config icon) to copy the configuration settings and share them.

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.

More resources