Send a stream from Wowza Streaming Engine to an ultra low latency stream target in Wowza Streaming Cloud using Wowza APIs

With Wowza Streaming Engine™ media server software version 4.2 and later and a Wowza Streaming Cloud™ with Ultra Low Latency subscription, you can use the Stream Targets feature in Wowza Streaming Engine to send a single stream to an ultra low latency target in Wowza Streaming Cloud. This allows you to use an existing Wowza Streaming Engine configuration to deliver an ultra low latency stream to viewers through Wowza Streaming Cloud.

This article explains how to use the Wowza Streaming Cloud REST API and the Wowza Streaming Engine REST API to send a live stream from Wowza Streaming Engine to a Wowza Streaming Cloud ultra low latency stream target for delivery to viewers. It also points to information about configuring playback with Wowza Player for Ultra Low Latency and information on playback with a mobile app created with Wowza GoCoder SDK.

Note: To do this workflow using the Wowza Streaming Engine Manager and the Wowza Streaming Cloud web manager intead of Wowza REST APIs, see Send a stream from Wowza Streaming Engine to an ultra low latency stream target in Wowza Streaming Cloud.

Video tutorial: Sending a stream from Wowza Streaming Engine to an ultra low latency stream target in Wowza Streaming Cloud


Create an ultra low latency stream target in Wowza Streaming Cloud


If you don't have an ultra low latency stream target already created, start by creating one using the Wowza Streaming Cloud REST API. See Create an ultra low latency stream target for detailed information about available parameters.

Notes:
  • Ultra low latency stream targets are not available in the sandbox environment, so be sure to use https://api.cloud.wowza.com, not https://api-sandbox.cloud.wowza.com in your API request.
  • For [key], substitute your API key or your access key as appropriate. For more information, see Locating and using API and access keys.
  • For [version], substitute the version number of the API that you're using. For the current version, use v1.2.

Example request and response

Create an ultra low latency stream target:

curl -H "wsc-api-key: [key]" -H "wsc-access-key: [key]" -H "Content-Type: application/json" -X POST -d '{     
  "ull_stream_target": { 
    "name": "My Ultra Low Latency Push Target from Wowza Streaming Engine", 
    "source_delivery_method": "push", 
    "enable_hls": true 
  } 
}' "https://api.cloud.wowza.com/api/[version]/stream_targets/ull" 

The request creates an ultra low latency stream target with an id parameter, ingest connection details, and playback details. You will need the primary_url from this response to configure Wowza Streaming Engine to send the stream. The response should look something like this:

{ 
    "ull_stream_target": { 
      "id": "abcx2y5v",  
      "name": "My Ultra Low Latency Push Target from Wowza Streaming Engine", 
      "provider": "wowza", 
      "enabled": true, 
      "state": "stopped", 
      "stream_name": "0I0p2SU9SanfhCaxBz3MWKdZUbmq592a", 
      "primary_url": "rtmp://origin.cdn.wowza.com:1935/live/0I0p2SU9SanfhCaxBz3MWKdZUbmq592a", 
      "source_delivery_method": "push", 
      "playback_urls": { 
        "ws": [
            "ws://edge.cdn.wowza.com/live/_definst_/0P0p2SU9SanNzZGZmWVQvc2RTRGR5844/stream.ws",
            "wss://edge.cdn.wowza.com/live/_definst_/0P0p2SU9SanNzZGZmWVQvc2RTRGR5844/stream.ws"
        ], 
        "wowz": [
            "wowz://edge.cdn.wowza.com/live/_definst_/0P0p2SU9SanNzZGZmWVQvc2RTRGR5844",
            "wowzs://edge.cdn.wowza.com/live/_definst_/0P0p2SU9SanNzZGZmWVQvc2RTRGR5844" 
         ], 
        "hls": [
            "https://[wowzasubdomain]/hls/live/687317/0P0p2SU9SanNzZGZmWVQvc2RTRGR5844/playlist.m3u8"
         ] 
      }, 
      "enable_hls": true, 
      "connection_code": "2abXlJ", 
      "connection_code_expires_at": "2018-07-31T19:17:05.000Z", 
      "created_at": "2018-07-27T19:20:58.000Z", 
      "updated_at": "2018-07-30T19:17:05.000Z", 
   } 
} 
Tip:  If you have already created an ultra low latency stream target, you can view source configuration details using a GET query.
 
curl -X GET -H "wsc-api-key: [key]" -H "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/stream_targets/ull/[ull_stream_target_id]"

Configure a live application in Wowza Streaming Engine


Next, using the Wowza Streaming Engine REST API, configure the live application that ships with Wowza Streaming Engine to ingest a source stream (publisher) that will receive the live stream from an H.264 encoder or camera.

Wowza Streaming Engine stream source (publisher) parameters

Parameter Data Type Description
publisherName String A descriptive name for the publisher, for example, MyRTMPencoder.

Example request and response

Note: Wowza Streaming Engine REST API requests must include three headers: Accept:application/json, Content-Type:application/json, and charset=utf-8. For more information, see QQuery the Wowza Streaming Engine REST API.

Create an RTMP source (publisher) for the live application on a local instance of Wowza Streaming Engine:

curl -X POST --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost/applications/live/publishers/myRTMPencoder" -d '{
  "publisherName": "myRTMPencoder"
}'

