Connect a WebRTC stream to Wowza Streaming Cloud using the Wowza Streaming Cloud REST API

Web Real-Time Communication (WebRTC) is an open-source project to enable real-time communication of audio, video, and data in web browsers and native apps. With the Wowza Streaming Cloud™ service, you can ingest and transcode WebRTC streams through the live stream or transcoder workflow. Supported browsers include the latest versions of Chrome, Firefox, and Safari, as well as Edge version 79 and later.

Note: Source authentication and closed captions aren't available for WebRTC

Live stream workflow


You can use the POST /live_streams operation to create a WebRTC stream. To ensure optimal video quality, WebRTC streams created through the live stream workflow are required to be transcoded.

  1. Using the Wowza Streaming Cloud REST API, create a live stream.

    Live stream parameters

    Parameter Data Type Description
    aspect_ratio_height integer

    The height, in pixels, of the output rendition.

    This value should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your encoder settings.

    We recommend using an aspect_ratio_height of 1280 for WebRTC.

    aspect_ratio_width integer

    The width, in pixels, of the output rendition.

    This value should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your encoder settings.

    We recommend using an aspect_ratio_width of 720 for WebRTC.

    billing_mode string The billing mode for the stream. Specify the default value, pay_as_you_go.
    broadcast_location string The region that's closest to where your stream originates. For a list of valid regions, see the API reference documentation.
    encoder string The video source for the live stream. Specify other_webrtc.
    name string The name of the live stream. Enter an alphanumeric string that is short (maximum 200 characters) and descriptive, for example, MyWebRTCStream.
    transcoder_type string The type of transcoder. Specify the default value, transcoded. passthrough isn't available for streams created through the /live_streams endpoint.
    delivery_method string The method you're using to deliver the source stream to the transcoder. Specify the default value, push. Wowza Streaming Cloud doesn't support pull or cdn connections for WebRTC.
     
    Notes:

    Example request and response

    Notes:

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \
    -d '{
       "live_stream": {
         "aspect_ratio_height": 720,
         "aspect_ratio_width": 1280,
         "billing_mode": "pay_as_you_go",
         "broadcast_location": "us_west_california",
         "delivery_method": "push",
         "encoder": "other_webrtc",
         "name": "MyWebRTCStream",
         "transcoder_type": "transcoded"
       }
    }' "${WSC_HOST}/api/${WSC_VERSION}/live_streams"

    This request creates a transcoded WebRTC live stream with an id property, an associated player, and a hosted page. The details of the live stream's configuration are listed in the response. Use the source_connection_information to configure the stream.

    {
       "live_stream": {
         "id": "1234abcd",
         "name": "MyWebRTCStream",
         ...
         "encoder": "other_webrtc",
         ...
         "source_connection_information": {
           "sdp_url": "wss://[subdomain].entrypoint.cloud.wowza.com/webrtc-session.json",
           "application_name": "app-30zl5349",
           "stream_name": "32a5814b"
         },
         ...
       }
    }

    Related API requests

    View the details of a live stream, including the player embed code and hosted page URL:

    curl -X GET \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \
    "${WSC_HOST}/api/${WSC_VERSION}/live_streams/[live_stream_id]"

    Update a live stream's configuration:

    curl -X PATCH \
    -H "Content-Type: application/json" \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \
    -d '{
       "live_stream": {
         "name": "MyDifferentLiveStreamName"
       }
    }' "${WSC_HOST}/api/${WSC_VERSION}/live_streams/[live_stream_id]"

    Delete a live stream:

    curl -X DELETE \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ 
    "${WSC_HOST}/api/${WSC_VERSION}/live_streams/[live_stream_id]"

  2. After creating the live stream, configure the WebRTC stream.
     
    Note: For more advanced learning and testing, Wowza Media Systems provides WebRTC examples on GitHub that demonstrate how to publish and play WebRTC streams.

Transcoder workflow


You can use the POST /transcoders operation to create a WebRTC stream. WebRTC streams created through the transcoder workflow can be transcoded or passthrough. To ensure optimal video quality, we recommend that you transcode the WebRTC source stream.

  1. Using the Wowza Streaming Cloud REST API, create a transcoder.

    Transcoder parameters

    Parameter Data Type Description
    billing_mode string The billing mode for the stream. Specify the default value, pay_as_you_go.
    broadcast_location string Specify the region that's closest to where your stream originates. For a list of valid regions, see the API reference documentation.
    delivery_method string The method you're using to deliver the source stream to the transcoder. Specify push. Wowza Streaming Cloud doesn't support pull or cdn connections for WebRTC.
    name string The name of the transcoder. Enter an alphanumeric string that is short (maximum 200 characters) and descriptive, for example, MyWebRTCTranscoder.
    protocol string The transport protocol you're using to send the encoded stream to the transcoder. Specify webrtc.
    transcoder_type string The type of transcoder. Specify the default value, transcoded.

    Alternatively, select passthrough to send the source video directly to the stream target without performing transcoding.
     
    Notes:

    Example request and response

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \
    -d '{    
      "transcoder": { 
        "billing_mode": "pay_as_you_go",      
        "broadcast_location": "us_west_california",      
        "delivery_method": "push",      
        "name": "MyWebRTCTranscoder",      
        "protocol": "webrtc",      
        "transcoder_type": "transcoded"
      } 
    }' "${WSC_HOST}/api/${WSC_VERSION}/transcoders"

    This request creates a transcoder with an id property, but no outputs or stream targets. The details of the transcoder's configuration are listed in the response.

    { 
      "transcoder": { 
        "id": "tmd8ybp2", 
        "name": "MyWebRTCTranscoder", 
        "transcoder_type": "transcoded", 
        "billing_mode": "pay_as_you_go", 
        "broadcast_location": "us_west_california", 
        ... 
        "protocol": "webrtc", 
        "delivery_method": "push", 
        "source_port": 443, 
        "domain_name": "[hostname].entrypoint.cloud.wowza.com",
        "application_name": "app-V5840271",
        "stream_name": "R1gxG3Ja",
        ...
        "outputs": []
      } 
    } 
  2. Complete the transcoder by adding output renditions and stream targets. For more information, see Create an ABR stream and send it to a target with the Wowza Streaming Cloud REST API.
     
    Note: For more advanced learning and testing, Wowza Media Systems provides WebRTC examples on GitHub that demonstrate how to publish and play WebRTC streams.

More resources