Send a stream from Wowza Streaming Engine to a Wowza CDN HLS target using Wowza REST APIs

Wowza Streaming Engine™ media server software can broadcast a live stream to a target in the Wowza Streaming Cloud™ service. This workflow allows you to bypass transcoding in Wowza Streaming Cloud and just use the Wowza Streaming Cloud edge network to deliver the stream to viewers.

You can achieve this workflow programmatically: First, use the Wowza Streaming Cloud REST API to create the Apple HLS target to deliver the final stream to viewers. Then, use the Wowza Streaming Engine REST API to configure the default live application to send a single- or multi-bitrate stream to the Wowza Streaming Cloud HLS target.

Note: This workflow requires Wowza Streaming Engine 4.5 or later and a Wowza Streaming Cloud or Wowza CDN subscription.

Create the Apple HLS stream target in Wowza Streaming Cloud


Using the Wowza Streaming Cloud REST API, create a Wowza stream target that receives the stream from Wowza Streaming Engine and delivers it to viewers using geographically distributed endpoints over Apple HLS.

Wowza Streaming Cloud stream target parameters

Parameter Data Type Description
name String A descriptive name for the stream target, for example, MyCloudHLStarget.
provider String Specify akamai_cupertino.

Example request and response

Notes: In Wowza Streaming Cloud REST API code examples:

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

Create the Wowza stream target:

curl -X POST --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" --header "Content-Type: application/json" -d '{
   "wowza_stream_target": {
     "name": "MyCloudHLStarget",
     "provider": "akamai_cupertino"
   }
}' "https://api.cloud.wowza.com/api/[version]/stream_targets/wowza"

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

{
  "wowza_stream_target": {
    "id": "1234hjkl",
    "name": "MyCloudHLStarget",
    "provider": "akamai_cupertino",
    "use_secure_ingest": false,
    "use_cors": false,
    "stream_name": "46d95e9d",
    "primary_url": "http://post.[domain]-i.akamaihd.net/253398/46d95e9d",
    "hls_playback_url": "https://[domain]-i.akamaihd.net/hls/live/253398/46d95e9d/playlist.m3u8",
    "connection_code": "1effa1",
    "connection_code_expires_at": "2017-05-16T21:44:49.000Z",
    ...
  }
}

Related requests

View the details of a stream target, including its Apple HLS playback URL:

curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/stream_targets/[stream_target_id]/"

Delete a stream target:

curl -X DELETE --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/stream_targets/[stream_target_id]"

Regenerate a target's connection code:

curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/stream_targets/[stream_target_id]/regenerate_connection_code"

Create the stream source for the live application in Wowza Streaming Engine


Now, use the Wowza Streaming Engine REST API to configure the live application that ships with Wowza Streaming Engine to ingest a source stream (publisher).

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 Query 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 source streams (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 the stream target for the live application in Wowza Streaming Engine


Still in the Wowza Streaming Engine REST API, create a stream target for the live application. The target will deliver the stream from Wowza Streaming Engine to the Wowza Streaming Cloud HLS target over HLS.

Parameter Data Type Description
connectionCode String The six-character connection_code from the Wowza Streaming Cloud HLS target, for example, 1effa1.
enabled Boolean Specify true so that the target is ready to run as soon as you create it.
entryName String A descriptive name for the map entry, for example, cloudHLStarget.
profile String Specify wowza-streaming-cloud.
sourceStreamName String The name of the incoming stream for the live application, for example, myStream.
wowzaCloud.adaptiveStreaming Boolean Determines whether Wowza Streaming Engine sends a single bitrate stream or a group of stream renditions to Wowza Streaming Cloud. Specify false to send a single bitrate stream, or specify true to send an adaptive bitrate stream as a group of stream renditions.
wowzaCloudDestinationType String Specify streamTarget.

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/cloudHLStarget" -d '{
   "connectionCode": "1effa1",
   "enabled": true,
   "entryName": "cloudHLStarget",
   "profile": "wowza-streaming-cloud",
   "sourceStreamName": "myStream",
   "wowzaCloud.adaptiveStreaming": "false",
   "extraOptions": {
    "wowzaCloudDestinationType": "streamTarget",
    "destinationName": "wowzastreamingcloud"
  }
}'

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

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

Related requests

View a list of stream targets (push publishing map entries):

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]/pushpublish/mapentries"

View the details of a target (push publishing map entry) for an application on a local instance of Wowza Streaming Engine:

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]/pushpublish/mapentries/[entryName]"

Delete a stream target (push publishing map entry):

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

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 Wowza Streaming 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.

Start streaming


Make sure your source is configured and connected to Wowza Streaming Engine (see Connect a live source to Wowza Streaming Engine). Then, start the source encoder or camera.