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:
- To authenticate API requests, use HMAC authentication for production environments. For testing or proof of concept purposes only, use API key and access key authentication.
- The curl examples below use environment variables. See Using cURL for more information on how to set these up.
- 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 when setting up environment variables for your API request.
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 '{ "stream_target_ull": { "name": "My Ultra Low Latency Stream Target for Secure Playback", "source_delivery_method": "push", "enable_hls": true } }' "${WSC_HOST}/api/${WSC_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:
{ "stream_target_ull": { "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: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_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.
- 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:
- In Wowza Streaming Cloud, click Advanced on the menu bar, and then click Stream Targets.
- Select an ultra low latency target on the Stream Targets page.
- 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.
- For License Key, enter the license key for your Wowza services and then click Apply.
- 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 - 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
- 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:
- 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.
- Click Get Embed Code.
- Enter the embed code information into a webpage.
- Copy the JavaScript from the first field, JS Includes, and paste it into the HEAD section of your webpage.
- 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.
- 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.
- Ensure that your website containing Wowza Player is hosted over an HTTPS connection using a certificate for use with SSL and TLS.