Manage secure playback for ultra low latency streams with the Wowza Streaming Cloud REST API

The Wowza Streaming Cloud™ service with Ultra Low Latency allows you to deliver ultra low latency streams for secure playback over WSS (WebSocket secure). WSS uses SSL (Secure Socket Layer) to create a handshake between a server and client to exchange encrypted data. Meanwhile, backup HLS streams associated with an ultra low latency stream target are available over HTTPS, a secure protocol that also uses SSL to establish a secure connection. By default, streams are available over both encrypted WSS and HTTPS connections or unencrypted WS and HTTP connections. To ensure that an ultra low latency stream and backup HLS stream are played over a secure connection, you can embed Wowza Player configured with secure playback URLs into a webpage hosted over HTTPS.

This article shows you how to create an ultra low latency stream and backup HLS stream with the Wowza Streaming Cloud REST API, configure a source, and then configure Wowza Player for secure playback using WSS and HTTPS.

Create an ultra low latency stream target


In the Wowza Streaming Cloud REST API, create an ultra low latency stream target with HLS enabled. Although HLS is optional, it is used by mobile devices for playback or in the event that WebSocket connection attempts fail.

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.
  • Use the /stream_targets/ull endpoint instead of the /stream_targets endpoint to create an ultra low latency stream target.
  • 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

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 Stream Target for Secure Playback", 
    "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, including a hash of playback URLs. You will need details from this response to configure  Wowza  Player.  The response should look something like this:

{  
  "ull_stream_target": {  
    "id": "abcx2y5v",    
    "name": "My Ultra Low Latency Stream Target for Secure Playback",   
    "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": "2reXlJ",  
    "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 source


Configure a source for your ultra low latency stream. See Connect a source Ultra low latency examples for more information.

Configure secure playback


Using Wowza Player Builder for Ultra Low Latency, configure Wowza Player using secure playback URLs.

  1. Choose one of the following.
    • You can prepopulate the  License Key,  Stream Source, and Backup Stream Source  information by navigating to the Wowza Player Builder for Ultra Low Latency from within the Wowza Streaming Cloud web manager:
      1. In Wowza Streaming Cloud, click  Advanced  on the menu bar, and then click  Stream Targets.
      2. Select an ultra low latency target on the  Stream Targets  page.
      3. Click  Test player for Wowza ultra low latency targets  to launch Wowza Player for Ultra Low Latency with prepopulated fields.
    • Alternatively, go straight to Wowza Player Builder for Ultra Low Latency.
      1. For License Key, enter the license key for your Wowza services and then click  Apply.
      2. In the  Source Stream Information  area, for  Stream Source, enter the WebSocket secure playback URL for your ultra low latency stream target. For example: 
        wss://edge.cdn.wowza.com/live/_definst_/0P1q1UHJEN1RzbXdRVGszMHoxWm15f33/stream.ws
      3. Enter a  Backup Stream Source  HLS playback URL to be used by mobile devices or in the event that WebSocket connection attempts fail. The HLS playback URL is only available if you enable HLS when creating the ultra low latency stream target with the Wowza Streaming Cloud REST API. Be sure to use HTTPS instead of HTTP. For example: 
        https://[wowzasubdomain]-i.akamaihd.net/hls/live/507400/0P1q1UHJEN1RzbXdRVGszMHoxWm15f33/playlist.m3u8
  2. Configure other settings for Wowza Player as needed. See Configure Wowza Player for Wowza Streaming Cloud ultra low latency streams for information about additional configuration options.
  3. Click Get Embed Code.
  4. Enter the embed code information into a webpage.
    1. Copy the JavaScript from the first field,  JS Includes, and paste it into the HEAD section of your webpage.
    2. Copy the HTML DIV element from the second field,  Create an HTML element to contain your video, and paste it at the top of the BODY section of your webpage.
    3. Copy the code from the third field,  Embed the Wowza Player, into the BODY section of your webpage after the HTML player element DIV element.
  5. Ensure that your website containing Wowza Player is hosted over an HTTPS connection using a certificate for use with SSL and TLS.