The command creates the publisher and returns a response that looks something like this:

{
  "success": true,
  "message": "",
  "data": null
}

Related requests

Get a list of applications:

curl -X GET --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/[serverName]/vhosts/[vhostName]/applications"

View the details of an application:

curl -X GET --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/[serverName]/vhosts/[vhostName]/applications/[appName]"

View a list of stream sources (publishers) connected to an application:

curl -X GET --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/[serverName]/vhosts/[vhostName]/applications/[appName]/publishers"

Create a stream target in Wowza Streaming Engine


Next, use the Wowza Streaming Engine REST API to create a stream target for the live application in Wowza Streaming Engine that will deliver the stream from Wowza Streaming Engine to the Wowza Streaming Cloud ultra low latency stream target over RTMP.

You will need the ultra low latency stream target’s primary_url to determine the configuration values. For the following example configuration, we'll use the primary_url from the example POST response above:
rtmp://origin.cdn.wowza.com:1935/live/0I0p2SU9SanfhCaxBz3MWKdZUbmq592a

Wowza Streaming Engine mapentries parameters

Parameter Data Type Description
application String The Wowza Streaming Engine application name. For example, live.
enabled Boolean Specify true so that the target is ready to run as soon as you create it. If you don't include this parameter, you'll need a separate API request to enable the stream target.
entryName String A descriptive name for the map entry, for example, wowza_streaming_cloud_ull_target.
host String The host URL of the origin ingest location for the ultra low latency stream. This is the destination entry point that the stream is sent to. It's part of the primary_url in the POST response. For example,  origin.cdn.wowza.com.
 
Note: If you want to ingest the stream into a different origin location than the one Wowza Streaming Cloud assigns to you automatically, see Override the origin or edge server location used by an ultra low latency stream target with the Wowza Streaming Cloud REST API to determine the Destination Host value.
port Integer The port number from the primary_url in the POST response. Specify 1935.
profile String Specify rtmp.
sourceStreamName String The name of the incoming stream for the live application, for example, myStream.
streamName String The destination stream name. It's the stream_name value or the final part of the primary_url in the POST response. For example: 0I0p2SU9SanfhCaxBz3MWKdZUbmq592a

Example request and response

curl -X POST --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/pushpublish/mapentries/wowza_streaming_cloud_ull_target" -d '{
   "application": "live",
   "enabled": true,
   "entryName": "wowza_streaming_cloud_ull_target",
   "host": "origin.cdn.wowza.com",
   "port": 1935,
   "profile": "rtmp",
   "streamName": "0I0p2SU9SanfhCaxBz3MWKdZUbmq592a",
   "sourceStreamName": "myStream"
}'

The command creates the target (map entry) and returns a response that looks something like this:

{
  "success": true,
  "message": "Entry (wowza_streaming_cloud_ull_target) saved successfully",
  "data": null
}

Related request

Enable a single stream target (push publishing map entry):

curl -X PUT --header "Accept:application/json" --header "charset=utf-8" --header "Content-Type:application/json" "http://localhost:8087/v2/servers/[server_name]/vhosts/[vhostName]/applications/[appname]/pushpublish/mapentries/[entryname]/actions/enable"

Enable the Wowza Streaming Engine stream targets feature


Follow these steps to enable the stream targets feature in the Wowza Streaming Engine Manager. For information about manual configuration of the Application.xml file to enable the stream targets feature, see Use CDNs and services to distribute live streams from Wowza Streaming Engine.

Before you stream, you must enable the Stream Targets feature for the Wowza Streaming Engine application and the stream target you created.

If you don't see a checkmark next to Stream Targets in the contents panel of the application, click Stream Targets in the contents panel and then click Enable Stream Targets. When prompted, click Restart Now so your change takes effect. When Stream Targets is enabled, a checkmark appears next to Stream Targets in the contents panel and the Stream Targets page shows Status is Enabled.

If the Status of an individual stream target is Disabled, click the Enable icon for the stream in the Actions column.

When a stream target is enabled, its status on the Stream Targets page is one of the following:

  • Waiting. The target is enabled but is not yet pushing the stream to the target destination because either the target's configured source stream is not connected to the Wowza Streaming Engine input or Wowza Streaming Engine has not completed initializing the connection to the target destination.
     
  • Active. The Wowza Streaming Engine instance successfully connected to the target destination and is actively pushing the stream.
     
  • Error. The Wowza Streaming Engine instance unsuccessfully tried to connect to the target destination. Make sure the target's configured source stream is connected to the Wowza Streaming Engine input. Errors might be due to an invalid target configuration or issue with the destination server.

The status of each stream target updates automatically if your Wowza Streaming Engine application has fewer than 100 stream targets. If your application has more than 100 stream targets, you can click Refresh to update the status.

Test the ultra low latency stream


  1. Start the stream in the H.264 camera or encoder that's sending the stream to the live application in Wowza Streaming Engine.

    The live application ingests the live stream and sends it to the Wowza Streaming Cloud ultra low latency stream target.
  2. In Wowza Streaming Engine Manager, verify that the stream is published by clicking Incoming Streams for the live application, and then clicking the stream name.

    The stream detail page displays the Status of the stream (Active) as well as details about connections, uptime, and throughput for the published stream.
  3. Configure playback:
  4. Stop the stream in the source camera or encoder to end your test stream.